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

Subversion Repositories ethmac

[/] [ethmac/] [tags/] [rel_7/] [rtl/] [verilog/] [eth_rxaddrcheck.v] - Blame information for rev 338

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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