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.

56 lines
807 B
Verilog

`timescale 1ns/1ns
module tb_uart();
reg sys_clk;
reg sys_rst;
reg rxd;
wire txd;
always #10 sys_clk = ~sys_clk;
// 发送数据 8'b0101_0101
parameter [7:0]data = 8'b0101_0101;
initial begin
sys_clk <= 1'b0;
rxd <= 1'b1;
sys_rst <= 1'b0;
#50
sys_rst <= 1'b1;
#1000
// 开始发送数据
rxd <= 1'b0; // 起始位
#8680
rxd <= data[0];
#8680
rxd <= data[1];
#8680
rxd <= data[2];
#8680
rxd <= data[3];
#8680
rxd <= data[4];
#8680
rxd <= data[5];
#8680
rxd <= data[6];
#8680
rxd <= data[7];
#8680
rxd <= 1'b1; // 停止位
#8680
rxd <= 1'b1; // 空闲了
end
uart_top u_uart_top(
.sys_clk(sys_clk), // U18
.sys_rst(sys_rst), //J15
.rxd(rxd),
.txd(txd)
);
endmodule