OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [ethmac/] [eth_wishbone.v] - Diff between revs 485 and 530

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 485 Rev 530
Line 435... Line 435...
   wire       RxWordAcc;
   wire       RxWordAcc;
   wire       RxHalfAcc;
   wire       RxHalfAcc;
   wire       RxByteAcc;
   wire       RxByteAcc;
 
 
 
 
 
 
 
   wire                                ResetTxBDReady;
 
   reg                                 BlockingTxStatusWrite_sync1;
 
   reg                                 BlockingTxStatusWrite_sync2;
 
   reg                                 BlockingTxStatusWrite_sync3;
 
 
 
   reg                                 cyc_cleared;
 
   reg                                 IncrTxPointer;
 
 
 
   reg [3:0]                            RxByteSel;
 
   wire                                MasterAccessFinished;
 
 
 
   reg                                 LatchValidBytes;
 
   reg                                 LatchValidBytes_q;
 
 
 
   // Start: Generation of the ReadTxDataFromFifo_tck signal and synchronization to the WB_CLK_I
 
   reg                                 ReadTxDataFromFifo_sync1;
 
   reg                                 ReadTxDataFromFifo_sync2;
 
   reg                                 ReadTxDataFromFifo_sync3;
 
   reg                                 ReadTxDataFromFifo_syncb1;
 
   reg                                 ReadTxDataFromFifo_syncb2;
 
   reg                                 ReadTxDataFromFifo_syncb3;
 
 
 
   reg                                 RxAbortSync1;
 
   reg                                 RxAbortSync2;
 
   reg                                 RxAbortSync3;
 
   reg                                 RxAbortSync4;
 
   reg                                 RxAbortSyncb1;
 
   reg                                 RxAbortSyncb2;
 
 
 
   reg                                 RxEnableWindow;
 
 
 
   wire                                SetWriteRxDataToFifo;
 
 
 
 
 
   reg                                 WriteRxDataToFifoSync1;
 
   reg                                 WriteRxDataToFifoSync2;
 
   reg                                 WriteRxDataToFifoSync3;
 
 
 
   wire                                WriteRxDataToFifo_wb;
 
   // Receive fifo selection register - JB
 
   reg [3:0]                            rx_shift_ended_wb_shr;
 
   reg                                 rx_ethside_fifo_sel /* synthesis syn_allow_retiming=0; syn_noprune=1; syn_keep=1 */;
 
   reg                                 rx_wbside_fifo_sel /* synthesis syn_allow_retiming=0; syn_noprune=1; syn_keep=1 */;
 
   reg                                 rx_discard_packet;
 
 
 
 
 
   reg                                 LatchedRxStartFrm;
 
   reg                                 SyncRxStartFrm;
 
   reg                                 SyncRxStartFrm_q;
 
   reg                                 SyncRxStartFrm_q2;
 
   wire                                RxFifoReset;
 
 
 
   wire [31:0]                          rx_fifo0_data_out;
 
   wire                                rx_fifo0_write;
 
   wire                                rx_fifo0_read;
 
   wire                                rx_fifo0_clear;
 
   wire                                rx_fifo0_full;
 
   wire                                rx_fifo0_afull;
 
   wire                                rx_fifo0_empty;
 
   wire                                rx_fifo0_aempty;
 
 
 
 
 
   wire [31:0]                          rx_fifo1_data_out;
 
   wire                                rx_fifo1_write;
 
   wire                                rx_fifo1_read;
 
   wire                                rx_fifo1_clear;
 
   wire                                rx_fifo1_full;
 
   wire                                rx_fifo1_afull;
 
   wire                                rx_fifo1_empty;
 
   wire                                rx_fifo1_aempty;
 
 
 
   wire [`ETH_RX_FIFO_CNT_WIDTH-1:0]   rx_fifo0_cnt;
 
   wire [`ETH_RX_FIFO_CNT_WIDTH-1:0]   rx_fifo1_cnt;
 
 
 
 
 
   wire                                TxError;
 
   wire                                RxError;
 
 
 
   wire                                write_rx_data_to_memory_wait;
 
   wire                                write_rx_data_to_memory_go;
 
 
 
   reg                                 RxStatusWriteLatched;
 
   reg                                 RxStatusWriteLatched_sync1;
 
   reg                                 RxStatusWriteLatched_sync2;
 
   reg                                 RxStatusWriteLatched_syncb1;
 
   reg                                 RxStatusWriteLatched_syncb2;
 
   reg                                 busy_wb;
 
 
 
   reg                                 overflow_bug_reset;
 
 
 
   // Fix bug when overflow causes things to become a bit confused
 
   always @ (posedge WB_CLK_I)
 
     if (Reset)
 
       overflow_bug_reset <= 0;
 
     else
 
       overflow_bug_reset <= (rx_fifo1_empty & rx_fifo0_empty &
 
                              !RxEnableWindow & !rx_wb_writeback_finished &
 
                              !rx_wb_last_writes & RxEn & RxEn_q &
 
                              (rx_ethside_fifo_sel != rx_wbside_fifo_sel));
 
 
 
   always @(posedge overflow_bug_reset)
 
     $display("%t: %m overflow_bug_reset posedge",$time);
 
 
 
 
`ifdef ETH_WISHBONE_B3
`ifdef ETH_WISHBONE_B3
 `ifndef BURST_4BEAT
 `ifndef BURST_4BEAT
   assign m_wb_bte_o = 2'b00;    // Linear burst
   assign m_wb_bte_o = 2'b00;    // Linear burst
 `endif
 `endif
`endif
`endif
Line 611... Line 716...
          else
          else
            if(TxUsedData)
            if(TxUsedData)
              Flop <= ~Flop;
              Flop <= ~Flop;
     end
     end
 
 
   wire ResetTxBDReady;
 
   assign ResetTxBDReady = TxDonePulse | TxAbortPulse | TxRetryPulse;
   assign ResetTxBDReady = TxDonePulse | TxAbortPulse | TxRetryPulse;
 
 
   // Latching READY status of the Tx buffer descriptor
   // Latching READY status of the Tx buffer descriptor
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     begin
     begin
Line 683... Line 787...
            if(TxStatusWrite)
            if(TxStatusWrite)
              BlockingTxStatusWrite <= 1'b1;
              BlockingTxStatusWrite <= 1'b1;
     end
     end
 
 
 
 
   reg BlockingTxStatusWrite_sync1;
 
   reg BlockingTxStatusWrite_sync2;
 
   reg BlockingTxStatusWrite_sync3;
 
 
 
   // Synchronizing BlockingTxStatusWrite to MTxClk
   // Synchronizing BlockingTxStatusWrite to MTxClk
   always @ (posedge MTxClk or posedge Reset)
   always @ (posedge MTxClk or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          BlockingTxStatusWrite_sync1 <= 1'b0;
          BlockingTxStatusWrite_sync1 <= 1'b0;
Line 766... Line 866...
          else
          else
            if(MasterWbTX & m_wb_ack_i)
            if(MasterWbTX & m_wb_ack_i)
              begin
              begin
                 if(TxLengthLt4)
                 if(TxLengthLt4)
                   TxLength <= 16'h0;
                   TxLength <= 16'h0;
                 else
                 else if(TxPointerLSB_rst==2'h0)
                   if(TxPointerLSB_rst==2'h0)
 
                     TxLength <= TxLength - 16'd4;    // Length is subtracted at
                     TxLength <= TxLength - 16'd4;    // Length is subtracted at
                                                     // the data request
                                                     // the data request
                   else
                 else if(TxPointerLSB_rst==2'h1)
                     if(TxPointerLSB_rst==2'h1)
 
                       TxLength <= TxLength - 16'd3;    // Length is subtracted 
                       TxLength <= TxLength - 16'd3;    // Length is subtracted 
                                                       // at the data request
                                                       // at the data request
                     else
                 else if(TxPointerLSB_rst==2'h2)
                       if(TxPointerLSB_rst==2'h2)
 
                         TxLength <= TxLength - 16'd2;   // Length is subtracted
                         TxLength <= TxLength - 16'd2;   // Length is subtracted
                                                         // at the data request
                                                         // at the data request
                       else
                 else if(TxPointerLSB_rst==2'h3)
                         if(TxPointerLSB_rst==2'h3)
 
                           TxLength <= TxLength - 16'd1; // Length is subtracted
                           TxLength <= TxLength - 16'd1; // Length is subtracted
                                                         // at the data request
                                                         // at the data request
              end
              end
     end
     end
 
 
 
 
 
 
   //Latching length from the buffer descriptor;
   //Latching length from the buffer descriptor;
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          LatchedTxLength <= 16'h0;
          LatchedTxLength <= 16'h0;
Line 800... Line 894...
     end
     end
 
 
   assign TxLengthEq0 = TxLength == 0;
   assign TxLengthEq0 = TxLength == 0;
   assign TxLengthLt4 = TxLength < 4;
   assign TxLengthLt4 = TxLength < 4;
 
 
   reg cyc_cleared;
 
   reg IncrTxPointer;
 
 
 
 
 
   // Latching Tx buffer pointer from buffer descriptor. Only 30 MSB bits are 
   // Latching Tx buffer pointer from buffer descriptor. Only 30 MSB bits are 
   // latched because TxPointerMSB is only used for word-aligned accesses.
   // latched because TxPointerMSB is only used for word-aligned accesses.
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     begin
     begin
Line 852... Line 943...
            if(MasterWbTX & m_wb_ack_i)
            if(MasterWbTX & m_wb_ack_i)
              TxPointerLSB_rst[1:0] <= 0;
              TxPointerLSB_rst[1:0] <= 0;
     end
     end
 
 
 
 
   reg  [3:0] RxByteSel;
 
   wire       MasterAccessFinished;
 
 
 
 
 
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          BlockingIncrementTxPointer <= 0;
          BlockingIncrementTxPointer <= 0;
        else
        else
Line 1342... Line 1429...
 
 
 
 
   // Marks which bytes are valid within the word.
   // Marks which bytes are valid within the word.
   assign TxValidBytes = TxLengthLt4 ? TxLength[1:0] : 2'b0;
   assign TxValidBytes = TxLengthLt4 ? TxLength[1:0] : 2'b0;
 
 
   reg LatchValidBytes;
 
   reg LatchValidBytes_q;
 
 
 
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          LatchValidBytes <= 1'b0;
          LatchValidBytes <= 1'b0;
        else
        else
Line 1390... Line 1474...
   assign RxIRQEn         = RxStatus[14];
   assign RxIRQEn         = RxStatus[14];
   assign WrapRxStatusBit = RxStatus[13];
   assign WrapRxStatusBit = RxStatus[13];
 
 
 
 
   // Temporary Tx and Rx buffer descriptor address
   // Temporary Tx and Rx buffer descriptor address
   assign TempTxBDAddress[7:1] = {7{ TxStatusWrite     & ~WrapTxStatusBit}}   & (TxBDAddress + 1) ; // Tx BD increment or wrap (last BD)
   assign TempTxBDAddress[7:1] = {7{ TxStatusWrite  & ~WrapTxStatusBit}} &
 
                                 (TxBDAddress + 1) ; // Tx BD increment or wrap
 
                                                     // (last BD)
 
 
   assign TempRxBDAddress[7:1] = {7{ WrapRxStatusBit}} & (r_TxBDNum[6:0])     | // Using first Rx BD
   assign TempRxBDAddress[7:1] = {7{ WrapRxStatusBit}} & (r_TxBDNum[6:0])     | // Using first Rx BD
                                 {7{~WrapRxStatusBit}} & (RxBDAddress + 1) ; // Using next Rx BD (incremenrement address)
                                 {7{~WrapRxStatusBit}} & (RxBDAddress + 1) ; // Using next Rx BD (incremenrement address)
 
 
 
 
Line 1744... Line 1830...
              if(TxUsedData & Flop)
              if(TxUsedData & Flop)
                TxByteCnt <= TxByteCnt + 1'b1;
                TxByteCnt <= TxByteCnt + 1'b1;
     end
     end
 
 
 
 
   // Start: Generation of the ReadTxDataFromFifo_tck signal and synchronization to the WB_CLK_I
 
   reg ReadTxDataFromFifo_sync1;
 
   reg ReadTxDataFromFifo_sync2;
 
   reg ReadTxDataFromFifo_sync3;
 
   reg ReadTxDataFromFifo_syncb1;
 
   reg ReadTxDataFromFifo_syncb2;
 
   reg ReadTxDataFromFifo_syncb3;
 
 
 
 
 
   always @ (posedge MTxClk or posedge Reset)
   always @ (posedge MTxClk or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          ReadTxDataFromFifo_tck <= 1'b0;
          ReadTxDataFromFifo_tck <= 1'b0;
        else
        else
Line 1875... Line 1952...
        else
        else
          TxAbort_wb <= TxAbortSync1;
          TxAbort_wb <= TxAbortSync1;
     end
     end
 
 
 
 
   reg RxAbortSync1;
 
   reg RxAbortSync2;
 
   reg RxAbortSync3;
 
   reg RxAbortSync4;
 
   reg RxAbortSyncb1;
 
   reg RxAbortSyncb2;
 
 
 
   assign StartRxBDRead = RxStatusWrite | RxAbortSync3 & ~RxAbortSync4 |
   assign StartRxBDRead = RxStatusWrite | RxAbortSync3 & ~RxAbortSync4 |
                          r_RxEn & ~r_RxEn_q;
                          r_RxEn & ~r_RxEn_q;
 
 
   // Reading the Rx buffer descriptor
   // Reading the Rx buffer descriptor
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
Line 1958... Line 2028...
   // RxBDOK generation
   // RxBDOK generation
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          RxBDOK <= 1'b0;
          RxBDOK <= 1'b0;
        else
        else if(rx_wb_writeback_finished | RxAbortSync2 & ~RxAbortSync3 |
          if(rx_wb_writeback_finished | RxAbortSync2 & ~RxAbortSync3 |
 
             ~r_RxEn & r_RxEn_q)
             ~r_RxEn & r_RxEn_q)
            RxBDOK <= 1'b0;
            RxBDOK <= 1'b0;
          else
        else if(RxBDReady)
            if(RxBDReady)
 
              RxBDOK <= 1'b1;
              RxBDOK <= 1'b1;
     end
     end
 
 
   // Reading Rx BD pointer
   // Reading Rx BD pointer
   assign StartRxPointerRead = RxBDRead & RxBDReady;
   assign StartRxPointerRead = RxBDRead & RxBDReady;
Line 2031... Line 2099...
 
 
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          RxEn_needed <= 1'b0;
          RxEn_needed <= 1'b0;
        else
        else if(/*~RxReady &*/ r_RxEn & WbEn & ~WbEn_q)
          if(/*~RxReady &*/ r_RxEn & WbEn & ~WbEn_q)
 
            RxEn_needed <= 1'b1;
            RxEn_needed <= 1'b1;
          else
        else if(RxPointerRead & RxEn & RxEn_q)
            if(RxPointerRead & RxEn & RxEn_q)
 
              RxEn_needed <= 1'b0;
              RxEn_needed <= 1'b0;
     end
     end
 
 
 
 
   // Reception status is written back to the buffer descriptor after the end 
   // Reception status is written back to the buffer descriptor after the end 
   // of frame is detected.
   // of frame is detected.
   assign RxStatusWrite = rx_wb_writeback_finished & RxEn & RxEn_q;
   assign RxStatusWrite = rx_wb_writeback_finished & RxEn & RxEn_q;
 
 
   reg RxEnableWindow;
 
 
 
   // Indicating that last byte is being reveived
   // Indicating that last byte is being reveived
   always @ (posedge MRxClk or posedge Reset)
   always @ (posedge MRxClk or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          LastByteIn <= 1'b0;
          LastByteIn <= 1'b0;
Line 2144... Line 2208...
                   2'h3:        RxDataLatched1        <= RxDataLatched1;
                   2'h3:        RxDataLatched1        <= RxDataLatched1;
                 endcase
                 endcase
              end
              end
     end
     end
 
 
   wire SetWriteRxDataToFifo;
 
 
 
   // Assembling data that will be written to the rx_fifo
   // Assembling data that will be written to the rx_fifo
   always @ (posedge MRxClk or posedge Reset)
   always @ (posedge MRxClk or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          RxDataLatched2 <= 32'h0;
          RxDataLatched2 <= 32'h0;
Line 2167... Line 2229...
                3 : RxDataLatched2 <= {RxDataLatched1[31:8],   8'h0};
                3 : RxDataLatched2 <= {RxDataLatched1[31:8],   8'h0};
              endcase
              endcase
     end
     end
 
 
 
 
   reg WriteRxDataToFifoSync1;
 
   reg WriteRxDataToFifoSync2;
 
   reg WriteRxDataToFifoSync3;
 
 
 
 
 
   // Indicating start of the reception process
   // Indicating start of the reception process
   assign SetWriteRxDataToFifo = (RxValid & ~RxStartFrm &
   assign SetWriteRxDataToFifo = (RxValid & ~RxStartFrm &
                                  RxEnableWindow & (&RxByteCnt))
                                  RxEnableWindow & (&RxByteCnt))
                                 /*| (RxValid & RxStartFrm &
                                 /*| (RxValid & RxStartFrm &
                                  (&RxPointerLSB_rst)) */
                                  (&RxPointerLSB_rst)) */
Line 2220... Line 2277...
          WriteRxDataToFifoSync3 <= 1'b0;
          WriteRxDataToFifoSync3 <= 1'b0;
        else
        else
          WriteRxDataToFifoSync3 <= WriteRxDataToFifoSync2;
          WriteRxDataToFifoSync3 <= WriteRxDataToFifoSync2;
     end
     end
 
 
   wire WriteRxDataToFifo_wb;
 
   assign WriteRxDataToFifo_wb = WriteRxDataToFifoSync2 &
   assign WriteRxDataToFifo_wb = WriteRxDataToFifoSync2 &
                                 ~WriteRxDataToFifoSync3;
                                 ~WriteRxDataToFifoSync3;
   // Receive fifo selection register - JB
 
   reg [3:0] rx_shift_ended_wb_shr;
 
   reg       rx_ethside_fifo_sel /* synthesis syn_allow_retiming=0; syn_noprune=1; syn_keep=1 */;
   // Signal to indicate data in current buffer should be discarded as we had
   reg       rx_wbside_fifo_sel /* synthesis syn_allow_retiming=0; syn_noprune=1; syn_keep=1 */;
   // no open buffer for it.
 
   // Goes high when rx_wb_last_writes goes off and we still haven't gotten a
 
   // RX buffer for it.
 
   always @(posedge WB_CLK_I)
 
     if (Reset)
 
       rx_discard_packet <= 0;
 
     else if (rx_shift_ended_wb_shr[3:2] == 2'b01)
 
       rx_discard_packet <= 0;
 
     else if (rx_wb_last_writes & RxBDRead)
 
       rx_discard_packet <= 1;
 
 
 
 
   // Shift in this - our detection of end of data RX
   // Shift in this - our detection of end of data RX
   always @(posedge WB_CLK_I)
   always @(posedge WB_CLK_I)
     rx_shift_ended_wb_shr <= {rx_shift_ended_wb_shr[2:0],
     rx_shift_ended_wb_shr <= {rx_shift_ended_wb_shr[2:0],
                               ShiftEndedSync1 & ~ShiftEndedSync2};
                               ShiftEndedSync1 & ~ShiftEndedSync2};
 
 
 
 
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     if(Reset)
     if(Reset)
       rx_ethside_fifo_sel <= 0;
       rx_ethside_fifo_sel <= 0;
     else
     else if (rx_discard_packet | overflow_bug_reset)
       if(rx_shift_ended_wb_shr[3:2] == 2'b01)
       rx_ethside_fifo_sel <= 0;
 
     else if(rx_shift_ended_wb_shr[3:2] == 2'b01 & !rx_discard_packet)
         // Switch over whenever we've finished receiving last frame's data
         // Switch over whenever we've finished receiving last frame's data
         rx_ethside_fifo_sel <= ~rx_ethside_fifo_sel;
         rx_ethside_fifo_sel <= ~rx_ethside_fifo_sel;
 
 
   // Wishbone side looks at other FIFO when we write back the status of this 
   // Wishbone side looks at other FIFO when we write back the status of this 
   // received frame
   // received frame
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     if(Reset)
     if(Reset)
       rx_wbside_fifo_sel <= 0;
       rx_wbside_fifo_sel <= 0;
     else
     else if (rx_discard_packet | overflow_bug_reset)
       if(rx_wb_writeback_finished & RxEn & RxEn_q)
       rx_wbside_fifo_sel <= 0;
 
     else if(rx_wb_writeback_finished & RxEn & RxEn_q)
         // Switch over whenever we've finished receiving last frame's data
         // Switch over whenever we've finished receiving last frame's data
         rx_wbside_fifo_sel <= ~rx_wbside_fifo_sel;
         rx_wbside_fifo_sel <= ~rx_wbside_fifo_sel;
 
 
   reg  LatchedRxStartFrm;
 
   reg  SyncRxStartFrm;
 
   reg  SyncRxStartFrm_q;
 
   reg  SyncRxStartFrm_q2;
 
   wire RxFifoReset;
 
 
 
   always @ (posedge MRxClk or posedge Reset)
   always @ (posedge MRxClk or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          LatchedRxStartFrm <= 0;
          LatchedRxStartFrm <= 0;
        else
        else
Line 2302... Line 2365...
     end
     end
   wire rx_startfrm_wb;
   wire rx_startfrm_wb;
   assign rx_startfrm_wb = SyncRxStartFrm_q & ~SyncRxStartFrm_q2;
   assign rx_startfrm_wb = SyncRxStartFrm_q & ~SyncRxStartFrm_q2;
 
 
 
 
   assign RxFifoReset = rx_startfrm_wb;
   assign RxFifoReset = rx_startfrm_wb | rx_discard_packet | overflow_bug_reset;
 
 
 
 
   wire [31:0] rx_fifo0_data_out;
 
   wire        rx_fifo0_write;
 
   wire        rx_fifo0_read;
 
   wire        rx_fifo0_clear;
 
   wire        rx_fifo0_full;
 
   wire        rx_fifo0_afull;
 
   wire        rx_fifo0_empty;
 
   wire        rx_fifo0_aempty;
 
 
 
 
 
   wire [31:0] rx_fifo1_data_out;
 
   wire        rx_fifo1_write;
 
   wire        rx_fifo1_read;
 
   wire        rx_fifo1_clear;
 
   wire        rx_fifo1_full;
 
   wire        rx_fifo1_afull;
 
   wire        rx_fifo1_empty;
 
   wire        rx_fifo1_aempty;
 
 
 
   wire [`ETH_RX_FIFO_CNT_WIDTH-1:0] rx_fifo0_cnt;
 
   wire [`ETH_RX_FIFO_CNT_WIDTH-1:0] rx_fifo1_cnt;
 
 
 
   // RX FIFO buffer 0 controls
   // RX FIFO buffer 0 controls
   assign rx_fifo0_write = (!rx_ethside_fifo_sel) & WriteRxDataToFifo_wb &
   assign rx_fifo0_write = (!rx_ethside_fifo_sel) & WriteRxDataToFifo_wb &
                           ~rx_fifo0_full;
                           ~rx_fifo0_full;
 
 
Line 2404... Line 2445...
 
 
   assign RxBufferFull = rx_wbside_fifo_sel ?
   assign RxBufferFull = rx_wbside_fifo_sel ?
                         rx_fifo1_full : rx_fifo0_full;
                         rx_fifo1_full : rx_fifo0_full;
 
 
 
 
 
 
 
 
 
 
   wire                              write_rx_data_to_memory_wait;
 
   assign write_rx_data_to_memory_wait = !RxBDOK | RxPointerRead;
   assign write_rx_data_to_memory_wait = !RxBDOK | RxPointerRead;
   wire                              write_rx_data_to_memory_go;
 
 
 
`ifdef ETH_RX_BURST_EN
`ifdef ETH_RX_BURST_EN
   assign enough_data_in_rxfifo_for_burst = rxfifo_cnt>=(`ETH_BURST_LENGTH);
   assign enough_data_in_rxfifo_for_burst = rxfifo_cnt>=(`ETH_BURST_LENGTH);
   assign enough_data_in_rxfifo_for_burst_plus1 = rxfifo_cnt>(`ETH_BURST_LENGTH - 1);
   assign enough_data_in_rxfifo_for_burst_plus1 = rxfifo_cnt>(`ETH_BURST_LENGTH - 1);
   // While receiving, don't flog the bus too hard, only write out when
   // While receiving, don't flog the bus too hard, only write out when
Line 2469... Line 2506...
       rx_wb_last_writes <= 1'b0;
       rx_wb_last_writes <= 1'b0;
     else if (!rx_wb_last_writes)
     else if (!rx_wb_last_writes)
       rx_wb_last_writes <= ShiftEndedSync1 & ~ShiftEndedSync2;
       rx_wb_last_writes <= ShiftEndedSync1 & ~ShiftEndedSync2;
     else if (rx_wb_writeback_finished & RxEn & RxEn_q)
     else if (rx_wb_writeback_finished & RxEn & RxEn_q)
       rx_wb_last_writes <= 0;
       rx_wb_last_writes <= 0;
 
     else if (rx_discard_packet | overflow_bug_reset)
 
       rx_wb_last_writes <= 0;
 
 
   // Pulse indicating last of RX data has been written out
   // Pulse indicating last of RX data has been written out
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     if(Reset)
     if(Reset)
       rx_wb_writeback_finished <= 0;
       rx_wb_writeback_finished <= 0;
Line 2502... Line 2541...
   // Generation of the end-of-frame signal
   // Generation of the end-of-frame signal
   always @ (posedge MRxClk or posedge Reset)
   always @ (posedge MRxClk or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          RxEnableWindow <= 1'b0;
          RxEnableWindow <= 1'b0;
        else
        else if(RxStartFrm)
          if(RxStartFrm)
 
            RxEnableWindow <= 1'b1;
            RxEnableWindow <= 1'b1;
          else
        else if(RxEndFrm | RxAbort)
            if(RxEndFrm | RxAbort)
 
              RxEnableWindow <= 1'b0;
              RxEnableWindow <= 1'b0;
     end
     end
 
 
 
 
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
Line 2583... Line 2620...
          if(LoadRxStatus)
          if(LoadRxStatus)
            LatchedRxLength[15:0] <= RxLength[15:0];
            LatchedRxLength[15:0] <= RxLength[15:0];
     end
     end
 
 
 
 
   assign RxStatusIn = {ReceivedPauseFrm, AddressMiss, RxOverrun, InvalidSymbol, DribbleNibble, ReceivedPacketTooBig, ShortFrame, LatchedCrcError, RxLateCollision};
   assign RxStatusIn = {ReceivedPauseFrm,
 
                        AddressMiss,
 
                        RxOverrun,
 
                        InvalidSymbol,
 
                        DribbleNibble,
 
                        ReceivedPacketTooBig,
 
                        ShortFrame,
 
                        LatchedCrcError,
 
                        RxLateCollision};
 
 
   always @ (posedge MRxClk or posedge Reset)
   always @ (posedge MRxClk or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          RxStatusInLatched <= 'h0;
          RxStatusInLatched <= 'h0;
Line 2600... Line 2645...
   // Rx overrun
   // Rx overrun
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
          RxOverrun <= 1'b0;
          RxOverrun <= 1'b0;
        else
        else if(RxStatusWrite | rx_discard_packet | overflow_bug_reset)
          if(RxStatusWrite)
 
            RxOverrun <= 1'b0;
            RxOverrun <= 1'b0;
          else
        else if(RxBufferFull & WriteRxDataToFifo_wb)
            if(RxBufferFull & WriteRxDataToFifo_wb)
 
              RxOverrun <= 1'b1;
              RxOverrun <= 1'b1;
     end
     end
 
 
 
 
 
   assign TxError = TxUnderRun | RetryLimit | LateCollLatched |
 
                     CarrierSenseLost;
 
 
   wire TxError;
 
   assign TxError = TxUnderRun | RetryLimit | LateCollLatched | CarrierSenseLost;
 
 
 
   wire RxError;
 
 
 
   // ShortFrame (RxStatusInLatched[2]) can not set an error because short 
   // ShortFrame (RxStatusInLatched[2]) can not set an error because short 
   // frames are aborted when signal r_RecSmall is set to 0 in MODER register. 
   // frames are aborted when signal r_RecSmall is set to 0 in MODER register. 
   // AddressMiss is identifying that a frame was received because of the 
   // AddressMiss is identifying that a frame was received because of the 
   // promiscous mode and is not an error
   // promiscous mode and is not an error
   assign RxError = (|RxStatusInLatched[6:3]) | (|RxStatusInLatched[1:0]);
   assign RxError = (|RxStatusInLatched[6:3]) | (|RxStatusInLatched[1:0]);
 
 
 
 
 
 
   reg  RxStatusWriteLatched;
 
   reg  RxStatusWriteLatched_sync1;
 
   reg  RxStatusWriteLatched_sync2;
 
   reg  RxStatusWriteLatched_syncb1;
 
   reg  RxStatusWriteLatched_syncb2;
 
 
 
 
 
   // Latching and synchronizing RxStatusWrite signal. This signal is used for 
   // Latching and synchronizing RxStatusWrite signal. This signal is used for 
   // clearing the ReceivedPauseFrm signal
   // clearing the ReceivedPauseFrm signal
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     begin
     begin
        if(Reset)
        if(Reset)
Line 2744... Line 2778...
               RxBDRead) & rx_startfrm_wb)
               RxBDRead) & rx_startfrm_wb)
       rxstartfrm_occurred <= 1;
       rxstartfrm_occurred <= 1;
 
 
 
 
 
 
   reg busy_wb;
 
   always @ (posedge WB_CLK_I or posedge Reset)
   always @ (posedge WB_CLK_I or posedge Reset)
     if(Reset)
     if(Reset)
       busy_wb <= 0;
       busy_wb <= 0;
     else if (busy_wb)
     else if (busy_wb)
       busy_wb <= 0;
       busy_wb <= 0;
Line 2781... Line 2814...
   assign dbg_dat0[30:28] = rx_burst_cnt;
   assign dbg_dat0[30:28] = rx_burst_cnt;
   assign dbg_dat0[27] = 0;
   assign dbg_dat0[27] = 0;
   assign dbg_dat0[26:24] = tx_burst_cnt;
   assign dbg_dat0[26:24] = tx_burst_cnt;
 
 
   // Third byte
   // Third byte
   assign dbg_dat0[23] = 0;
   assign dbg_dat0[23] = rx_ethside_fifo_sel;
   assign dbg_dat0[22] = 0;
   assign dbg_dat0[22] = rx_wbside_fifo_sel;
   assign dbg_dat0[21] = rx_burst;
   assign dbg_dat0[21] = rx_fifo0_empty;
   assign dbg_dat0[20] = rx_burst_en;
   assign dbg_dat0[20] = rx_fifo1_empty;
   assign dbg_dat0[19] = 0;
   assign dbg_dat0[19] = overflow_bug_reset;
   assign dbg_dat0[18] = 0;
   assign dbg_dat0[18] = RxBDOK;
   assign dbg_dat0[17] = tx_burst;
   assign dbg_dat0[17] = write_rx_data_to_memory_go;
   assign dbg_dat0[16] = tx_burst_en;
   assign dbg_dat0[16] = rx_wb_last_writes;
   // Second byte - TxBDAddress - or TX BD address pointer
   // Second byte - TxBDAddress - or TX BD address pointer
   assign dbg_dat0[15:8] = { 1'b0, TxBDAddress};
   assign dbg_dat0[15:8] = { BlockingTxBDRead , TxBDAddress};
   // Bottom byte - FSM controlling vector
   // Bottom byte - FSM controlling vector
   assign dbg_dat0[7:0] = {MasterWbTX,MasterWbRX,
   assign dbg_dat0[7:0] = {MasterWbTX,
                           ReadTxDataFromMemory_2,WriteRxDataToMemory,
                           MasterWbRX,
                           MasterAccessFinished,cyc_cleared,
                           ReadTxDataFromMemory_2,
                           tx_burst,rx_burst};
                           WriteRxDataToMemory,
 
                           MasterAccessFinished,
 
                           cyc_cleared,
 
                           tx_burst,
 
                           rx_burst};
 
 
`endif
`endif
 
 
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.