-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathUART_Loopback_tb.v
More file actions
54 lines (46 loc) · 1.08 KB
/
Copy pathUART_Loopback_tb.v
File metadata and controls
54 lines (46 loc) · 1.08 KB
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
`include "UART_Loopback_module.v"
`include "UART_TX.v"
`include "UART_RX.v"
module UART_Loopback_tb();
reg clk = 1'b1;
reg RsRx; // UART RX Data
wire RsTx; // UART TX Data
wire [7:0] dout; // data out
wire o_TX_Done; // high when transition is done
wire o_RX_DV; // data valid
always #1 clk <= ~clk;
initial begin
// starting UART transition
#0 RsRx = 1;
#1736 RsRx = 0;
#1736 RsRx = 1;
#1736 RsRx = 0;
#1736 RsRx = 1;
#1736 RsRx = 0;
#1736 RsRx = 1;
#1736 RsRx = 0;
#1736 RsRx = 1;
#1736 RsRx = 0;
#1736 RsRx = 1;
#100_000;
$finish();
end
initial
begin
$display(" ");
$display("----------------------------------------------");
$display(" Starting Testbench...");
$dumpfile("wave.vcd");
$dumpvars(0);
$display("----------------------------------------------");
$display(" ");
end
UART_Loopback_module Test_Unit(
.clk(clk),
.RsRx(RsRx),
.RsTx(RsTx),
.dout(dout),
.o_TX_Done(o_TX_Done),
.o_RX_DV(o_RX_DV)
);
endmodule