2 USE ieee.std_logic_1164.ALL;
3 USE ieee.numeric_std.all;
8 ENTITY lx_dad_top_tb IS
11 ARCHITECTURE behavior OF lx_dad_top_tb IS
13 -- Component Declaration for the Unit Under Test (UUT)
17 --clk_cpu : IN std_logic;
18 clk_50m : IN std_logic;
19 cs0_xc : IN std_logic;
21 bls : IN std_logic_vector(3 downto 0);
22 address : IN std_logic_vector(15 downto 0);
23 data : INOUT std_logic_vector(31 downto 0);
31 --signal clk_cpu : std_logic := '0';
32 signal clk_50m : std_logic := '0';
33 signal cs0_xc : std_logic := '1';
34 signal rd : std_logic := '1';
35 signal bls : std_logic_vector(3 downto 0) := (others => '1');
36 signal address : std_logic_vector(15 downto 0) := (others => '0');
38 signal init : std_logic := '1';
41 signal data : std_logic_vector(31 downto 0);
43 -- Clock period definitions
44 --constant clk_period_cpu : time := 13.8 ns;
45 constant clk_period_50m : time := 20 ns;
49 -- Instantiate the Unit Under Test (UUT)
50 uut: lx_dad_top PORT MAP (
62 -- Clock process definitions
63 -- clk_cpu_process :process
66 -- wait for clk_period_cpu/2;
68 -- wait for clk_period_cpu/2;
71 clk_50m_process :process
74 wait for clk_period_50m/2;
76 wait for clk_period_50m/2;
83 -- External ModelSim script
88 setup_imem_process : process
89 -- file imem_file : text open READ_MODE is "imem.bits";
90 -- variable my_line : LINE;
91 -- variable bits_line : LINE;
92 -- variable mem_location : bit_vector(31 downto 0);
93 -- variable imem_fill_addr : natural range 0 to 2**8-1 := 0;
96 -- Assert LX_DAD system reset for 3 clock cycles
97 wait until clk_50m'event and clk_50m = '1';
99 wait until clk_50m'event and clk_50m = '1';
100 wait until clk_50m'event and clk_50m = '1';
101 wait until clk_50m'event and clk_50m = '1';
104 -- Fill Tumbl instruction memory
105 --fill_loop: while not endfile(imem_file) loop
106 -- wait until clk_50m'event and clk_50m = '1';
110 -- wait until clk_50m'event and clk_50m = '1';
111 -- address <= std_logic_vector(to_unsigned(imem_fill_addr, 16));
112 -- readline(imem_file, bits_line);
113 -- read(bits_line, mem_location);
114 -- data <= to_stdLogicVector(mem_location);
117 -- imem_fill_addr := imem_fill_addr + 1;
118 -- wait until clk_50m'event and clk_50m = '1';
119 -- wait until clk_50m'event and clk_50m = '1';
123 --end loop fill_loop;
125 -- Write to example bus memory
126 wait until clk_50m'event and clk_50m = '1';
127 wait until clk_50m'event and clk_50m = '1';
132 wait until clk_50m'event and clk_50m = '1';
133 wait until clk_50m'event and clk_50m = '1';
138 data <= (others => 'Z');
139 wait until clk_50m'event and clk_50m = '1';
141 -- Simulate external master accesses example bus memory
143 wait until clk_50m'event and clk_50m = '1';
144 wait until clk_50m'event and clk_50m = '1';
148 wait until clk_50m'event and clk_50m = '1';
149 wait until clk_50m'event and clk_50m = '1';
150 wait until clk_50m'event and clk_50m = '1';
151 wait until clk_50m'event and clk_50m = '1';
156 wait until clk_50m'event and clk_50m = '1';
157 wait until clk_50m'event and clk_50m = '1';
161 wait until clk_50m'event and clk_50m = '1';
162 wait until clk_50m'event and clk_50m = '1';
163 wait until clk_50m'event and clk_50m = '1';
164 wait until clk_50m'event and clk_50m = '1';