-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComparator_4_bit_TB.vhd
63 lines (46 loc) · 1.06 KB
/
Comparator_4_bit_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;
ENTITY Comparator_4_bit_TB IS
END Comparator_4_bit_TB;
ARCHITECTURE behavior OF Comparator_4_bit_TB IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT Comparator_4_bit
PORT(
A : IN std_logic_vector(3 downto 0);
B : IN std_logic_vector(3 downto 0);
EQ : OUT std_logic
);
END COMPONENT;
--Inputs
signal L_A : std_logic_vector(3 downto 0);
signal L_B : std_logic_vector(3 downto 0);
--Outputs
signal L_EQ : std_logic;
signal L_A_GT_B : std_logic;
signal L_A_LT_B : std_logic;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: Comparator_4_bit
PORT MAP (
A => L_A,
B => L_B,
EQ => L_EQ,
A_GT_B => L_A_GT_B,
A_LT_B => L_A_LT_B
);
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
wait for 100 ns;
L_A <= "0000";
L_B <= "0010";
wait for 20 ns;
L_A <= "1010";
L_B <= "1010";
wait for 20 ns;
L_A <= "1011";
L_B <= "1010";
wait;
end process;
END;