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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [ethmac/] [eth_rxaddrcheck.v] - Blame information for rev 794

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

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

powered by: WebSVN 2.1.0

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