-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSIPO_TB.vhd
103 lines (77 loc) · 1.61 KB
/
SIPO_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
102
103
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY SIPO_TB IS
GENERIC(
WIDTH: integer := 4
);
END SIPO_TB;
ARCHITECTURE behavior OF SIPO_TB IS
COMPONENT SIPO
GENERIC(
N: integer
);
PORT(
tick : IN std_logic;
rx : IN std_logic;
enable : IN std_logic;
reset : IN std_logic;
B_OUT : OUT std_logic_vector(N-1 downto 0)
);
END COMPONENT;
--Inputs
signal L_tick : std_logic;
signal L_rx : std_logic;
signal L_enable : std_logic;
signal L_reset : std_logic;
--Outputs
signal L_B_OUT : std_logic_vector(WIDTH-1 downto 0);
constant tick_period : time := 1000 ms / 9600;
BEGIN
-- Instantiate the Unit Under Test (UUT)
UUT: SIPO
GENERIC MAP(
N => WIDTH
)
PORT MAP (
tick => L_tick,
rx => L_rx,
enable => L_enable,
reset => L_reset,
B_OUT => L_B_OUT
);
-- 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;
L_reset <= '1';
L_enable <= '0';
L_reset <= '0';
wait for tick_period/2;
L_rx <= '1';
wait for tick_period;
L_rx <= '1';
wait for tick_period/8;
L_enable <= '1';
wait for 7*tick_period/8;
L_rx <= '1';
wait for tick_period;
L_rx <= '1';
wait for tick_period;
L_rx <= '0';
wait for tick_period;
L_rx <= '1';
wait for tick_period/8;
L_enable <= '0';
wait for 2*tick_period;
L_reset <= '1';
wait;
end process;
END;