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

Subversion Repositories ethmac

[/] [ethmac/] [branches/] [unneback/] [rtl/] [verilog/] [eth_rxstatem.v] - Blame information for rev 18

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 mohor
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  eth_rxstatem.v                                              ////
4
////                                                              ////
5
////  This file is part of the Ethernet IP core project           ////
6
////  http://www.opencores.org/cores/ethmac/                      ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Igor Mohor (igorM@opencores.org)                      ////
10
////      - Novan Hartadi (novan@vlsi.itb.ac.id)                  ////
11
////      - Mahmud Galela (mgalela@vlsi.itb.ac.id)                ////
12
////                                                              ////
13
////  All additional information is avaliable in the Readme.txt   ////
14
////  file.                                                       ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2001 Authors                                   ////
19
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
//
43
// CVS Revision History
44
//
45
// $Log: not supported by cvs2svn $
46 18 mohor
// Revision 1.1  2001/08/06 14:44:29  mohor
47
// A define FPGA added to select between Artisan RAM (for ASIC) and Block Ram (For Virtex).
48
// Include files fixed to contain no path.
49
// File names and module names changed ta have a eth_ prologue in the name.
50
// File eth_timescale.v is used to define timescale
51
// All pin names on the top module are changed to contain _I, _O or _OE at the end.
52
// Bidirectional signal MDIO is changed to three signals (Mdc_O, Mdi_I, Mdo_O
53
// and Mdo_OE. The bidirectional signal must be created on the top level. This
54
// is done due to the ASIC tools.
55
//
56 15 mohor
// Revision 1.1  2001/07/30 21:23:42  mohor
57
// Directory structure changed. Files checked and joind together.
58
//
59
// Revision 1.2  2001/07/03 12:55:41  mohor
60
// Minor changes because of the synthesys warnings.
61
//
62
//
63
// Revision 1.1  2001/06/27 21:26:19  mohor
64
// Initial release of the RxEthMAC module.
65
//
66
//
67
//
68
//
69
 
70
 
71
`include "eth_timescale.v"
72
 
73
 
74
module eth_rxstatem (MRxClk, Reset, MRxDV, ByteCntEq0, ByteCntGreat2, Transmitting, MRxDEq5, MRxDEqD,
75
                     IFGCounterEq24, ByteCntMaxFrame, StateData, StateIdle, StatePreamble, StateSFD,
76
                     StateDrop
77
                    );
78
 
79
parameter Tp = 1;
80
 
81
input         MRxClk;
82
input         Reset;
83
input         MRxDV;
84
input         ByteCntEq0;
85
input         ByteCntGreat2;
86
input         MRxDEq5;
87
input         Transmitting;
88
input         MRxDEqD;
89
input         IFGCounterEq24;
90
input         ByteCntMaxFrame;
91
 
92
output [1:0]  StateData;
93
output        StateIdle;
94
output        StateDrop;
95
output        StatePreamble;
96
output        StateSFD;
97
 
98
reg           StateData0;
99
reg           StateData1;
100
reg           StateIdle;
101
reg           StateDrop;
102
reg           StatePreamble;
103
reg           StateSFD;
104
 
105
wire          StartIdle;
106
wire          StartDrop;
107
wire          StartData0;
108
wire          StartData1;
109
wire          StartPreamble;
110
wire          StartSFD;
111
 
112
 
113
// Defining the next state
114 18 mohor
assign StartIdle = ~MRxDV & (StateDrop | StatePreamble | StateSFD | (|StateData) & (ByteCntEq0 | ByteCntGreat2));
115 15 mohor
 
116
assign StartPreamble = MRxDV & ~MRxDEq5 & (StateIdle & ~Transmitting);
117
 
118
assign StartSFD = MRxDV & MRxDEq5 & (StateIdle & ~Transmitting);
119
 
120
assign StartData0 = MRxDV & (StateSFD & MRxDEqD & IFGCounterEq24 | StateData1);
121
 
122
assign StartData1 = MRxDV & StateData0;
123
 
124
assign StartDrop = MRxDV & (StateIdle & Transmitting | StateSFD & ~IFGCounterEq24 &  MRxDEqD
125
                         |  StateData0 &  ByteCntMaxFrame
126
                           );
127
 
128
// Rx State Machine
129
always @ (posedge MRxClk or posedge Reset)
130
begin
131
  if(Reset)
132
    begin
133
      StateIdle     <= #Tp 1'b0;
134
      StateDrop     <= #Tp 1'b1;
135
      StatePreamble <= #Tp 1'b0;
136
      StateSFD      <= #Tp 1'b0;
137
      StateData0    <= #Tp 1'b0;
138
      StateData1    <= #Tp 1'b0;
139
    end
140
  else
141
    begin
142
      if(StartPreamble | StartSFD | StartDrop)
143
        StateIdle <= #Tp 1'b0;
144
      else
145
      if(StartIdle)
146
        StateIdle <= #Tp 1'b1;
147
 
148
      if(StartIdle)
149
        StateDrop <= #Tp 1'b0;
150
      else
151
      if(StartDrop)
152
        StateDrop <= #Tp 1'b1;
153
 
154
      if(StartSFD | StartIdle | StartDrop)
155
        StatePreamble <= #Tp 1'b0;
156
      else
157
      if(StartPreamble)
158
        StatePreamble <= #Tp 1'b1;
159
 
160
      if(StartPreamble | StartIdle | StartData0 | StartDrop)
161
        StateSFD <= #Tp 1'b0;
162
      else
163
      if(StartSFD)
164
        StateSFD <= #Tp 1'b1;
165
 
166
      if(StartIdle | StartData1 | StartDrop)
167
        StateData0 <= #Tp 1'b0;
168
      else
169
      if(StartData0)
170
        StateData0 <= #Tp 1'b1;
171
 
172
      if(StartIdle | StartData0 | StartDrop)
173
        StateData1 <= #Tp 1'b0;
174
      else
175
      if(StartData1)
176
        StateData1 <= #Tp 1'b1;
177
    end
178
end
179
 
180
assign StateData[1:0] = {StateData1, StateData0};
181
 
182
endmodule

powered by: WebSVN 2.1.0

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