亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? readusbwiredata.v

?? 包括USB
?? V
字號:
//////////////////////////////////////////////////////////////////////
////                                                              ////
//// readUSBWireData.v                                            ////
////                                                              ////
//// This file is part of the usbhostslave opencores effort.
//// <http://www.opencores.org/cores//>                           ////
////                                                              ////
//// Module Description:                                          ////
////      This module reads data from the differential USB data lines
////      and writes into a 4 entry FIFO. The data is read from
////      the fifo and output from the module when the higher level
////      state machine is ready to receive the data.
////      This module must recover the clock phase from the incoming
////      USB data. 'sampleCnt' is reset to zero whenever a RX data
////      edge is detected. Note that due to metastability the data
////      at the edge may not be registered correctly, but this does
////      not matter. All that matters is that an edge was detected. The
////      data will be accurately sampled in the middle of the USB bit 
////      period without metastability issues. 
////      After the edge detect, 'sampleCnt' is incremented at every clock
////      tick, and when it indicates the middle of a USB bit period
////      the RX data is sampled and written to the input buffer.
////      Single clock tick adjustments to 'sampleCnt' can be made at 
////      every RX data edge detect without double sampling the incoming
////      data. However, the first RX data bit in a packet may cause 
////      'sampleCnt' to be adjusted by a value greater than a single 
////      clock tick, and this can result in double sampling of the 
////      first data bit a RX packet. This 
////      double sampled data must be rejected by the higher level module.
////      This is achieved by 
////      qualifying the outgoing data with 'RxWireActive'. Thus 
////      the first data bit in a RX packet may be double sampled
////      as the clock recovery mechanism synchronizes to 'RxBitsIn'
////      but the double sampled data will be rejected by the higher 
////      level module.
//// 
////                                                              ////
//// To Do:                                                       ////
//// 
////                                                              ////
//// Author(s):                                                   ////
//// - Steve Fielding, sfielding@base2designs.com                 ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
////                                                              ////
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG          ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// removed from the file and that any derivative work contains  ////
//// the original copyright notice and the associated disclaimer. ////
////                                                              ////
//// This source file is free software; you can redistribute it   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any   ////
//// later version.                                               ////
////                                                              ////
//// This source is distributed in the hope that it will be       ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// PURPOSE. See the GNU Lesser General Public License for more  ////
//// details.                                                     ////
////                                                              ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// from <http://www.opencores.org/lgpl.shtml>                   ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//
`include "timescale.v"
`include "usbSerialInterfaceEngine_h.v"

module readUSBWireData (RxBitsIn, RxDataInTick, RxBitsOut, SIERxRdyIn, SIERxWEn, fullSpeedRate, TxWireActiveDrive, clk, rst, noActivityTimeOut, RxWireActive, noActivityTimeOutEnable);
input   [1:0] RxBitsIn;
output  RxDataInTick;
input   SIERxRdyIn;
input   clk;
input   fullSpeedRate;
input   rst;
input   TxWireActiveDrive;
output  [1:0] RxBitsOut;
output  SIERxWEn;
output noActivityTimeOut;
output RxWireActive;
input  noActivityTimeOutEnable;

wire   [1:0] RxBitsIn;
reg    RxDataInTick;
wire   SIERxRdyIn;
wire   clk;
wire   fullSpeedRate;
wire   rst;
reg    [1:0] RxBitsOut;
reg    SIERxWEn;
reg    noActivityTimeOut;
reg    RxWireActive;
wire   noActivityTimeOutEnable;

// local registers
reg  [2:0]buffer0;
reg  [2:0]buffer1;
reg  [2:0]buffer2;
reg  [2:0]buffer3;
reg  [2:0]bufferCnt;
reg  [1:0]bufferInIndex;
reg  [1:0]bufferOutIndex;
reg decBufferCnt;
reg  [4:0]sampleCnt;
reg incBufferCnt;
reg  [1:0]oldRxBitsIn;
reg [1:0] RxBitsInReg;
reg [15:0] timeOutCnt;
reg [7:0] rxActiveCnt;
reg RxWireEdgeDetect;
reg RxWireActiveReg;
reg RxWireActiveReg2;
reg [1:0] RxBitsInSyncReg1;
reg [1:0] RxBitsInSyncReg2;

// buffer output state machine state codes:
`define WAIT_BUFFER_NOT_EMPTY 2'b00
`define WAIT_SIE_RX_READY 2'b01
`define SIE_RX_WRITE 2'b10

// re-synchronize incoming bits
always @(posedge clk) begin
  RxBitsInSyncReg1 <= RxBitsIn;
  RxBitsInSyncReg2 <= RxBitsInSyncReg1;
end

reg [1:0] bufferOutStMachCurrState;


always @(posedge clk) begin
  if (rst == 1'b1)
  begin
    bufferCnt <= 3'b000;
  end
  else begin
    if (incBufferCnt == 1'b1 && decBufferCnt == 1'b0)
      bufferCnt <= bufferCnt + 1'b1;
    else if (incBufferCnt == 1'b0 && decBufferCnt == 1'b1)
      bufferCnt <= bufferCnt - 1'b1;
  end
end



//Perform line rate clock recovery
//Recover the wire data, and store data to buffer
always @(posedge clk) begin
  if (rst == 1'b1)
  begin
    sampleCnt <= 5'b00000;
    incBufferCnt <= 1'b0;
    bufferInIndex <= 2'b00;
    buffer0 <= 3'b000;
    buffer1 <= 3'b000;
    buffer2 <= 3'b000;
    buffer3 <= 3'b000;
    RxDataInTick <= 1'b0;
    RxWireEdgeDetect <= 1'b0;
    RxWireActiveReg <= 1'b0;
    RxWireActiveReg2 <= 1'b0;
  end
  else begin
    RxWireActiveReg2 <= RxWireActiveReg; //Delay 'RxWireActiveReg' until after 'sampleCnt' has been reset
    RxBitsInReg <= RxBitsInSyncReg2;    
    oldRxBitsIn <= RxBitsInReg;
    incBufferCnt <= 1'b0;         //default value
    if ( (TxWireActiveDrive == 1'b0) && (RxBitsInSyncReg2 != RxBitsInReg)) begin  //if edge detected then
      sampleCnt <= 5'b00000;        
      RxWireEdgeDetect <= 1'b1;   // flag receive activity 
      RxWireActiveReg <= 1'b1;
      rxActiveCnt <= 8'h00;
    end
    else begin
      sampleCnt <= sampleCnt + 1'b1;
      RxWireEdgeDetect <= 1'b0;
      rxActiveCnt <= rxActiveCnt + 1'b1;
      //clear 'RxWireActiveReg' if no RX transitions for RX_EDGE_DET_TOUT USB bit periods 
      if ( (fullSpeedRate == 1'b1 && rxActiveCnt == `RX_EDGE_DET_TOUT * `FS_OVER_SAMPLE_RATE)
        || (fullSpeedRate == 1'b0 && rxActiveCnt == `RX_EDGE_DET_TOUT * `LS_OVER_SAMPLE_RATE) ) 
        RxWireActiveReg <= 1'b0;
    end
    if ( (fullSpeedRate == 1'b1 && sampleCnt[1:0] == 2'b10) || (fullSpeedRate == 1'b0 && sampleCnt == 5'b10000) )
    begin
      RxDataInTick <= !RxDataInTick;
      if (TxWireActiveDrive != 1'b1)  //do not read wire data when transmitter is active
      begin
        incBufferCnt <= 1'b1;
        bufferInIndex <= bufferInIndex + 1'b1;
        case (bufferInIndex)
          2'b00 : buffer0 <= {RxWireActiveReg2, oldRxBitsIn}; 
          2'b01 : buffer1 <= {RxWireActiveReg2, oldRxBitsIn};
          2'b10 : buffer2 <= {RxWireActiveReg2, oldRxBitsIn};
          2'b11 : buffer3 <= {RxWireActiveReg2, oldRxBitsIn};
        endcase
      end
    end
  end
end

        

//read from buffer, and output to SIEReceiver
always @(posedge clk) begin
  if (rst == 1'b1)
  begin
    decBufferCnt <= 1'b0;
    bufferOutIndex <= 2'b00;
    RxBitsOut <= 2'b00;
    SIERxWEn <= 1'b0;
    bufferOutStMachCurrState <= `WAIT_BUFFER_NOT_EMPTY;
  end
  else begin
    case (bufferOutStMachCurrState)
      `WAIT_BUFFER_NOT_EMPTY:
      begin
        if (bufferCnt != 3'b000)
          bufferOutStMachCurrState <= `WAIT_SIE_RX_READY;
      end
      `WAIT_SIE_RX_READY:
      begin
        if (SIERxRdyIn == 1'b1)
        begin 
          SIERxWEn <= 1'b1;
          bufferOutStMachCurrState <= `SIE_RX_WRITE;
          decBufferCnt <= 1'b1;
          bufferOutIndex <= bufferOutIndex + 1'b1;
          case (bufferOutIndex)
            2'b00 : begin RxBitsOut <= buffer0[1:0]; RxWireActive <= buffer0[2]; end
            2'b01 : begin RxBitsOut <= buffer1[1:0]; RxWireActive <= buffer1[2]; end
            2'b10 : begin RxBitsOut <= buffer2[1:0]; RxWireActive <= buffer2[2]; end
            2'b11 : begin RxBitsOut <= buffer3[1:0]; RxWireActive <= buffer3[2]; end
          endcase
        end
      end
      `SIE_RX_WRITE:
      begin
        SIERxWEn <= 1'b0;
        decBufferCnt <= 1'b0;
        bufferOutStMachCurrState <= `WAIT_BUFFER_NOT_EMPTY;
      end
    endcase
  end
end

//generate 'noActivityTimeOut' pulse if no tx or rx activity for RX_PACKET_TOUT USB bit periods
//'noActivityTimeOut'  pulse can only be generated when the host or slave getPacket
//process enables via 'noActivityTimeOutEnable' signal
//'noActivityTimeOut' pulse is used by host and slave getPacket processes to determine if 
//there has been a response time out.
always @(posedge clk) begin
  if (rst) begin
    timeOutCnt <= 16'h0000;
    noActivityTimeOut <= 1'b0;
  end
  else begin
    if (TxWireActiveDrive == 1'b1 || RxWireEdgeDetect == 1'b1 || noActivityTimeOutEnable == 1'b0)
      timeOutCnt <= 16'h0000;
    else
      timeOutCnt <= timeOutCnt + 1'b1;
    if ( (fullSpeedRate == 1'b1 && timeOutCnt == `RX_PACKET_TOUT * `FS_OVER_SAMPLE_RATE)
      || (fullSpeedRate == 1'b0 && timeOutCnt == `RX_PACKET_TOUT * `LS_OVER_SAMPLE_RATE) ) 
      noActivityTimeOut <= 1'b1; 
    else 
      noActivityTimeOut <= 1'b0;
  end
end


endmodule

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成+人+日韩+欧美+亚洲| 欧美国产日韩一二三区| 亚洲超碰97人人做人人爱| 91蝌蚪porny| 亚洲资源中文字幕| 欧美精品一二三四| 久久精品国产99久久6| 26uuu国产在线精品一区二区| 国产精品66部| 亚洲免费观看视频| 欧美日韩国产一级片| 激情文学综合网| 国产女人aaa级久久久级| 成人精品一区二区三区中文字幕| 最新国产の精品合集bt伙计| 欧美午夜精品电影| 久久66热re国产| 国产精品国产三级国产三级人妇| 欧美日韩一区国产| 国产在线视频一区二区| 亚洲视频小说图片| 91精品国产免费| 丰满少妇久久久久久久 | 欧美精品v国产精品v日韩精品| 91色porny在线视频| 久久久久久久精| 不卡一区在线观看| 日韩黄色在线观看| 国产精品久久久久久久蜜臀| 欧美性一二三区| 国产成人综合网| 亚洲高清免费视频| 久久九九全国免费| 欧美久久婷婷综合色| 成人国产精品免费| 青青草一区二区三区| 17c精品麻豆一区二区免费| 91精品一区二区三区在线观看| 国产成人99久久亚洲综合精品| 亚洲成a人片在线不卡一二三区| 久久亚洲精华国产精华液| 欧美日韩中文字幕精品| 成人av高清在线| 国产美女av一区二区三区| 性感美女极品91精品| 国产精品久久毛片| 精品少妇一区二区三区视频免付费| 99久久精品99国产精品| 韩国成人在线视频| 午夜精品123| 一区二区三区在线观看网站| 中文字幕第一区二区| 日韩免费高清视频| 欧美挠脚心视频网站| 91在线视频在线| 国产iv一区二区三区| 韩国视频一区二区| 日韩精品每日更新| 婷婷国产在线综合| 有坂深雪av一区二区精品| 欧美韩国一区二区| 久久久久久亚洲综合| 精品国产麻豆免费人成网站| 欧美另类z0zxhd电影| 在线观看精品一区| 欧美中文字幕久久| 91福利国产成人精品照片| 99re成人精品视频| 91小视频在线免费看| 成人aa视频在线观看| 成人一区二区三区视频在线观看| 国内精品国产成人国产三级粉色| 人妖欧美一区二区| 日本视频一区二区| 另类调教123区| 久久精品国产第一区二区三区| 久久草av在线| 国产九色sp调教91| 懂色av一区二区在线播放| 国产成人在线影院| 成年人国产精品| 91女人视频在线观看| 色狠狠一区二区| 欧美日韩一本到| 日韩免费看的电影| 久久麻豆一区二区| 国产精品麻豆视频| 亚洲男同性视频| 天堂影院一区二区| 免费观看91视频大全| 国产一区二区三区日韩 | 国产亚洲欧美日韩俺去了| 久久精品一级爱片| 亚洲特黄一级片| 亚洲国产中文字幕在线视频综合| 日韩精品每日更新| 国产成人午夜精品5599| av亚洲精华国产精华精华| 日本高清视频一区二区| 欧美精品日韩综合在线| 精品国产一区二区三区忘忧草| 国产精品三级av在线播放| 亚洲精品美腿丝袜| 美国十次综合导航| 成人18视频日本| 欧美肥妇毛茸茸| 日本一区二区三区dvd视频在线| 一区二区日韩av| 久久精品二区亚洲w码| av激情综合网| 欧美一区二区视频在线观看2022 | 日本不卡123| 成人精品视频一区二区三区| 91久久精品一区二区三| 日韩一区二区三区免费看 | 精品少妇一区二区三区免费观看 | 国产乱子伦一区二区三区国色天香| 本田岬高潮一区二区三区| 欧美色精品天天在线观看视频| 精品国产亚洲一区二区三区在线观看| 国产精品高潮呻吟久久| 青娱乐精品视频在线| 91香蕉视频mp4| 精品国产一区久久| 亚洲午夜视频在线观看| 国产一级精品在线| 欧美日韩成人在线| 亚洲视频你懂的| 国产电影一区在线| 51精品秘密在线观看| 中文字幕五月欧美| 韩国v欧美v日本v亚洲v| 欧美日韩高清在线| 亚洲日本一区二区三区| 国产精品一区三区| 在线成人av影院| 亚洲卡通动漫在线| 国产精品影视在线| 日韩精品一区二区三区在线观看 | 日本在线不卡视频| 91首页免费视频| 国产精品视频在线看| 狠狠色综合日日| 日韩欧美一区电影| 亚洲一区二区精品3399| 99久久er热在这里只有精品15| 精品成人一区二区三区四区| 丝袜美腿亚洲一区| 欧美少妇xxx| 亚洲免费看黄网站| 91小视频在线| 亚洲日本青草视频在线怡红院| 国产精品羞羞答答xxdd| 精品乱码亚洲一区二区不卡| 麻豆精品新av中文字幕| 7777精品伊人久久久大香线蕉最新版| 亚洲综合久久av| 在线一区二区三区做爰视频网站| 国产精品国产精品国产专区不片| 国产激情视频一区二区在线观看 | 国产精品视频你懂的| 国产高清在线精品| 久久亚洲影视婷婷| 国产精品一级片在线观看| 欧美xxxx在线观看| 狠狠色综合播放一区二区| 久久亚洲精精品中文字幕早川悠里| 久久精品国产成人一区二区三区 | 国产精品国产三级国产| 成人激情综合网站| 日韩毛片高清在线播放| 99免费精品在线| 亚洲精品国产无天堂网2021| 日本韩国一区二区三区视频| 一区二区三区精密机械公司| 在线免费观看不卡av| 亚洲不卡av一区二区三区| 欧美肥大bbwbbw高潮| 蜜臀久久99精品久久久画质超高清 | 欧美日韩中字一区| 日韩中文字幕区一区有砖一区 | 天天操天天综合网| 欧美高清dvd| 韩国一区二区视频| 国产精品电影一区二区三区| 91丨九色丨蝌蚪富婆spa| 亚洲综合免费观看高清在线观看| 欧美日韩黄色一区二区| 久久99国产精品久久| 中国色在线观看另类| 日本韩国欧美国产| 奇米色777欧美一区二区| 26uuu国产在线精品一区二区| www.欧美亚洲| 亚洲第一久久影院| 久久先锋影音av| 色综合久久88色综合天天| 日韩高清欧美激情| 国产精品午夜久久| 欧美在线视频你懂得|