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

Subversion Repositories ethmac

[/] [ethmac/] [trunk/] [rtl/] [verilog/] [eth_wishbone.v] - Diff between revs 97 and 105

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

Rev 97 Rev 105
Line 39... Line 39...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.21  2002/03/29 16:18:11  lampret
 
// Small typo fixed.
 
//
// Revision 1.20  2002/03/25 16:19:12  mohor
// Revision 1.20  2002/03/25 16:19:12  mohor
// Any address can be used for Tx and Rx BD pointers. Address does not need
// Any address can be used for Tx and Rx BD pointers. Address does not need
// to be aligned.
// to be aligned.
//
//
// Revision 1.19  2002/03/19 12:51:50  mohor
// Revision 1.19  2002/03/19 12:51:50  mohor
Line 278... Line 281...
reg             TxDone_wb;
reg             TxDone_wb;
 
 
reg             TxDone_wb_q;
reg             TxDone_wb_q;
reg             TxAbort_wb_q;
reg             TxAbort_wb_q;
reg             TxRetry_wb_q;
reg             TxRetry_wb_q;
 
reg             TxDone_wb_q2;
 
reg             TxAbort_wb_q2;
 
reg             TxRetry_wb_q2;
reg             RxBDReady;
reg             RxBDReady;
reg             TxBDReady;
reg             TxBDReady;
 
 
reg             RxBDRead;
reg             RxBDRead;
wire            RxStatusWrite;
wire            RxStatusWrite;
Line 332... Line 338...
reg             TxEndFrm_wb;
reg             TxEndFrm_wb;
 
 
wire            TxRetryPulse;
wire            TxRetryPulse;
wire            TxDonePulse;
wire            TxDonePulse;
wire            TxAbortPulse;
wire            TxAbortPulse;
 
wire            TxRetryPulse_q;
 
wire            TxDonePulse_q;
 
wire            TxAbortPulse_q;
 
 
wire            StartRxBDRead;
wire            StartRxBDRead;
 
 
wire            StartTxBDRead;
wire            StartTxBDRead;
 
 
Line 767... Line 776...
reg  [3:0] m_wb_sel_tmp_rx;
reg  [3:0] m_wb_sel_tmp_rx;
 
 
 
 
assign m_wb_sel_tmp_tx[0] = TxWordAcc | TxHalfAcc | TxByteAcc &  TxPointer[1];
assign m_wb_sel_tmp_tx[0] = TxWordAcc | TxHalfAcc | TxByteAcc &  TxPointer[1];
assign m_wb_sel_tmp_tx[1] = TxWordAcc | TxHalfAcc;
assign m_wb_sel_tmp_tx[1] = TxWordAcc | TxHalfAcc;
assign m_wb_sel_tmp_tx[2] = TxWordAcc |           | TxByteAcc & ~TxPointer[1];
assign m_wb_sel_tmp_tx[2] = TxWordAcc |             TxByteAcc & ~TxPointer[1];
assign m_wb_sel_tmp_tx[3] = TxWordAcc;
assign m_wb_sel_tmp_tx[3] = TxWordAcc;
 
 
 
 
wire MasterAccessFinished;
wire MasterAccessFinished;
 
 
Line 796... Line 805...
wire ResetReadTxDataFromMemory;
wire ResetReadTxDataFromMemory;
wire SetReadTxDataFromMemory;
wire SetReadTxDataFromMemory;
 
 
reg BlockReadTxDataFromMemory;
reg BlockReadTxDataFromMemory;
 
 
assign ResetReadTxDataFromMemory = (TxLengthEq0) | TxAbortPulse | TxRetryPulse;
assign ResetReadTxDataFromMemory = (TxLengthEq0) | TxAbortPulse_q | TxRetryPulse_q;
assign SetReadTxDataFromMemory = TxEn & TxEn_q & TxPointerRead;
assign SetReadTxDataFromMemory = TxEn & TxEn_q & TxPointerRead;
 
 
always @ (posedge WB_CLK_I or posedge Reset)
always @ (posedge WB_CLK_I or posedge Reset)
begin
begin
  if(Reset)
  if(Reset)
Line 849... Line 858...
      m_wb_sel_o <=#Tp 4'h0;
      m_wb_sel_o <=#Tp 4'h0;
    end
    end
  else
  else
    begin
    begin
      // Switching between two stages depends on enable signals
      // Switching between two stages depends on enable signals
      case ({MasterWbTX, MasterWbRX, ReadTxDataFromMemory_2, WriteRxDataToMemory, MasterAccessFinished})
      case ({MasterWbTX, MasterWbRX, ReadTxDataFromMemory_2, WriteRxDataToMemory, MasterAccessFinished})  // synopsys parallel_case
        5'b00_01_0, 5'b00_11_0 :
        5'b00_01_0, 5'b00_11_0 :
          begin
          begin
            MasterWbTX <=#Tp 1'b0;  // idle and master write is needed (data write to rx buffer)
            MasterWbTX <=#Tp 1'b0;  // idle and master write is needed (data write to rx buffer)
            MasterWbRX <=#Tp 1'b1;
            MasterWbRX <=#Tp 1'b1;
            m_wb_adr_o <=#Tp RxPointer;
            m_wb_adr_o <=#Tp RxPointer;
Line 951... Line 960...
tx_fifo ( .data_in(tx_fifo_dat_i),                          .data_out(TxData_wb),
tx_fifo ( .data_in(tx_fifo_dat_i),                          .data_out(TxData_wb),
          .clk(WB_CLK_I),                                   .reset(Reset),
          .clk(WB_CLK_I),                                   .reset(Reset),
          .write(MasterWbTX & m_wb_ack_i & m_wb_sel_o[0]),  .read(ReadTxDataFromFifo_wb),
          .write(MasterWbTX & m_wb_ack_i & m_wb_sel_o[0]),  .read(ReadTxDataFromFifo_wb),
          .clear(TxFifoClear),                              .full(TxBufferFull),
          .clear(TxFifoClear),                              .full(TxBufferFull),
          .almost_full(TxBufferAlmostFull),                 .almost_empty(TxBufferAlmostEmpty),
          .almost_full(TxBufferAlmostFull),                 .almost_empty(TxBufferAlmostEmpty),
          .empty(TxBufferEmpty)
          .empty(TxBufferEmpty),                            .cnt()
        );
        );
 
 
 
 
reg StartOccured;
reg StartOccured;
reg TxStartFrm_sync1;
reg TxStartFrm_sync1;
Line 1140... Line 1149...
 
 
// Signals used for various purposes
// Signals used for various purposes
assign TxRetryPulse   = TxRetry_wb   & ~TxRetry_wb_q;
assign TxRetryPulse   = TxRetry_wb   & ~TxRetry_wb_q;
assign TxDonePulse    = TxDone_wb    & ~TxDone_wb_q;
assign TxDonePulse    = TxDone_wb    & ~TxDone_wb_q;
assign TxAbortPulse   = TxAbort_wb   & ~TxAbort_wb_q;
assign TxAbortPulse   = TxAbort_wb   & ~TxAbort_wb_q;
 
assign TxRetryPulse_q = TxRetry_wb_q & ~TxRetry_wb_q2;
 
assign TxDonePulse_q  = TxDone_wb_q  & ~TxDone_wb_q2;
 
assign TxAbortPulse_q = TxAbort_wb_q & ~TxAbort_wb_q2;
 
 
 
 
assign TPauseRq = 0;
assign TPauseRq = 0;
assign TxPauseTV[15:0] = TxLength[15:0];
assign TxPauseTV[15:0] = TxLength[15:0];
 
 
Line 1171... Line 1183...
  if(Reset)
  if(Reset)
    begin
    begin
      TxDone_wb_q   <=#Tp 1'b0;
      TxDone_wb_q   <=#Tp 1'b0;
      TxAbort_wb_q  <=#Tp 1'b0;
      TxAbort_wb_q  <=#Tp 1'b0;
      TxRetry_wb_q  <=#Tp 1'b0;
      TxRetry_wb_q  <=#Tp 1'b0;
 
      TxDone_wb_q2  <=#Tp 1'b0;
 
      TxAbort_wb_q2 <=#Tp 1'b0;
 
      TxRetry_wb_q2 <=#Tp 1'b0;
    end
    end
  else
  else
    begin
    begin
      TxDone_wb_q   <=#Tp TxDone_wb;
      TxDone_wb_q   <=#Tp TxDone_wb;
      TxAbort_wb_q  <=#Tp TxAbort_wb;
      TxAbort_wb_q  <=#Tp TxAbort_wb;
      TxRetry_wb_q  <=#Tp TxRetry_wb;
      TxRetry_wb_q  <=#Tp TxRetry_wb;
 
      TxDone_wb_q2  <=#Tp TxDone_wb_q;
 
      TxAbort_wb_q2 <=#Tp TxAbort_wb_q;
 
      TxRetry_wb_q2 <=#Tp TxRetry_wb_q;
    end
    end
end
end
 
 
 
 
// Sinchronizing and evaluating tx data
// Sinchronizing and evaluating tx data
Line 1215... Line 1233...
  if(Flop & TxEndFrm | TxAbort | TxRetry_q)
  if(Flop & TxEndFrm | TxAbort | TxRetry_q)
    TxEndFrm <=#Tp 1'b0;
    TxEndFrm <=#Tp 1'b0;
  else
  else
  if(Flop & LastWord)
  if(Flop & LastWord)
    begin
    begin
      case (TxValidBytesLatched)
      case (TxValidBytesLatched)  // synopsys parallel_case
        1 : TxEndFrm <=#Tp TxByteCnt == 2'h0;
        1 : TxEndFrm <=#Tp TxByteCnt == 2'h0;
        2 : TxEndFrm <=#Tp TxByteCnt == 2'h1;
        2 : TxEndFrm <=#Tp TxByteCnt == 2'h1;
        3 : TxEndFrm <=#Tp TxByteCnt == 2'h2;
        3 : TxEndFrm <=#Tp TxByteCnt == 2'h2;
        0 : TxEndFrm <=#Tp TxByteCnt == 2'h3;
        0 : TxEndFrm <=#Tp TxByteCnt == 2'h3;
        default : TxEndFrm <=#Tp 1'b0;
        default : TxEndFrm <=#Tp 1'b0;
Line 1233... Line 1251...
begin
begin
  if(Reset)
  if(Reset)
    TxData <=#Tp 0;
    TxData <=#Tp 0;
  else
  else
  if(TxStartFrm_sync2 & ~TxStartFrm)
  if(TxStartFrm_sync2 & ~TxStartFrm)
    case(TxPointerLatched)
    case(TxPointerLatched)  // synopsys parallel_case
      2'h0 : TxData <=#Tp TxData_wb[31:24];                  // Big Endian Byte Ordering
      2'h0 : TxData <=#Tp TxData_wb[31:24];                  // Big Endian Byte Ordering
      2'h1 : TxData <=#Tp TxData_wb[23:16];                  // Big Endian Byte Ordering
      2'h1 : TxData <=#Tp TxData_wb[23:16];                  // Big Endian Byte Ordering
      2'h2 : TxData <=#Tp TxData_wb[15:08];                  // Big Endian Byte Ordering
      2'h2 : TxData <=#Tp TxData_wb[15:08];                  // Big Endian Byte Ordering
      2'h3 : TxData <=#Tp TxData_wb[07:00];                  // Big Endian Byte Ordering
      2'h3 : TxData <=#Tp TxData_wb[07:00];                  // Big Endian Byte Ordering
    endcase
    endcase
Line 1245... Line 1263...
  if(TxStartFrm & TxUsedData & TxPointerLatched==2'h3)
  if(TxStartFrm & TxUsedData & TxPointerLatched==2'h3)
    TxData <=#Tp TxData_wb[31:24];                           // Big Endian Byte Ordering
    TxData <=#Tp TxData_wb[31:24];                           // Big Endian Byte Ordering
  else
  else
  if(TxUsedData & Flop)
  if(TxUsedData & Flop)
    begin
    begin
      case(TxByteCnt)
      case(TxByteCnt)  // synopsys parallel_case
        0 : TxData <=#Tp TxDataLatched[31:24];      // Big Endian Byte Ordering
        0 : TxData <=#Tp TxDataLatched[31:24];      // Big Endian Byte Ordering
        1 : TxData <=#Tp TxDataLatched[23:16];
        1 : TxData <=#Tp TxDataLatched[23:16];
        2 : TxData <=#Tp TxDataLatched[15:8];
        2 : TxData <=#Tp TxDataLatched[15:8];
        3 : TxData <=#Tp TxDataLatched[7:0];
        3 : TxData <=#Tp TxDataLatched[7:0];
      endcase
      endcase
Line 1304... Line 1322...
  else
  else
  if(TxAbort_q | TxRetry_q)
  if(TxAbort_q | TxRetry_q)
    TxByteCnt <=#Tp 2'h0;
    TxByteCnt <=#Tp 2'h0;
  else
  else
  if(TxStartFrm & ~TxUsedData)
  if(TxStartFrm & ~TxUsedData)
    case(TxPointerLatched)
    case(TxPointerLatched)  // synopsys parallel_case
      2'h0 : TxByteCnt <=#Tp 2'h1;
      2'h0 : TxByteCnt <=#Tp 2'h1;
      2'h1 : TxByteCnt <=#Tp 2'h2;
      2'h1 : TxByteCnt <=#Tp 2'h2;
      2'h2 : TxByteCnt <=#Tp 2'h3;
      2'h2 : TxByteCnt <=#Tp 2'h3;
      2'h3 : TxByteCnt <=#Tp 2'h0;
      2'h3 : TxByteCnt <=#Tp 2'h0;
    endcase
    endcase
Line 1529... Line 1547...
end
end
 
 
 
 
always @ (RxPointerLatched)
always @ (RxPointerLatched)
begin
begin
  case(RxPointerLatched[1:0])
  case(RxPointerLatched[1:0])  // synopsys parallel_case
    2'h0 : m_wb_sel_tmp_rx[3:0] = 4'hf;
    2'h0 : m_wb_sel_tmp_rx[3:0] = 4'hf;
    2'h1 : m_wb_sel_tmp_rx[3:0] = 4'h7;
    2'h1 : m_wb_sel_tmp_rx[3:0] = 4'h7;
    2'h2 : m_wb_sel_tmp_rx[3:0] = 4'h3;
    2'h2 : m_wb_sel_tmp_rx[3:0] = 4'h3;
    2'h3 : m_wb_sel_tmp_rx[3:0] = 4'h1;
    2'h3 : m_wb_sel_tmp_rx[3:0] = 4'h1;
  endcase
  endcase
Line 1642... Line 1660...
  else
  else
  if(ShiftEnded_tck | RxAbort)
  if(ShiftEnded_tck | RxAbort)
    RxByteCnt <=#Tp 2'h0;
    RxByteCnt <=#Tp 2'h0;
  else
  else
  if(RxValid & RxStartFrm & RxBDReady)
  if(RxValid & RxStartFrm & RxBDReady)
    case(RxPointerLatched)
    case(RxPointerLatched)  // synopsys parallel_case
      2'h0 : RxByteCnt <=#Tp 2'h1;
      2'h0 : RxByteCnt <=#Tp 2'h1;
      2'h1 : RxByteCnt <=#Tp 2'h2;
      2'h1 : RxByteCnt <=#Tp 2'h2;
      2'h2 : RxByteCnt <=#Tp 2'h3;
      2'h2 : RxByteCnt <=#Tp 2'h3;
      2'h3 : RxByteCnt <=#Tp 2'h0;
      2'h3 : RxByteCnt <=#Tp 2'h0;
    endcase
    endcase
Line 1661... Line 1679...
begin
begin
  if(Reset)
  if(Reset)
    RxValidBytes <=#Tp 2'h1;
    RxValidBytes <=#Tp 2'h1;
  else
  else
  if(RxValid & RxStartFrm)
  if(RxValid & RxStartFrm)
    case(RxPointerLatched)
    case(RxPointerLatched)  // synopsys parallel_case
      2'h0 : RxValidBytes <=#Tp 2'h1;
      2'h0 : RxValidBytes <=#Tp 2'h1;
      2'h1 : RxValidBytes <=#Tp 2'h2;
      2'h1 : RxValidBytes <=#Tp 2'h2;
      2'h2 : RxValidBytes <=#Tp 2'h3;
      2'h2 : RxValidBytes <=#Tp 2'h3;
      2'h3 : RxValidBytes <=#Tp 2'h0;
      2'h3 : RxValidBytes <=#Tp 2'h0;
    endcase
    endcase
Line 1711... Line 1729...
  else
  else
  if(SetWriteRxDataToFifo & ~ShiftWillEnd)
  if(SetWriteRxDataToFifo & ~ShiftWillEnd)
    RxDataLatched2 <=#Tp {RxDataLatched1[31:8], RxData};              // Big Endian Byte Ordering
    RxDataLatched2 <=#Tp {RxDataLatched1[31:8], RxData};              // Big Endian Byte Ordering
  else
  else
  if(SetWriteRxDataToFifo & ShiftWillEnd)
  if(SetWriteRxDataToFifo & ShiftWillEnd)
    case(RxValidBytes)
    case(RxValidBytes)  // synopsys parallel_case
//      0 : RxDataLatched2 <=#Tp {RxDataLatched1[31:8],  RxData};       // Big Endian Byte Ordering
//      0 : RxDataLatched2 <=#Tp {RxDataLatched1[31:8],  RxData};       // Big Endian Byte Ordering
//      1 : RxDataLatched2 <=#Tp {RxDataLatched1[31:24], 24'h0};
//      1 : RxDataLatched2 <=#Tp {RxDataLatched1[31:24], 24'h0};
//      2 : RxDataLatched2 <=#Tp {RxDataLatched1[31:16], 16'h0};
//      2 : RxDataLatched2 <=#Tp {RxDataLatched1[31:16], 16'h0};
//      3 : RxDataLatched2 <=#Tp {RxDataLatched1[31:8],   8'h0};
//      3 : RxDataLatched2 <=#Tp {RxDataLatched1[31:8],   8'h0};
      0 : RxDataLatched2 <=#Tp {RxDataLatched1[31:8],  RxData};       // Big Endian Byte Ordering
      0 : RxDataLatched2 <=#Tp {RxDataLatched1[31:8],  RxData};       // Big Endian Byte Ordering
Line 1821... Line 1839...
rx_fifo (.data_in(RxDataLatched2),                      .data_out(m_wb_dat_o),
rx_fifo (.data_in(RxDataLatched2),                      .data_out(m_wb_dat_o),
         .clk(WB_CLK_I),                                .reset(Reset),
         .clk(WB_CLK_I),                                .reset(Reset),
         .write(WriteRxDataToFifo_wb),                  .read(MasterWbRX & m_wb_ack_i),
         .write(WriteRxDataToFifo_wb),                  .read(MasterWbRX & m_wb_ack_i),
         .clear(RxFifoReset),                           .full(RxBufferFull),
         .clear(RxFifoReset),                           .full(RxBufferFull),
         .almost_full(RxBufferAlmostFull),              .almost_empty(RxBufferAlmostEmpty),
         .almost_full(RxBufferAlmostFull),              .almost_empty(RxBufferAlmostEmpty),
         .empty(RxBufferEmpty)
         .empty(RxBufferEmpty),                         .cnt()
        );
        );
 
 
assign WriteRxDataToMemory = ~RxBufferEmpty & (~MasterWbRX | ~RxBufferAlmostEmpty);
assign WriteRxDataToMemory = ~RxBufferEmpty & (~MasterWbRX | ~RxBufferAlmostEmpty);
 
 
 
 

powered by: WebSVN 2.1.0

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