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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [ethmac/] [eth_rxethmac.v] - Diff between revs 409 and 439

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

Rev 409 Rev 439
Line 37... Line 37...
//// You should have received a copy of the GNU Lesser General    ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
 
// CVS Revision History
 
//
 
// $Log: not supported by cvs2svn $
 
// Revision 1.12  2004/04/26 15:26:23  igorm
 
// - Bug connected to the TX_BD_NUM_Wr signal fixed (bug came in with the
 
//   previous update of the core.
 
// - TxBDAddress is set to 0 after the TX is enabled in the MODER register.
 
// - RxBDAddress is set to r_TxBDNum<<1 after the RX is enabled in the MODER
 
//   register. (thanks to Mathias and Torbjorn)
 
// - Multicast reception was fixed. Thanks to Ulrich Gries
 
//
 
// Revision 1.11  2004/03/17 09:32:15  igorm
 
// Multicast detection fixed. Only the LSB of the first byte is checked.
 
//
 
// Revision 1.10  2002/11/22 01:57:06  mohor
 
// Rx Flow control fixed. CF flag added to the RX buffer descriptor. RxAbort
 
// synchronized.
 
//
 
// Revision 1.9  2002/11/19 17:35:35  mohor
 
// AddressMiss status is connecting to the Rx BD. AddressMiss is identifying
 
// that a frame was received because of the promiscous mode.
 
//
 
// Revision 1.8  2002/02/16 07:15:27  mohor
 
// Testbench fixed, code simplified, unused signals removed.
 
//
 
// Revision 1.7  2002/02/15 13:44:28  mohor
 
// RxAbort is an output. No need to have is declared as wire.
 
//
 
// Revision 1.6  2002/02/15 11:17:48  mohor
 
// File format changed.
 
//
 
// Revision 1.5  2002/02/14 20:48:43  billditt
 
// Addition  of new module eth_addrcheck.v
 
//
 
// 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
 
// eth_timescale.v changed to timescale.v This is done because of the
 
// simulation of the few cores in a one joined project.
 
//
 
// Revision 1.2  2001/09/11 14:17:00  mohor
 
// Few little NCSIM warnings fixed.
 
//
 
// Revision 1.1  2001/08/06 14:44:29  mohor
 
// A define FPGA added to select between Artisan RAM (for ASIC) and Block Ram (For Virtex).
 
// Include files fixed to contain no path.
 
// File names and module names changed ta have a eth_ prologue in the name.
 
// File eth_timescale.v is used to define timescale
 
// All pin names on the top module are changed to contain _I, _O or _OE at the end.
 
// Bidirectional signal MDIO is changed to three signals (Mdc_O, Mdi_I, Mdo_O
 
// and Mdo_OE. The bidirectional signal must be created on the top level. This
 
// is done due to the ASIC tools.
 
//
 
// Revision 1.1  2001/07/30 21:23:42  mohor
 
// Directory structure changed. Files checked and joind together.
 
//
 
// Revision 1.1  2001/06/27 21:26:19  mohor
 
// Initial release of the RxEthMAC module.
 
//
 
//
 
//
 
//
 
//
 
 
 
`include "timescale.v"
`include "timescale.v"
 
 
 
 
module eth_rxethmac (MRxClk, MRxDV, MRxD, Reset, Transmitting, MaxFL, r_IFG, HugEn, DlyCrcEn,
module eth_rxethmac (MRxClk, MRxDV, MRxD, Reset, Transmitting, MaxFL, r_IFG,
                     RxData, RxValid, RxStartFrm, RxEndFrm, ByteCnt, ByteCntEq0, ByteCntGreat2,
                     HugEn, DlyCrcEn, RxData, RxValid, RxStartFrm, RxEndFrm,
                     ByteCntMaxFrame, CrcError, StateIdle, StatePreamble, StateSFD, StateData,
                     ByteCnt, ByteCntEq0, ByteCntGreat2, ByteCntMaxFrame,
                     MAC, r_Pro, r_Bro,r_HASH0, r_HASH1, RxAbort, AddressMiss, PassAll, ControlFrmAddressOK
                     CrcError, StateIdle, StatePreamble, StateSFD, StateData,
 
                     MAC, r_Pro, r_Bro,r_HASH0, r_HASH1, RxAbort, AddressMiss,
 
                     PassAll, ControlFrmAddressOK
                    );
                    );
 
 
parameter Tp = 1;
 
 
 
 
 
 
 
input         MRxClk;
input         MRxClk;
input         MRxDV;
input         MRxDV;
input   [3:0] MRxD;
input   [3:0] MRxD;
input         Transmitting;
input         Transmitting;
input         HugEn;
input         HugEn;
Line 191... Line 124...
assign MRxDEqD = MRxD == 4'hd;
assign MRxDEqD = MRxD == 4'hd;
assign MRxDEq5 = MRxD == 4'h5;
assign MRxDEq5 = MRxD == 4'h5;
 
 
 
 
// Rx State Machine module
// Rx State Machine module
eth_rxstatem rxstatem1 (.MRxClk(MRxClk), .Reset(Reset), .MRxDV(MRxDV), .ByteCntEq0(ByteCntEq0),
   eth_rxstatem rxstatem1
                        .ByteCntGreat2(ByteCntGreat2), .Transmitting(Transmitting), .MRxDEq5(MRxDEq5),
     (
                        .MRxDEqD(MRxDEqD), .IFGCounterEq24(IFGCounterEq24), .ByteCntMaxFrame(ByteCntMaxFrame),
      .MRxClk(MRxClk),
                        .StateData(StateData), .StateIdle(StateIdle), .StatePreamble(StatePreamble),
      .Reset(Reset),
                        .StateSFD(StateSFD), .StateDrop(StateDrop)
      .MRxDV(MRxDV),
 
      .ByteCntEq0(ByteCntEq0),
 
      .ByteCntGreat2(ByteCntGreat2),
 
      .Transmitting(Transmitting),
 
      .MRxDEq5(MRxDEq5),
 
      .MRxDEqD(MRxDEqD),
 
      .IFGCounterEq24(IFGCounterEq24),
 
      .ByteCntMaxFrame(ByteCntMaxFrame),
 
      .StateData(StateData),
 
      .StateIdle(StateIdle),
 
      .StatePreamble(StatePreamble),
 
      .StateSFD(StateSFD),
 
      .StateDrop(StateDrop)
                       );
                       );
 
 
 
 
// Rx Counters module
// Rx Counters module
eth_rxcounters rxcounters1 (.MRxClk(MRxClk), .Reset(Reset), .MRxDV(MRxDV), .StateIdle(StateIdle),
   eth_rxcounters rxcounters1
                            .StateSFD(StateSFD), .StateData(StateData), .StateDrop(StateDrop),
     (.MRxClk(MRxClk),
                            .StatePreamble(StatePreamble), .MRxDEqD(MRxDEqD), .DlyCrcEn(DlyCrcEn),
      .Reset(Reset),
                            .DlyCrcCnt(DlyCrcCnt), .Transmitting(Transmitting), .MaxFL(MaxFL), .r_IFG(r_IFG),
      .MRxDV(MRxDV),
                            .HugEn(HugEn), .IFGCounterEq24(IFGCounterEq24), .ByteCntEq0(ByteCntEq0),
      .StateIdle(StateIdle),
                            .ByteCntEq1(ByteCntEq1), .ByteCntEq2(ByteCntEq2), .ByteCntEq3(ByteCntEq3),
      .StateSFD(StateSFD),
                            .ByteCntEq4(ByteCntEq4), .ByteCntEq5(ByteCntEq5), .ByteCntEq6(ByteCntEq6),
      .StateData(StateData),
                            .ByteCntEq7(ByteCntEq7), .ByteCntGreat2(ByteCntGreat2),
      .StateDrop(StateDrop),
                            .ByteCntSmall7(ByteCntSmall7), .ByteCntMaxFrame(ByteCntMaxFrame),
      .StatePreamble(StatePreamble),
 
      .MRxDEqD(MRxDEqD),
 
      .DlyCrcEn(DlyCrcEn),
 
      .DlyCrcCnt(DlyCrcCnt),
 
      .Transmitting(Transmitting),
 
      .MaxFL(MaxFL),
 
      .r_IFG(r_IFG),
 
      .HugEn(HugEn),
 
      .IFGCounterEq24(IFGCounterEq24),
 
      .ByteCntEq0(ByteCntEq0),
 
      .ByteCntEq1(ByteCntEq1),
 
      .ByteCntEq2(ByteCntEq2),
 
      .ByteCntEq3(ByteCntEq3),
 
      .ByteCntEq4(ByteCntEq4),
 
      .ByteCntEq5(ByteCntEq5),
 
      .ByteCntEq6(ByteCntEq6),
 
      .ByteCntEq7(ByteCntEq7),
 
      .ByteCntGreat2(ByteCntGreat2),
 
      .ByteCntSmall7(ByteCntSmall7),
 
      .ByteCntMaxFrame(ByteCntMaxFrame),
                            .ByteCntOut(ByteCnt)
                            .ByteCntOut(ByteCnt)
                           );
                           );
 
 
// Rx Address Check
// Rx Address Check
 
 
eth_rxaddrcheck rxaddrcheck1
eth_rxaddrcheck rxaddrcheck1
              (.MRxClk(MRxClk),         .Reset( Reset),             .RxData(RxData),
     (.MRxClk(MRxClk),
               .Broadcast (Broadcast),  .r_Bro (r_Bro),             .r_Pro(r_Pro),
      .Reset( Reset),
               .ByteCntEq6(ByteCntEq6), .ByteCntEq7(ByteCntEq7),    .ByteCntEq2(ByteCntEq2),
      .RxData(RxData),
               .ByteCntEq3(ByteCntEq3), .ByteCntEq4(ByteCntEq4),    .ByteCntEq5(ByteCntEq5),
      .Broadcast (Broadcast),
               .HASH0(r_HASH0),         .HASH1(r_HASH1),
      .r_Bro (r_Bro),
               .CrcHash(CrcHash),       .CrcHashGood(CrcHashGood),  .StateData(StateData),
      .r_Pro(r_Pro),
               .Multicast(Multicast),   .MAC(MAC),                  .RxAbort(RxAbort),
      .ByteCntEq6(ByteCntEq6),
               .RxEndFrm(RxEndFrm),     .AddressMiss(AddressMiss),  .PassAll(PassAll),
      .ByteCntEq7(ByteCntEq7),
 
      .ByteCntEq2(ByteCntEq2),
 
      .ByteCntEq3(ByteCntEq3),
 
      .ByteCntEq4(ByteCntEq4),
 
      .ByteCntEq5(ByteCntEq5),
 
      .HASH0(r_HASH0),
 
      .HASH1(r_HASH1),
 
      .CrcHash(CrcHash),
 
      .CrcHashGood(CrcHashGood),
 
      .StateData(StateData),
 
      .Multicast(Multicast),
 
      .MAC(MAC),
 
      .RxAbort(RxAbort),
 
      .RxEndFrm(RxEndFrm),
 
      .AddressMiss(AddressMiss),
 
      .PassAll(PassAll),
               .ControlFrmAddressOK(ControlFrmAddressOK)
               .ControlFrmAddressOK(ControlFrmAddressOK)
              );
              );
 
 
 
 
assign Enable_Crc = MRxDV & (|StateData & ~ByteCntMaxFrame);
assign Enable_Crc = MRxDV & (|StateData & ~ByteCntMaxFrame);
assign Initialize_Crc = StateSFD | DlyCrcEn & (|DlyCrcCnt[3:0]) & DlyCrcCnt[3:0] < 4'h9;
   assign Initialize_Crc = StateSFD | DlyCrcEn & (|DlyCrcCnt[3:0]) &
 
                           DlyCrcCnt[3:0] < 4'h9;
 
 
assign Data_Crc[0] = MRxD[3];
assign Data_Crc[0] = MRxD[3];
assign Data_Crc[1] = MRxD[2];
assign Data_Crc[1] = MRxD[2];
assign Data_Crc[2] = MRxD[1];
assign Data_Crc[2] = MRxD[1];
assign Data_Crc[3] = MRxD[0];
assign Data_Crc[3] = MRxD[0];
 
 
 
 
// Connecting module Crc
// Connecting module Crc
eth_crc crcrx (.Clk(MRxClk), .Reset(Reset), .Data(Data_Crc), .Enable(Enable_Crc), .Initialize(Initialize_Crc),
   eth_crc crcrx
 
     (.Clk(MRxClk),
 
      .Reset(Reset),
 
      .Data(Data_Crc),
 
      .Enable(Enable_Crc),
 
      .Initialize(Initialize_Crc),
               .Crc(Crc), .CrcError(CrcError)
               .Crc(Crc), .CrcError(CrcError)
              );
              );
 
 
 
 
 
 
Line 272... Line 257...
      LatchedByte[7:0]   <=  8'h0;
      LatchedByte[7:0]   <=  8'h0;
      RxData[7:0]        <=  8'h0;
      RxData[7:0]        <=  8'h0;
    end
    end
  else
  else
    begin
    begin
      LatchedByte[7:0]   <=  {MRxD[3:0], LatchedByte[7:4]};  // Latched byte
             // Latched byte
 
             LatchedByte[7:0]   <=  {MRxD[3:0], LatchedByte[7:4]};
 
 
      DelayData          <=  StateData[0];
      DelayData          <=  StateData[0];
 
 
      if(GenerateRxValid)
      if(GenerateRxValid)
        RxData_d[7:0] <=  LatchedByte[7:0] & {8{|StateData}};  // Data goes through only in data state 
               // Data goes through only in data state 
 
               RxData_d[7:0] <=  LatchedByte[7:0] & {8{|StateData}};
      else
      else
      if(~DelayData)
      if(~DelayData)
        RxData_d[7:0] <=  8'h0;                                // Delaying data to be valid for two cycles. Zero when not active.
                 // Delaying data to be valid for two cycles. 
 
                 // Zero when not active.
 
                 RxData_d[7:0] <=  8'h0;
 
 
      RxData[7:0] <=  RxData_d[7:0];                           // Output data byte
      RxData[7:0] <=  RxData_d[7:0];                           // Output data byte
    end
    end
end
end
 
 
Line 336... Line 326...
      RxValid   <=  RxValid_d;
      RxValid   <=  RxValid_d;
    end
    end
end
end
 
 
 
 
assign GenerateRxStartFrm = StateData[0] & (ByteCntEq1 & ~DlyCrcEn | DlyCrcCnt == 4'h3 & DlyCrcEn);
   assign GenerateRxStartFrm = StateData[0] &
 
                               ((ByteCntEq1 & ~DlyCrcEn) |
 
                                ((DlyCrcCnt == 4'h3) & DlyCrcEn));
 
 
always @ (posedge MRxClk or posedge Reset)
always @ (posedge MRxClk or posedge Reset)
begin
begin
  if(Reset)
  if(Reset)
    begin
    begin
Line 353... Line 345...
      RxStartFrm   <=  RxStartFrm_d;
      RxStartFrm   <=  RxStartFrm_d;
    end
    end
end
end
 
 
 
 
assign GenerateRxEndFrm = StateData[0] & (~MRxDV & ByteCntGreat2 | ByteCntMaxFrame);
   assign GenerateRxEndFrm = StateData[0] &
 
                             (~MRxDV & ByteCntGreat2 | ByteCntMaxFrame);
assign DribbleRxEndFrm  = StateData[1] &  ~MRxDV & ByteCntGreat2;
assign DribbleRxEndFrm  = StateData[1] &  ~MRxDV & ByteCntGreat2;
 
 
 
 
always @ (posedge MRxClk or posedge Reset)
always @ (posedge MRxClk or posedge Reset)
begin
begin

powered by: WebSVN 2.1.0

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