-
Notifications
You must be signed in to change notification settings - Fork 2
/
uart.v
79 lines (55 loc) · 1.19 KB
/
uart.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
`timescale 1ns/100ps
module uart ( sys_clk,
sys_rst_l,
uart_XMIT_dataH,
xmitH,
xmit_dataH,
xmit_doneH,
uart_REC_dataH,
rec_dataH,
rec_readyH
);
`include "inc.h"
input sys_clk;
input sys_rst_l;
output uart_XMIT_dataH;
input xmitH;
input [7:0] xmit_dataH;
output xmit_doneH;
input uart_REC_dataH;
output [7:0] rec_dataH;
output rec_readyH;
reg [7:0] rec_dataH;
reg [7:0] rec_dataH_temp;
wire [7:0] rec_dataH_rec;
wire rec_readyH;
u_xmit iXMIT( .sys_clk(sys_clk),
.sys_rst_l(sys_rst_l),
.uart_xmitH(uart_XMIT_dataH),
.xmitH(xmitH),
.xmit_dataH(xmit_dataH),
.xmit_doneH(xmit_doneH),
);
u_rec iRECEIVER (.sys_rst_l(sys_rst_l),
.sys_clk(sys_clk),
.uart_dataH(uart_REC_dataH),
.rec_dataH(rec_dataH_rec),
.rec_readyH(rec_readyH)
);
always @(posedge sys_clk or negedge sys_rst_l) begin
if (~sys_rst_l) begin
rec_dataH=0;
end
else begin
rec_dataH=rec_dataH_temp;
end
end
always @(posedge rec_readyH or negedge sys_rst_l) begin
if (~sys_rst_l) begin
rec_dataH_temp<=0;
end
else begin
rec_dataH_temp<=rec_dataH_rec;
end
end
endmodule