OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [rtl/] [src_peripheral/] [ethmac/] [rtl/] [eth_rxaddrcheck.v] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  eth_rxaddrcheck.v                                           ////
4
////                                                              ////
5
////  This file is part of the Ethernet IP core project           ////
6
////  http://www.opencores.org/project,ethmac/                    ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Bill Dittenhofer (billditt@aol.com)                   ////
10
////      - Olof Kindgren    (olof@opencores.org)                 ////
11
////                                                              ////
12
////  All additional information is avaliable in the Readme.txt   ////
13
////  file.                                                       ////
14
////                                                              ////
15
//////////////////////////////////////////////////////////////////////
16
////                                                              ////
17
//// Copyright (C) 2001, 2011 Authors                             ////
18
////                                                              ////
19
//// This source file may be used and distributed without         ////
20
//// restriction provided that this copyright statement is not    ////
21
//// removed from the file and that any derivative work contains  ////
22
//// the original copyright notice and the associated disclaimer. ////
23
////                                                              ////
24
//// This source file is free software; you can redistribute it   ////
25
//// and/or modify it under the terms of the GNU Lesser General   ////
26
//// Public License as published by the Free Software Foundation; ////
27
//// either version 2.1 of the License, or (at your option) any   ////
28
//// later version.                                               ////
29
////                                                              ////
30
//// This source is distributed in the hope that it will be       ////
31
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
32
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
33
//// PURPOSE.  See the GNU Lesser General Public License for more ////
34
//// details.                                                     ////
35
////                                                              ////
36
//// You should have received a copy of the GNU Lesser General    ////
37
//// Public License along with this source; if not, download it   ////
38
//// from http://www.opencores.org/lgpl.shtml                     ////
39
////                                                              ////
40
//////////////////////////////////////////////////////////////////////
41
//
42
// 2011-07-06 Olof Kindgren <olof@opencores.org>
43
// Reset AdressMiss when a new frame arrives. Otherwise it will report
44
// the last value when a frame is less than seven bytes
45
//
46
// CVS Revision History
47
//
48
// $Log: not supported by cvs2svn $
49
// Revision 1.8  2002/11/19 17:34:52  mohor
50
// AddressMiss status is connecting to the Rx BD. AddressMiss is identifying
51
// that a frame was received because of the promiscous mode.
52
//
53
// Revision 1.7  2002/09/04 18:41:06  mohor
54
// Bug when last byte of destination address was not checked fixed.
55
//
56
// Revision 1.6  2002/03/20 15:14:11  mohor
57
// When in promiscous mode some frames were not received correctly. Fixed.
58
//
59
// Revision 1.5  2002/03/02 21:06:32  mohor
60
// Log info was missing.
61
//
62
//
63
// Revision 1.1  2002/02/08 12:51:54  ditt
64
// Initial release of the ethernet addresscheck module.
65
//
66
//
67
//
68
//
69
//
70
 
71
 
72
`include "timescale.v"
73
 
74
 
75
module eth_rxaddrcheck(MRxClk,  Reset, RxData, Broadcast ,r_Bro ,r_Pro,
76
                       ByteCntEq2, ByteCntEq3, ByteCntEq4, ByteCntEq5,
77
                       ByteCntEq6, ByteCntEq7, HASH0, HASH1, ByteCntEq0,
78
                       CrcHash,    CrcHashGood, StateData, RxEndFrm,
79
                       Multicast, MAC, RxAbort, AddressMiss, PassAll,
80
                       ControlFrmAddressOK
81
                      );
82
 
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        ByteCntEq0;
91
  input        ByteCntEq2;
92
  input        ByteCntEq3;
93
  input        ByteCntEq4;
94
  input        ByteCntEq5;
95
  input        ByteCntEq6;
96
  input        ByteCntEq7;
97
  input [31:0] HASH0;
98
  input [31:0] HASH1;
99
  input [5:0]  CrcHash;
100
  input        CrcHashGood;
101
  input        Multicast;
102
  input [47:0] MAC;
103
  input [1:0]  StateData;
104
  input        RxEndFrm;
105
  input        PassAll;
106
  input        ControlFrmAddressOK;
107
 
108
  output       RxAbort;
109
  output       AddressMiss;
110
 
111
 wire BroadcastOK;
112
 wire ByteCntEq2;
113
 wire ByteCntEq3;
114
 wire ByteCntEq4;
115
 wire ByteCntEq5;
116
 wire RxAddressInvalid;
117
 wire RxCheckEn;
118
 wire HashBit;
119
 wire [31:0] IntHash;
120
 reg [7:0]  ByteHash;
121
 reg MulticastOK;
122
 reg UnicastOK;
123
 reg RxAbort;
124
 reg AddressMiss;
125
 
126
assign RxAddressInvalid = ~(UnicastOK | BroadcastOK | MulticastOK | r_Pro);
127
 
128
assign BroadcastOK = Broadcast & ~r_Bro;
129
 
130
assign RxCheckEn   = | StateData;
131
 
132
 // Address Error Reported at end of address cycle
133
 // RxAbort clears after one cycle
134
 
135
always @ (posedge MRxClk or posedge Reset)
136
begin
137
  if(Reset)
138
    RxAbort <=  1'b0;
139
  else if(RxAddressInvalid & ByteCntEq7 & RxCheckEn)
140
    RxAbort <=  1'b1;
141
  else
142
    RxAbort <=  1'b0;
143
end
144
 
145
 
146
// This ff holds the "Address Miss" information that is written to the RX BD status.
147
always @ (posedge MRxClk or posedge Reset)
148
begin
149
  if(Reset)
150
    AddressMiss <=  1'b0;
151
  else if(ByteCntEq0)
152
    AddressMiss <=  1'b0;
153
  else if(ByteCntEq7 & RxCheckEn)
154
    AddressMiss <=  (~(UnicastOK | BroadcastOK | MulticastOK | (PassAll & ControlFrmAddressOK)));
155
end
156
 
157
 
158
// Hash Address Check, Multicast
159
always @ (posedge MRxClk or posedge Reset)
160
begin
161
  if(Reset)
162
    MulticastOK <=  1'b0;
163
  else if(RxEndFrm | RxAbort)
164
    MulticastOK <=  1'b0;
165
  else if(CrcHashGood & Multicast)
166
    MulticastOK <=  HashBit;
167
end
168
 
169
 
170
// Address Detection (unicast)
171
// start with ByteCntEq2 due to delay of addres from RxData
172
always @ (posedge MRxClk or posedge Reset)
173
begin
174
  if(Reset)
175
    UnicastOK <=  1'b0;
176
  else
177
  if(RxCheckEn & ByteCntEq2)
178
    UnicastOK <=    RxData[7:0] == MAC[47:40];
179
  else
180
  if(RxCheckEn & ByteCntEq3)
181
    UnicastOK <=  ( RxData[7:0] == MAC[39:32]) & UnicastOK;
182
  else
183
  if(RxCheckEn & ByteCntEq4)
184
    UnicastOK <=  ( RxData[7:0] == MAC[31:24]) & UnicastOK;
185
  else
186
  if(RxCheckEn & ByteCntEq5)
187
    UnicastOK <=  ( RxData[7:0] == MAC[23:16]) & UnicastOK;
188
  else
189
  if(RxCheckEn & ByteCntEq6)
190
    UnicastOK <=  ( RxData[7:0] == MAC[15:8])  & UnicastOK;
191
  else
192
  if(RxCheckEn & ByteCntEq7)
193
    UnicastOK <=  ( RxData[7:0] == MAC[7:0])   & UnicastOK;
194
  else
195
  if(RxEndFrm | RxAbort)
196
    UnicastOK <=  1'b0;
197
end
198
 
199
assign IntHash = (CrcHash[5])? HASH1 : HASH0;
200
 
201
always@(CrcHash or IntHash)
202
begin
203
  case(CrcHash[4:3])
204
    2'b00: ByteHash = IntHash[7:0];
205
    2'b01: ByteHash = IntHash[15:8];
206
    2'b10: ByteHash = IntHash[23:16];
207
    2'b11: ByteHash = IntHash[31:24];
208
  endcase
209
end
210
 
211
assign HashBit = ByteHash[CrcHash[2:0]];
212
 
213
 
214
endmodule

powered by: WebSVN 2.1.0

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