AddressDecoder testbench

This commit is contained in:
freitz85 2017-10-11 00:53:20 +02:00
parent 819904bea2
commit eeb0b14725
8 changed files with 672 additions and 599 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

BIN
Images/AppleIISd_Test.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

View File

@ -54,7 +54,9 @@ begin
DATA_EN <= RNW and not NDEV_SEL; DATA_EN <= RNW and not NDEV_SEL;
NG <= NDEV_SEL and noe_int; NG <= NDEV_SEL and noe_int;
NOE <= noe_int; NOE <= noe_int;
noe_int <= not RNW or not NDEV_SEL or NIO_STB or ncs; noe_int <= not RNW or not NDEV_SEL
or (NIO_SEL and NIO_STB)
or (NIO_SEL and ncs);
cfxx <= A(8) and A(9) and A(10) and not NIO_STB; cfxx <= A(8) and A(9) and A(10) and not NIO_STB;

View File

@ -1,79 +1,136 @@
-- Vhdl test bench created from schematic U:\AppleIISd\VHDL\AddressDecoder.sch - Mon Oct 09 20:12:16 2017 --------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 23:42:22 10/10/2017
-- Design Name:
-- Module Name: C:/Git/AppleIISd/VHDL/AddressDecoder_Test.vhd
-- Project Name: AppleIISd
-- Target Device:
-- Tool versions:
-- Description:
--
-- VHDL Test Bench Created by ISE for module: AddressDecoder
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
-- --
-- Notes: -- Notes:
-- 1) This testbench template has been automatically generated using types -- This testbench has been automatically generated using types std_logic and
-- std_logic and std_logic_vector for the ports of the unit under test. -- std_logic_vector for the ports of the unit under test. Xilinx recommends
-- Xilinx recommends that these types always be used for the top-level -- that these types always be used for the top-level I/O of a design in order
-- I/O of a design in order to guarantee that the testbench will bind -- to guarantee that the testbench will bind correctly to the post-implementation
-- correctly to the timing (post-route) simulation model. -- simulation model.
-- 2) To use this template as your testbench, change the filename to any --------------------------------------------------------------------------------
-- name of your choice with the extension .vhd, and use the "Source->Add"
-- menu in Project Navigator to import the testbench. Then
-- edit the user defined section below, adding code to generate the
-- stimulus for your design.
--
LIBRARY ieee; LIBRARY ieee;
USE ieee.std_logic_1164.ALL; USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
LIBRARY UNISIM; -- Uncomment the following library declaration if using
USE UNISIM.Vcomponents.ALL; -- arithmetic functions with Signed or Unsigned values
ENTITY AddressDecoder_AddressDecoder_sch_tb IS --USE ieee.numeric_std.ALL;
END AddressDecoder_AddressDecoder_sch_tb;
ARCHITECTURE behavioral OF AddressDecoder_AddressDecoder_sch_tb IS ENTITY AddressDecoder_Test IS
END AddressDecoder_Test;
ARCHITECTURE behavior OF AddressDecoder_Test IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT AddressDecoder
PORT(
A : IN std_logic_vector(10 downto 8);
B : OUT std_logic_vector(10 downto 8);
RNW : IN std_logic;
NDEV_SEL : IN std_logic;
NIO_SEL : IN std_logic;
NIO_STB : IN std_logic;
NRESET : IN std_logic;
DATA_EN : OUT std_logic;
NG : OUT std_logic;
NOE : OUT std_logic
);
END COMPONENT;
COMPONENT AddressDecoder --Inputs
PORT( A10 : IN STD_LOGIC; signal A : std_logic_vector(10 downto 8) := "101";
A9 : IN STD_LOGIC; signal RNW : std_logic := '1';
A8 : IN STD_LOGIC; signal NDEV_SEL : std_logic := '1';
B10 : OUT STD_LOGIC; signal NIO_SEL : std_logic := '1';
B9 : OUT STD_LOGIC; signal NIO_STB : std_logic := '1';
B8 : OUT STD_LOGIC; signal NRESET : std_logic := '1';
NIO_SEL : IN STD_LOGIC;
NDEV_SEL : IN STD_LOGIC;
NOE : OUT STD_LOGIC;
RNW : IN STD_LOGIC;
NG : OUT STD_LOGIC;
DATA_EN : OUT STD_LOGIC;
NIO_STB : IN STD_LOGIC);
END COMPONENT;
SIGNAL A10 : STD_LOGIC := '0';
SIGNAL A9 : STD_LOGIC := '0';
SIGNAL A8 : STD_LOGIC := '0';
SIGNAL B10 : STD_LOGIC;
SIGNAL B9 : STD_LOGIC;
SIGNAL B8 : STD_LOGIC;
SIGNAL NIO_SEL : STD_LOGIC := '1';
SIGNAL NDEV_SEL : STD_LOGIC := '1';
SIGNAL NOE : STD_LOGIC;
SIGNAL RNW : STD_LOGIC := '1';
SIGNAL NG : STD_LOGIC;
SIGNAL DATA_EN : STD_LOGIC;
SIGNAL NIO_STB : STD_LOGIC := '1';
--Outputs
signal B : std_logic_vector(10 downto 8);
signal DATA_EN : std_logic;
signal NG : std_logic;
signal NOE : std_logic;
BEGIN BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: AddressDecoder PORT MAP (
A => A,
B => B,
RNW => RNW,
NDEV_SEL => NDEV_SEL,
NIO_SEL => NIO_SEL,
NIO_STB => NIO_STB,
NRESET => NRESET,
DATA_EN => DATA_EN,
NG => NG,
NOE => NOE
);
UUT: AddressDecoder PORT MAP( -- Stimulus process
A10 => A10, stim_proc: process
A9 => A9, begin
A8 => A8, -- hold reset state for 100 ns.
B10 => B10, wait for 50 ns;
B9 => B9, NRESET <= '0';
B8 => B8, wait for 50 ns;
NIO_SEL => NIO_SEL, NRESET <= '1';
NDEV_SEL => NDEV_SEL, wait for 50 ns;
NOE => NOE,
RNW => RNW,
NG => NG,
DATA_EN => DATA_EN,
NIO_STB => NIO_STB
);
-- *** Test Bench - User Defined Section *** -- insert stimulus here
tb : PROCESS -- CPLD access
BEGIN NDEV_SEL <= '0';
WAIT; -- will wait forever wait for 10 ns;
END PROCESS; NDEV_SEL <= '1';
-- *** End Test Bench - User Defined Section *** wait for 20 ns;
-- CnXX access
NIO_SEL <= '0';
wait for 10 ns;
NIO_SEL <= '1';
wait for 20 ns;
-- C8xx access, selected
NIO_STB <= '0';
wait for 10 ns;
NIO_STB <= '1';
wait for 20 ns;
-- CPLD access
NDEV_SEL <= '0';
wait for 10 ns;
NDEV_SEL <= '1';
wait for 20 ns;
-- CFFF access
A <= "111";
NIO_STB <= '0';
wait for 10 ns;
A <= "000";
NIO_STB <= '1';
wait for 20 ns;
-- C8xx access, unselected
NIO_STB <= '0';
wait for 10 ns;
NIO_STB <= '1';
wait for 20 ns;
wait;
end process;
END; END;

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -72,6 +72,7 @@ architecture Behavioral of AppleIISd is
signal rnw_int : std_logic; signal rnw_int : std_logic;
signal data_en : std_logic; signal data_en : std_logic;
signal ndev_sel_int : std_logic;
component SpiController is component SpiController is
Port ( Port (
@ -131,7 +132,7 @@ begin
A => ADD_HIGH, A => ADD_HIGH,
B => B, B => B,
RNW => RNW, RNW => RNW,
NDEV_SEL => NDEV_SEL, NDEV_SEL => ndev_sel_int,
NIO_SEL => NIO_SEL, NIO_SEL => NIO_SEL,
NIO_STB => NIO_STB, NIO_STB => NIO_STB,
NRESET => NRESET, NRESET => NRESET,
@ -155,6 +156,15 @@ begin
end if; end if;
end process; end process;
process(CLK, NRESET)
begin
if(NRESET = '0') then
ndev_sel_int <= '1';
elsif rising_edge(CLK) then
ndev_sel_int <= NDEV_SEL;
end if;
end process;
DATA <= data_out when (data_en = '1') else (others => 'Z'); -- data bus tristate DATA <= data_out when (data_en = '1') else (others => 'Z'); -- data bus tristate
-- synthesis translate_off -- synthesis translate_off

View File

@ -34,6 +34,10 @@
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="2"/> <association xil_pn:name="BehavioralSimulation" xil_pn:seqID="2"/>
<association xil_pn:name="Implementation" xil_pn:seqID="2"/> <association xil_pn:name="Implementation" xil_pn:seqID="2"/>
</file> </file>
<file xil_pn:name="AddressDecoder_Test.vhd" xil_pn:type="FILE_VHDL">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="0"/>
<association xil_pn:name="PostRouteSimulation" xil_pn:seqID="230"/>
</file>
</files> </files>
<properties> <properties>