forked from raplin/OpenNX4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuart_test.v
93 lines (80 loc) · 1.57 KB
/
uart_test.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
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
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:45:26 11/01/2017
// Design Name: uart
// Module Name: C:/rda/Barco/xilinx/NX4Driver/uart_test.v
// Project Name: NX4Driver
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: uart
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module uart_test;
// Inputs
reg rx;
reg [15:0] baud_rate;
reg [7:0] tx_data;
reg tx_data_strobe;
reg CLK_40;
reg reset;
// Outputs
wire tx;
wire [7:0] rx_data;
wire rx_data_strobe;
wire tx_busy;
// Instantiate the Unit Under Test (UUT)
uart uut (
.rx(rx),
.tx(tx),
.rx_data(rx_data),
.baud_rate(baud_rate),
.rx_data_strobe(rx_data_strobe),
.tx_data(tx_data),
.tx_data_strobe(tx_data_strobe),
.tx_busy(tx_busy),
.CLK_40(CLK_40),
.reset(reset)
);
initial begin
// Initialize Inputs
rx = 0;
baud_rate = 8; //40000000/115200;
tx_data = 0;
tx_data_strobe = 0;
CLK_40 = 0;
reset = 0;
// Add stimulus here
#10
reset=1;
#50
reset=0;
end
always begin
forever #12.5 CLK_40=~CLK_40;
end
always begin
forever #12.5 rx<=tx;
end
always begin
#100 tx_data <= 'hc1; tx_data_strobe<=1;
#100 tx_data_strobe<=0;
#1000 tx_data_strobe<=0;
end
// always begin
// #200
//`define SPICLK2 100
//`define mosi
//`include "spi_tester_gen.v"
// end
endmodule