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

Subversion Repositories ethmac

[/] [ethmac/] [tags/] [rel_14/] [rtl/] [verilog/] [eth_macstatus.v] - Diff between revs 37 and 42

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

Rev 37 Rev 42
Line 39... Line 39...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.4  2002/01/23 10:28:16  mohor
 
// Link in the header changed.
 
//
// Revision 1.3  2001/10/19 08:43:51  mohor
// Revision 1.3  2001/10/19 08:43:51  mohor
// eth_timescale.v changed to timescale.v This is done because of the
// eth_timescale.v changed to timescale.v This is done because of the
// simulation of the few cores in a one joined project.
// simulation of the few cores in a one joined project.
//
//
// Revision 1.2  2001/09/11 14:17:00  mohor
// Revision 1.2  2001/09/11 14:17:00  mohor
Line 68... Line 71...
 
 
`include "timescale.v"
`include "timescale.v"
 
 
 
 
module eth_macstatus(
module eth_macstatus(
                      MRxClk, Reset, ReceivedLengthOK, ReceiveEnd, TransmitEnd, ReceivedPacketGood, RxCrcError,
                      MRxClk, Reset, ReceivedLengthOK, ReceiveEnd, ReceivedPacketGood, RxCrcError,
                      MRxErr, MRxDV, RxStateSFD, RxStateData, RxStatePreamble, RxStateIdle, Transmitting,
                      MRxErr, MRxDV, RxStateSFD, RxStateData, RxStatePreamble, RxStateIdle, Transmitting,
                      RxByteCnt, RxByteCntEq0, RxByteCntGreat2, RxByteCntMaxFrame, ReceivedPauseFrm
                      RxByteCnt, RxByteCntEq0, RxByteCntGreat2, RxByteCntMaxFrame, ReceivedPauseFrm,
 
                      InvalidSymbol, MRxD, LatchedCrcError, Collision, CollValid, RxLateCollision,
 
                      r_RecSmall, r_MinFL, r_MaxFL, ShortFrame, DribbleNibble, ReceivedPacketTooBig, r_HugEn,
 
                      LoadRxStatus
                    );
                    );
 
 
 
 
 
 
parameter Tp = 1;
parameter Tp = 1;
Line 94... Line 100...
input  [15:0] RxByteCnt;
input  [15:0] RxByteCnt;
input         RxByteCntEq0;
input         RxByteCntEq0;
input         RxByteCntGreat2;
input         RxByteCntGreat2;
input         RxByteCntMaxFrame;
input         RxByteCntMaxFrame;
input         ReceivedPauseFrm;
input         ReceivedPauseFrm;
 
input   [3:0] MRxD;
 
input         Collision;
 
input   [5:0] CollValid;
 
input         r_RecSmall;
 
input  [15:0] r_MinFL;
 
input  [15:0] r_MaxFL;
 
input         r_HugEn;
 
 
output        ReceivedLengthOK;
output        ReceivedLengthOK;
output        ReceiveEnd;
output        ReceiveEnd;
output        ReceivedPacketGood;
output        ReceivedPacketGood;
output        TransmitEnd;
output        InvalidSymbol;
 
output        LatchedCrcError;
 
output        RxLateCollision;
 
output        ShortFrame;
 
output        DribbleNibble;
 
output        ReceivedPacketTooBig;
 
output        LoadRxStatus;
 
 
reg           ReceiveEnd;
reg           ReceiveEnd;
 
 
reg           LatchedCrcError;
reg           LatchedCrcError;
reg           LatchedMRxErr;
reg           LatchedMRxErr;
reg           PreloadRxStatus;
reg           LoadRxStatus;
reg    [15:0] LatchedRxByteCnt;
reg           InvalidSymbol;
 
 
wire          TakeSample;
wire          TakeSample;
 
wire          SetInvalidSymbol; // Invalid symbol was received during reception in 100Mbps 
 
 
// Crc error
// Crc error
always @ (posedge MRxClk or posedge Reset)
always @ (posedge MRxClk or posedge Reset)
begin
begin
  if(Reset)
  if(Reset)
    LatchedCrcError <=#Tp 1'b0;
    LatchedCrcError <=#Tp 1'b0;
  else
  else
    begin
 
      if(RxStateSFD)
      if(RxStateSFD)
        LatchedCrcError <=#Tp 1'b0;
        LatchedCrcError <=#Tp 1'b0;
      else
      else
      if(RxStateData[0])
      if(RxStateData[0])
        LatchedCrcError <=#Tp RxCrcError & ~RxByteCntEq0;
        LatchedCrcError <=#Tp RxCrcError & ~RxByteCntEq0;
    end
    end
end
 
 
 
 
 
// LatchedMRxErr
// LatchedMRxErr
always @ (posedge MRxClk or posedge Reset)
always @ (posedge MRxClk or posedge Reset)
begin
begin
Line 145... Line 162...
// ReceivedPacketGood
// ReceivedPacketGood
assign ReceivedPacketGood = ~LatchedCrcError & ~LatchedMRxErr;
assign ReceivedPacketGood = ~LatchedCrcError & ~LatchedMRxErr;
 
 
 
 
// ReceivedLengthOK
// ReceivedLengthOK
assign ReceivedLengthOK = LatchedRxByteCnt[15:0] > 63 & LatchedRxByteCnt[15:0] < 1519;
assign ReceivedLengthOK = RxByteCnt[15:0] > 63 & RxByteCnt[15:0] < 1519;
 
 
 
 
 
 
// LatchedRxByteCnt[15:0]
 
 
 
 
// Time to take a sample
 
assign TakeSample = |RxStateData     & ~MRxDV & RxByteCntGreat2  |
 
                     RxStateData[0]  &  MRxDV & RxByteCntMaxFrame;
 
 
 
 
 
// LoadRxStatus
always @ (posedge MRxClk or posedge Reset)
always @ (posedge MRxClk or posedge Reset)
begin
begin
  if(Reset)
  if(Reset)
    LatchedRxByteCnt[15:0] <=#Tp 16'h0;
    LoadRxStatus <=#Tp 1'b0;
  else
  else
 
    LoadRxStatus <=#Tp TakeSample;
 
end
 
 
 
 
 
 
 
// ReceiveEnd
 
always @ (posedge MRxClk or posedge Reset)
    begin
    begin
      if(RxStateSFD)
  if(Reset)
        LatchedRxByteCnt[15:0] <=#Tp RxByteCnt[15:0];
    ReceiveEnd  <=#Tp 1'b0;
      else
      else
      if(RxStateData[0])
    ReceiveEnd  <=#Tp LoadRxStatus;
        LatchedRxByteCnt[15:0] <=#Tp RxByteCnt[15:0];
 
    end
 
end
end
 
 
 
 
 
// Invalid Symbol received during 100Mbps mode
 
assign SetInvalidSymbol = MRxDV & MRxErr & ~LatchedMRxErr & MRxD[3:0] == 4'he;
 
 
// Time to take a sample
 
assign TakeSample = |RxStateData     & ~MRxDV & RxByteCntGreat2  |
// InvalidSymbol
                     RxStateData[0]  &  MRxDV & RxByteCntMaxFrame;
always @ (posedge MRxClk or posedge Reset)
 
begin
 
  if(Reset)
 
    InvalidSymbol <=#Tp 1'b0;
 
  else
 
  if(LoadRxStatus & ~SetInvalidSymbol)
 
    InvalidSymbol <=#Tp 1'b0;
 
  else
 
  if(SetInvalidSymbol)
 
    InvalidSymbol <=#Tp 1'b1;
 
end
 
 
 
 
// PreloadRxStatus
// Late Collision
 
 
 
reg RxLateCollision;
 
reg RxColWindow;
 
// Collision Window
always @ (posedge MRxClk or posedge Reset)
always @ (posedge MRxClk or posedge Reset)
begin
begin
  if(Reset)
  if(Reset)
    PreloadRxStatus <=#Tp 1'b0;
    RxLateCollision <=#Tp 1'b0;
 
  else
 
  if(LoadRxStatus)
 
    RxLateCollision <=#Tp 1'b0;
  else
  else
    PreloadRxStatus <=#Tp TakeSample;
  if(Collision & (~RxColWindow | r_RecSmall))
 
    RxLateCollision <=#Tp 1'b1;
end
end
 
 
 
// Collision Window
 
always @ (posedge MRxClk or posedge Reset)
 
begin
 
  if(Reset)
 
    RxColWindow <=#Tp 1'b1;
 
  else
 
  if(~Collision & RxByteCnt[5:0] == CollValid[5:0] & RxStateData[1])
 
    RxColWindow <=#Tp 1'b0;
 
  else
 
  if(RxStateIdle)
 
    RxColWindow <=#Tp 1'b1;
 
end
 
 
 
 
// ReceiveEnd
// ShortFrame
 
reg ShortFrame;
always @ (posedge MRxClk or posedge Reset)
always @ (posedge MRxClk or posedge Reset)
begin
begin
  if(Reset)
  if(Reset)
    ReceiveEnd  <=#Tp 1'b0;
    ShortFrame <=#Tp 1'b0;
  else
  else
    ReceiveEnd  <=#Tp PreloadRxStatus;
  if(LoadRxStatus)
 
    ShortFrame <=#Tp 1'b0;
 
  else
 
  if(TakeSample)
 
    ShortFrame <=#Tp r_RecSmall & RxByteCnt[15:0] < r_MinFL[15:0];
end
end
 
 
 
 
 
// DribbleNibble
 
reg DribbleNibble;
 
always @ (posedge MRxClk or posedge Reset)
 
begin
 
  if(Reset)
 
    DribbleNibble <=#Tp 1'b0;
 
  else
 
  if(RxStateSFD)
 
    DribbleNibble <=#Tp 1'b0;
 
  else
 
  if(~MRxDV & RxStateData[1])
 
    DribbleNibble <=#Tp 1'b1;
 
end
 
 
 
 
 
reg ReceivedPacketTooBig;
 
assign ReceivedLengthOK = RxByteCnt[15:0] > 63 & RxByteCnt[15:0] < 1519;
 
always @ (posedge MRxClk or posedge Reset)
 
begin
 
  if(Reset)
 
    ReceivedPacketTooBig <=#Tp 1'b0;
 
  else
 
  if(LoadRxStatus)
 
    ReceivedPacketTooBig <=#Tp 1'b0;
 
  else
 
  if(TakeSample)
 
    ReceivedPacketTooBig <=#Tp ~r_HugEn & RxByteCnt[15:0] > r_MaxFL[15:0];
 
end
 
 
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.