Sync
Sync
module m(
clk_in, rx_out,tx_out,mcu_out
);
input clk_in;
////---TX------
output reg tx_out;
integer cnt_tx=0;
integer tx_high=30; // 1 => 10ns, 2 => 20ns,...
//---RX------
output reg rx_out;
integer cnt_rx=0;
//integer rx_high=6; // 1 => 10ns, 2 => 20ns,...
//assign clk_in_reg=clk_in;
//---mcu_out---
always@(posedge clk_in) begin
cnt_mcu=cnt_mcu+1;
if(cnt_mcu==div) begin
cnt_mcu=0;
end
end
////---TX PULSE---
always@(posedge clk_in) begin
cnt_tx=cnt_tx+1;
if(cnt_tx==div) begin
cnt_tx=0;
end
end
//--RX PULSE---
always@(posedge clk_in) begin
cnt_rx=cnt_rx+1;
if(cnt_rx==div) begin
cnt_rx=0; temp=temp+1;
if(temp==temp_2) temp=80;
end
end
endmodule