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

Subversion Repositories ethmac

[/] [ethmac/] [tags/] [rel_1/] [rtl/] [verilog/] [eth_wishbone.v] - Diff between revs 43 and 48

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

Rev 43 Rev 48
Line 39... Line 39...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.6  2002/02/11 09:18:22  mohor
 
// Tx status is written back to the BD.
 
//
// Revision 1.5  2002/02/08 16:21:54  mohor
// Revision 1.5  2002/02/08 16:21:54  mohor
// Rx status is written back to the BD.
// Rx status is written back to the BD.
//
//
// Revision 1.4  2002/02/06 14:10:21  mohor
// Revision 1.4  2002/02/06 14:10:21  mohor
// non-DMA host interface added. Select the right configutation in eth_defines.
// non-DMA host interface added. Select the right configutation in eth_defines.
Line 92... Line 95...
    m_wb_adr_o, m_wb_sel_o, m_wb_we_o,
    m_wb_adr_o, m_wb_sel_o, m_wb_we_o,
    m_wb_dat_o, m_wb_dat_i, m_wb_cyc_o,
    m_wb_dat_o, m_wb_dat_i, m_wb_cyc_o,
    m_wb_stb_o, m_wb_ack_i, m_wb_err_i,
    m_wb_stb_o, m_wb_ack_i, m_wb_err_i,
 
 
    //TX
    //TX
    MTxClk, TxStartFrm, TxEndFrm, TxUsedData, TxData, StatusIzTxEthMACModula,
    MTxClk, TxStartFrm, TxEndFrm, TxUsedData, TxData,
    TxRetry, TxAbort, TxUnderRun, TxDone, TPauseRq, TxPauseTV, PerPacketCrcEn,
    TxRetry, TxAbort, TxUnderRun, TxDone, TPauseRq, TxPauseTV, PerPacketCrcEn,
    PerPacketPad,
    PerPacketPad,
 
 
    //RX
    //RX
    MRxClk, RxData, RxValid, RxStartFrm, RxEndFrm, RxAbort,
    MRxClk, RxData, RxValid, RxStartFrm, RxEndFrm, RxAbort,
Line 164... Line 167...
input           CarrierSenseLost; // Carrier Sense was lost during the frame transmission
input           CarrierSenseLost; // Carrier Sense was lost during the frame transmission
 
 
// Tx
// Tx
input           MTxClk;         // Transmit clock (from PHY)
input           MTxClk;         // Transmit clock (from PHY)
input           TxUsedData;     // Transmit packet used data
input           TxUsedData;     // Transmit packet used data
input  [15:0]   StatusIzTxEthMACModula;
 
input           TxRetry;        // Transmit packet retry
input           TxRetry;        // Transmit packet retry
input           TxAbort;        // Transmit packet abort
input           TxAbort;        // Transmit packet abort
input           TxDone;         // Transmission ended
input           TxDone;         // Transmission ended
output          TxStartFrm;     // Transmit packet start frame
output          TxStartFrm;     // Transmit packet start frame
output          TxEndFrm;       // Transmit packet end frame
output          TxEndFrm;       // Transmit packet end frame
Line 266... Line 268...
 
 
reg             WriteRxDataToFifo;
reg             WriteRxDataToFifo;
reg    [15:0]   LatchedRxLength;
reg    [15:0]   LatchedRxLength;
 
 
reg             ShiftEnded;
reg             ShiftEnded;
 
reg             RxOverrun;
 
 
reg             BDWrite;                    // BD Write Enable for access from WISHBONE side
reg             BDWrite;                    // BD Write Enable for access from WISHBONE side
reg             BDRead;                     // BD Read access from WISHBONE side
reg             BDRead;                     // BD Read access from WISHBONE side
wire   [31:0]   RxBDDataIn;                 // Rx BD data in
wire   [31:0]   RxBDDataIn;                 // Rx BD data in
wire   [31:0]   TxBDDataIn;                 // Tx BD data in
wire   [31:0]   TxBDDataIn;                 // Tx BD data in
Line 298... Line 301...
wire            SetGotData;
wire            SetGotData;
wire            GotDataEvaluate;
wire            GotDataEvaluate;
 
 
reg             temp_ack;
reg             temp_ack;
 
 
wire    [5:0]   RxStatusIn;
wire    [6:0]   RxStatusIn;
reg     [5:0]   RxStatusInLatched;
reg     [6:0]   RxStatusInLatched;
 
 
`ifdef ETH_REGISTERED_OUTPUTS
`ifdef ETH_REGISTERED_OUTPUTS
reg             temp_ack2;
reg             temp_ack2;
reg [31:0]      registered_ram_do;
reg [31:0]      registered_ram_do;
`endif
`endif
Line 318... Line 321...
reg [7:0]   ram_addr;
reg [7:0]   ram_addr;
reg [31:0]  ram_di;
reg [31:0]  ram_di;
wire [31:0] ram_do;
wire [31:0] ram_do;
 
 
wire StartTxPointerRead;
wire StartTxPointerRead;
wire ResetTxPointerRead;
 
reg  TxPointerRead;
reg  TxPointerRead;
reg TxEn_needed;
reg TxEn_needed;
reg RxEn_needed;
reg RxEn_needed;
 
 
wire StartRxPointerRead;
wire StartRxPointerRead;
Line 941... Line 943...
  if(TxRetryPulse | TxDonePulse | TxAbortPulse)
  if(TxRetryPulse | TxDonePulse | TxAbortPulse)
    TxValidBytesLatched <=#Tp 2'h0;
    TxValidBytesLatched <=#Tp 2'h0;
end
end
 
 
 
 
// Bit 14 is used as a wrap bit. When active it indicates the last buffer descriptor in a row. After
 
// using this descriptor, first BD will be used again.
 
 
 
// TX
 
// bit 15 od tx je ready
 
// bit 14 od tx je interrupt (Tx buffer ali tx error bit se postavi v interrupt registru, ko se ta buffer odda)
 
// bit 13 od tx je wrap
 
// bit 12 od tx je pad
 
// bit 11 od tx je crc
 
// bit 10 od tx je last (crc se doda le ce je bit 11 in hkrati bit 10)
 
// bit 9  od tx je pause request (control frame)
 
    // Vsi zgornji biti gredo ven, spodnji biti (od 8 do 0) pa so statusni in se vpisejo po koncu oddajanja
 
// bit 8  od tx je defer indication           done
 
// bit 7  od tx je late collision             done
 
// bit 6  od tx je retransmittion limit       done
 
// bit 5  od tx je underrun                   done
 
// bit 4  od tx je carrier sense lost
 
// bit [3:0] od tx je retry count             done
 
 
 
//assign TxBDReady      = TxStatus[15];     // already used
 
assign TxIRQEn          = TxStatus[14];
assign TxIRQEn          = TxStatus[14];
assign WrapTxStatusBit  = TxStatus[13];                                                   // ok povezan
assign WrapTxStatusBit  = TxStatus[13];
assign PerPacketPad     = TxStatus[12];                                                   // ok povezan
assign PerPacketPad     = TxStatus[12];
assign PerPacketCrcEn   = TxStatus[11];
assign PerPacketCrcEn   = TxStatus[11];
//assign TxPauseRq      = TxStatus[9];      // already used     Ta gre ven, ker bo stvar izvedena preko registrov
//assign TxPauseRq      = TxStatus[9];      // already used     Ta gre ven, ker bo stvar izvedena preko registrov
 
 
 
 
 
 
// RX
 
// bit 15 od rx je empty
 
// bit 14 od rx je interrupt (Rx buffer ali rx frame received se postavi v interrupt registru, ko se ta buffer zapre)
 
// bit 13 od rx je wrap
 
// bit 12 od rx je reserved
 
// bit 11 od rx je reserved
 
// bit 10 od rx je reserved
 
// bit 9  od rx je reserved
 
// bit 8  od rx je reserved
 
// bit 7  od rx je reserved
 
// bit 6  od rx je underrun         still missing
 
// bit 5  od rx je InvalidSymbol
 
// bit 4  od rx je DribbleNibble
 
// bit 3  od rx je ReceivedPacketTooBig
 
// bit 2  od rx je ShortFrame
 
// bit 1  od rx je LatchedCrcError
 
// bit 0  od rx je RxLateCollision
 
assign RxStatusIn = {InvalidSymbol, DribbleNibble, ReceivedPacketTooBig, ShortFrame, LatchedCrcError, RxLateCollision};
 
 
 
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:0] = {8{ TxStatusWrite     & ~WrapTxStatusBit}} & (TxBDAddress + 2'h2) ; // Tx BD increment or wrap (last BD)
assign TempTxBDAddress[7:0] = {8{ TxStatusWrite     & ~WrapTxStatusBit}} & (TxBDAddress + 2'h2) ; // Tx BD increment or wrap (last BD)
Line 1023... Line 985...
    RxBDAddress <=#Tp TempRxBDAddress;
    RxBDAddress <=#Tp TempRxBDAddress;
end
end
 
 
wire [8:0] TxStatusInLatched = {TxUnderRun, RetryCntLatched[3:0], RetryLimit, LateCollLatched, DeferLatched, CarrierSenseLost};
wire [8:0] TxStatusInLatched = {TxUnderRun, RetryCntLatched[3:0], RetryLimit, LateCollLatched, DeferLatched, CarrierSenseLost};
 
 
assign RxBDDataIn = {LatchedRxLength, 1'b0, RxStatus, 7'h0, RxStatusInLatched};
assign RxBDDataIn = {LatchedRxLength, 1'b0, RxStatus, 6'h0, RxStatusInLatched};
assign TxBDDataIn = {LatchedTxLength, 1'b0, TxStatus, 2'h0, TxStatusInLatched};
assign TxBDDataIn = {LatchedTxLength, 1'b0, TxStatus, 2'h0, TxStatusInLatched};
 
 
 
 
// Signals used for various purposes
// Signals used for various purposes
assign TxRetryPulse   = TxRetry_wb   & ~TxRetry_wb_q;
assign TxRetryPulse   = TxRetry_wb   & ~TxRetry_wb_q;
Line 1740... Line 1702...
  if(LoadRxStatus & ~LoadStatusBlocked)
  if(LoadRxStatus & ~LoadStatusBlocked)
    LatchedRxLength[15:0] <=#Tp RxLength[15:0];
    LatchedRxLength[15:0] <=#Tp RxLength[15:0];
end
end
 
 
 
 
 
assign RxStatusIn = {RxOverrun, InvalidSymbol, DribbleNibble, ReceivedPacketTooBig, ShortFrame, LatchedCrcError, RxLateCollision};
assign RxStatusIn = {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 <=#Tp 'h0;
    RxStatusInLatched <=#Tp 'h0;
Line 1753... Line 1714...
  if(LoadRxStatus & ~LoadStatusBlocked)
  if(LoadRxStatus & ~LoadStatusBlocked)
    RxStatusInLatched <=#Tp RxStatusIn;
    RxStatusInLatched <=#Tp RxStatusIn;
end
end
 
 
 
 
 
// Rx overrun
 
always @ (posedge WB_CLK_I or posedge Reset)
 
begin
 
  if(Reset)
 
    RxOverrun <=#Tp 1'b0;
 
  else
 
  if(RxStatusWrite)
 
    RxOverrun <=#Tp 1'b0;
 
  else
 
  if(RxBufferFull & WriteRxDataToFifo_wb)
 
    RxOverrun <=#Tp 1'b1;
 
end
 
 
 
 
 
// TX
 
// bit 15 od tx je ready
 
// bit 14 od tx je interrupt (Tx buffer ali tx error bit se postavi v interrupt registru, ko se ta buffer odda)
 
// bit 13 od tx je wrap
 
// bit 12 od tx je pad
 
// bit 11 od tx je crc
 
// bit 10 od tx je last (crc se doda le ce je bit 11 in hkrati bit 10)
 
// bit 9  od tx je pause request (control frame)
 
    // Vsi zgornji biti gredo ven, spodnji biti (od 8 do 0) pa so statusni in se vpisejo po koncu oddajanja
 
// bit 8  od tx je defer indication           done
 
// bit 7  od tx je late collision             done
 
// bit 6  od tx je retransmittion limit       done
 
// bit 5  od tx je underrun                   done
 
// bit 4  od tx je carrier sense lost
 
// bit [3:0] od tx je retry count             done
 
 
 
 
 
// RX
 
// bit 15 od rx je empty
 
// bit 14 od rx je interrupt (Rx buffer ali rx frame received se postavi v interrupt registru, ko se ta buffer zapre)
 
// bit 13 od rx je wrap
 
// bit 12 od rx je reserved
 
// bit 11 od rx je reserved
 
// bit 10 od rx je reserved
 
// bit 9  od rx je reserved
 
// bit 8  od rx je reserved
 
// bit 7  od rx je reserved
 
// bit 6  od rx je RxOverrun
 
// bit 5  od rx je InvalidSymbol
 
// bit 4  od rx je DribbleNibble
 
// bit 3  od rx je ReceivedPacketTooBig
 
// bit 2  od rx je ShortFrame
 
// bit 1  od rx je LatchedCrcError
 
// bit 0  od rx je RxLateCollision
 
 
endmodule
endmodule
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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