新聞中心

EEPW首頁 > EDA/PCB > 設(shè)計(jì)應(yīng)用 > 基于FPGA的UART、USB接口協(xié)議設(shè)計(jì)

基于FPGA的UART、USB接口協(xié)議設(shè)計(jì)

作者: 時(shí)間:2012-03-13 來源:網(wǎng)絡(luò) 收藏

//clk_bps sync bps generater

reg clk_bps_r0,clk_bps_r1,clk_bps_r2;

always@(posedge clk or negedge rst_n)

begin

if(!rst_n)

begin

clk_bps_r0 = 0;

clk_bps_r1 = 0;

clk_bps_r2 = 0;

end

else

begin

if(bps_cnt1 32'h7FFF_FFFF)

clk_bps_r0 = 0;

else

clk_bps_r0 = 1;

clk_bps_r1 = clk_bps_r0;

clk_bps_r2 = clk_bps_r1;

end

end

assign clk_bps = ~clk_bps_r2 clk_bps_r1;

//------------------------------------------

//clk_smp sync receive bps generator

reg clk_smp_r0,clk_smp_r1,clk_smp_r2;

always@(posedge clk or negedge rst_n)

begin

if(!rst_n)

begin

clk_smp_r0 = 0;

clk_smp_r1 = 0;

clk_smp_r2 = 0;

end

else

begin

if(bps_cnt2 32'h7FFF_FFFF)

clk_smp_r0 = 0;

else

clk_smp_r0 = 1;

clk_smp_r1 = clk_smp_r0;

clk_smp_r2 = clk_smp_r1;

end

end

assign clk_smp = ~clk_smp_r2 clk_smp_r1;

endmodule

c++相關(guān)文章:c++教程




關(guān)鍵詞: FPGA UART USB 接口

評(píng)論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉