-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalu_tb.vhd
66 lines (52 loc) · 1.85 KB
/
alu_tb.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
64
65
66
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity alu_tb is
end alu_tb;
architecture alu_test of alu_tb is
component alu is
port(op: in std_logic_vector(2 downto 0);
a,b : in std_logic_vector (7 downto 0);
s : out std_logic_vector (7 downto 0));
end component;
signal op: std_logic_vector(2 downto 0);
signal a,b: std_logic_vector(7 downto 0);
signal s: std_logic_vector(7 downto 0);
begin
uut: entity work.alu(alu_architecture) port map(op => op, a => a, b => b, s => s);
process
begin
a <= "10101010"; b <= "01010101";
op <= "000";
wait for 10 ns;
assert s="10101010" report "Falla instruccion cod.: 000" severity failure;
a <= "10101010"; b <= "01010101";
op <= "001";
wait for 10 ns;
assert s="01010100" report "Falla instruccion cod.: 001" severity failure;
a <= "10101010"; b <= "01010101";
op <= "010";
wait for 10 ns;
assert s="11111111" report "Falla instruccion cod.: 010" severity failure;
a <= "10101010"; b <= "01010101";
op <= "011";
wait for 10 ns;
assert s="01010101" report "Falla instruccion cod.: 011" severity failure;
a <= "10101010"; b <= "01010101";
op <= "100";
wait for 10 ns;
assert s="00000000" report "Falla instruccion cod.: 100" severity failure;
a <= "10101010"; b <= "01010101";
op <= "101";
wait for 10 ns;
assert s="11111111" report "Falla instruccion cod.: 101" severity failure;
a <= "10101010"; b <= "01010101";
op <= "110";
wait for 10 ns;
assert s="11111111" report "Falla instruccion cod.: 110" severity failure;
a <= "10101010"; b <= "01010101";
op <= "111";
wait for 10 ns;
assert s="01010101" report "Falla instruccion cod.: 111" severity failure;
wait;
end process;
end alu_test;