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

Subversion Repositories ethmac

[/] [ethmac/] [trunk/] [rtl/] [verilog/] [eth_rxcounters.v] - Diff between revs 57 and 326

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

Rev 57 Rev 326
Line 41... Line 41...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.5  2002/02/15 11:13:29  mohor
 
// Format of the file changed a bit.
 
//
// Revision 1.4  2002/02/14 20:19:41  billditt
// Revision 1.4  2002/02/14 20:19:41  billditt
// Modified for Address Checking,
// Modified for Address Checking,
// addition of eth_addrcheck.v
// addition of eth_addrcheck.v
//
//
// Revision 1.3  2002/01/23 10:28:16  mohor
// Revision 1.3  2002/01/23 10:28:16  mohor
Line 81... Line 84...
 
 
 
 
module eth_rxcounters (MRxClk, Reset, MRxDV, StateIdle, StateSFD, StateData, StateDrop, StatePreamble,
module eth_rxcounters (MRxClk, Reset, MRxDV, StateIdle, StateSFD, StateData, StateDrop, StatePreamble,
                       MRxDEqD, DlyCrcEn, DlyCrcCnt, Transmitting, MaxFL, r_IFG, HugEn, IFGCounterEq24,
                       MRxDEqD, DlyCrcEn, DlyCrcCnt, Transmitting, MaxFL, r_IFG, HugEn, IFGCounterEq24,
                       ByteCntEq0, ByteCntEq1, ByteCntEq2,ByteCntEq3,ByteCntEq4,ByteCntEq5, ByteCntEq6,
                       ByteCntEq0, ByteCntEq1, ByteCntEq2,ByteCntEq3,ByteCntEq4,ByteCntEq5, ByteCntEq6,
                       ByteCntEq7, ByteCntGreat2, ByteCntSmall7, ByteCntMaxFrame, ByteCnt
                       ByteCntEq7, ByteCntGreat2, ByteCntSmall7, ByteCntMaxFrame, ByteCntOut
                      );
                      );
 
 
parameter Tp = 1;
parameter Tp = 1;
 
 
input         MRxClk;
input         MRxClk;
Line 114... Line 117...
output        ByteCntEq6;               // Byte counter = 6
output        ByteCntEq6;               // Byte counter = 6
output        ByteCntEq7;               // Byte counter = 7
output        ByteCntEq7;               // Byte counter = 7
output        ByteCntGreat2;            // Byte counter > 2
output        ByteCntGreat2;            // Byte counter > 2
output        ByteCntSmall7;            // Byte counter < 7
output        ByteCntSmall7;            // Byte counter < 7
output        ByteCntMaxFrame;          // Byte counter = MaxFL
output        ByteCntMaxFrame;          // Byte counter = MaxFL
output [15:0] ByteCnt;                  // Byte counter
output [15:0] ByteCntOut;               // Byte counter
 
 
wire          ResetByteCounter;
wire          ResetByteCounter;
wire          IncrementByteCounter;
wire          IncrementByteCounter;
wire          ResetIFGCounter;
wire          ResetIFGCounter;
wire          IncrementIFGCounter;
wire          IncrementIFGCounter;
Line 126... Line 129...
 
 
reg   [15:0]  ByteCnt;
reg   [15:0]  ByteCnt;
reg   [3:0]   DlyCrcCnt;
reg   [3:0]   DlyCrcCnt;
reg   [4:0]   IFGCounter;
reg   [4:0]   IFGCounter;
 
 
 
wire  [15:0]  ByteCntDelayed;
 
 
 
 
 
 
assign ResetByteCounter = MRxDV & (StateSFD & MRxDEqD | StateData[0] & ByteCntMaxFrame);
assign ResetByteCounter = MRxDV & (StateSFD & MRxDEqD | StateData[0] & ByteCntMaxFrame);
 
 
assign IncrementByteCounter = ~ResetByteCounter & MRxDV &
assign IncrementByteCounter = ~ResetByteCounter & MRxDV &
Line 139... Line 144...
 
 
 
 
always @ (posedge MRxClk or posedge Reset)
always @ (posedge MRxClk or posedge Reset)
begin
begin
  if(Reset)
  if(Reset)
    ByteCnt[15:0] <= #Tp 11'h0;
    ByteCnt[15:0] <= #Tp 16'h0;
  else
  else
    begin
    begin
      if(ResetByteCounter)
      if(ResetByteCounter)
        ByteCnt[15:0] <= #Tp 11'h0;
        ByteCnt[15:0] <= #Tp 16'h0;
      else
      else
      if(IncrementByteCounter)
      if(IncrementByteCounter)
        ByteCnt[15:0] <= #Tp ByteCnt[15:0] + 1'b1;
        ByteCnt[15:0] <= #Tp ByteCnt[15:0] + 1'b1;
     end
     end
end
end
 
 
 
assign ByteCntDelayed = ByteCnt + 3'h4;
 
assign ByteCntOut = DlyCrcEn? ByteCntDelayed : ByteCnt;
 
 
assign ByteCntEq0       = ByteCnt == 16'h0;
assign ByteCntEq0       = ByteCnt == 16'h0;
assign ByteCntEq1       = ByteCnt == 16'h1;
assign ByteCntEq1       = ByteCnt == 16'h1;
assign ByteCntEq2       = ByteCnt == 16'h2;
assign ByteCntEq2       = ByteCnt == 16'h2;
assign ByteCntEq3       = ByteCnt == 16'h3;
assign ByteCntEq3       = ByteCnt == 16'h3;
assign ByteCntEq4       = ByteCnt == 16'h4;
assign ByteCntEq4       = ByteCnt == 16'h4;
Line 164... Line 172...
assign ByteCntSmall7    = ByteCnt <  16'h7;
assign ByteCntSmall7    = ByteCnt <  16'h7;
assign ByteCntMax       = ByteCnt == 16'hffff;
assign ByteCntMax       = ByteCnt == 16'hffff;
assign ByteCntMaxFrame  = ByteCnt == MaxFL[15:0] & ~HugEn;
assign ByteCntMaxFrame  = ByteCnt == MaxFL[15:0] & ~HugEn;
 
 
 
 
 
 
assign ResetIFGCounter = StateSFD  &  MRxDV & MRxDEqD | StateDrop;
assign ResetIFGCounter = StateSFD  &  MRxDV & MRxDEqD | StateDrop;
 
 
assign IncrementIFGCounter = ~ResetIFGCounter & (StateDrop | StateIdle | StatePreamble | StateSFD) & ~IFGCounterEq24;
assign IncrementIFGCounter = ~ResetIFGCounter & (StateDrop | StateIdle | StatePreamble | StateSFD) & ~IFGCounterEq24;
 
 
always @ (posedge MRxClk or posedge Reset)
always @ (posedge MRxClk or posedge Reset)

powered by: WebSVN 2.1.0

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