-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransmitter_TX_TB.vhd
128 lines (94 loc) · 2.61 KB
/
Transmitter_TX_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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY Transmitter_TX_TB IS
END Transmitter_TX_TB;
ARCHITECTURE behavior OF Transmitter_TX_TB IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT Transmitter_TX
PORT(
RESET_ALL_TX : IN std_logic;
CLK : IN std_logic;
START : IN std_logic;
CTS : IN std_logic;
B_IN : IN std_logic_vector(6 downto 0);
AVAILABLE:out std_logic;
TX_OUT : OUT std_logic
);
END COMPONENT;
--Inputs
signal L_RESET_ALL_TX : std_logic;
signal L_CLK : std_logic;
signal L_START : std_logic;
signal L_CTS : std_logic;
signal L_B_IN : std_logic_vector(6 downto 0);
--Outputs
signal L_TX_OUT : std_logic;
signal L_AVAILABLE:std_logic;
--debug
-- Clock period definitions
constant Tick_period : time := 160 ns;
constant CLK_period : time := Tick_period/16;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: Transmitter_TX PORT MAP (
--debug
RESET_ALL_TX =>L_RESET_ALL_TX,
CLK => L_CLK,
START => L_START,
CTS => L_CTS,
B_IN => L_B_IN,
TX_OUT => L_TX_OUT,
AVAILABLE=>L_AVAILABLE
);
-- Clock process definitions
CLK_process :process
begin
L_CLK <= '0';
wait for CLK_period/2;
L_CLK <= '1';
wait for CLK_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
L_RESET_ALL_TX<='1';
-- hold reset state for 100 ns.
wait for Tick_period;
L_RESET_ALL_TX<='0';
-- B_IN = '1110101', lascio start per 1 baudrate,
-- la trasmissione funziona
L_B_IN<="1110101";
L_START<='1';
L_CTS<='1';
wait for Tick_period ;
L_START<='0';
wait for 9*Tick_period ;
-- B_IN = '1010101', aspetto 1 baudrate
-- e poi metto start a 1,
-- dopo un baudrate cts a 0
-- la trasmissione funziona da quando metto start
-- e da li in poi non trasmette più
L_B_IN<="1010101";
wait for Tick_period;
L_START<='1';
wait for Tick_period;
L_CTS<='0';
wait for 9*Tick_period;
-- B_IN = '1110101', start già alto,
-- aspetto 3 baudrate e poi cts=1,
-- la trasmissione funziona
-- da quando metto cts=1
L_B_IN<="1110101";
wait for 3*Tick_period;
L_CTS<='1';
wait for 10*Tick_period;
-- B_IN = '1010101', start già alto,
-- aspetto 1 baudrate e poi start basso,
-- la trasmissione funziona appena
-- finisce quella precedente
L_B_IN<="1010101";
wait for Tick_period;
L_START<='0';
wait;
end process;
END;