-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtb_uart_tx.v
66 lines (60 loc) · 1.19 KB
/
tb_uart_tx.v
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
`timescale 1ns/1ns
module tb_uart_tx ();
reg clk;
reg rst_n;
reg [7:0] in_data;
reg in_en;
wire out_data;
wire out_en;
uart_tx #(
.BAUD (5_000_000),
.SYS_CLK (50_000_000)
)
component(
.clk (clk),
.rst_n (rst_n),
.in_data (in_data),
.in_en (in_en),
.out_data (out_data),
.out_en (out_en)
);
initial begin
clk = 1'b1;
rst_n = 1'b0;
in_en = 1'b0;
in_data = 8'b0;
#10;
rst_n = 1'b1;
#10;
in_en = 1'b1;
in_data = 8'b0011_0001;
#2;
in_en = 1'b0;
in_data = 8'b0;
#250;
in_en = 1'b1;
in_data = 8'b1001_0101;
#2;
in_en = 1'b0;
in_data = 8'b0;
#250;
in_en = 1'b1;
in_data = 8'b0001_0000;
#2;
in_en = 1'b0;
in_data = 8'b0;
#250;
in_en = 1'b1;
in_data = 8'b1110_1111;
#2;
in_en = 1'b0;
in_data = 8'b0;
#250;
$finish;
end
always #1 clk = ~clk;
initial begin
$dumpfile("tb_uart_tx.vcd");
$dumpvars(0, component);
end
endmodule