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 65

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

powered by: WebSVN 2.1.0

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