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

Subversion Repositories ts7300_opencore

[/] [ts7300_opencore/] [trunk/] [ethernet/] [eth_rxaddrcheck.v] - Blame information for rev 6

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

Line No. Rev Author Line
1 2 joff
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  eth_rxaddrcheck.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
////      - Bill Dittenhofer (billditt@aol.com)                   ////
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
// Revision 1.9  2002/11/22 01:57:06  mohor
45
// Rx Flow control fixed. CF flag added to the RX buffer descriptor. RxAbort
46
// synchronized.
47
//
48
// Revision 1.8  2002/11/19 17:34:52  mohor
49
// AddressMiss status is connecting to the Rx BD. AddressMiss is identifying
50
// that a frame was received because of the promiscous mode.
51
//
52
// Revision 1.7  2002/09/04 18:41:06  mohor
53
// Bug when last byte of destination address was not checked fixed.
54
//
55
// Revision 1.6  2002/03/20 15:14:11  mohor
56
// When in promiscous mode some frames were not received correctly. Fixed.
57
//
58
// Revision 1.5  2002/03/02 21:06:32  mohor
59
// Log info was missing.
60
//
61
//
62
// Revision 1.1  2002/02/08 12:51:54  ditt
63
// Initial release of the ethernet addresscheck module.
64
//
65
//
66
//
67
//
68
//
69
 
70
 
71
`include "timescale.v"
72
 
73
 
74
module eth_rxaddrcheck(MRxClk,  Reset, RxData, Broadcast ,r_Bro ,r_Pro,
75
                       ByteCntEq2, ByteCntEq3, ByteCntEq4, ByteCntEq5,
76
                       ByteCntEq6, ByteCntEq7, HASH0, HASH1,
77
                       CrcHash,    CrcHashGood, StateData, RxEndFrm,
78
                       Multicast, MAC, RxAbort, AddressMiss, PassAll,
79
                       ControlFrmAddressOK
80
                      );
81
 
82
parameter Tp = 1;
83
 
84
  input        MRxClk;
85
  input        Reset;
86
  input [7:0]  RxData;
87
  input        Broadcast;
88
  input        r_Bro;
89
  input        r_Pro;
90
  input        ByteCntEq2;
91
  input        ByteCntEq3;
92
  input        ByteCntEq4;
93
  input        ByteCntEq5;
94
  input        ByteCntEq6;
95
  input        ByteCntEq7;
96
  input [31:0] HASH0;
97
  input [31:0] HASH1;
98
  input [5:0]  CrcHash;
99
  input        CrcHashGood;
100
  input        Multicast;
101
  input [47:0] MAC;
102
  input [1:0]  StateData;
103
  input        RxEndFrm;
104
  input        PassAll;
105
  input        ControlFrmAddressOK;
106
 
107
  output       RxAbort;
108
  output       AddressMiss;
109
 
110
 wire BroadcastOK;
111
 wire ByteCntEq2;
112
 wire ByteCntEq3;
113
 wire ByteCntEq4;
114
 wire ByteCntEq5;
115
 wire RxAddressInvalid;
116
 wire RxCheckEn;
117
 wire HashBit;
118
 wire [31:0] IntHash;
119
 reg [7:0]  ByteHash;
120
 reg MulticastOK;
121
 reg UnicastOK;
122
 reg RxAbort;
123
 reg AddressMiss;
124
 
125
assign RxAddressInvalid = ~(UnicastOK | BroadcastOK | MulticastOK | r_Pro);
126
 
127
assign BroadcastOK = Broadcast & ~r_Bro;
128
 
129
assign RxCheckEn   = | StateData;
130
 
131
 // Address Error Reported at end of address cycle
132
 // RxAbort clears after one cycle
133
 
134
always @ (posedge MRxClk or posedge Reset)
135
begin
136
  if(Reset)
137
    RxAbort <= #Tp 1'b0;
138
  else if(RxAddressInvalid & ByteCntEq7 & RxCheckEn)
139
    RxAbort <= #Tp 1'b1;
140
  else
141
    RxAbort <= #Tp 1'b0;
142
end
143
 
144
 
145
// This ff holds the "Address Miss" information that is written to the RX BD status.
146
always @ (posedge MRxClk or posedge Reset)
147
begin
148
  if(Reset)
149
    AddressMiss <= #Tp 1'b0;
150
  else if(ByteCntEq7 & RxCheckEn)
151
    AddressMiss <= #Tp (~(UnicastOK | BroadcastOK | MulticastOK | (PassAll & ControlFrmAddressOK)));
152
end
153
 
154
 
155
// Hash Address Check, Multicast
156
always @ (posedge MRxClk or posedge Reset)
157
begin
158
  if(Reset)
159
    MulticastOK <= #Tp 1'b0;
160
  else if(RxEndFrm | RxAbort)
161
    MulticastOK <= #Tp 1'b0;
162
  else if(CrcHashGood & Multicast)
163
    MulticastOK <= #Tp HashBit;
164
end
165
 
166
 
167
// Address Detection (unicast)
168
// start with ByteCntEq2 due to delay of addres from RxData
169
always @ (posedge MRxClk or posedge Reset)
170
begin
171
  if(Reset)
172
    UnicastOK <= #Tp 1'b0;
173
  else
174
  if(RxCheckEn & ByteCntEq2)
175
    UnicastOK <= #Tp   RxData[7:0] == MAC[47:40];
176
  else
177
  if(RxCheckEn & ByteCntEq3)
178
    UnicastOK <= #Tp ( RxData[7:0] == MAC[39:32]) & UnicastOK;
179
  else
180
  if(RxCheckEn & ByteCntEq4)
181
    UnicastOK <= #Tp ( RxData[7:0] == MAC[31:24]) & UnicastOK;
182
  else
183
  if(RxCheckEn & ByteCntEq5)
184
    UnicastOK <= #Tp ( RxData[7:0] == MAC[23:16]) & UnicastOK;
185
  else
186
  if(RxCheckEn & ByteCntEq6)
187
    UnicastOK <= #Tp ( RxData[7:0] == MAC[15:8])  & UnicastOK;
188
  else
189
  if(RxCheckEn & ByteCntEq7)
190
    UnicastOK <= #Tp ( RxData[7:0] == MAC[7:0])   & UnicastOK;
191
  else
192
  if(RxEndFrm | RxAbort)
193
    UnicastOK <= #Tp 1'b0;
194
end
195
 
196
assign IntHash = (CrcHash[5])? HASH1 : HASH0;
197
 
198
always@(CrcHash or IntHash)
199
begin
200
  case(CrcHash[4:3])
201
    2'b00: ByteHash = IntHash[7:0];
202
    2'b01: ByteHash = IntHash[15:8];
203
    2'b10: ByteHash = IntHash[23:16];
204
    2'b11: ByteHash = IntHash[31:24];
205
  endcase
206
end
207
 
208
assign HashBit = ByteHash[CrcHash[2:0]];
209
 
210
 
211
endmodule

powered by: WebSVN 2.1.0

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