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

Subversion Repositories ethmac

[/] [ethmac/] [trunk/] [rtl/] [verilog/] [eth_macstatus.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_macstatus.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
////                                                              ////
11
////  All additional information is avaliable in the Readme.txt   ////
12
////  file.                                                       ////
13
////                                                              ////
14
//////////////////////////////////////////////////////////////////////
15
////                                                              ////
16
//// Copyright (C) 2001 Authors                                   ////
17
////                                                              ////
18
//// This source file may be used and distributed without         ////
19
//// restriction provided that this copyright statement is not    ////
20
//// removed from the file and that any derivative work contains  ////
21
//// the original copyright notice and the associated disclaimer. ////
22
////                                                              ////
23
//// This source file is free software; you can redistribute it   ////
24
//// and/or modify it under the terms of the GNU Lesser General   ////
25
//// Public License as published by the Free Software Foundation; ////
26
//// either version 2.1 of the License, or (at your option) any   ////
27
//// later version.                                               ////
28
////                                                              ////
29
//// This source is distributed in the hope that it will be       ////
30
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
31
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
32
//// PURPOSE.  See the GNU Lesser General Public License for more ////
33
//// details.                                                     ////
34
////                                                              ////
35
//// You should have received a copy of the GNU Lesser General    ////
36
//// Public License along with this source; if not, download it   ////
37
//// from http://www.opencores.org/lgpl.shtml                     ////
38
////                                                              ////
39
//////////////////////////////////////////////////////////////////////
40
//
41
// CVS Revision History
42
//
43
// $Log: not supported by cvs2svn $
44 22 mohor
// Revision 1.2  2001/09/11 14:17:00  mohor
45
// Few little NCSIM warnings fixed.
46
//
47 18 mohor
// Revision 1.1  2001/08/06 14:44:29  mohor
48
// A define FPGA added to select between Artisan RAM (for ASIC) and Block Ram (For Virtex).
49
// Include files fixed to contain no path.
50
// File names and module names changed ta have a eth_ prologue in the name.
51
// File eth_timescale.v is used to define timescale
52
// All pin names on the top module are changed to contain _I, _O or _OE at the end.
53
// Bidirectional signal MDIO is changed to three signals (Mdc_O, Mdi_I, Mdo_O
54
// and Mdo_OE. The bidirectional signal must be created on the top level. This
55
// is done due to the ASIC tools.
56
//
57 15 mohor
// Revision 1.1  2001/07/30 21:23:42  mohor
58
// Directory structure changed. Files checked and joind together.
59
//
60
//
61
//
62
//
63
//
64
 
65 22 mohor
`include "timescale.v"
66 15 mohor
 
67
 
68
module eth_macstatus(
69
                      MRxClk, Reset, ReceivedLengthOK, ReceiveEnd, TransmitEnd, ReceivedPacketGood, RxCrcError,
70
                      MRxErr, MRxDV, RxStateSFD, RxStateData, RxStatePreamble, RxStateIdle, Transmitting,
71
                      RxByteCnt, RxByteCntEq0, RxByteCntGreat2, RxByteCntMaxFrame, ReceivedPauseFrm
72
                    );
73
 
74
 
75
 
76
parameter Tp = 1;
77
 
78
 
79
input         MRxClk;
80
input         Reset;
81
input         RxCrcError;
82
input         MRxErr;
83
input         MRxDV;
84
 
85
input         RxStateSFD;
86
input   [1:0] RxStateData;
87
input         RxStatePreamble;
88
input         RxStateIdle;
89
input         Transmitting;
90
input  [15:0] RxByteCnt;
91
input         RxByteCntEq0;
92
input         RxByteCntGreat2;
93
input         RxByteCntMaxFrame;
94
input         ReceivedPauseFrm;
95
 
96
output        ReceivedLengthOK;
97
output        ReceiveEnd;
98
output        ReceivedPacketGood;
99
output        TransmitEnd;
100
 
101
reg           ReceiveEnd;
102
 
103
reg           LatchedCrcError;
104
reg           LatchedMRxErr;
105
reg           PreloadRxStatus;
106
reg    [15:0] LatchedRxByteCnt;
107
 
108
wire          TakeSample;
109
 
110
 
111
// Crc error
112
always @ (posedge MRxClk or posedge Reset)
113
begin
114
  if(Reset)
115
    LatchedCrcError <=#Tp 1'b0;
116
  else
117
    begin
118
      if(RxStateSFD)
119
        LatchedCrcError <=#Tp 1'b0;
120
      else
121
      if(RxStateData[0])
122
        LatchedCrcError <=#Tp RxCrcError & ~RxByteCntEq0;
123
    end
124
end
125
 
126
 
127
// LatchedMRxErr
128
always @ (posedge MRxClk or posedge Reset)
129
begin
130
  if(Reset)
131
    LatchedMRxErr <=#Tp 1'b0;
132
  else
133
  if(~MRxErr & MRxDV & RxStateIdle & ~Transmitting)
134
    LatchedMRxErr <=#Tp 1'b0;
135
  else
136 18 mohor
  if(MRxErr & MRxDV & (RxStatePreamble | RxStateSFD | (|RxStateData) | RxStateIdle & ~Transmitting))
137 15 mohor
    LatchedMRxErr <=#Tp 1'b1;
138
end
139
 
140
 
141
// ReceivedPacketGood
142
assign ReceivedPacketGood = ~LatchedCrcError & ~LatchedMRxErr;
143
 
144
 
145
// ReceivedLengthOK
146
assign ReceivedLengthOK = LatchedRxByteCnt[15:0] > 63 & LatchedRxByteCnt[15:0] < 1519;
147
 
148
 
149
 
150
// LatchedRxByteCnt[15:0]
151
always @ (posedge MRxClk or posedge Reset)
152
begin
153
  if(Reset)
154
    LatchedRxByteCnt[15:0] <=#Tp 16'h0;
155
  else
156
    begin
157
      if(RxStateSFD)
158
        LatchedRxByteCnt[15:0] <=#Tp RxByteCnt[15:0];
159
      else
160
      if(RxStateData[0])
161
        LatchedRxByteCnt[15:0] <=#Tp RxByteCnt[15:0];
162
    end
163
end
164
 
165
 
166
 
167
// Time to take a sample
168
assign TakeSample = |RxStateData     & ~MRxDV & RxByteCntGreat2  |
169
                     RxStateData[0]  &  MRxDV & RxByteCntMaxFrame;
170
 
171
 
172
// PreloadRxStatus
173
always @ (posedge MRxClk or posedge Reset)
174
begin
175
  if(Reset)
176
    PreloadRxStatus <=#Tp 1'b0;
177
  else
178
    PreloadRxStatus <=#Tp TakeSample;
179
end
180
 
181
 
182
 
183
// ReceiveEnd
184
always @ (posedge MRxClk or posedge Reset)
185
begin
186
  if(Reset)
187
    ReceiveEnd  <=#Tp 1'b0;
188
  else
189
    ReceiveEnd  <=#Tp PreloadRxStatus;
190
end
191
 
192
 
193
endmodule

powered by: WebSVN 2.1.0

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