-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUart8.v
60 lines (54 loc) · 1.07 KB
/
Uart8.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
/*
* Simple 8-bit UART realization.
* Combine receiver, transmitter and baud rate generator.
* Able to operate 8 bits of serial data, one start bit, one stop bit.
*/
module Uart8 #(
parameter CLOCK_RATE = 100000000, // board internal clock
parameter BAUD_RATE = 9600
)(
input wire clk,
// rx interface
input wire rx,
input wire rxEn,
output wire [7:0] out,
output wire rxDone,
output wire rxBusy,
output wire rxErr,
// tx interface
output wire tx,
input wire txEn,
input wire txStart,
input wire [7:0] in,
output wire txDone,
output wire txBusy
);
wire rxClk;
wire txClk;
BaudRateGenerator #(
.CLOCK_RATE(CLOCK_RATE),
.BAUD_RATE(BAUD_RATE)
) generatorInst (
.clk(clk),
.rxClk(rxClk),
.txClk(txClk)
);
Uart8Receiver rxInst (
.clk(rxClk),
.en(rxEn),
.in(rx),
.out(out),
.done(rxDone),
.busy(rxBusy),
.err(rxErr)
);
Uart8Transmitter txInst (
.clk(txClk),
.en(txEn),
.start(txStart),
.in(in),
.out(tx),
.done(txDone),
.busy(txBusy)
);
endmodule