-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrolWordGeneratorTest.vhd
63 lines (53 loc) · 2.68 KB
/
controlWordGeneratorTest.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE ieee.numeric_std.ALL;
ENTITY controlWordGeneratorTest IS
END controlWordGeneratorTest;
ARCHITECTURE testbench OF controlWordGeneratorTest IS
signal clock,rst : std_logic := '1';
signal flags : std_logic_vector(3 downto 0) := (others =>'0');
signal IR_reg : std_logic_vector(15 downto 0) := (others =>'0');
signal run : std_logic := '0';
signal state : std_logic_vector (1 downto 0) := (others =>'0');
signal control_word : std_logic_vector(33 downto 0) := (others =>'0');
signal mpc : std_logic_vector(11 downto 0) := (others =>'0');
BEGIN
con_w_gen :entity work.controlWordGenerator PORT MAP (rst => rst,clk => clock,flags => flags,IR_reg => IR_reg,run => run,state => state,control_word => control_word,temp_mpc => mpc);
PROCESS
BEGIN
run <= '1';
wait for 1 ns;
assert (control_word = X"0000000000") REPORT "error in reading data at index 0" severity error;
flags <= "0100";
rst <= '0';
wait for 1 ns;
assert (control_word = X"0000000000") REPORT "error in reading data at index 1" severity error;
wait for 1 ns;
assert (control_word = X"0040000000") REPORT "error in reading data at index 2" severity error;
wait for 1 ns;
assert (control_word = X"0040000002") REPORT "error in reading data at index 3" severity error;
wait for 1 ns;
flags <= "0000";
assert (control_word = X"0040000000") REPORT "error in reading data at index 2" severity error;
wait for 1 ns;
assert (control_word = X"0040000002") REPORT "error in reading data at index 3" severity error;
wait for 1 ns;
assert (control_word = X"00A0000000") REPORT "error in reading data at index 4" severity error;
wait for 1 ns;
assert (control_word = X"0100000000") REPORT "error in reading data at index 5" severity error;
wait for 1 ns;
assert (control_word = X"0060000004") REPORT "error in reading data at index 6" severity error;
wait for 1 ns;
assert (control_word = X"0000000001") REPORT "error in reading data at index 7" severity error;
wait for 1 ns;
assert (control_word = X"0000000000") REPORT "error in reading data at index 8" severity error;
WAIT;
END PROCESS;
process
begin
clock <= not clock;
WAIT FOR 0.5 ns;
clock <= not clock;
wait FOR 0.5 ns;
end process ; -- switch_clock
END ARCHITECTURE;