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 15

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
// Revision 1.1  2001/07/30 21:23:42  mohor
47
// Directory structure changed. Files checked and joind together.
48
//
49
// Revision 1.2  2001/07/03 12:55:41  mohor
50
// Minor changes because of the synthesys warnings.
51
//
52
//
53
// Revision 1.1  2001/06/27 21:26:19  mohor
54
// Initial release of the RxEthMAC module.
55
//
56
//
57
//
58
//
59
 
60
 
61
`include "eth_timescale.v"
62
 
63
 
64
module eth_rxstatem (MRxClk, Reset, MRxDV, ByteCntEq0, ByteCntGreat2, Transmitting, MRxDEq5, MRxDEqD,
65
                     IFGCounterEq24, ByteCntMaxFrame, StateData, StateIdle, StatePreamble, StateSFD,
66
                     StateDrop
67
                    );
68
 
69
parameter Tp = 1;
70
 
71
input         MRxClk;
72
input         Reset;
73
input         MRxDV;
74
input         ByteCntEq0;
75
input         ByteCntGreat2;
76
input         MRxDEq5;
77
input         Transmitting;
78
input         MRxDEqD;
79
input         IFGCounterEq24;
80
input         ByteCntMaxFrame;
81
 
82
output [1:0]  StateData;
83
output        StateIdle;
84
output        StateDrop;
85
output        StatePreamble;
86
output        StateSFD;
87
 
88
reg           StateData0;
89
reg           StateData1;
90
reg           StateIdle;
91
reg           StateDrop;
92
reg           StatePreamble;
93
reg           StateSFD;
94
 
95
wire          StartIdle;
96
wire          StartDrop;
97
wire          StartData0;
98
wire          StartData1;
99
wire          StartPreamble;
100
wire          StartSFD;
101
 
102
 
103
// Defining the next state
104
assign StartIdle = ~MRxDV & (StateDrop | StatePreamble | StateSFD | |StateData & (ByteCntEq0 | ByteCntGreat2));
105
 
106
assign StartPreamble = MRxDV & ~MRxDEq5 & (StateIdle & ~Transmitting);
107
 
108
assign StartSFD = MRxDV & MRxDEq5 & (StateIdle & ~Transmitting);
109
 
110
assign StartData0 = MRxDV & (StateSFD & MRxDEqD & IFGCounterEq24 | StateData1);
111
 
112
assign StartData1 = MRxDV & StateData0;
113
 
114
assign StartDrop = MRxDV & (StateIdle & Transmitting | StateSFD & ~IFGCounterEq24 &  MRxDEqD
115
                         |  StateData0 &  ByteCntMaxFrame
116
                           );
117
 
118
// Rx State Machine
119
always @ (posedge MRxClk or posedge Reset)
120
begin
121
  if(Reset)
122
    begin
123
      StateIdle     <= #Tp 1'b0;
124
      StateDrop     <= #Tp 1'b1;
125
      StatePreamble <= #Tp 1'b0;
126
      StateSFD      <= #Tp 1'b0;
127
      StateData0    <= #Tp 1'b0;
128
      StateData1    <= #Tp 1'b0;
129
    end
130
  else
131
    begin
132
      if(StartPreamble | StartSFD | StartDrop)
133
        StateIdle <= #Tp 1'b0;
134
      else
135
      if(StartIdle)
136
        StateIdle <= #Tp 1'b1;
137
 
138
      if(StartIdle)
139
        StateDrop <= #Tp 1'b0;
140
      else
141
      if(StartDrop)
142
        StateDrop <= #Tp 1'b1;
143
 
144
      if(StartSFD | StartIdle | StartDrop)
145
        StatePreamble <= #Tp 1'b0;
146
      else
147
      if(StartPreamble)
148
        StatePreamble <= #Tp 1'b1;
149
 
150
      if(StartPreamble | StartIdle | StartData0 | StartDrop)
151
        StateSFD <= #Tp 1'b0;
152
      else
153
      if(StartSFD)
154
        StateSFD <= #Tp 1'b1;
155
 
156
      if(StartIdle | StartData1 | StartDrop)
157
        StateData0 <= #Tp 1'b0;
158
      else
159
      if(StartData0)
160
        StateData0 <= #Tp 1'b1;
161
 
162
      if(StartIdle | StartData0 | StartDrop)
163
        StateData1 <= #Tp 1'b0;
164
      else
165
      if(StartData1)
166
        StateData1 <= #Tp 1'b1;
167
    end
168
end
169
 
170
assign StateData[1:0] = {StateData1, StateData0};
171
 
172
endmodule

powered by: WebSVN 2.1.0

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