国产肉体XXXX裸体137大胆,国产成人久久精品流白浆,国产乱子伦视频在线观看,无码中文字幕免费一区二区三区 国产成人手机在线-午夜国产精品无套-swag国产精品-国产毛片久久国产

新聞中心

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

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

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

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

//Capture the falling of data transfer over

reg txd_flag_r0,txd_flag_r1;

always@(posedge clk or negedge rst_n)

begin

if(!rst_n)

begin

txd_flag_r0 = 0;

txd_flag_r1 = 0;

end

else

begin

txd_flag_r0 = txd_flag_r;

txd_flag_r1 = txd_flag_r0;

end

end

assign txd_flag = txd_flag_r1 ~txd_flag_r0;

(3)RXD發(fā)送模塊

由于接收數(shù)據(jù)的時(shí)候,主控是PC,從機(jī)是,因此需要采樣數(shù)據(jù)。以上波特率發(fā)生器中講到過(guò),采樣時(shí)鐘clk_bps = 16*clk_bps。硬件描述,通過(guò)計(jì)數(shù),當(dāng)采樣到RXD數(shù)據(jù)起始位信號(hào)有效時(shí),0-7-15開(kāi)始計(jì)數(shù),,其中7為數(shù)據(jù)的中點(diǎn),最穩(wěn)定的時(shí)刻。因此在此時(shí)采樣數(shù)據(jù),能夠達(dá)到最穩(wěn)定的效果。Bingo設(shè)計(jì)代碼如下:

always@(posedge clk or negedge rst_n)

begin

if(!rst_n)

begin

smp_cnt = 0;

rxd_cnt = 0;

rxd_data = 0;

rxd_state = R_IDLE;

end

else if(clk_smp == 1)

begin

case(rxd_state)

R_IDLE:

begin

rxd_cnt = 0;

if(rxd_sync == 1'b0)

begin

smp_cnt = smp_cnt + 1'b1;

if(smp_cnt == 4'd7) //8 clk_smp enable

rxd_state = R_SAMPLE;

end

else

smp_cnt = 0;

end

R_SAMPLE:

begin

smp_cnt = smp_cnt +1'b1;

if(smp_cnt == 4'd7)

begin

rxd_cnt = rxd_cnt +1'b1;

if(rxd_cnt == 4'd7)

rxd_state = R_IDLE;

case(rxd_cnt)

3'd0: rxd_data[0] = rxd_sync;

3'd1: rxd_data[1] = rxd_sync;

3'd2: rxd_data[2] = rxd_sync;

3'd3: rxd_data[3] = rxd_sync;

3'd4: rxd_data[4] = rxd_sync;

3'd5: rxd_data[5] = rxd_sync;

3'd6: rxd_data[6] = rxd_sync;

3'd7: rxd_data[7] = rxd_sync;

endcase

end

end

endcase

end

end

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




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

評(píng)論


相關(guān)推薦

技術(shù)專(zhuān)區(qū)

關(guān)閉