|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
[code]module txmit(
input wire sys_clk , //system clock;
input wire sys_rst_n , //system reset, low is active
output reg uart_txd,
input wire [7:0]data_in
);
reg [7:0] buff ;
reg txd ;
reg [19:0] counter ;
reg [23:0] delay_count ;
//assign LED = buff;
always @(posedge sys_clk or negedge sys_rst_n) begin
if (sys_rst_n ==1'b0)begin // 鍒濆?鍖buff, 澶嶄綅鏃跺叏閮ㄦ竻闆
buff <= 8'b0;
end
else begin
buff <= data_in;
end
end
always @(posedge sys_clk or negedge sys_rst_n) begin
if ( sys_rst_n == 1'b0)begin
delay_count <= 24'b0;
end
else if (delay_count <= 24'd50000000 )begin
delay_count <= delay_count+ 24'b1;
end
else begin
delay_count <= 24'b0;
end
end
always @(posedge sys_clk or negedge sys_rst_n ) begin
if ( sys_rst_n ==1'b0 )begin
counter <= 20'b0;
end
else if (delay_count == 24'd50000000)begin
//counter 鍦鍦delay_count 璁℃暟鍒DELAY_CNT 鏃跺紑濮嬪彂閫佹暟鎹
counter <= 20'b0;
end
else if (counter <= 57200)begin // 瀹屾垚涓 |
|