You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
884 B
Verilog
41 lines
884 B
Verilog
// 该模块是把通过串口接收到的数据, 通过 uart_rx模块 把串行数据转为并行, 并保存到 rx_data中
|
|
// 接收一帧之后 拉高rx_done, rx_done和uart_tx模块的start_en相连,通过uart_tx模块再原封不动的把rx_data中的并行数据, 通过txd 再发送出去
|
|
module uart_top(
|
|
input wire sys_clk, // U18
|
|
input wire sys_rst, //J15
|
|
input wire rxd,
|
|
output wire txd
|
|
);
|
|
|
|
parameter CLK_FREQ = 5000_0000;
|
|
parameter BPS = 115200;
|
|
|
|
wire rx_done;
|
|
wire [7:0] rx_data;
|
|
uart_rx #(
|
|
.CLK_FREQ(CLK_FREQ),
|
|
.BPS(BPS)
|
|
)u_uart_rx(
|
|
.sys_clk(sys_clk),
|
|
.sys_rst(sys_rst),
|
|
.rxd(rxd),
|
|
.rx_done(rx_done),
|
|
.rx_data(rx_data)
|
|
);
|
|
|
|
uart_tx #(
|
|
.CLK_FREQ(CLK_FREQ),
|
|
.BPS(BPS)
|
|
)u_uart_tx(
|
|
.sys_clk(sys_clk),
|
|
.sys_rst(sys_rst),
|
|
.start_en(rx_done),
|
|
.tx_data(rx_data),
|
|
.txd(txd),
|
|
.tx_busy()
|
|
);
|
|
|
|
|
|
|
|
|
|
endmodule |