-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuart.sv
More file actions
51 lines (41 loc) · 845 Bytes
/
Copy pathuart.sv
File metadata and controls
51 lines (41 loc) · 845 Bytes
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
`timescale 1ns/1ps
`include "uart_reader.sv"
`include "uart_writer.sv"
module uart(
input logic clk, rst_i, RXD,
output logic TXD,
output logic [5:0] led,
output logic tmds_clk_p,
output logic tmds_clk_n
);
logic [7:0] bits;
logic end_read, end_write, error_read;
logic led_state = 0;
uart_reader uart_reader(
.clk(clk),
.reset(!rst_i),
.rx(RXD),
.bits(bits),
.clk_per_tick(32'd2808),
.end_transmission(end_read),
.error(error_read)
);
uart_writer uart_writer(
.clk(clk),
.reset(!rst_i),
.tx(TXD),
.start_transmission(end_read),
.bits(bits),
.clk_per_tick(32'd2808),
.end_transmission(end_write),
.error(error_write)
);
always_ff @(posedge clk)
if(end_read)
led_state = ~led_state;
always_comb
begin
tmds_clk_p = RXD;
tmds_clk_n = bits[0];
end
endmodule