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

Subversion Repositories ethmac

[/] [ethmac/] [tags/] [rel_14/] [rtl/] [verilog/] [eth_rxaddrcheck.v] - Blame information for rev 93

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

powered by: WebSVN 2.1.0

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