-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bit_Counter_TB.vhd
85 lines (66 loc) · 1.43 KB
/
Bit_Counter_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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY Bit_Counter_TB IS
generic(
MOD_COUNT : integer := 4
);
END Bit_Counter_TB;
ARCHITECTURE behavior OF Bit_Counter_TB IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT Bit_Counter
generic(
N : integer
);
PORT(
tick : IN std_logic;
reset : IN std_logic;
enable : IN std_logic;
count : OUT std_logic_vector(0 to N-1)
);
END COMPONENT;
--Inputs
signal L_tick : std_logic;
signal L_reset : std_logic;
signal L_enable : std_logic;
--Outputs
signal L_count : std_logic_vector(0 to MOD_COUNT-1);
-- No clocks detected in port list. Replace <clock> below with
-- appropriate port name
constant tick_period : time := 100 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: Bit_Counter
GENERIC MAP(
N => MOD_COUNT
)
PORT MAP (
tick => L_tick,
reset => L_reset,
enable => L_enable,
count => L_count
);
-- Clock process definitions
tick_process :process
begin
L_tick <= '0';
wait for tick_period/2;
L_tick <= '1';
wait for tick_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
wait for tick_period*2;
L_enable <= '1';
L_reset <= '1';
wait for 10 ns;
L_reset <= '0';
wait for tick_period*16;
L_reset <= '1';
wait for 10 ns;
L_reset <= '0';
wait for tick_period*3;
L_enable <= '0';
wait;
end process;
END;