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

Subversion Repositories ethmac

[/] [ethmac/] [tags/] [rel_14/] [rtl/] [verilog/] [eth_rxstatem.v] - Blame information for rev 22

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 22 mohor
// Revision 1.3  2001/10/18 12:07:11  mohor
47
// Status signals changed, Adress decoding changed, interrupt controller
48
// added.
49
//
50 21 mohor
// Revision 1.2  2001/09/11 14:17:00  mohor
51
// Few little NCSIM warnings fixed.
52
//
53 18 mohor
// Revision 1.1  2001/08/06 14:44:29  mohor
54
// A define FPGA added to select between Artisan RAM (for ASIC) and Block Ram (For Virtex).
55
// Include files fixed to contain no path.
56
// File names and module names changed ta have a eth_ prologue in the name.
57
// File eth_timescale.v is used to define timescale
58
// All pin names on the top module are changed to contain _I, _O or _OE at the end.
59
// Bidirectional signal MDIO is changed to three signals (Mdc_O, Mdi_I, Mdo_O
60
// and Mdo_OE. The bidirectional signal must be created on the top level. This
61
// is done due to the ASIC tools.
62
//
63 15 mohor
// Revision 1.1  2001/07/30 21:23:42  mohor
64
// Directory structure changed. Files checked and joind together.
65
//
66
// Revision 1.2  2001/07/03 12:55:41  mohor
67
// Minor changes because of the synthesys warnings.
68
//
69
//
70
// Revision 1.1  2001/06/27 21:26:19  mohor
71
// Initial release of the RxEthMAC module.
72
//
73
//
74
//
75
//
76
 
77
 
78 22 mohor
`include "timescale.v"
79 15 mohor
 
80
 
81
module eth_rxstatem (MRxClk, Reset, MRxDV, ByteCntEq0, ByteCntGreat2, Transmitting, MRxDEq5, MRxDEqD,
82
                     IFGCounterEq24, ByteCntMaxFrame, StateData, StateIdle, StatePreamble, StateSFD,
83
                     StateDrop
84
                    );
85
 
86
parameter Tp = 1;
87
 
88
input         MRxClk;
89
input         Reset;
90
input         MRxDV;
91
input         ByteCntEq0;
92
input         ByteCntGreat2;
93
input         MRxDEq5;
94
input         Transmitting;
95
input         MRxDEqD;
96
input         IFGCounterEq24;
97
input         ByteCntMaxFrame;
98
 
99
output [1:0]  StateData;
100
output        StateIdle;
101
output        StateDrop;
102
output        StatePreamble;
103
output        StateSFD;
104
 
105
reg           StateData0;
106
reg           StateData1;
107
reg           StateIdle;
108
reg           StateDrop;
109
reg           StatePreamble;
110
reg           StateSFD;
111
 
112
wire          StartIdle;
113
wire          StartDrop;
114
wire          StartData0;
115
wire          StartData1;
116
wire          StartPreamble;
117
wire          StartSFD;
118
 
119
 
120
// Defining the next state
121 18 mohor
assign StartIdle = ~MRxDV & (StateDrop | StatePreamble | StateSFD | (|StateData) & (ByteCntEq0 | ByteCntGreat2));
122 15 mohor
 
123
assign StartPreamble = MRxDV & ~MRxDEq5 & (StateIdle & ~Transmitting);
124
 
125 21 mohor
//assign StartSFD = MRxDV & MRxDEq5 & (StateIdle & ~Transmitting);
126
assign StartSFD = MRxDV & MRxDEq5 & (StateIdle & ~Transmitting | StatePreamble);
127 15 mohor
 
128
assign StartData0 = MRxDV & (StateSFD & MRxDEqD & IFGCounterEq24 | StateData1);
129
 
130
assign StartData1 = MRxDV & StateData0;
131
 
132
assign StartDrop = MRxDV & (StateIdle & Transmitting | StateSFD & ~IFGCounterEq24 &  MRxDEqD
133
                         |  StateData0 &  ByteCntMaxFrame
134
                           );
135
 
136
// Rx State Machine
137
always @ (posedge MRxClk or posedge Reset)
138
begin
139
  if(Reset)
140
    begin
141
      StateIdle     <= #Tp 1'b0;
142
      StateDrop     <= #Tp 1'b1;
143
      StatePreamble <= #Tp 1'b0;
144
      StateSFD      <= #Tp 1'b0;
145
      StateData0    <= #Tp 1'b0;
146
      StateData1    <= #Tp 1'b0;
147
    end
148
  else
149
    begin
150
      if(StartPreamble | StartSFD | StartDrop)
151
        StateIdle <= #Tp 1'b0;
152
      else
153
      if(StartIdle)
154
        StateIdle <= #Tp 1'b1;
155
 
156
      if(StartIdle)
157
        StateDrop <= #Tp 1'b0;
158
      else
159
      if(StartDrop)
160
        StateDrop <= #Tp 1'b1;
161
 
162
      if(StartSFD | StartIdle | StartDrop)
163
        StatePreamble <= #Tp 1'b0;
164
      else
165
      if(StartPreamble)
166
        StatePreamble <= #Tp 1'b1;
167
 
168
      if(StartPreamble | StartIdle | StartData0 | StartDrop)
169
        StateSFD <= #Tp 1'b0;
170
      else
171
      if(StartSFD)
172
        StateSFD <= #Tp 1'b1;
173
 
174
      if(StartIdle | StartData1 | StartDrop)
175
        StateData0 <= #Tp 1'b0;
176
      else
177
      if(StartData0)
178
        StateData0 <= #Tp 1'b1;
179
 
180
      if(StartIdle | StartData0 | StartDrop)
181
        StateData1 <= #Tp 1'b0;
182
      else
183
      if(StartData1)
184
        StateData1 <= #Tp 1'b1;
185
    end
186
end
187
 
188
assign StateData[1:0] = {StateData1, StateData0};
189
 
190
endmodule

powered by: WebSVN 2.1.0

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