-
Notifications
You must be signed in to change notification settings - Fork 0
/
arithmetic_logic_unit_tb.vhd
63 lines (50 loc) · 1.52 KB
/
arithmetic_logic_unit_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
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity arithmetic_logic_unit_tb is
end arithmetic_logic_unit_tb;
architecture behavior of arithmetic_logic_unit_tb is
-- component Declaration for the Unit Under Test (UUT)
component arithmetic_logic_unit
port (
A : in std_logic_vector(15 downto 0);
B : in std_logic_vector(15 downto 0);
G_sel : in std_logic_vector(3 downto 0);
G : out std_logic_vector(15 downto 0);
C : out std_logic
);
end component;
--Inputs
signal A : std_logic_vector(15 downto 0) := (others => '0');
signal B : std_logic_vector(15 downto 0) := (others => '0');
signal G_sel : std_logic_vector(3 downto 0) := (others => '0');
--Outputs
signal G : std_logic_vector(15 downto 0);
signal C : std_logic;
begin
-- Instantiate the Unit Under Test (UUT)
uut : arithmetic_logic_unit
port map(
A => A,
B => B,
G_sel => G_sel,
G => G,
C => C
);
-- Stimulus process
stim_proc : process
begin
-- hold reset state for 100 ns.
wait for 100 ns;
-- test values
A <= "1000000000000011";
B <= "1000000000000010";
-- loop over all ALU operations
-- i.e. 0000 to 1011
TEST_VALUES : for i in 0 to 11 loop
G_sel <= std_logic_vector(to_unsigned(i, G_sel'LENGTH));
wait for 100 ns;
end loop TEST_VALUES;
wait;
end process;
end;