1 |
23 |
ghutchis |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// MAC_rx.v ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the Ethernet IP core project ////
|
6 |
|
|
//// http://www.opencores.org/projects.cgi/web/ethernet_tri_mode/////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Author(s): ////
|
9 |
|
|
//// - Jon Gao (gaojon@yahoo.com) ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// ////
|
12 |
|
|
//////////////////////////////////////////////////////////////////////
|
13 |
|
|
//// ////
|
14 |
|
|
//// Copyright (C) 2001 Authors ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source file may be used and distributed without ////
|
17 |
|
|
//// restriction provided that this copyright statement is not ////
|
18 |
|
|
//// removed from the file and that any derivative work contains ////
|
19 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
20 |
|
|
//// ////
|
21 |
|
|
//// This source file is free software; you can redistribute it ////
|
22 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
23 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
24 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
25 |
|
|
//// later version. ////
|
26 |
|
|
//// ////
|
27 |
|
|
//// This source is distributed in the hope that it will be ////
|
28 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
29 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
30 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
31 |
|
|
//// details. ////
|
32 |
|
|
//// ////
|
33 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
34 |
|
|
//// Public License along with this source; if not, download it ////
|
35 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
36 |
|
|
//// ////
|
37 |
|
|
//////////////////////////////////////////////////////////////////////
|
38 |
|
|
//
|
39 |
|
|
// CVS Revision History
|
40 |
|
|
//
|
41 |
|
|
// $Log: MAC_rx.v,v $
|
42 |
|
|
// Revision 1.3 2006/01/19 14:07:52 maverickist
|
43 |
|
|
// verification is complete.
|
44 |
|
|
//
|
45 |
|
|
// Revision 1.2 2005/12/16 06:44:13 Administrator
|
46 |
|
|
// replaced tab with space.
|
47 |
|
|
// passed 9.6k length frame test.
|
48 |
|
|
//
|
49 |
|
|
// Revision 1.1.1.1 2005/12/13 01:51:44 Administrator
|
50 |
|
|
// no message
|
51 |
|
|
//
|
52 |
|
|
module MAC_rx (
|
53 |
|
|
input Reset ,
|
54 |
|
|
input Clk_user,
|
55 |
|
|
input Clk ,
|
56 |
|
|
//RMII interface
|
57 |
|
|
input MCrs_dv ,
|
58 |
|
|
input [7:0] MRxD ,
|
59 |
|
|
input MRxErr ,
|
60 |
|
|
//flow_control signals
|
61 |
|
|
output [15:0] pause_quanta ,
|
62 |
|
|
output pause_quanta_val ,
|
63 |
|
|
//user interface
|
64 |
|
|
output Rx_mac_ra ,
|
65 |
|
|
input Rx_mac_rd ,
|
66 |
|
|
output [31:0] Rx_mac_data ,
|
67 |
|
|
output [1:0] Rx_mac_BE ,
|
68 |
|
|
output Rx_mac_pa ,
|
69 |
|
|
output Rx_mac_sop ,
|
70 |
|
|
output Rx_mac_eop ,
|
71 |
|
|
//CPU
|
72 |
|
|
input MAC_rx_add_chk_en ,
|
73 |
|
|
input [7:0] MAC_add_prom_data ,
|
74 |
|
|
input [2:0] MAC_add_prom_add ,
|
75 |
|
|
input MAC_add_prom_wr ,
|
76 |
|
|
input broadcast_filter_en ,
|
77 |
|
|
input [15:0] broadcast_bucket_depth ,
|
78 |
|
|
input [15:0] broadcast_bucket_interval ,
|
79 |
|
|
input RX_APPEND_CRC,
|
80 |
|
|
input [4:0] Rx_Hwmark ,
|
81 |
|
|
input [4:0] Rx_Lwmark ,
|
82 |
|
|
input CRC_chk_en ,
|
83 |
|
|
input [5:0] RX_IFG_SET ,
|
84 |
|
|
input [15:0] RX_MAX_LENGTH ,// 1518
|
85 |
|
|
input [6:0] RX_MIN_LENGTH ,// 64
|
86 |
|
|
//RMON interface
|
87 |
|
|
output [15:0] Rx_pkt_length_rmon ,
|
88 |
|
|
output Rx_apply_rmon ,
|
89 |
|
|
output [2:0] Rx_pkt_err_type_rmon ,
|
90 |
|
|
output [2:0] Rx_pkt_type_rmon
|
91 |
|
|
);
|
92 |
|
|
//******************************************************************************
|
93 |
|
|
//internal signals
|
94 |
|
|
//******************************************************************************
|
95 |
|
|
//CRC_chk interface
|
96 |
|
|
wire CRC_en ;
|
97 |
|
|
wire CRC_init;
|
98 |
|
|
wire CRC_err ;
|
99 |
|
|
//MAC_rx_add_chk interface
|
100 |
|
|
wire MAC_add_en ;
|
101 |
|
|
wire MAC_rx_add_chk_err ;
|
102 |
|
|
//broadcast_filter
|
103 |
|
|
wire broadcast_ptr ;
|
104 |
|
|
wire broadcast_drop ;
|
105 |
|
|
//flow_control signals
|
106 |
|
|
//wire [15:0] pause_quanta ;
|
107 |
|
|
//wire pause_quanta_val ;
|
108 |
|
|
//MAC_rx_ctrl interface
|
109 |
|
|
wire [7:0] Fifo_data ;
|
110 |
|
|
wire Fifo_data_en ;
|
111 |
|
|
wire Fifo_full ;
|
112 |
|
|
wire Fifo_data_err ;
|
113 |
|
|
wire Fifo_data_end ;
|
114 |
|
|
//******************************************************************************
|
115 |
|
|
//instantiation
|
116 |
|
|
//******************************************************************************
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
MAC_rx_ctrl U_MAC_rx_ctrl(
|
120 |
|
|
.Reset (Reset ),
|
121 |
|
|
.Clk (Clk ),
|
122 |
|
|
//RMII interface ( //RMII interface ),
|
123 |
|
|
.MCrs_dv (MCrs_dv ),
|
124 |
|
|
.MRxD (MRxD ),
|
125 |
|
|
.MRxErr (MRxErr ),
|
126 |
|
|
//CRC_chk interface (//CRC_chk interface ),
|
127 |
|
|
.CRC_en (CRC_en ),
|
128 |
|
|
.CRC_init (CRC_init ),
|
129 |
|
|
.CRC_err (CRC_err ),
|
130 |
|
|
//MAC_rx_add_chk interface (//MAC_rx_add_chk interface),
|
131 |
|
|
.MAC_add_en (MAC_add_en ),
|
132 |
|
|
.MAC_rx_add_chk_err (MAC_rx_add_chk_err ),
|
133 |
|
|
//broadcast_filter (//broadcast_filter ),
|
134 |
|
|
.broadcast_ptr (broadcast_ptr ),
|
135 |
|
|
.broadcast_drop (broadcast_drop ),
|
136 |
|
|
//flow_control signals (//flow_control signals ),
|
137 |
|
|
.pause_quanta (pause_quanta ),
|
138 |
|
|
.pause_quanta_val (pause_quanta_val ),
|
139 |
|
|
//MAC_rx_FF interface (//MAC_rx_FF interface ),
|
140 |
|
|
.Fifo_data (Fifo_data ),
|
141 |
|
|
.Fifo_data_en (Fifo_data_en ),
|
142 |
|
|
.Fifo_data_err (Fifo_data_err ),
|
143 |
|
|
.Fifo_data_end (Fifo_data_end ),
|
144 |
|
|
.Fifo_full (Fifo_full ),
|
145 |
|
|
//RMON interface (//RMON interface ),
|
146 |
|
|
.Rx_pkt_type_rmon (Rx_pkt_type_rmon ),
|
147 |
|
|
.Rx_pkt_length_rmon (Rx_pkt_length_rmon ),
|
148 |
|
|
.Rx_apply_rmon (Rx_apply_rmon ),
|
149 |
|
|
.Rx_pkt_err_type_rmon (Rx_pkt_err_type_rmon ),
|
150 |
|
|
//CPU (//CPU ),
|
151 |
|
|
.RX_IFG_SET (RX_IFG_SET ),
|
152 |
|
|
.RX_MAX_LENGTH (RX_MAX_LENGTH ),
|
153 |
|
|
.RX_MIN_LENGTH (RX_MIN_LENGTH )
|
154 |
|
|
);
|
155 |
|
|
|
156 |
|
|
MAC_rx_FF U_MAC_rx_FF (
|
157 |
|
|
.Reset (Reset ),
|
158 |
|
|
.Clk_MAC (Clk ),
|
159 |
|
|
.Clk_SYS (Clk_user ),
|
160 |
|
|
//MAC_rx_ctrl interface (//MAC_rx_ctrl interface ),
|
161 |
|
|
.Fifo_data (Fifo_data ),
|
162 |
|
|
.Fifo_data_en (Fifo_data_en ),
|
163 |
|
|
.Fifo_full (Fifo_full ),
|
164 |
|
|
.Fifo_data_err (Fifo_data_err ),
|
165 |
|
|
.Fifo_data_end (Fifo_data_end ),
|
166 |
|
|
//CPU (//CPU ),
|
167 |
|
|
.Rx_Hwmark (Rx_Hwmark ),
|
168 |
|
|
.Rx_Lwmark (Rx_Lwmark ),
|
169 |
|
|
.RX_APPEND_CRC (RX_APPEND_CRC ),
|
170 |
|
|
//user interface (//user interface ),
|
171 |
|
|
.Rx_mac_ra (Rx_mac_ra ),
|
172 |
|
|
.Rx_mac_rd (Rx_mac_rd ),
|
173 |
|
|
.Rx_mac_data (Rx_mac_data ),
|
174 |
|
|
.Rx_mac_BE (Rx_mac_BE ),
|
175 |
|
|
.Rx_mac_sop (Rx_mac_sop ),
|
176 |
|
|
.Rx_mac_pa (Rx_mac_pa ),
|
177 |
|
|
.Rx_mac_eop (Rx_mac_eop )
|
178 |
|
|
);
|
179 |
|
|
|
180 |
|
|
`ifdef MAC_BROADCAST_FILTER_EN
|
181 |
|
|
Broadcast_filter U_Broadcast_filter(
|
182 |
|
|
.Reset (Reset ),
|
183 |
|
|
.Clk (Clk ),
|
184 |
|
|
//MAC_rx_ctrl (//MAC_rx_ctrl ),
|
185 |
|
|
.broadcast_ptr (broadcast_ptr ),
|
186 |
|
|
.broadcast_drop (broadcast_drop ),
|
187 |
|
|
//FromCPU (//FromCPU ),
|
188 |
|
|
.broadcast_filter_en (broadcast_filter_en ),
|
189 |
|
|
.broadcast_bucket_depth (broadcast_bucket_depth ),
|
190 |
|
|
.broadcast_bucket_interval (broadcast_bucket_interval )
|
191 |
|
|
);
|
192 |
|
|
`else
|
193 |
|
|
assign broadcast_drop=0;
|
194 |
|
|
`endif
|
195 |
|
|
|
196 |
|
|
CRC_chk U_CRC_chk(
|
197 |
|
|
.Reset (Reset ),
|
198 |
|
|
.Clk (Clk ),
|
199 |
|
|
.CRC_data (Fifo_data ),
|
200 |
|
|
.CRC_init (CRC_init ),
|
201 |
|
|
.CRC_en (CRC_en ),
|
202 |
|
|
//From CPU (//From CPU ),
|
203 |
|
|
.CRC_chk_en (CRC_chk_en ),
|
204 |
|
|
.CRC_err (CRC_err )
|
205 |
|
|
);
|
206 |
|
|
|
207 |
|
|
`ifdef MAC_TARGET_CHECK_EN
|
208 |
|
|
MAC_rx_add_chk U_MAC_rx_add_chk(
|
209 |
|
|
.Reset (Reset ),
|
210 |
|
|
.Clk (Clk ),
|
211 |
|
|
.Init (CRC_init ),
|
212 |
|
|
.data (Fifo_data ),
|
213 |
|
|
.MAC_add_en (MAC_add_en ),
|
214 |
|
|
.MAC_rx_add_chk_err (MAC_rx_add_chk_err ),
|
215 |
|
|
//From CPU (//From CPU ),
|
216 |
|
|
.MAC_rx_add_chk_en (MAC_rx_add_chk_en ),
|
217 |
|
|
.MAC_add_prom_data (MAC_add_prom_data ),
|
218 |
|
|
.MAC_add_prom_add (MAC_add_prom_add ),
|
219 |
|
|
.MAC_add_prom_wr (MAC_add_prom_wr )
|
220 |
|
|
);
|
221 |
|
|
`else
|
222 |
|
|
assign MAC_rx_add_chk_err=0;
|
223 |
|
|
`endif
|
224 |
|
|
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
endmodule
|