-
Notifications
You must be signed in to change notification settings - Fork 0
/
Parity_Bit_Generator_TB.vhd
101 lines (75 loc) · 1.74 KB
/
Parity_Bit_Generator_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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY Parity_Bit_Generator_TB IS
END Parity_Bit_Generator_TB;
ARCHITECTURE behavior OF Parity_Bit_Generator_TB IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT Parity_Bit_Generator is
port(
d_in: in std_logic;
tick: in std_logic;
reset: in std_logic;
preset: in std_logic;
enable: in std_logic;
even_p: out std_logic
);
END COMPONENT;
--Inputs
signal l_d_in : std_logic;
signal l_tick: std_logic;
signal l_reset: std_logic;
signal l_preset: std_logic;
signal l_enable: std_logic;
--Outputs
signal l_even_p : std_logic;
constant tick_period : time := 1000 ms/9600;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: Parity_Bit_Generator PORT MAP (
d_in => l_d_in,
even_p => l_even_p,
tick => l_tick,
reset => l_reset,
preset => l_preset,
enable => l_enable
);
-- 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
l_reset <= '1';
l_preset <= '0';
l_enable <= '0';
wait for tick_period/2;
l_reset <= '0';
l_d_in <= '1';
wait for tick_period;
l_d_in <= '1';
wait for tick_period/8;
l_enable <= '1';
wait for 7*tick_period/8;
l_d_in <= '1';
wait for tick_period;
l_d_in <= '1';
wait for tick_period;
l_d_in <= '0';
wait for tick_period;
l_d_in <= '1';
wait for 20 us;
l_enable <= '0';
wait for 20 us;
l_reset <= '1';
wait for 20 us;
l_reset <= '0';
wait for 20 us;
l_preset <= '1';
wait;
end process;
END;