Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: fflp_hdr_dp.v | |
4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | // | |
7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | // | |
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; version 2 of the License. | |
12 | // | |
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | // | |
22 | // For the avoidance of doubt, and except that if any non-GPL license | |
23 | // choice is available it will apply instead, Sun elects to use only | |
24 | // the General Public License version 2 (GPLv2) at this time for any | |
25 | // software where a choice of GPL license versions is made | |
26 | // available with the language indicating that GPLv2 or any later version | |
27 | // may be used, or where a choice of which version of the GPL is applied is | |
28 | // otherwise unspecified. | |
29 | // | |
30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | // CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | // have any questions. | |
33 | // | |
34 | // ========== Copyright Header End ============================================ | |
35 | /**********************************************************************/ | |
36 | /*project name: N2 */ | |
37 | /*module name: fflp_hdr_dp */ | |
38 | /*description: datapath for header bus and information decoded */ | |
39 | /* from them */ | |
40 | /* */ | |
41 | /*parent module in: fflp_hdr.v */ | |
42 | /*child modules in: none */ | |
43 | /*interface modules: */ | |
44 | /*author name: Jeanne Cai */ | |
45 | /*date created: 03-10-2004 */ | |
46 | /* */ | |
47 | /* Copyright (c) 2004, Sun Microsystems, Inc. */ | |
48 | /* Sun Proprietary and Confidential */ | |
49 | /* */ | |
50 | /*modifications: */ | |
51 | /**********************************************************************/ | |
52 | ||
53 | `include "fflp.h" | |
54 | ||
55 | module fflp_hdr_dp ( | |
56 | cclk, | |
57 | reset, | |
58 | ipp_fflp_data, | |
59 | ipp_fflp_mac_default, | |
60 | ipp_fflp_mac_port, | |
61 | shft0_reg_en, | |
62 | shft1_reg_en, | |
63 | shft2_reg_en, | |
64 | shft3_reg_en, | |
65 | shft4_reg_en, | |
66 | shft5_reg_en, | |
67 | shft6_reg_en, | |
68 | shft7_reg_en, | |
69 | hdr_shft_done, | |
70 | fwd_sched, | |
71 | snap_en, | |
72 | disable_chksum, | |
73 | ||
74 | class2_hdr_byte_value, | |
75 | class3_hdr_byte_value, | |
76 | class4_hdr_byte_value, | |
77 | class5_hdr_byte_value, | |
78 | class6_hdr_byte_value, | |
79 | class7_hdr_byte_value, | |
80 | class_action_reg4_dout, | |
81 | class_action_reg5_dout, | |
82 | class_action_reg6_dout, | |
83 | class_action_reg7_dout, | |
84 | class_action_reg8_dout, | |
85 | class_action_reg9_dout, | |
86 | class_action_reg10_dout, | |
87 | class_action_reg11_dout, | |
88 | class_action_reg12_dout, | |
89 | class_action_reg13_dout, | |
90 | class_action_reg14_dout, | |
91 | class_action_reg15_dout, | |
92 | f_key_class_action_reg4_dout, | |
93 | f_key_class_action_reg5_dout, | |
94 | f_key_class_action_reg6_dout, | |
95 | f_key_class_action_reg7_dout, | |
96 | f_key_class_action_reg8_dout, | |
97 | f_key_class_action_reg9_dout, | |
98 | f_key_class_action_reg10_dout, | |
99 | f_key_class_action_reg11_dout, | |
100 | f_key_class_action_reg12_dout, | |
101 | f_key_class_action_reg13_dout, | |
102 | f_key_class_action_reg14_dout, | |
103 | f_key_class_action_reg15_dout, | |
104 | hdr_ctrl_bit_mask_reg_dout, | |
105 | cpu_vlan_req, | |
106 | cpu_vlan_rd, | |
107 | cpu_vlan_wr, | |
108 | cpu_vlan_addr, | |
109 | vlan_tbl_rd_din, | |
110 | ||
111 | fwd_req, | |
112 | key_bus, | |
113 | fwd_info_bus, | |
114 | hdr_fifo_space_avail, | |
115 | hdr_fifo_full, | |
116 | fflp_ipp_dvalid, | |
117 | fflp_ipp_data, | |
118 | vlan_tbl_cs, | |
119 | vlan_tbl_wr, | |
120 | vlan_tbl_addr, | |
121 | vlan_tbl_din_reg_dout, | |
122 | vlan_parity_err_log_en, | |
123 | vlan_tag_id, | |
124 | cpu_vlan_gnt_3 | |
125 | ||
126 | ); | |
127 | ||
128 | input cclk; | |
129 | input reset; | |
130 | input[127:0] ipp_fflp_data; | |
131 | input[11:0] ipp_fflp_mac_default; | |
132 | input[1:0] ipp_fflp_mac_port; | |
133 | input shft0_reg_en; | |
134 | input shft1_reg_en; | |
135 | input shft2_reg_en; | |
136 | input shft3_reg_en; | |
137 | input shft4_reg_en; | |
138 | input shft5_reg_en; | |
139 | input shft6_reg_en; | |
140 | input shft7_reg_en; | |
141 | input hdr_shft_done; | |
142 | input fwd_sched; | |
143 | input snap_en; | |
144 | input disable_chksum; | |
145 | ||
146 | input[16:0] class2_hdr_byte_value; | |
147 | input[16:0] class3_hdr_byte_value; | |
148 | input[25:0] class4_hdr_byte_value; | |
149 | input[25:0] class5_hdr_byte_value; | |
150 | input[25:0] class6_hdr_byte_value; | |
151 | input[25:0] class7_hdr_byte_value; | |
152 | ||
153 | input[2:0] class_action_reg4_dout; | |
154 | input[2:0] class_action_reg5_dout; | |
155 | input[2:0] class_action_reg6_dout; | |
156 | input[2:0] class_action_reg7_dout; | |
157 | input[2:0] class_action_reg8_dout; | |
158 | input[2:0] class_action_reg9_dout; | |
159 | input[2:0] class_action_reg10_dout; | |
160 | input[2:0] class_action_reg11_dout; | |
161 | input[2:0] class_action_reg12_dout; | |
162 | input[2:0] class_action_reg13_dout; | |
163 | input[2:0] class_action_reg14_dout; | |
164 | input[2:0] class_action_reg15_dout; | |
165 | input[9:0] f_key_class_action_reg4_dout; | |
166 | input[9:0] f_key_class_action_reg5_dout; | |
167 | input[9:0] f_key_class_action_reg6_dout; | |
168 | input[9:0] f_key_class_action_reg7_dout; | |
169 | input[9:0] f_key_class_action_reg8_dout; | |
170 | input[9:0] f_key_class_action_reg9_dout; | |
171 | input[9:0] f_key_class_action_reg10_dout; | |
172 | input[9:0] f_key_class_action_reg11_dout; | |
173 | input[9:0] f_key_class_action_reg12_dout; | |
174 | input[9:0] f_key_class_action_reg13_dout; | |
175 | input[9:0] f_key_class_action_reg14_dout; | |
176 | input[9:0] f_key_class_action_reg15_dout; | |
177 | input[11:0] hdr_ctrl_bit_mask_reg_dout; | |
178 | input cpu_vlan_req; | |
179 | input cpu_vlan_rd; | |
180 | input cpu_vlan_wr; | |
181 | input[11:0] cpu_vlan_addr; | |
182 | input[17:0] vlan_tbl_rd_din; | |
183 | ||
184 | output fwd_req; | |
185 | output[199:0] key_bus; | |
186 | output[445:0] fwd_info_bus; | |
187 | output hdr_fifo_space_avail; | |
188 | output hdr_fifo_full; | |
189 | output[3:0] fflp_ipp_dvalid; | |
190 | output[15:0] fflp_ipp_data; | |
191 | output vlan_tbl_cs; | |
192 | output vlan_tbl_wr; | |
193 | output[11:0] vlan_tbl_addr; | |
194 | output[17:0] vlan_tbl_din_reg_dout; | |
195 | output vlan_parity_err_log_en; | |
196 | output[11:0] vlan_tag_id; | |
197 | output cpu_vlan_gnt_3; | |
198 | ||
199 | wire hdr_fifo_cnt_en; | |
200 | wire[2:0] hdr_fifo_cnt_in; | |
201 | wire[2:0] hdr_fifo_cnt; | |
202 | wire[199:0] key_bus; | |
203 | wire[445:0] fwd_info_bus; | |
204 | ||
205 | reg[7:0] shft0_tmp12_dout; | |
206 | reg[7:0] shft0_tmp13_dout; | |
207 | reg[7:0] shft0_tmp14_dout; | |
208 | reg[7:0] shft0_tmp15_dout; | |
209 | ||
210 | reg[7:0] shft1_tmp0_dout; | |
211 | reg[7:0] shft1_tmp1_dout; | |
212 | reg[7:0] shft1_tmp2_dout; | |
213 | reg[7:0] shft1_tmp3_dout; | |
214 | reg[7:0] shft1_tmp4_dout; | |
215 | reg[7:0] shft1_tmp5_dout; | |
216 | reg[7:0] shft1_tmp6_dout; | |
217 | reg[7:0] shft1_tmp7_dout; | |
218 | reg[7:0] shft1_tmp8_dout; | |
219 | reg[7:0] shft1_tmp9_dout; | |
220 | reg[7:0] shft1_tmp10_dout; | |
221 | reg[7:0] shft1_tmp11_dout; | |
222 | reg[7:0] shft1_tmp12_dout; | |
223 | reg[7:0] shft1_tmp13_dout; | |
224 | reg[7:0] shft1_tmp14_dout; | |
225 | reg[7:0] shft1_tmp15_dout; | |
226 | ||
227 | reg[7:0] shft2_tmp0_dout; | |
228 | reg[7:0] shft2_tmp1_dout; | |
229 | reg[7:0] shft2_tmp2_dout; | |
230 | reg[7:0] shft2_tmp3_dout; | |
231 | reg[7:0] shft2_tmp4_dout; | |
232 | reg[7:0] shft2_tmp5_dout; | |
233 | reg[7:0] shft2_tmp6_dout; | |
234 | reg[7:0] shft2_tmp7_dout; | |
235 | reg[7:0] shft2_tmp8_dout; | |
236 | reg[7:0] shft2_tmp9_dout; | |
237 | reg[7:0] shft2_tmp10_dout; | |
238 | reg[7:0] shft2_tmp11_dout; | |
239 | reg[7:0] shft2_tmp12_dout; | |
240 | reg[7:0] shft2_tmp13_dout; | |
241 | reg[7:0] shft2_tmp14_dout; | |
242 | reg[7:0] shft2_tmp15_dout; | |
243 | ||
244 | reg[7:0] shft3_tmp0_dout; | |
245 | reg[7:0] shft3_tmp1_dout; | |
246 | reg[7:0] shft3_tmp2_dout; | |
247 | reg[7:0] shft3_tmp3_dout; | |
248 | reg[7:0] shft3_tmp4_dout; | |
249 | reg[7:0] shft3_tmp5_dout; | |
250 | reg[7:0] shft3_tmp6_dout; | |
251 | reg[7:0] shft3_tmp7_dout; | |
252 | reg[7:0] shft3_tmp8_dout; | |
253 | reg[7:0] shft3_tmp9_dout; | |
254 | reg[7:0] shft3_tmp10_dout; | |
255 | reg[7:0] shft3_tmp11_dout; | |
256 | reg[7:0] shft3_tmp12_dout; | |
257 | reg[7:0] shft3_tmp13_dout; | |
258 | reg[7:0] shft3_tmp14_dout; | |
259 | reg[7:0] shft3_tmp15_dout; | |
260 | ||
261 | reg[7:0] shft4_tmp0_dout; | |
262 | reg[7:0] shft4_tmp1_dout; | |
263 | reg[7:0] shft4_tmp2_dout; | |
264 | reg[7:0] shft4_tmp3_dout; | |
265 | reg[7:0] shft4_tmp4_dout; | |
266 | reg[7:0] shft4_tmp5_dout; | |
267 | reg[7:0] shft4_tmp6_dout; | |
268 | reg[7:0] shft4_tmp7_dout; | |
269 | reg[7:0] shft4_tmp8_dout; | |
270 | reg[7:0] shft4_tmp9_dout; | |
271 | reg[7:0] shft4_tmp10_dout; | |
272 | reg[7:0] shft4_tmp11_dout; | |
273 | reg[7:0] shft4_tmp12_dout; | |
274 | reg[7:0] shft4_tmp13_dout; | |
275 | reg[7:0] shft4_tmp14_dout; | |
276 | reg[7:0] shft4_tmp15_dout; | |
277 | ||
278 | reg[7:0] shft5_tmp0_dout; | |
279 | reg[7:0] shft5_tmp1_dout; | |
280 | reg[7:0] shft5_tmp2_dout; | |
281 | reg[7:0] shft5_tmp3_dout; | |
282 | //reg[7:0] shft5_tmp4_dout; | |
283 | //reg[7:0] shft5_tmp5_dout; | |
284 | reg[7:0] shft5_tmp6_dout; | |
285 | reg[7:0] shft5_tmp7_dout; | |
286 | ||
287 | wire[1:0] encap_offset_reg; | |
288 | wire[1:0] ether_type_in; | |
289 | wire[1:0] ether_type; | |
290 | wire[4:0] class; | |
291 | ||
292 | wire[4:0] v4_protocol_in; | |
293 | wire[4:0] v6_next_hdr_in; | |
294 | ||
295 | wire[4:0] v4_protocol; | |
296 | wire[4:0] v6_next_hdr; | |
297 | wire[1:0] l4_protocol_r; | |
298 | ||
299 | wire[7:0] shft2_tmp2_dout_r; | |
300 | wire[7:0] shft2_tmp3_dout_r; | |
301 | wire[3:0] ipv4_ip_hdr_len_r; | |
302 | wire[3:0] ipv4_ip_hdr_len_r0; | |
303 | wire[15:0] ipv4_ip_pkt_len_r; | |
304 | wire noport_r; | |
305 | wire badip_r; | |
306 | ||
307 | wire[15:0] shft0_tmp1312_trans_r; | |
308 | wire[15:0] valid_hdr_class_match_in; | |
309 | wire[15:0] valid_hdr_class_match; | |
310 | wire[16:0] addr_ind_hdr_byte_masked4_r; | |
311 | wire[16:0] addr_ind_hdr_byte_masked5_r; | |
312 | wire[16:0] addr_ind_hdr_byte_masked6_r; | |
313 | wire[16:0] addr_ind_hdr_byte_masked7_r; | |
314 | ||
315 | reg[2:0] l2_rdc_num; | |
316 | wire[2:0] l2_rdc_num_r; | |
317 | ||
318 | reg[31:0] v4_tcp_port_01; | |
319 | reg[31:0] v4_tcp_port_10; | |
320 | reg[31:0] v4_tcp_port_11; | |
321 | reg[31:0] v4_tcp_port; | |
322 | wire[31:0] v4_tcp_port_01_r; | |
323 | wire[31:0] v4_tcp_port_10_r; | |
324 | wire[31:0] v4_tcp_port_r; | |
325 | ||
326 | wire[7:0] ipv4_tos_r; | |
327 | wire[7:0] ipv4_protocol_r; | |
328 | wire[31:0] ipv4_src_addr_r; | |
329 | wire[31:0] ipv4_dest_addr_r; | |
330 | //wire[31:0] ipv4_ah_spi_r; | |
331 | //wire[31:0] ipv4_esp_spi_r; | |
332 | ||
333 | wire[7:0] ipv6_tos_r; | |
334 | wire[7:0] ipv6_next_hdr_r; | |
335 | wire[127:0] ipv6_src_addr_r; | |
336 | wire[127:0] ipv6_dest_addr_r; | |
337 | wire[15:0] ipv6_tcp_src_port_r; | |
338 | wire[15:0] ipv6_tcp_dest_port_r; | |
339 | //wire[31:0] ipv6_ah_spi_r; | |
340 | //wire[31:0] ipv6_esp_spi_r; | |
341 | wire[31:0] v6_tcp_port_r; | |
342 | ||
343 | wire[87:0] raw_cam_key_r; | |
344 | wire do_raw_key_r; | |
345 | wire[2:0] class_action_r; | |
346 | wire[199:0] tcam_key_r; | |
347 | wire[9:0] f_key_class_action_r; | |
348 | wire[361:0] flow_key_r; | |
349 | ||
350 | reg[31:0] v4_seq_num_01; | |
351 | reg[31:0] v4_seq_num_10; | |
352 | reg[31:0] v4_seq_num_11; | |
353 | reg[31:0] v4_seq_num; | |
354 | wire[31:0] v4_seq_num_01_r; | |
355 | wire[31:0] v4_seq_num_10_r; | |
356 | wire[31:0] v4_seq_num_r; | |
357 | ||
358 | wire[31:0] v6_seq_num; | |
359 | wire[31:0] v6_seq_num_r; | |
360 | ||
361 | reg[3:0] v4_tcp_len_01; | |
362 | reg[3:0] v4_tcp_len_10; | |
363 | reg[3:0] v4_tcp_len_11; | |
364 | reg[3:0] v4_tcp_len; | |
365 | wire[3:0] v4_tcp_len_01_r; | |
366 | wire[3:0] v4_tcp_len_10_r; | |
367 | wire[3:0] v4_tcp_len_r; | |
368 | ||
369 | wire[3:0] v6_tcp_len; | |
370 | wire[3:0] v6_tcp_len_r; | |
371 | ||
372 | reg[11:0] v4_tcp_flag_01; | |
373 | reg[11:0] v4_tcp_flag_10; | |
374 | reg[11:0] v4_tcp_flag_11; | |
375 | reg[11:0] v4_tcp_flag; | |
376 | wire[11:0] v4_tcp_flag_01_r; | |
377 | wire[11:0] v4_tcp_flag_10_r; | |
378 | wire[11:0] v4_tcp_flag_r; | |
379 | ||
380 | wire[11:0] v6_tcp_flag; | |
381 | wire[11:0] v6_tcp_flag_r; | |
382 | ||
383 | reg[31:0] tcp_port; | |
384 | reg[31:0] tcp_seq_num; | |
385 | reg[3:0] tcp_hdr_len; | |
386 | reg[11:0] tcp_ctrl_flag; | |
387 | reg[15:0] ip_pkt_len; | |
388 | ||
389 | wire[3:0] pkt_id_in; | |
390 | wire[3:0] pkt_id; | |
391 | ||
392 | ||
393 | wire[127:0] ipp_fflp_data_reg_dout; | |
394 | wire[13:0] ipp_fflp_status_reg_dout; | |
395 | wire[13:0] shft0_status_reg_dout; | |
396 | wire promiscuous; | |
397 | wire ph_match; | |
398 | wire[2:0] mac_rdc_num; | |
399 | //wire mpr; | |
400 | wire[1:0] mac_port; | |
401 | ||
402 | wire[127:0] shft0_reg_dout; | |
403 | wire[127:0] shft1_reg_dout; | |
404 | wire[127:0] shft2_reg_dout; | |
405 | wire[127:0] shft3_reg_dout; | |
406 | wire[127:0] shft4_reg_dout; | |
407 | wire[127:0] shft5_reg_dout; | |
408 | wire[31:0] shft6_reg_dout; | |
409 | ||
410 | wire[7:0] shft0_reg0_dout; | |
411 | wire[7:0] shft0_reg1_dout; | |
412 | wire[7:0] shft0_reg2_dout; | |
413 | wire[7:0] shft0_reg3_dout; | |
414 | wire[7:0] shft0_reg4_dout; | |
415 | wire[7:0] shft0_reg5_dout; | |
416 | /* | |
417 | wire[7:0] shft0_reg6_dout; | |
418 | wire[7:0] shft0_reg7_dout; | |
419 | wire[7:0] shft0_reg8_dout; | |
420 | wire[7:0] shft0_reg9_dout; | |
421 | wire[7:0] shft0_reg10_dout; | |
422 | wire[7:0] shft0_reg11_dout; | |
423 | */ | |
424 | wire[7:0] shft0_reg12_dout; | |
425 | wire[7:0] shft0_reg13_dout; | |
426 | wire[7:0] shft0_reg14_dout; | |
427 | wire[7:0] shft0_reg15_dout; | |
428 | ||
429 | wire[7:0] shft1_reg0_dout; | |
430 | wire[7:0] shft1_reg1_dout; | |
431 | wire[7:0] shft1_reg2_dout; | |
432 | wire[7:0] shft1_reg3_dout; | |
433 | wire[7:0] shft1_reg4_dout; | |
434 | wire[7:0] shft1_reg5_dout; | |
435 | wire[7:0] shft1_reg6_dout; | |
436 | wire[7:0] shft1_reg7_dout; | |
437 | wire[7:0] shft1_reg8_dout; | |
438 | wire[7:0] shft1_reg9_dout; | |
439 | wire[7:0] shft1_reg10_dout; | |
440 | wire[7:0] shft1_reg11_dout; | |
441 | wire[7:0] shft1_reg12_dout; | |
442 | wire[7:0] shft1_reg13_dout; | |
443 | wire[7:0] shft1_reg14_dout; | |
444 | wire[7:0] shft1_reg15_dout; | |
445 | ||
446 | wire[7:0] shft2_reg0_dout; | |
447 | wire[7:0] shft2_reg1_dout; | |
448 | wire[7:0] shft2_reg2_dout; | |
449 | wire[7:0] shft2_reg3_dout; | |
450 | wire[7:0] shft2_reg4_dout; | |
451 | wire[7:0] shft2_reg5_dout; | |
452 | wire[7:0] shft2_reg6_dout; | |
453 | wire[7:0] shft2_reg7_dout; | |
454 | wire[7:0] shft2_reg8_dout; | |
455 | wire[7:0] shft2_reg9_dout; | |
456 | wire[7:0] shft2_reg10_dout; | |
457 | wire[7:0] shft2_reg11_dout; | |
458 | wire[7:0] shft2_reg12_dout; | |
459 | wire[7:0] shft2_reg13_dout; | |
460 | wire[7:0] shft2_reg14_dout; | |
461 | wire[7:0] shft2_reg15_dout; | |
462 | ||
463 | wire[7:0] shft3_reg0_dout; | |
464 | wire[7:0] shft3_reg1_dout; | |
465 | wire[7:0] shft3_reg2_dout; | |
466 | wire[7:0] shft3_reg3_dout; | |
467 | wire[7:0] shft3_reg4_dout; | |
468 | wire[7:0] shft3_reg5_dout; | |
469 | wire[7:0] shft3_reg6_dout; | |
470 | wire[7:0] shft3_reg7_dout; | |
471 | wire[7:0] shft3_reg8_dout; | |
472 | wire[7:0] shft3_reg9_dout; | |
473 | wire[7:0] shft3_reg10_dout; | |
474 | wire[7:0] shft3_reg11_dout; | |
475 | wire[7:0] shft3_reg12_dout; | |
476 | wire[7:0] shft3_reg13_dout; | |
477 | wire[7:0] shft3_reg14_dout; | |
478 | wire[7:0] shft3_reg15_dout; | |
479 | ||
480 | wire[7:0] shft4_reg0_dout; | |
481 | wire[7:0] shft4_reg1_dout; | |
482 | wire[7:0] shft4_reg2_dout; | |
483 | wire[7:0] shft4_reg3_dout; | |
484 | wire[7:0] shft4_reg4_dout; | |
485 | wire[7:0] shft4_reg5_dout; | |
486 | wire[7:0] shft4_reg6_dout; | |
487 | wire[7:0] shft4_reg7_dout; | |
488 | wire[7:0] shft4_reg8_dout; | |
489 | wire[7:0] shft4_reg9_dout; | |
490 | wire[7:0] shft4_reg10_dout; | |
491 | wire[7:0] shft4_reg11_dout; | |
492 | wire[7:0] shft4_reg12_dout; | |
493 | wire[7:0] shft4_reg13_dout; | |
494 | wire[7:0] shft4_reg14_dout; | |
495 | wire[7:0] shft4_reg15_dout; | |
496 | ||
497 | wire[7:0] shft5_reg0_dout; | |
498 | wire[7:0] shft5_reg1_dout; | |
499 | wire[7:0] shft5_reg2_dout; | |
500 | wire[7:0] shft5_reg3_dout; | |
501 | wire[7:0] shft5_reg4_dout; | |
502 | wire[7:0] shft5_reg5_dout; | |
503 | wire[7:0] shft5_reg6_dout; | |
504 | wire[7:0] shft5_reg7_dout; | |
505 | wire[7:0] shft5_reg8_dout; | |
506 | wire[7:0] shft5_reg9_dout; | |
507 | wire[7:0] shft5_reg10_dout; | |
508 | wire[7:0] shft5_reg11_dout; | |
509 | wire[7:0] shft5_reg12_dout; | |
510 | wire[7:0] shft5_reg13_dout; | |
511 | wire[7:0] shft5_reg14_dout; | |
512 | wire[7:0] shft5_reg15_dout; | |
513 | ||
514 | wire[7:0] shft6_reg2_dout; | |
515 | wire[7:0] shft6_reg3_dout; | |
516 | ||
517 | /* | |
518 | wire[7:0] shft6_reg0_dout; | |
519 | wire[7:0] shft6_reg1_dout; | |
520 | ||
521 | wire[7:0] shft6_reg4_dout; | |
522 | wire[7:0] shft6_reg5_dout; | |
523 | wire[7:0] shft6_reg6_dout; | |
524 | wire[7:0] shft6_reg7_dout; | |
525 | wire[7:0] shft6_reg8_dout; | |
526 | wire[7:0] shft6_reg9_dout; | |
527 | wire[7:0] shft6_reg10_dout; | |
528 | wire[7:0] shft6_reg11_dout; | |
529 | wire[7:0] shft6_reg12_dout; | |
530 | wire[7:0] shft6_reg13_dout; | |
531 | wire[7:0] shft6_reg14_dout; | |
532 | wire[7:0] shft6_reg15_dout; | |
533 | */ | |
534 | ||
535 | wire[15:0] shft0_reg1312_trans; | |
536 | wire[15:0] shft0_reg1514_trans; | |
537 | wire[15:0] shft1_reg10_trans; | |
538 | wire[15:0] shft1_reg32_trans; | |
539 | wire[47:0] mac_dest_addr; | |
540 | ||
541 | wire or_tag; | |
542 | wire[11:0] vlan_tag_id; | |
543 | wire is_snap_type_0; | |
544 | wire is_aa_0; | |
545 | wire is_03_0; | |
546 | wire is_snap_type_1; | |
547 | wire is_aa_1; | |
548 | wire is_03_1; | |
549 | wire snap_type_0; | |
550 | wire snap_type_1; | |
551 | wire snap_type; | |
552 | wire[1:0] encap_offset; | |
553 | ||
554 | wire[15:0] shft0_tmp1312_trans; | |
555 | wire[15:0] shft1_tmp54_trans; | |
556 | wire is_ipv4; | |
557 | wire is_ipv6; | |
558 | wire is_ip_pkt; | |
559 | wire v4_prot_tcp; | |
560 | wire v4_prot_udp; | |
561 | wire v4_prot_ah; | |
562 | wire v4_prot_esp; | |
563 | wire v4_prot_sctp; | |
564 | wire v6_nhdr_tcp; | |
565 | wire v6_nhdr_udp; | |
566 | wire v6_nhdr_ah; | |
567 | wire v6_nhdr_esp; | |
568 | wire v6_nhdr_sctp; | |
569 | wire[2:0] l4_protocol_dec; | |
570 | wire[1:0] l4_protocol; | |
571 | ||
572 | wire[3:0] ipv4_ip_hdr_len; | |
573 | wire[15:0] ipv4_ip_pkt_len; | |
574 | wire[15:0] ipv4_frag_offset; | |
575 | wire noport; | |
576 | wire badip; | |
577 | ||
578 | wire[15:0] ipv6_ip_pkt_len; //IP payload len, not include IP hdr len (40 bytes) | |
579 | wire[15:0] ipv6_ip_pkt_len_r; | |
580 | ||
581 | wire[15:0] class_en_mask; | |
582 | wire[16:0] addr_ind_hdr_byte; | |
583 | wire[7:0] addr_ind_hdr_byte0; | |
584 | wire[7:0] addr_ind_hdr_byte1; | |
585 | wire[16:0] addr_ind_hdr_byte_masked4; | |
586 | wire[16:0] addr_ind_hdr_byte_masked5; | |
587 | wire[16:0] addr_ind_hdr_byte_masked6; | |
588 | wire[16:0] addr_ind_hdr_byte_masked7; | |
589 | ||
590 | wire[16:0] class4_hdr_byte_value_masked; | |
591 | wire[16:0] class5_hdr_byte_value_masked; | |
592 | wire[16:0] class6_hdr_byte_value_masked; | |
593 | wire[16:0] class7_hdr_byte_value_masked; | |
594 | ||
595 | wire l2_hdr_class_match2; | |
596 | wire l2_hdr_class_match3; | |
597 | wire l3_hdr_class_match4; | |
598 | wire l3_hdr_class_match5; | |
599 | wire l3_hdr_class_match6; | |
600 | wire l3_hdr_class_match7; | |
601 | wire l3_hdr_class_match8; | |
602 | wire l3_hdr_class_match9; | |
603 | wire l3_hdr_class_match10; | |
604 | wire l3_hdr_class_match11; | |
605 | wire l3_hdr_class_match12; | |
606 | wire l3_hdr_class_match13; | |
607 | wire l3_hdr_class_match14; | |
608 | wire l3_hdr_class_match15; | |
609 | wire l3_hdr_class_match16; | |
610 | wire l3_hdr_class_match17; | |
611 | ||
612 | wire[15:0] hdr_class_match; | |
613 | wire[4:0] class_index; | |
614 | wire[4:0] class_index_tmp; | |
615 | wire[2:0] class_action; | |
616 | wire[1:0] class_action_r0; | |
617 | wire[9:0] f_key_class_action; | |
618 | ||
619 | wire[2:0] vlan_rdc_num; | |
620 | wire vpr; | |
621 | wire[1:0] vlan_parity; | |
622 | wire vlan_rdc_prio; | |
623 | wire use_vlan_rdc; | |
624 | wire is_promis; | |
625 | ||
626 | wire[1:0] vlan_parity_bit; | |
627 | wire vlan_parity_err; | |
628 | wire vlan_parity_err_r; | |
629 | ||
630 | wire[19:0] shft1_status; | |
631 | ||
632 | wire[7:0] ipv4_tos; | |
633 | wire[7:0] ipv4_protocol; | |
634 | wire[31:0] ipv4_src_addr; | |
635 | wire[31:0] ipv4_dest_addr; | |
636 | //wire[31:0] ipv4_ah_spi; | |
637 | //wire[31:0] ipv4_esp_spi; | |
638 | wire[7:0] ipv6_tos; | |
639 | wire[7:0] ipv6_next_hdr; | |
640 | wire[127:0] ipv6_src_addr; | |
641 | wire[63:0] ipv6_dest_addr_pre; | |
642 | wire[63:0] ipv6_dest_addr_suf; | |
643 | wire[127:0] ipv6_dest_addr; | |
644 | wire[15:0] ipv6_tcp_src_port; | |
645 | wire[15:0] ipv6_tcp_dest_port; | |
646 | //wire[31:0] ipv6_ah_spi; | |
647 | //wire[31:0] ipv6_esp_spi; | |
648 | ||
649 | wire do_raw_key; | |
650 | wire[87:0] raw_cam_key; | |
651 | ||
652 | wire class_action_ipaddr; | |
653 | wire[199:0] v4_cam_key; | |
654 | wire[199:0] v4_cam_key_ah; | |
655 | wire[199:0] v4_cam_key_esp; | |
656 | wire[199:0] v6_cam_key_src; | |
657 | wire[199:0] v6_cam_key_src_ah; | |
658 | wire[199:0] v6_cam_key_src_esp; | |
659 | wire[199:0] v6_cam_key_dest; | |
660 | wire[199:0] v6_cam_key_dest_ah; | |
661 | wire[199:0] v6_cam_key_dest_esp; | |
662 | wire[199:0] v4_5t_cam_key; | |
663 | wire[199:0] v6_4t_cam_key; | |
664 | ||
665 | wire[199:0] raw_cam_key_r0; | |
666 | wire[199:0] tcam_key; | |
667 | ||
668 | wire[1:0] f_key_class_action_l4_1; | |
669 | wire[1:0] f_key_class_action_l4_0; | |
670 | wire f_key_class_action_prot; | |
671 | wire f_key_class_action_ip_da; | |
672 | wire f_key_class_action_ip_sa; | |
673 | wire f_key_class_action_vlan; | |
674 | wire f_key_class_action_l2_da; | |
675 | wire f_key_class_action_vport; | |
676 | wire[7:0] prot_bytes; | |
677 | wire[31:0] ip_da_bytes_0; | |
678 | wire[31:0] ip_da_bytes_1; | |
679 | wire[31:0] ip_da_bytes_2; | |
680 | wire[31:0] ip_da_bytes_3; | |
681 | wire[31:0] ip_sa_bytes_0; | |
682 | wire[31:0] ip_sa_bytes_1; | |
683 | wire[31:0] ip_sa_bytes_2; | |
684 | wire[31:0] ip_sa_bytes_3; | |
685 | wire vlan_bytes_valid; | |
686 | wire[15:0] f_key_l4_1_bytes; | |
687 | wire[15:0] f_key_l4_0_bytes; | |
688 | wire[7:0] f_key_prot_bytes; | |
689 | wire[31:0] f_key_ip_da_bytes_0; | |
690 | wire[31:0] f_key_ip_da_bytes_1; | |
691 | wire[31:0] f_key_ip_da_bytes_2; | |
692 | wire[31:0] f_key_ip_da_bytes_3; | |
693 | wire[31:0] f_key_ip_sa_bytes_0; | |
694 | wire[31:0] f_key_ip_sa_bytes_1; | |
695 | wire[31:0] f_key_ip_sa_bytes_2; | |
696 | wire[31:0] f_key_ip_sa_bytes_3; | |
697 | wire[3:0] f_key_vlan_valid; | |
698 | wire[11:0] f_key_vlan_bytes; | |
699 | wire[47:0] f_key_l2_da_bytes; | |
700 | wire[1:0] f_key_vport_bytes; | |
701 | wire[361:0] flow_key; | |
702 | ||
703 | wire tcp_push_bit; | |
704 | wire[83:0] fwd_info; | |
705 | ||
706 | wire hdr_fifo_wen; | |
707 | wire hdr_fifo_ren; | |
708 | wire hdr_fifo_space_avail; | |
709 | //wire hdr_fifo_lastwp; | |
710 | wire[645:0] hdr_fifo_din; | |
711 | wire[645:0] hdr_fifo_dout; | |
712 | wire hdr_fifo_empty; | |
713 | wire hdr_fifo_full; | |
714 | wire fwd_req; | |
715 | ||
716 | wire cpu_vlan_acc_en; | |
717 | wire cpu_vlan_acc_in; | |
718 | wire cpu_vlan_acc; | |
719 | wire cpu_vlan_acc_dly; | |
720 | ||
721 | wire cpu_vlan_gnt_1; | |
722 | wire cpu_vlan_gnt_2; | |
723 | wire cpu_vlan_gnt_3; | |
724 | ||
725 | wire cpu_vlan_gnt; | |
726 | wire cpu_vlan_rd_gnt; | |
727 | wire cpu_vlan_wr_gnt; | |
728 | ||
729 | wire srch_vlan_rd_in; | |
730 | wire srch_vlan_rd; | |
731 | ||
732 | wire vlan_tbl_cs_in; | |
733 | wire vlan_tbl_rd_in; | |
734 | wire vlan_tbl_wr_in; | |
735 | ||
736 | wire vlan_tbl_cs; | |
737 | wire vlan_tbl_wr; | |
738 | ||
739 | wire[11:0] vlan_tbl_addr_in; | |
740 | wire[11:0] vlan_tbl_addr; | |
741 | wire[17:0] vlan_tbl_din_reg_dout; | |
742 | wire vlan_parity_err_log_en; | |
743 | wire[17:0] masked_vlan_tbl_dout; | |
744 | wire[3:0] vlan_tbl_rd_data; | |
745 | ||
746 | wire[3:0] mac_port_dec; | |
747 | wire mac_port0, mac_port1, mac_port2, mac_port3; | |
748 | ||
749 | wire[3:0] fflp_ipp_dvalid_in; | |
750 | wire[3:0] fflp_ipp_dvalid; | |
751 | wire[15:0] fflp_ipp_data; | |
752 | ||
753 | ||
754 | /* | |
755 | dff #(128) ipp_fflp_data_reg | |
756 | ( | |
757 | cclk, | |
758 | 1'b0, | |
759 | 1'b1, | |
760 | ipp_fflp_data, | |
761 | ipp_fflp_data_reg_dout | |
762 | ); | |
763 | ||
764 | dff #(14) ipp_fflp_ctrl_reg | |
765 | ( | |
766 | cclk, | |
767 | 1'b0, | |
768 | 1'b1, | |
769 | {ipp_fflp_mac_port[1:0], ipp_fflp_mac_default[11:0]}, | |
770 | ipp_fflp_status_reg_dout | |
771 | ); | |
772 | */ | |
773 | ||
774 | assign ipp_fflp_data_reg_dout = ipp_fflp_data; | |
775 | assign ipp_fflp_status_reg_dout = {ipp_fflp_mac_port[1:0], ipp_fflp_mac_default[11:0]}; | |
776 | ||
777 | dffre #(14) hdr_shft0_status_reg | |
778 | ( | |
779 | cclk, | |
780 | reset, | |
781 | shft0_reg_en, | |
782 | ipp_fflp_status_reg_dout, //{mac_port[1:0], 1'b0, mpr, 5'b0, mac_rdc[2:0], ph_match, promiscuous} | |
783 | shft0_status_reg_dout | |
784 | ); | |
785 | ||
786 | dffre #(128) hdr_shft0_reg | |
787 | ( | |
788 | cclk, | |
789 | reset, | |
790 | shft0_reg_en, | |
791 | ipp_fflp_data_reg_dout, | |
792 | shft0_reg_dout | |
793 | ) ; | |
794 | ||
795 | dffre #(128) hdr_shft1_reg | |
796 | ( | |
797 | cclk, | |
798 | reset, | |
799 | shft1_reg_en, | |
800 | ipp_fflp_data_reg_dout, | |
801 | shft1_reg_dout | |
802 | ); | |
803 | ||
804 | dffre #(128) hdr_shft2_reg | |
805 | ( | |
806 | cclk, | |
807 | reset, | |
808 | shft2_reg_en, | |
809 | ipp_fflp_data_reg_dout, | |
810 | shft2_reg_dout | |
811 | ); | |
812 | ||
813 | dffre #(128) hdr_shft3_reg | |
814 | ( | |
815 | cclk, | |
816 | reset, | |
817 | shft3_reg_en, | |
818 | ipp_fflp_data_reg_dout, | |
819 | shft3_reg_dout | |
820 | ); | |
821 | ||
822 | dffre #(128) hdr_shft4_reg | |
823 | ( | |
824 | cclk, | |
825 | reset, | |
826 | shft4_reg_en, | |
827 | ipp_fflp_data_reg_dout, | |
828 | shft4_reg_dout | |
829 | ); | |
830 | ||
831 | dffre #(128) hdr_shft5_reg | |
832 | ( | |
833 | cclk, | |
834 | reset, | |
835 | shft5_reg_en, | |
836 | ipp_fflp_data_reg_dout, | |
837 | shft5_reg_dout | |
838 | ); | |
839 | ||
840 | dffre #(32) hdr_shft6_reg | |
841 | ( | |
842 | cclk, | |
843 | reset, | |
844 | shft6_reg_en, | |
845 | ipp_fflp_data_reg_dout[31:0], | |
846 | shft6_reg_dout[31:0] | |
847 | ); | |
848 | ||
849 | /* | |
850 | dffre #(128) hdr_shft7_reg | |
851 | ( | |
852 | cclk, | |
853 | reset, | |
854 | shft7_reg_en, | |
855 | ipp_fflp_data_reg_dout, | |
856 | shft7_reg_dout | |
857 | ); | |
858 | */ | |
859 | ||
860 | ||
861 | assign promiscuous = shft0_status_reg_dout[0]; | |
862 | assign ph_match = shft0_status_reg_dout[1]; | |
863 | assign mac_rdc_num = shft0_status_reg_dout[4:2]; | |
864 | //assign mpr = shft0_status_reg_dout[10]; | |
865 | assign mac_port = shft0_status_reg_dout[13:12]; | |
866 | ||
867 | assign shft0_reg0_dout = shft0_reg_dout[7:0]; | |
868 | assign shft0_reg1_dout = shft0_reg_dout[15:8]; | |
869 | assign shft0_reg2_dout = shft0_reg_dout[23:16]; | |
870 | assign shft0_reg3_dout = shft0_reg_dout[31:24]; | |
871 | assign shft0_reg4_dout = shft0_reg_dout[39:32]; | |
872 | assign shft0_reg5_dout = shft0_reg_dout[47:40]; | |
873 | /* | |
874 | assign shft0_reg6_dout = shft0_reg_dout[55:48]; | |
875 | assign shft0_reg7_dout = shft0_reg_dout[63:56]; | |
876 | assign shft0_reg8_dout = shft0_reg_dout[71:64]; | |
877 | assign shft0_reg9_dout = shft0_reg_dout[79:72]; | |
878 | assign shft0_reg10_dout = shft0_reg_dout[87:80]; | |
879 | assign shft0_reg11_dout = shft0_reg_dout[95:88]; | |
880 | */ | |
881 | assign shft0_reg12_dout = shft0_reg_dout[103:96]; | |
882 | assign shft0_reg13_dout = shft0_reg_dout[111:104]; | |
883 | assign shft0_reg14_dout = shft0_reg_dout[119:112]; | |
884 | assign shft0_reg15_dout = shft0_reg_dout[127:120]; | |
885 | ||
886 | assign shft1_reg0_dout = shft1_reg_dout[7:0]; | |
887 | assign shft1_reg1_dout = shft1_reg_dout[15:8]; | |
888 | assign shft1_reg2_dout = shft1_reg_dout[23:16]; | |
889 | assign shft1_reg3_dout = shft1_reg_dout[31:24]; | |
890 | assign shft1_reg4_dout = shft1_reg_dout[39:32]; | |
891 | assign shft1_reg5_dout = shft1_reg_dout[47:40]; | |
892 | assign shft1_reg6_dout = shft1_reg_dout[55:48]; | |
893 | assign shft1_reg7_dout = shft1_reg_dout[63:56]; | |
894 | assign shft1_reg8_dout = shft1_reg_dout[71:64]; | |
895 | assign shft1_reg9_dout = shft1_reg_dout[79:72]; | |
896 | assign shft1_reg10_dout = shft1_reg_dout[87:80]; | |
897 | assign shft1_reg11_dout = shft1_reg_dout[95:88]; | |
898 | assign shft1_reg12_dout = shft1_reg_dout[103:96]; | |
899 | assign shft1_reg13_dout = shft1_reg_dout[111:104]; | |
900 | assign shft1_reg14_dout = shft1_reg_dout[119:112]; | |
901 | assign shft1_reg15_dout = shft1_reg_dout[127:120]; | |
902 | ||
903 | assign shft2_reg0_dout = shft2_reg_dout[7:0]; | |
904 | assign shft2_reg1_dout = shft2_reg_dout[15:8]; | |
905 | assign shft2_reg2_dout = shft2_reg_dout[23:16]; | |
906 | assign shft2_reg3_dout = shft2_reg_dout[31:24]; | |
907 | assign shft2_reg4_dout = shft2_reg_dout[39:32]; | |
908 | assign shft2_reg5_dout = shft2_reg_dout[47:40]; | |
909 | assign shft2_reg6_dout = shft2_reg_dout[55:48]; | |
910 | assign shft2_reg7_dout = shft2_reg_dout[63:56]; | |
911 | assign shft2_reg8_dout = shft2_reg_dout[71:64]; | |
912 | assign shft2_reg9_dout = shft2_reg_dout[79:72]; | |
913 | assign shft2_reg10_dout = shft2_reg_dout[87:80]; | |
914 | assign shft2_reg11_dout = shft2_reg_dout[95:88]; | |
915 | assign shft2_reg12_dout = shft2_reg_dout[103:96]; | |
916 | assign shft2_reg13_dout = shft2_reg_dout[111:104]; | |
917 | assign shft2_reg14_dout = shft2_reg_dout[119:112]; | |
918 | assign shft2_reg15_dout = shft2_reg_dout[127:120]; | |
919 | ||
920 | assign shft3_reg0_dout = shft3_reg_dout[7:0]; | |
921 | assign shft3_reg1_dout = shft3_reg_dout[15:8]; | |
922 | assign shft3_reg2_dout = shft3_reg_dout[23:16]; | |
923 | assign shft3_reg3_dout = shft3_reg_dout[31:24]; | |
924 | assign shft3_reg4_dout = shft3_reg_dout[39:32]; | |
925 | assign shft3_reg5_dout = shft3_reg_dout[47:40]; | |
926 | assign shft3_reg6_dout = shft3_reg_dout[55:48]; | |
927 | assign shft3_reg7_dout = shft3_reg_dout[63:56]; | |
928 | assign shft3_reg8_dout = shft3_reg_dout[71:64]; | |
929 | assign shft3_reg9_dout = shft3_reg_dout[79:72]; | |
930 | assign shft3_reg10_dout = shft3_reg_dout[87:80]; | |
931 | assign shft3_reg11_dout = shft3_reg_dout[95:88]; | |
932 | assign shft3_reg12_dout = shft3_reg_dout[103:96]; | |
933 | assign shft3_reg13_dout = shft3_reg_dout[111:104]; | |
934 | assign shft3_reg14_dout = shft3_reg_dout[119:112]; | |
935 | assign shft3_reg15_dout = shft3_reg_dout[127:120]; | |
936 | ||
937 | assign shft4_reg0_dout = shft4_reg_dout[7:0]; | |
938 | assign shft4_reg1_dout = shft4_reg_dout[15:8]; | |
939 | assign shft4_reg2_dout = shft4_reg_dout[23:16]; | |
940 | assign shft4_reg3_dout = shft4_reg_dout[31:24]; | |
941 | assign shft4_reg4_dout = shft4_reg_dout[39:32]; | |
942 | assign shft4_reg5_dout = shft4_reg_dout[47:40]; | |
943 | assign shft4_reg6_dout = shft4_reg_dout[55:48]; | |
944 | assign shft4_reg7_dout = shft4_reg_dout[63:56]; | |
945 | assign shft4_reg8_dout = shft4_reg_dout[71:64]; | |
946 | assign shft4_reg9_dout = shft4_reg_dout[79:72]; | |
947 | assign shft4_reg10_dout = shft4_reg_dout[87:80]; | |
948 | assign shft4_reg11_dout = shft4_reg_dout[95:88]; | |
949 | assign shft4_reg12_dout = shft4_reg_dout[103:96]; | |
950 | assign shft4_reg13_dout = shft4_reg_dout[111:104]; | |
951 | assign shft4_reg14_dout = shft4_reg_dout[119:112]; | |
952 | assign shft4_reg15_dout = shft4_reg_dout[127:120]; | |
953 | ||
954 | assign shft5_reg0_dout = shft5_reg_dout[7:0]; | |
955 | assign shft5_reg1_dout = shft5_reg_dout[15:8]; | |
956 | assign shft5_reg2_dout = shft5_reg_dout[23:16]; | |
957 | assign shft5_reg3_dout = shft5_reg_dout[31:24]; | |
958 | assign shft5_reg4_dout = shft5_reg_dout[39:32]; | |
959 | assign shft5_reg5_dout = shft5_reg_dout[47:40]; | |
960 | assign shft5_reg6_dout = shft5_reg_dout[55:48]; | |
961 | assign shft5_reg7_dout = shft5_reg_dout[63:56]; | |
962 | assign shft5_reg8_dout = shft5_reg_dout[71:64]; | |
963 | assign shft5_reg9_dout = shft5_reg_dout[79:72]; | |
964 | assign shft5_reg10_dout = shft5_reg_dout[87:80]; | |
965 | assign shft5_reg11_dout = shft5_reg_dout[95:88]; | |
966 | assign shft5_reg12_dout = shft5_reg_dout[103:96]; | |
967 | assign shft5_reg13_dout = shft5_reg_dout[111:104]; | |
968 | assign shft5_reg14_dout = shft5_reg_dout[119:112]; | |
969 | assign shft5_reg15_dout = shft5_reg_dout[127:120]; | |
970 | ||
971 | assign shft6_reg2_dout = shft6_reg_dout[23:16]; | |
972 | assign shft6_reg3_dout = shft6_reg_dout[31:24]; | |
973 | ||
974 | /* | |
975 | assign shft6_reg0_dout = shft6_reg_dout[7:0]; | |
976 | assign shft6_reg1_dout = shft6_reg_dout[15:8]; | |
977 | ||
978 | assign shft6_reg4_dout = shft6_reg_dout[39:32]; | |
979 | assign shft6_reg5_dout = shft6_reg_dout[47:40]; | |
980 | assign shft6_reg6_dout = shft6_reg_dout[55:48]; | |
981 | assign shft6_reg7_dout = shft6_reg_dout[63:56]; | |
982 | assign shft6_reg8_dout = shft6_reg_dout[71:64]; | |
983 | assign shft6_reg9_dout = shft6_reg_dout[79:72]; | |
984 | assign shft6_reg10_dout = shft6_reg_dout[87:80]; | |
985 | assign shft6_reg11_dout = shft6_reg_dout[95:88]; | |
986 | assign shft6_reg12_dout = shft6_reg_dout[103:96]; | |
987 | assign shft6_reg13_dout = shft6_reg_dout[111:104]; | |
988 | assign shft6_reg14_dout = shft6_reg_dout[119:112]; | |
989 | assign shft6_reg15_dout = shft6_reg_dout[127:120]; | |
990 | ||
991 | assign shft7_reg0_dout = shft7_reg_dout[7:0]; | |
992 | assign shft7_reg1_dout = shft7_reg_dout[15:8]; | |
993 | assign shft7_reg2_dout = shft7_reg_dout[23:16]; | |
994 | assign shft7_reg3_dout = shft7_reg_dout[31:24]; | |
995 | assign shft7_reg4_dout = shft7_reg_dout[39:32]; | |
996 | assign shft7_reg5_dout = shft7_reg_dout[47:40]; | |
997 | assign shft7_reg6_dout = shft7_reg_dout[55:48]; | |
998 | assign shft7_reg7_dout = shft7_reg_dout[63:56]; | |
999 | assign shft7_reg8_dout = shft7_reg_dout[71:64]; | |
1000 | assign shft7_reg9_dout = shft7_reg_dout[79:72]; | |
1001 | assign shft7_reg10_dout = shft7_reg_dout[87:80]; | |
1002 | assign shft7_reg11_dout = shft7_reg_dout[95:88]; | |
1003 | assign shft7_reg12_dout = shft7_reg_dout[103:96]; | |
1004 | assign shft7_reg13_dout = shft7_reg_dout[111:104]; | |
1005 | assign shft7_reg14_dout = shft7_reg_dout[119:112]; | |
1006 | assign shft7_reg15_dout = shft7_reg_dout[127:120]; | |
1007 | */ | |
1008 | ||
1009 | assign mac_port0 = (mac_port == 2'b00); | |
1010 | assign mac_port1 = (mac_port == 2'b01); | |
1011 | assign mac_port2 = (mac_port == 2'b10); | |
1012 | assign mac_port3 = (mac_port == 2'b11); | |
1013 | assign mac_port_dec = {mac_port3, mac_port2, mac_port1, mac_port0}; | |
1014 | ||
1015 | assign shft0_reg1312_trans = {shft0_reg12_dout, shft0_reg13_dout}; | |
1016 | assign shft0_reg1514_trans = {shft0_reg14_dout, shft0_reg15_dout}; | |
1017 | assign shft1_reg10_trans = {shft1_reg0_dout, shft1_reg1_dout}; | |
1018 | assign shft1_reg32_trans = {shft1_reg2_dout, shft1_reg3_dout}; | |
1019 | ||
1020 | assign mac_dest_addr = {shft0_reg0_dout, shft0_reg1_dout, shft0_reg2_dout, | |
1021 | shft0_reg3_dout, shft0_reg4_dout, shft0_reg5_dout}; | |
1022 | assign or_tag = (shft0_reg1312_trans == 16'h8100); | |
1023 | assign vlan_tag_id = shft0_reg1514_trans[11:0]; | |
1024 | ||
1025 | assign is_snap_type_0 = snap_en & | |
1026 | !((|shft0_reg1312_trans[15:11]) | | |
1027 | ((~|shft0_reg1312_trans[15:11]) & | |
1028 | shft0_reg1312_trans[10] & | |
1029 | shft0_reg1312_trans[9]) & | |
1030 | (|shft0_reg1312_trans[8:0])); | |
1031 | ||
1032 | assign is_aa_0 = shft0_reg1514_trans == 16'haaaa; | |
1033 | assign is_03_0 = shft1_reg0_dout == 8'h03; | |
1034 | ||
1035 | assign is_snap_type_1 = snap_en & | |
1036 | !((|shft1_reg10_trans[15:11]) | | |
1037 | ((~|shft1_reg10_trans[15:11]) & | |
1038 | shft1_reg10_trans[10] & | |
1039 | shft1_reg10_trans[9]) & | |
1040 | (|shft1_reg10_trans[8:0])); | |
1041 | ||
1042 | assign is_aa_1 = shft1_reg32_trans == 16'haaaa; | |
1043 | assign is_03_1 = shft1_reg4_dout == 8'h03; | |
1044 | ||
1045 | assign snap_type_0 = is_snap_type_0 & is_aa_0 & is_03_0; | |
1046 | assign snap_type_1 = is_snap_type_1 & is_aa_1 & is_03_1; | |
1047 | assign snap_type = or_tag ? snap_type_1 : snap_type_0; | |
1048 | assign encap_offset = {snap_type, or_tag}; | |
1049 | ||
1050 | dffre #(2) encap_offset_reg0 (cclk, reset, shft2_reg_en, encap_offset, encap_offset_reg); | |
1051 | ||
1052 | always @ ( | |
1053 | encap_offset or | |
1054 | shft0_reg12_dout or | |
1055 | shft0_reg13_dout or | |
1056 | shft0_reg14_dout or | |
1057 | shft0_reg15_dout or | |
1058 | shft1_reg0_dout or | |
1059 | shft1_reg1_dout or | |
1060 | shft1_reg2_dout or | |
1061 | shft1_reg3_dout or | |
1062 | shft1_reg4_dout or | |
1063 | shft1_reg5_dout or | |
1064 | shft1_reg6_dout or | |
1065 | shft1_reg7_dout or | |
1066 | shft1_reg8_dout or | |
1067 | shft1_reg9_dout or | |
1068 | shft1_reg10_dout or | |
1069 | shft1_reg11_dout or | |
1070 | shft1_reg12_dout or | |
1071 | shft1_reg13_dout or | |
1072 | shft1_reg14_dout or | |
1073 | shft1_reg15_dout or | |
1074 | shft2_reg0_dout or | |
1075 | shft2_reg1_dout or | |
1076 | shft2_reg2_dout or | |
1077 | shft2_reg3_dout or | |
1078 | shft2_reg4_dout or | |
1079 | shft2_reg5_dout or | |
1080 | shft2_reg6_dout or | |
1081 | shft2_reg7_dout or | |
1082 | shft2_reg8_dout or | |
1083 | shft2_reg9_dout or | |
1084 | shft2_reg10_dout or | |
1085 | shft2_reg11_dout or | |
1086 | shft2_reg12_dout or | |
1087 | shft2_reg13_dout or | |
1088 | shft2_reg14_dout or | |
1089 | shft2_reg15_dout) | |
1090 | ||
1091 | begin | |
1092 | case (encap_offset) //synopsys parallel_case full_case | |
1093 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:shftM_tmpN_dout_1" | |
1094 | 2'b00: begin | |
1095 | shft0_tmp12_dout = shft0_reg12_dout; | |
1096 | shft0_tmp13_dout = shft0_reg13_dout; | |
1097 | shft0_tmp14_dout = shft0_reg14_dout; | |
1098 | shft0_tmp15_dout = shft0_reg15_dout; | |
1099 | ||
1100 | shft1_tmp0_dout = shft1_reg0_dout; | |
1101 | shft1_tmp1_dout = shft1_reg1_dout; | |
1102 | shft1_tmp2_dout = shft1_reg2_dout; | |
1103 | shft1_tmp3_dout = shft1_reg3_dout; | |
1104 | shft1_tmp4_dout = shft1_reg4_dout; | |
1105 | shft1_tmp5_dout = shft1_reg5_dout; | |
1106 | shft1_tmp6_dout = shft1_reg6_dout; | |
1107 | shft1_tmp7_dout = shft1_reg7_dout; | |
1108 | shft1_tmp8_dout = shft1_reg8_dout; | |
1109 | shft1_tmp9_dout = shft1_reg9_dout; | |
1110 | shft1_tmp10_dout = shft1_reg10_dout; | |
1111 | shft1_tmp11_dout = shft1_reg11_dout; | |
1112 | shft1_tmp12_dout = shft1_reg12_dout; | |
1113 | shft1_tmp13_dout = shft1_reg13_dout; | |
1114 | shft1_tmp14_dout = shft1_reg14_dout; | |
1115 | shft1_tmp15_dout = shft1_reg15_dout; | |
1116 | ||
1117 | shft2_tmp0_dout = shft2_reg0_dout; | |
1118 | shft2_tmp1_dout = shft2_reg1_dout; | |
1119 | shft2_tmp2_dout = shft2_reg2_dout; | |
1120 | shft2_tmp3_dout = shft2_reg3_dout; | |
1121 | end | |
1122 | ||
1123 | 2'b01: begin | |
1124 | shft0_tmp12_dout = shft1_reg0_dout; | |
1125 | shft0_tmp13_dout = shft1_reg1_dout; | |
1126 | shft0_tmp14_dout = shft1_reg2_dout; | |
1127 | shft0_tmp15_dout = shft1_reg3_dout; | |
1128 | ||
1129 | shft1_tmp0_dout = shft1_reg4_dout; | |
1130 | shft1_tmp1_dout = shft1_reg5_dout; | |
1131 | shft1_tmp2_dout = shft1_reg6_dout; | |
1132 | shft1_tmp3_dout = shft1_reg7_dout; | |
1133 | shft1_tmp4_dout = shft1_reg8_dout; | |
1134 | shft1_tmp5_dout = shft1_reg9_dout; | |
1135 | shft1_tmp6_dout = shft1_reg10_dout; | |
1136 | shft1_tmp7_dout = shft1_reg11_dout; | |
1137 | shft1_tmp8_dout = shft1_reg12_dout; | |
1138 | shft1_tmp9_dout = shft1_reg13_dout; | |
1139 | shft1_tmp10_dout = shft1_reg14_dout; | |
1140 | shft1_tmp11_dout = shft1_reg15_dout; | |
1141 | shft1_tmp12_dout = shft2_reg0_dout; | |
1142 | shft1_tmp13_dout = shft2_reg1_dout; | |
1143 | shft1_tmp14_dout = shft2_reg2_dout; | |
1144 | shft1_tmp15_dout = shft2_reg3_dout; | |
1145 | ||
1146 | shft2_tmp0_dout = shft2_reg4_dout; | |
1147 | shft2_tmp1_dout = shft2_reg5_dout; | |
1148 | shft2_tmp2_dout = shft2_reg6_dout; | |
1149 | shft2_tmp3_dout = shft2_reg7_dout; | |
1150 | end | |
1151 | ||
1152 | 2'b10: begin | |
1153 | shft0_tmp12_dout = shft1_reg4_dout; | |
1154 | shft0_tmp13_dout = shft1_reg5_dout; | |
1155 | shft0_tmp14_dout = shft1_reg6_dout; | |
1156 | shft0_tmp15_dout = shft1_reg7_dout; | |
1157 | ||
1158 | shft1_tmp0_dout = shft1_reg8_dout; | |
1159 | shft1_tmp1_dout = shft1_reg9_dout; | |
1160 | shft1_tmp2_dout = shft1_reg10_dout; | |
1161 | shft1_tmp3_dout = shft1_reg11_dout; | |
1162 | shft1_tmp4_dout = shft1_reg12_dout; | |
1163 | shft1_tmp5_dout = shft1_reg13_dout; | |
1164 | shft1_tmp6_dout = shft1_reg14_dout; | |
1165 | shft1_tmp7_dout = shft1_reg15_dout; | |
1166 | shft1_tmp8_dout = shft2_reg0_dout; | |
1167 | shft1_tmp9_dout = shft2_reg1_dout; | |
1168 | shft1_tmp10_dout = shft2_reg2_dout; | |
1169 | shft1_tmp11_dout = shft2_reg3_dout; | |
1170 | shft1_tmp12_dout = shft2_reg4_dout; | |
1171 | shft1_tmp13_dout = shft2_reg5_dout; | |
1172 | shft1_tmp14_dout = shft2_reg6_dout; | |
1173 | shft1_tmp15_dout = shft2_reg7_dout; | |
1174 | ||
1175 | shft2_tmp0_dout = shft2_reg8_dout; | |
1176 | shft2_tmp1_dout = shft2_reg9_dout; | |
1177 | shft2_tmp2_dout = shft2_reg10_dout; | |
1178 | shft2_tmp3_dout = shft2_reg11_dout; | |
1179 | end | |
1180 | ||
1181 | 2'b11: begin | |
1182 | shft0_tmp12_dout = shft1_reg8_dout; | |
1183 | shft0_tmp13_dout = shft1_reg9_dout; | |
1184 | shft0_tmp14_dout = shft1_reg10_dout; | |
1185 | shft0_tmp15_dout = shft1_reg11_dout; | |
1186 | ||
1187 | shft1_tmp0_dout = shft1_reg12_dout; | |
1188 | shft1_tmp1_dout = shft1_reg13_dout; | |
1189 | shft1_tmp2_dout = shft1_reg14_dout; | |
1190 | shft1_tmp3_dout = shft1_reg15_dout; | |
1191 | shft1_tmp4_dout = shft2_reg0_dout; | |
1192 | shft1_tmp5_dout = shft2_reg1_dout; | |
1193 | shft1_tmp6_dout = shft2_reg2_dout; | |
1194 | shft1_tmp7_dout = shft2_reg3_dout; | |
1195 | shft1_tmp8_dout = shft2_reg4_dout; | |
1196 | shft1_tmp9_dout = shft2_reg5_dout; | |
1197 | shft1_tmp10_dout = shft2_reg6_dout; | |
1198 | shft1_tmp11_dout = shft2_reg7_dout; | |
1199 | shft1_tmp12_dout = shft2_reg8_dout; | |
1200 | shft1_tmp13_dout = shft2_reg9_dout; | |
1201 | shft1_tmp14_dout = shft2_reg10_dout; | |
1202 | shft1_tmp15_dout = shft2_reg11_dout; | |
1203 | ||
1204 | shft2_tmp0_dout = shft2_reg12_dout; | |
1205 | shft2_tmp1_dout = shft2_reg13_dout; | |
1206 | shft2_tmp2_dout = shft2_reg14_dout; | |
1207 | shft2_tmp3_dout = shft2_reg15_dout; | |
1208 | end | |
1209 | ||
1210 | default:begin | |
1211 | shft0_tmp12_dout = 8'b0; | |
1212 | shft0_tmp13_dout = 8'b0; | |
1213 | shft0_tmp14_dout = 8'b0; | |
1214 | shft0_tmp15_dout = 8'b0; | |
1215 | ||
1216 | shft1_tmp0_dout = 8'b0; | |
1217 | shft1_tmp1_dout = 8'b0; | |
1218 | shft1_tmp2_dout = 8'b0; | |
1219 | shft1_tmp3_dout = 8'b0; | |
1220 | shft1_tmp4_dout = 8'b0; | |
1221 | shft1_tmp5_dout = 8'b0; | |
1222 | shft1_tmp6_dout = 8'b0; | |
1223 | shft1_tmp7_dout = 8'b0; | |
1224 | shft1_tmp8_dout = 8'b0; | |
1225 | shft1_tmp9_dout = 8'b0; | |
1226 | shft1_tmp10_dout = 8'b0; | |
1227 | shft1_tmp11_dout = 8'b0; | |
1228 | shft1_tmp12_dout = 8'b0; | |
1229 | shft1_tmp13_dout = 8'b0; | |
1230 | shft1_tmp14_dout = 8'b0; | |
1231 | shft1_tmp15_dout = 8'b0; | |
1232 | ||
1233 | shft2_tmp0_dout = 8'b0; | |
1234 | shft2_tmp1_dout = 8'b0; | |
1235 | shft2_tmp2_dout = 8'b0; | |
1236 | shft2_tmp3_dout = 8'b0; | |
1237 | end | |
1238 | endcase | |
1239 | end | |
1240 | ||
1241 | assign shft0_tmp1312_trans = {shft0_tmp12_dout, | |
1242 | shft0_tmp13_dout}; | |
1243 | assign shft1_tmp54_trans = {shft1_tmp4_dout, | |
1244 | shft1_tmp5_dout}; | |
1245 | ||
1246 | assign is_ipv4 = (shft0_tmp1312_trans == `TYPE_IPV4) & | |
1247 | (shft0_tmp14_dout[7:4] == 4'b0100); | |
1248 | assign is_ipv6 = (shft0_tmp1312_trans == `TYPE_IPV6) & | |
1249 | (shft0_tmp14_dout[7:4] == 4'b0110); | |
1250 | ||
1251 | assign ether_type_in = {is_ipv6, is_ipv4}; | |
1252 | ||
1253 | dffre #(2) ether_type_reg (cclk, reset, shft2_reg_en, ether_type_in, ether_type); | |
1254 | ||
1255 | assign is_ip_pkt = |ether_type; | |
1256 | ||
1257 | assign v4_prot_tcp = (shft1_tmp7_dout == `TCP) & ether_type[0]; | |
1258 | assign v4_prot_udp = (shft1_tmp7_dout == `UDP) & ether_type[0]; | |
1259 | assign v4_prot_ah = (shft1_tmp7_dout == `AH) & ether_type[0]; | |
1260 | assign v4_prot_esp = (shft1_tmp7_dout == `ESP) & ether_type[0]; | |
1261 | assign v4_prot_sctp = (shft1_tmp7_dout == `SCTP) & ether_type[0]; | |
1262 | ||
1263 | assign v6_nhdr_tcp = (shft1_tmp4_dout == `TCP) & ether_type[1]; | |
1264 | assign v6_nhdr_udp = (shft1_tmp4_dout == `UDP) & ether_type[1]; | |
1265 | assign v6_nhdr_ah = (shft1_tmp4_dout == `AH) & ether_type[1]; | |
1266 | assign v6_nhdr_esp = (shft1_tmp4_dout == `ESP) & ether_type[1]; | |
1267 | assign v6_nhdr_sctp = (shft1_tmp4_dout == `SCTP) & ether_type[1]; | |
1268 | ||
1269 | assign l4_protocol_dec = {(v4_prot_sctp | v6_nhdr_sctp), | |
1270 | (v4_prot_udp | v6_nhdr_udp), | |
1271 | (v4_prot_tcp | v6_nhdr_tcp)}; | |
1272 | ||
1273 | assign l4_protocol = noport ? 2'b00 : | |
1274 | l4_protocol_dec[0] ? 2'b01 : | |
1275 | l4_protocol_dec[1] ? 2'b10 : | |
1276 | l4_protocol_dec[2] ? 2'b11 : 2'b00; | |
1277 | ||
1278 | assign v4_protocol_in = {v4_prot_sctp, v4_prot_esp, v4_prot_ah, v4_prot_udp, v4_prot_tcp}; | |
1279 | assign v6_next_hdr_in = {v6_nhdr_sctp, v6_nhdr_esp, v6_nhdr_ah, v6_nhdr_udp, v6_nhdr_tcp}; | |
1280 | ||
1281 | dffre #(2) l4_protocol_r_reg (cclk, reset, shft3_reg_en, l4_protocol, l4_protocol_r); | |
1282 | dffre #(5) v4_protocol_reg (cclk, reset, shft3_reg_en, v4_protocol_in, v4_protocol); | |
1283 | dffre #(5) v6_next_hdr_reg (cclk, reset, shft3_reg_en, v6_next_hdr_in, v6_next_hdr); | |
1284 | ||
1285 | assign ipv4_ip_hdr_len = shft0_tmp14_dout[3:0]; | |
1286 | assign ipv4_ip_pkt_len = {shft1_tmp0_dout, shft1_tmp1_dout}; | |
1287 | assign ipv4_frag_offset = shft1_tmp54_trans; | |
1288 | //assign noport = ether_type[0] & ((ipv4_frag_offset[15:13] == 3'b001) | (|ipv4_frag_offset[12:0])); | |
1289 | assign noport = ether_type[0] & (ipv4_frag_offset[13] | (|ipv4_frag_offset[12:0])); | |
1290 | assign badip = ether_type[0] & (ipv4_ip_hdr_len < 4'b0101); | |
1291 | ||
1292 | assign ipv6_ip_pkt_len = {shft1_tmp2_dout, shft1_tmp3_dout}; | |
1293 | ||
1294 | ||
1295 | dffre #(8) shft2_tmp2_dout_r_reg (cclk, reset, shft3_reg_en, shft2_tmp2_dout, shft2_tmp2_dout_r); | |
1296 | dffre #(8) shft2_tmp3_dout_r_reg (cclk, reset, shft3_reg_en, shft2_tmp3_dout, shft2_tmp3_dout_r); | |
1297 | dffre #(4) ipv4_ip_hdr_len_r_reg (cclk, reset, shft3_reg_en, ipv4_ip_hdr_len, ipv4_ip_hdr_len_r); | |
1298 | dffre #(4) ipv4_ip_hdr_len_r0_reg (cclk, reset, shft3_reg_en, ipv4_ip_hdr_len, ipv4_ip_hdr_len_r0); | |
1299 | dffre #(16) ipv4_ip_pkt_len_r_reg (cclk, reset, shft3_reg_en, ipv4_ip_pkt_len, ipv4_ip_pkt_len_r); | |
1300 | dffre #(1) noport_r_reg (cclk, reset, shft3_reg_en, noport, noport_r); | |
1301 | dffre #(1) badip_r_reg (cclk, reset, shft3_reg_en, badip, badip_r); | |
1302 | ||
1303 | dffre #(16) ipv6_ip_pkt_len_r_reg (cclk, reset, shft3_reg_en, ipv6_ip_pkt_len, ipv6_ip_pkt_len_r); | |
1304 | ||
1305 | /******************************/ | |
1306 | //Forward Decision to IPP | |
1307 | /******************************/ | |
1308 | assign fflp_ipp_data = {2'b0, pkt_id, l4_protocol_r, ipv4_ip_hdr_len_r, ether_type, encap_offset_reg}; | |
1309 | ||
1310 | assign fflp_ipp_dvalid_in = {4{shft3_reg_en}} & mac_port_dec[3:0]; | |
1311 | ||
1312 | dffr #(4) fflp_ipp_dvalid_reg (cclk, reset, fflp_ipp_dvalid_in, fflp_ipp_dvalid); | |
1313 | ||
1314 | /*************************/ | |
1315 | // Class | |
1316 | /*************************/ | |
1317 | assign class_en_mask = | |
1318 | { | |
1319 | 10'h3ff, | |
1320 | class7_hdr_byte_value[25], | |
1321 | class6_hdr_byte_value[25], | |
1322 | class5_hdr_byte_value[25], | |
1323 | class4_hdr_byte_value[25], | |
1324 | class3_hdr_byte_value[16], | |
1325 | class2_hdr_byte_value[16] | |
1326 | }; | |
1327 | ||
1328 | assign addr_ind_hdr_byte1 = ether_type[1] ? ipv6_next_hdr : ipv4_protocol; | |
1329 | assign addr_ind_hdr_byte0 = ether_type[1] ? ipv6_tos : ipv4_tos; | |
1330 | assign addr_ind_hdr_byte = | |
1331 | { | |
1332 | ether_type[1], //{v6,v4} | |
1333 | addr_ind_hdr_byte1, //Protocol | |
1334 | addr_ind_hdr_byte0 //TOS | |
1335 | }; | |
1336 | ||
1337 | assign addr_ind_hdr_byte_masked4 = | |
1338 | { | |
1339 | addr_ind_hdr_byte[16:8], | |
1340 | addr_ind_hdr_byte[7:0] & class4_hdr_byte_value[15:8] | |
1341 | }; | |
1342 | ||
1343 | assign addr_ind_hdr_byte_masked5 = | |
1344 | {addr_ind_hdr_byte[16:8], | |
1345 | addr_ind_hdr_byte[7:0] & class5_hdr_byte_value[15:8] | |
1346 | }; | |
1347 | ||
1348 | assign addr_ind_hdr_byte_masked6 = | |
1349 | {addr_ind_hdr_byte[16:8], | |
1350 | addr_ind_hdr_byte[7:0] & class6_hdr_byte_value[15:8] | |
1351 | }; | |
1352 | ||
1353 | assign addr_ind_hdr_byte_masked7 = | |
1354 | {addr_ind_hdr_byte[16:8], | |
1355 | addr_ind_hdr_byte[7:0] & class7_hdr_byte_value[15:8] | |
1356 | }; | |
1357 | ||
1358 | ||
1359 | dffre #(16) shft0_tmp1312_trans_r_reg (cclk, reset, shft3_reg_en, shft0_tmp1312_trans, shft0_tmp1312_trans_r); | |
1360 | dffre #(17) addr_ind_hdr_byte_masked4_r_reg (cclk, reset, shft3_reg_en, addr_ind_hdr_byte_masked4, addr_ind_hdr_byte_masked4_r); | |
1361 | dffre #(17) addr_ind_hdr_byte_masked5_r_reg (cclk, reset, shft3_reg_en, addr_ind_hdr_byte_masked5, addr_ind_hdr_byte_masked5_r); | |
1362 | dffre #(17) addr_ind_hdr_byte_masked6_r_reg (cclk, reset, shft3_reg_en, addr_ind_hdr_byte_masked6, addr_ind_hdr_byte_masked6_r); | |
1363 | dffre #(17) addr_ind_hdr_byte_masked7_r_reg (cclk, reset, shft3_reg_en, addr_ind_hdr_byte_masked7, addr_ind_hdr_byte_masked7_r); | |
1364 | ||
1365 | assign class4_hdr_byte_value_masked = | |
1366 | { | |
1367 | class4_hdr_byte_value[24:16], | |
1368 | class4_hdr_byte_value[7:0] & class4_hdr_byte_value[15:8] | |
1369 | }; | |
1370 | ||
1371 | assign class5_hdr_byte_value_masked = | |
1372 | { | |
1373 | class5_hdr_byte_value[24:16], | |
1374 | class5_hdr_byte_value[7:0] & class5_hdr_byte_value[15:8] | |
1375 | }; | |
1376 | ||
1377 | assign class6_hdr_byte_value_masked = | |
1378 | { | |
1379 | class6_hdr_byte_value[24:16], | |
1380 | class6_hdr_byte_value[7:0] & class6_hdr_byte_value[15:8] | |
1381 | }; | |
1382 | ||
1383 | assign class7_hdr_byte_value_masked = | |
1384 | { | |
1385 | class7_hdr_byte_value[24:16], | |
1386 | class7_hdr_byte_value[7:0] & class7_hdr_byte_value[15:8] | |
1387 | }; | |
1388 | ||
1389 | ||
1390 | assign l2_hdr_class_match2 = (shft0_tmp1312_trans_r == class2_hdr_byte_value[15:0]); | |
1391 | assign l2_hdr_class_match3 = (shft0_tmp1312_trans_r == class3_hdr_byte_value[15:0]); | |
1392 | ||
1393 | assign l3_hdr_class_match4 = (addr_ind_hdr_byte_masked4_r == class4_hdr_byte_value_masked) & is_ip_pkt; | |
1394 | assign l3_hdr_class_match5 = (addr_ind_hdr_byte_masked5_r == class5_hdr_byte_value_masked) & is_ip_pkt; | |
1395 | assign l3_hdr_class_match6 = (addr_ind_hdr_byte_masked6_r == class6_hdr_byte_value_masked) & is_ip_pkt; | |
1396 | assign l3_hdr_class_match7 = (addr_ind_hdr_byte_masked7_r == class7_hdr_byte_value_masked) & is_ip_pkt; | |
1397 | ||
1398 | assign l3_hdr_class_match8 = v4_protocol[0]; | |
1399 | assign l3_hdr_class_match9 = v4_protocol[1]; | |
1400 | assign l3_hdr_class_match10 = v4_protocol[2] | v4_protocol[3]; | |
1401 | assign l3_hdr_class_match11 = v4_protocol[4]; | |
1402 | assign l3_hdr_class_match12 = v6_next_hdr[0]; | |
1403 | assign l3_hdr_class_match13 = v6_next_hdr[1]; | |
1404 | assign l3_hdr_class_match14 = v6_next_hdr[2] | v6_next_hdr[3]; | |
1405 | assign l3_hdr_class_match15 = v6_next_hdr[4]; | |
1406 | assign l3_hdr_class_match16 = (shft0_tmp1312_trans_r == `TYPE_ARP); | |
1407 | assign l3_hdr_class_match17 = (shft0_tmp1312_trans_r == `TYPE_RARP); | |
1408 | ||
1409 | ||
1410 | assign hdr_class_match = | |
1411 | { | |
1412 | l3_hdr_class_match17, | |
1413 | l3_hdr_class_match16, | |
1414 | l3_hdr_class_match15, | |
1415 | l3_hdr_class_match14, | |
1416 | l3_hdr_class_match13, | |
1417 | l3_hdr_class_match12, | |
1418 | l3_hdr_class_match11, | |
1419 | l3_hdr_class_match10, | |
1420 | l3_hdr_class_match9, | |
1421 | l3_hdr_class_match8, | |
1422 | l3_hdr_class_match7, | |
1423 | l3_hdr_class_match6, | |
1424 | l3_hdr_class_match5, | |
1425 | l3_hdr_class_match4, | |
1426 | l2_hdr_class_match3, | |
1427 | l2_hdr_class_match2 | |
1428 | }; | |
1429 | ||
1430 | ||
1431 | assign valid_hdr_class_match_in = hdr_class_match & class_en_mask; | |
1432 | assign class_index = class_index_enc (valid_hdr_class_match[15:0]); | |
1433 | assign class_index_tmp = (is_promis) ? 5'b0 : class_index; | |
1434 | ||
1435 | dffre #(16) valid_hdr_class_match_reg (cclk, reset, shft4_reg_en, valid_hdr_class_match_in, valid_hdr_class_match); | |
1436 | dffre #(5) class_reg (cclk, reset, shft5_reg_en, class_index_tmp, class); | |
1437 | ||
1438 | assign class_action = class_action_sel0 | |
1439 | ( | |
1440 | class[3:0], | |
1441 | 3'b010, | |
1442 | 3'b010, | |
1443 | class_action_reg4_dout[2:0], | |
1444 | class_action_reg5_dout[2:0], | |
1445 | class_action_reg6_dout[2:0], | |
1446 | class_action_reg7_dout[2:0], | |
1447 | class_action_reg8_dout[2:0], | |
1448 | class_action_reg9_dout[2:0], | |
1449 | class_action_reg10_dout[2:0], | |
1450 | class_action_reg11_dout[2:0], | |
1451 | class_action_reg12_dout[2:0], | |
1452 | class_action_reg13_dout[2:0], | |
1453 | class_action_reg14_dout[2:0], | |
1454 | class_action_reg15_dout[2:0] | |
1455 | ); | |
1456 | ||
1457 | assign f_key_class_action = class_action_sel1 | |
1458 | ( | |
1459 | class[3:0], | |
1460 | 10'b0, | |
1461 | 10'b0, | |
1462 | f_key_class_action_reg4_dout[9:0], | |
1463 | f_key_class_action_reg5_dout[9:0], | |
1464 | f_key_class_action_reg6_dout[9:0], | |
1465 | f_key_class_action_reg7_dout[9:0], | |
1466 | f_key_class_action_reg8_dout[9:0], | |
1467 | f_key_class_action_reg9_dout[9:0], | |
1468 | f_key_class_action_reg10_dout[9:0], | |
1469 | f_key_class_action_reg11_dout[9:0], | |
1470 | f_key_class_action_reg12_dout[9:0], | |
1471 | f_key_class_action_reg13_dout[9:0], | |
1472 | f_key_class_action_reg14_dout[9:0], | |
1473 | f_key_class_action_reg15_dout[9:0] | |
1474 | ); | |
1475 | ||
1476 | ||
1477 | /***************************************/ | |
1478 | //L2 RDC number | |
1479 | /***************************************/ | |
1480 | assign vlan_parity_err_log_en = vlan_parity_err & shft5_reg_en; | |
1481 | ||
1482 | assign masked_vlan_tbl_dout = {18{shft5_reg_en | cpu_vlan_gnt_3}} & vlan_tbl_din_reg_dout[17:0]; | |
1483 | assign vlan_tbl_rd_data = mac_port_dec[0] ? masked_vlan_tbl_dout[3:0] : | |
1484 | mac_port_dec[1] ? masked_vlan_tbl_dout[7:4] : | |
1485 | mac_port_dec[2] ? masked_vlan_tbl_dout[12:9] : | |
1486 | masked_vlan_tbl_dout[16:13]; | |
1487 | ||
1488 | assign vlan_rdc_num = vlan_tbl_rd_data[2:0]; | |
1489 | assign vpr = vlan_tbl_rd_data[3]; | |
1490 | assign vlan_parity = {masked_vlan_tbl_dout[17], masked_vlan_tbl_dout[8]}; | |
1491 | ||
1492 | assign vlan_parity_bit = {^masked_vlan_tbl_dout[16:9], ^masked_vlan_tbl_dout[7:0]}; | |
1493 | assign vlan_parity_err = !((vlan_parity_bit == vlan_parity) | disable_chksum) & encap_offset_reg[0]; | |
1494 | ||
1495 | assign use_vlan_rdc = encap_offset_reg[0] & !vlan_parity_err; | |
1496 | assign vlan_rdc_prio = use_vlan_rdc & vpr; | |
1497 | assign is_promis = !ph_match & promiscuous; | |
1498 | ||
1499 | /* | |
1500 | always @ (use_vlan_rdc or vlan_rdc_prio or mpr or | |
1501 | vlan_rdc_num or mac_rdc_num) | |
1502 | if (vlan_rdc_prio) | |
1503 | l2_rdc_num = vlan_rdc_num; | |
1504 | else if (mpr) | |
1505 | l2_rdc_num = mac_rdc_num; | |
1506 | else if (use_vlan_rdc) | |
1507 | l2_rdc_num = vlan_rdc_num; | |
1508 | else | |
1509 | l2_rdc_num = mac_rdc_num; | |
1510 | */ | |
1511 | ||
1512 | always @ (vlan_rdc_prio or vlan_rdc_num or mac_rdc_num) | |
1513 | if (vlan_rdc_prio) | |
1514 | l2_rdc_num = vlan_rdc_num; | |
1515 | else | |
1516 | l2_rdc_num = mac_rdc_num; | |
1517 | ||
1518 | dffre #(3) l2_rdc_num_r_reg (cclk, reset, shft5_reg_en, l2_rdc_num, l2_rdc_num_r); | |
1519 | dffre #(1) vlan_parity_err_r_reg (cclk, reset, shft5_reg_en, vlan_parity_err, vlan_parity_err_r); | |
1520 | ||
1521 | assign class_action_r0 = class[4] ? 2'b01 : class_action_r[2:1]; | |
1522 | assign shft1_status = { is_promis, ph_match, class[4:0], | |
1523 | encap_offset_reg[0], encap_offset_reg[1], noport_r, | |
1524 | badip_r, l4_protocol_r[1:0], ether_type[1:0], | |
1525 | class_action_r0[1:0], l2_rdc_num_r[2:0]}; //20 bits | |
1526 | ||
1527 | ||
1528 | /***************************/ | |
1529 | //Stage two | |
1530 | /***************************/ | |
1531 | always @ ( | |
1532 | encap_offset_reg or | |
1533 | shft2_reg4_dout or | |
1534 | shft2_reg5_dout or | |
1535 | shft2_reg6_dout or | |
1536 | shft2_reg7_dout or | |
1537 | shft2_reg8_dout or | |
1538 | shft2_reg9_dout or | |
1539 | shft2_reg10_dout or | |
1540 | shft2_reg11_dout or | |
1541 | shft2_reg12_dout or | |
1542 | shft2_reg13_dout or | |
1543 | shft2_reg14_dout or | |
1544 | shft2_reg15_dout or | |
1545 | shft3_reg0_dout or | |
1546 | shft3_reg1_dout or | |
1547 | shft3_reg2_dout or | |
1548 | shft3_reg3_dout or | |
1549 | shft3_reg4_dout or | |
1550 | shft3_reg5_dout or | |
1551 | shft3_reg6_dout or | |
1552 | shft3_reg7_dout or | |
1553 | shft3_reg8_dout or | |
1554 | shft3_reg9_dout or | |
1555 | shft3_reg10_dout or | |
1556 | shft3_reg11_dout or | |
1557 | shft3_reg12_dout or | |
1558 | shft3_reg13_dout or | |
1559 | shft3_reg14_dout or | |
1560 | shft3_reg15_dout or | |
1561 | shft4_reg0_dout or | |
1562 | shft4_reg1_dout or | |
1563 | shft4_reg2_dout or | |
1564 | shft4_reg3_dout or | |
1565 | shft4_reg4_dout or | |
1566 | shft4_reg5_dout or | |
1567 | shft4_reg6_dout or | |
1568 | shft4_reg7_dout or | |
1569 | shft4_reg8_dout or | |
1570 | shft4_reg9_dout or | |
1571 | shft4_reg10_dout or | |
1572 | shft4_reg11_dout or | |
1573 | shft4_reg12_dout or | |
1574 | shft4_reg13_dout or | |
1575 | shft4_reg14_dout or | |
1576 | shft4_reg15_dout or | |
1577 | shft5_reg0_dout or | |
1578 | shft5_reg1_dout or | |
1579 | shft5_reg2_dout or | |
1580 | shft5_reg3_dout or | |
1581 | shft5_reg4_dout or | |
1582 | shft5_reg5_dout or | |
1583 | shft5_reg6_dout or | |
1584 | shft5_reg7_dout or | |
1585 | shft5_reg8_dout or | |
1586 | shft5_reg9_dout or | |
1587 | shft5_reg10_dout or | |
1588 | shft5_reg11_dout or | |
1589 | shft5_reg12_dout or | |
1590 | shft5_reg13_dout or | |
1591 | shft5_reg14_dout or | |
1592 | shft5_reg15_dout or | |
1593 | //shft6_reg0_dout or | |
1594 | //shft6_reg1_dout or | |
1595 | shft6_reg2_dout or | |
1596 | shft6_reg3_dout | |
1597 | ) | |
1598 | ||
1599 | begin | |
1600 | case (encap_offset_reg) //synopsys parallel_case full_case | |
1601 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:shftM_tmpN_dout_2" | |
1602 | 2'b00: begin | |
1603 | shft2_tmp4_dout = shft2_reg4_dout; | |
1604 | shft2_tmp5_dout = shft2_reg5_dout; | |
1605 | shft2_tmp6_dout = shft2_reg6_dout; | |
1606 | shft2_tmp7_dout = shft2_reg7_dout; | |
1607 | shft2_tmp8_dout = shft2_reg8_dout; | |
1608 | shft2_tmp9_dout = shft2_reg9_dout; | |
1609 | shft2_tmp10_dout = shft2_reg10_dout; | |
1610 | shft2_tmp11_dout = shft2_reg11_dout; | |
1611 | shft2_tmp12_dout = shft2_reg12_dout; | |
1612 | shft2_tmp13_dout = shft2_reg13_dout; | |
1613 | shft2_tmp14_dout = shft2_reg14_dout; | |
1614 | shft2_tmp15_dout = shft2_reg15_dout; | |
1615 | ||
1616 | shft3_tmp0_dout = shft3_reg0_dout; | |
1617 | shft3_tmp1_dout = shft3_reg1_dout; | |
1618 | shft3_tmp2_dout = shft3_reg2_dout; | |
1619 | shft3_tmp3_dout = shft3_reg3_dout; | |
1620 | shft3_tmp4_dout = shft3_reg4_dout; | |
1621 | shft3_tmp5_dout = shft3_reg5_dout; | |
1622 | shft3_tmp6_dout = shft3_reg6_dout; | |
1623 | shft3_tmp7_dout = shft3_reg7_dout; | |
1624 | shft3_tmp8_dout = shft3_reg8_dout; | |
1625 | shft3_tmp9_dout = shft3_reg9_dout; | |
1626 | shft3_tmp10_dout = shft3_reg10_dout; | |
1627 | shft3_tmp11_dout = shft3_reg11_dout; | |
1628 | shft3_tmp12_dout = shft3_reg12_dout; | |
1629 | shft3_tmp13_dout = shft3_reg13_dout; | |
1630 | shft3_tmp14_dout = shft3_reg14_dout; | |
1631 | shft3_tmp15_dout = shft3_reg15_dout; | |
1632 | ||
1633 | ||
1634 | shft4_tmp0_dout = shft4_reg0_dout; | |
1635 | shft4_tmp1_dout = shft4_reg1_dout; | |
1636 | shft4_tmp2_dout = shft4_reg2_dout; | |
1637 | shft4_tmp3_dout = shft4_reg3_dout; | |
1638 | shft4_tmp4_dout = shft4_reg4_dout; | |
1639 | shft4_tmp5_dout = shft4_reg5_dout; | |
1640 | shft4_tmp6_dout = shft4_reg6_dout; | |
1641 | shft4_tmp7_dout = shft4_reg7_dout; | |
1642 | shft4_tmp8_dout = shft4_reg8_dout; | |
1643 | shft4_tmp9_dout = shft4_reg9_dout; | |
1644 | shft4_tmp10_dout = shft4_reg10_dout; | |
1645 | shft4_tmp11_dout = shft4_reg11_dout; | |
1646 | shft4_tmp12_dout = shft4_reg12_dout; | |
1647 | shft4_tmp13_dout = shft4_reg13_dout; | |
1648 | shft4_tmp14_dout = shft4_reg14_dout; | |
1649 | shft4_tmp15_dout = shft4_reg15_dout; | |
1650 | ||
1651 | shft5_tmp0_dout = shft5_reg0_dout; | |
1652 | shft5_tmp1_dout = shft5_reg1_dout; | |
1653 | shft5_tmp2_dout = shft5_reg2_dout; | |
1654 | shft5_tmp3_dout = shft5_reg3_dout; | |
1655 | //shft5_tmp4_dout = shft5_reg4_dout; | |
1656 | //shft5_tmp5_dout = shft5_reg5_dout; | |
1657 | shft5_tmp6_dout = shft5_reg6_dout; | |
1658 | shft5_tmp7_dout = shft5_reg7_dout; | |
1659 | ||
1660 | end | |
1661 | ||
1662 | 2'b01: begin | |
1663 | shft2_tmp4_dout = shft2_reg8_dout; | |
1664 | shft2_tmp5_dout = shft2_reg9_dout; | |
1665 | shft2_tmp6_dout = shft2_reg10_dout; | |
1666 | shft2_tmp7_dout = shft2_reg11_dout; | |
1667 | shft2_tmp8_dout = shft2_reg12_dout; | |
1668 | shft2_tmp9_dout = shft2_reg13_dout; | |
1669 | shft2_tmp10_dout = shft2_reg14_dout; | |
1670 | shft2_tmp11_dout = shft2_reg15_dout; | |
1671 | shft2_tmp12_dout = shft3_reg0_dout; | |
1672 | shft2_tmp13_dout = shft3_reg1_dout; | |
1673 | shft2_tmp14_dout = shft3_reg2_dout; | |
1674 | shft2_tmp15_dout = shft3_reg3_dout; | |
1675 | ||
1676 | shft3_tmp0_dout = shft3_reg4_dout; | |
1677 | shft3_tmp1_dout = shft3_reg5_dout; | |
1678 | shft3_tmp2_dout = shft3_reg6_dout; | |
1679 | shft3_tmp3_dout = shft3_reg7_dout; | |
1680 | shft3_tmp4_dout = shft3_reg8_dout; | |
1681 | shft3_tmp5_dout = shft3_reg9_dout; | |
1682 | shft3_tmp6_dout = shft3_reg10_dout; | |
1683 | shft3_tmp7_dout = shft3_reg11_dout; | |
1684 | shft3_tmp8_dout = shft3_reg12_dout; | |
1685 | shft3_tmp9_dout = shft3_reg13_dout; | |
1686 | shft3_tmp10_dout = shft3_reg14_dout; | |
1687 | shft3_tmp11_dout = shft3_reg15_dout; | |
1688 | shft3_tmp12_dout = shft4_reg0_dout; | |
1689 | shft3_tmp13_dout = shft4_reg1_dout; | |
1690 | shft3_tmp14_dout = shft4_reg2_dout; | |
1691 | shft3_tmp15_dout = shft4_reg3_dout; | |
1692 | ||
1693 | shft4_tmp0_dout = shft4_reg4_dout; | |
1694 | shft4_tmp1_dout = shft4_reg5_dout; | |
1695 | shft4_tmp2_dout = shft4_reg6_dout; | |
1696 | shft4_tmp3_dout = shft4_reg7_dout; | |
1697 | shft4_tmp4_dout = shft4_reg8_dout; | |
1698 | shft4_tmp5_dout = shft4_reg9_dout; | |
1699 | shft4_tmp6_dout = shft4_reg10_dout; | |
1700 | shft4_tmp7_dout = shft4_reg11_dout; | |
1701 | shft4_tmp8_dout = shft4_reg12_dout; | |
1702 | shft4_tmp9_dout = shft4_reg13_dout; | |
1703 | shft4_tmp10_dout = shft4_reg14_dout; | |
1704 | shft4_tmp11_dout = shft4_reg15_dout; | |
1705 | shft4_tmp12_dout = shft5_reg0_dout; | |
1706 | shft4_tmp13_dout = shft5_reg1_dout; | |
1707 | shft4_tmp14_dout = shft5_reg2_dout; | |
1708 | shft4_tmp15_dout = shft5_reg3_dout; | |
1709 | ||
1710 | shft5_tmp0_dout = shft5_reg4_dout; | |
1711 | shft5_tmp1_dout = shft5_reg5_dout; | |
1712 | shft5_tmp2_dout = shft5_reg6_dout; | |
1713 | shft5_tmp3_dout = shft5_reg7_dout; | |
1714 | //shft5_tmp4_dout = shft5_reg8_dout; | |
1715 | //shft5_tmp5_dout = shft5_reg9_dout; | |
1716 | shft5_tmp6_dout = shft5_reg10_dout; | |
1717 | shft5_tmp7_dout = shft5_reg11_dout; | |
1718 | ||
1719 | end | |
1720 | ||
1721 | 2'b10: begin | |
1722 | shft2_tmp4_dout = shft2_reg12_dout; | |
1723 | shft2_tmp5_dout = shft2_reg13_dout; | |
1724 | shft2_tmp6_dout = shft2_reg14_dout; | |
1725 | shft2_tmp7_dout = shft2_reg15_dout; | |
1726 | shft2_tmp8_dout = shft3_reg0_dout; | |
1727 | shft2_tmp9_dout = shft3_reg1_dout; | |
1728 | shft2_tmp10_dout = shft3_reg2_dout; | |
1729 | shft2_tmp11_dout = shft3_reg3_dout; | |
1730 | shft2_tmp12_dout = shft3_reg4_dout; | |
1731 | shft2_tmp13_dout = shft3_reg5_dout; | |
1732 | shft2_tmp14_dout = shft3_reg6_dout; | |
1733 | shft2_tmp15_dout = shft3_reg7_dout; | |
1734 | ||
1735 | shft3_tmp0_dout = shft3_reg8_dout; | |
1736 | shft3_tmp1_dout = shft3_reg9_dout; | |
1737 | shft3_tmp2_dout = shft3_reg10_dout; | |
1738 | shft3_tmp3_dout = shft3_reg11_dout; | |
1739 | shft3_tmp4_dout = shft3_reg12_dout; | |
1740 | shft3_tmp5_dout = shft3_reg13_dout; | |
1741 | shft3_tmp6_dout = shft3_reg14_dout; | |
1742 | shft3_tmp7_dout = shft3_reg15_dout; | |
1743 | shft3_tmp8_dout = shft4_reg0_dout; | |
1744 | shft3_tmp9_dout = shft4_reg1_dout; | |
1745 | shft3_tmp10_dout = shft4_reg2_dout; | |
1746 | shft3_tmp11_dout = shft4_reg3_dout; | |
1747 | shft3_tmp12_dout = shft4_reg4_dout; | |
1748 | shft3_tmp13_dout = shft4_reg5_dout; | |
1749 | shft3_tmp14_dout = shft4_reg6_dout; | |
1750 | shft3_tmp15_dout = shft4_reg7_dout; | |
1751 | ||
1752 | shft4_tmp0_dout = shft4_reg8_dout; | |
1753 | shft4_tmp1_dout = shft4_reg9_dout; | |
1754 | shft4_tmp2_dout = shft4_reg10_dout; | |
1755 | shft4_tmp3_dout = shft4_reg11_dout; | |
1756 | shft4_tmp4_dout = shft4_reg12_dout; | |
1757 | shft4_tmp5_dout = shft4_reg13_dout; | |
1758 | shft4_tmp6_dout = shft4_reg14_dout; | |
1759 | shft4_tmp7_dout = shft4_reg15_dout; | |
1760 | shft4_tmp8_dout = shft5_reg0_dout; | |
1761 | shft4_tmp9_dout = shft5_reg1_dout; | |
1762 | shft4_tmp10_dout = shft5_reg2_dout; | |
1763 | shft4_tmp11_dout = shft5_reg3_dout; | |
1764 | shft4_tmp12_dout = shft5_reg4_dout; | |
1765 | shft4_tmp13_dout = shft5_reg5_dout; | |
1766 | shft4_tmp14_dout = shft5_reg6_dout; | |
1767 | shft4_tmp15_dout = shft5_reg7_dout; | |
1768 | ||
1769 | shft5_tmp0_dout = shft5_reg8_dout; | |
1770 | shft5_tmp1_dout = shft5_reg9_dout; | |
1771 | shft5_tmp2_dout = shft5_reg10_dout; | |
1772 | shft5_tmp3_dout = shft5_reg11_dout; | |
1773 | //shft5_tmp4_dout = shft5_reg12_dout; | |
1774 | //shft5_tmp5_dout = shft5_reg13_dout; | |
1775 | shft5_tmp6_dout = shft5_reg14_dout; | |
1776 | shft5_tmp7_dout = shft5_reg15_dout; | |
1777 | ||
1778 | end | |
1779 | ||
1780 | 2'b11: begin | |
1781 | shft2_tmp4_dout = shft3_reg0_dout; | |
1782 | shft2_tmp5_dout = shft3_reg1_dout; | |
1783 | shft2_tmp6_dout = shft3_reg2_dout; | |
1784 | shft2_tmp7_dout = shft3_reg3_dout; | |
1785 | shft2_tmp8_dout = shft3_reg4_dout; | |
1786 | shft2_tmp9_dout = shft3_reg5_dout; | |
1787 | shft2_tmp10_dout = shft3_reg6_dout; | |
1788 | shft2_tmp11_dout = shft3_reg7_dout; | |
1789 | shft2_tmp12_dout = shft3_reg8_dout; | |
1790 | shft2_tmp13_dout = shft3_reg9_dout; | |
1791 | shft2_tmp14_dout = shft3_reg10_dout; | |
1792 | shft2_tmp15_dout = shft3_reg11_dout; | |
1793 | ||
1794 | shft3_tmp0_dout = shft3_reg12_dout; | |
1795 | shft3_tmp1_dout = shft3_reg13_dout; | |
1796 | shft3_tmp2_dout = shft3_reg14_dout; | |
1797 | shft3_tmp3_dout = shft3_reg15_dout; | |
1798 | shft3_tmp4_dout = shft4_reg0_dout; | |
1799 | shft3_tmp5_dout = shft4_reg1_dout; | |
1800 | shft3_tmp6_dout = shft4_reg2_dout; | |
1801 | shft3_tmp7_dout = shft4_reg3_dout; | |
1802 | shft3_tmp8_dout = shft4_reg4_dout; | |
1803 | shft3_tmp9_dout = shft4_reg5_dout; | |
1804 | shft3_tmp10_dout = shft4_reg6_dout; | |
1805 | shft3_tmp11_dout = shft4_reg7_dout; | |
1806 | shft3_tmp12_dout = shft4_reg8_dout; | |
1807 | shft3_tmp13_dout = shft4_reg9_dout; | |
1808 | shft3_tmp14_dout = shft4_reg10_dout; | |
1809 | shft3_tmp15_dout = shft4_reg11_dout; | |
1810 | ||
1811 | shft4_tmp0_dout = shft4_reg12_dout; | |
1812 | shft4_tmp1_dout = shft4_reg13_dout; | |
1813 | shft4_tmp2_dout = shft4_reg14_dout; | |
1814 | shft4_tmp3_dout = shft4_reg15_dout; | |
1815 | shft4_tmp4_dout = shft5_reg0_dout; | |
1816 | shft4_tmp5_dout = shft5_reg1_dout; | |
1817 | shft4_tmp6_dout = shft5_reg2_dout; | |
1818 | shft4_tmp7_dout = shft5_reg3_dout; | |
1819 | shft4_tmp8_dout = shft5_reg4_dout; | |
1820 | shft4_tmp9_dout = shft5_reg5_dout; | |
1821 | shft4_tmp10_dout = shft5_reg6_dout; | |
1822 | shft4_tmp11_dout = shft5_reg7_dout; | |
1823 | shft4_tmp12_dout = shft5_reg8_dout; | |
1824 | shft4_tmp13_dout = shft5_reg9_dout; | |
1825 | shft4_tmp14_dout = shft5_reg10_dout; | |
1826 | shft4_tmp15_dout = shft5_reg11_dout; | |
1827 | ||
1828 | shft5_tmp0_dout = shft5_reg12_dout; | |
1829 | shft5_tmp1_dout = shft5_reg13_dout; | |
1830 | shft5_tmp2_dout = shft5_reg14_dout; | |
1831 | shft5_tmp3_dout = shft5_reg15_dout; | |
1832 | //shft5_tmp4_dout = shft6_reg0_dout; | |
1833 | //shft5_tmp5_dout = shft6_reg1_dout; | |
1834 | shft5_tmp6_dout = shft6_reg2_dout; | |
1835 | shft5_tmp7_dout = shft6_reg3_dout; | |
1836 | ||
1837 | end | |
1838 | ||
1839 | default:begin | |
1840 | shft2_tmp4_dout = 8'b0; | |
1841 | shft2_tmp5_dout = 8'b0; | |
1842 | shft2_tmp6_dout = 8'b0; | |
1843 | shft2_tmp7_dout = 8'b0; | |
1844 | shft2_tmp8_dout = 8'b0; | |
1845 | shft2_tmp9_dout = 8'b0; | |
1846 | shft2_tmp10_dout = 8'b0; | |
1847 | shft2_tmp11_dout = 8'b0; | |
1848 | shft2_tmp12_dout = 8'b0; | |
1849 | shft2_tmp13_dout = 8'b0; | |
1850 | shft2_tmp14_dout = 8'b0; | |
1851 | shft2_tmp15_dout = 8'b0; | |
1852 | ||
1853 | shft3_tmp0_dout = 8'b0; | |
1854 | shft3_tmp1_dout = 8'b0; | |
1855 | shft3_tmp2_dout = 8'b0; | |
1856 | shft3_tmp3_dout = 8'b0; | |
1857 | shft3_tmp4_dout = 8'b0; | |
1858 | shft3_tmp5_dout = 8'b0; | |
1859 | shft3_tmp6_dout = 8'b0; | |
1860 | shft3_tmp7_dout = 8'b0; | |
1861 | shft3_tmp8_dout = 8'b0; | |
1862 | shft3_tmp9_dout = 8'b0; | |
1863 | shft3_tmp10_dout = 8'b0; | |
1864 | shft3_tmp11_dout = 8'b0; | |
1865 | shft3_tmp12_dout = 8'b0; | |
1866 | shft3_tmp13_dout = 8'b0; | |
1867 | shft3_tmp14_dout = 8'b0; | |
1868 | shft3_tmp15_dout = 8'b0; | |
1869 | ||
1870 | shft4_tmp0_dout = 8'b0; | |
1871 | shft4_tmp1_dout = 8'b0; | |
1872 | shft4_tmp2_dout = 8'b0; | |
1873 | shft4_tmp3_dout = 8'b0; | |
1874 | shft4_tmp4_dout = 8'b0; | |
1875 | shft4_tmp5_dout = 8'b0; | |
1876 | shft4_tmp6_dout = 8'b0; | |
1877 | shft4_tmp7_dout = 8'b0; | |
1878 | shft4_tmp8_dout = 8'b0; | |
1879 | shft4_tmp9_dout = 8'b0; | |
1880 | shft4_tmp10_dout = 8'b0; | |
1881 | shft4_tmp11_dout = 8'b0; | |
1882 | shft4_tmp12_dout = 8'b0; | |
1883 | shft4_tmp13_dout = 8'b0; | |
1884 | shft4_tmp14_dout = 8'b0; | |
1885 | shft4_tmp15_dout = 8'b0; | |
1886 | ||
1887 | shft5_tmp0_dout = 8'b0; | |
1888 | shft5_tmp1_dout = 8'b0; | |
1889 | shft5_tmp2_dout = 8'b0; | |
1890 | shft5_tmp3_dout = 8'b0; | |
1891 | //shft5_tmp4_dout = 8'b0; | |
1892 | //shft5_tmp5_dout = 8'b0; | |
1893 | shft5_tmp6_dout = 8'b0; | |
1894 | shft5_tmp7_dout = 8'b0; | |
1895 | ||
1896 | end | |
1897 | endcase | |
1898 | end | |
1899 | ||
1900 | assign ipv4_tos = shft0_tmp15_dout; | |
1901 | assign ipv4_protocol = shft1_tmp7_dout; | |
1902 | assign ipv4_src_addr = {shft1_tmp10_dout, shft1_tmp11_dout, | |
1903 | shft1_tmp12_dout, shft1_tmp13_dout}; | |
1904 | assign ipv4_dest_addr = {shft1_tmp14_dout, shft1_tmp15_dout, | |
1905 | shft2_tmp0_dout, shft2_tmp1_dout}; | |
1906 | ||
1907 | /* | |
1908 | assign ipv4_ah_spi = {shft2_tmp6_dout, shft2_tmp7_dout, | |
1909 | shft2_tmp8_dout, shft2_tmp9_dout}; | |
1910 | assign ipv4_esp_spi = {shft2_tmp2_dout, shft2_tmp3_dout, | |
1911 | shft2_tmp4_dout, shft2_tmp5_dout}; | |
1912 | */ | |
1913 | ||
1914 | assign ipv6_tos = {shft0_tmp14_dout[3:0], shft0_tmp15_dout[7:4]}; | |
1915 | assign ipv6_next_hdr = shft1_tmp4_dout; | |
1916 | assign ipv6_src_addr = {shft1_tmp6_dout, shft1_tmp7_dout, | |
1917 | shft1_tmp8_dout, shft1_tmp9_dout, | |
1918 | shft1_tmp10_dout, shft1_tmp11_dout, | |
1919 | shft1_tmp12_dout, shft1_tmp13_dout, | |
1920 | shft1_tmp14_dout, shft1_tmp15_dout, | |
1921 | shft2_tmp0_dout, shft2_tmp1_dout, | |
1922 | shft2_tmp2_dout, shft2_tmp3_dout, | |
1923 | shft2_tmp4_dout, shft2_tmp5_dout}; | |
1924 | ||
1925 | assign ipv6_dest_addr_pre = {shft2_tmp6_dout, shft2_tmp7_dout, | |
1926 | shft2_tmp8_dout, shft2_tmp9_dout, | |
1927 | shft2_tmp10_dout, shft2_tmp11_dout, | |
1928 | shft2_tmp12_dout, shft2_tmp13_dout}; | |
1929 | ||
1930 | assign ipv6_dest_addr_suf = {shft2_tmp14_dout, shft2_tmp15_dout, | |
1931 | shft3_tmp0_dout, shft3_tmp1_dout, | |
1932 | shft3_tmp2_dout, shft3_tmp3_dout, | |
1933 | shft3_tmp4_dout, shft3_tmp5_dout}; | |
1934 | ||
1935 | assign ipv6_dest_addr = {ipv6_dest_addr_pre, ipv6_dest_addr_suf}; | |
1936 | ||
1937 | assign ipv6_tcp_src_port = {shft3_tmp6_dout, shft3_tmp7_dout}; | |
1938 | assign ipv6_tcp_dest_port = {shft3_tmp8_dout, shft3_tmp9_dout}; | |
1939 | ||
1940 | /* | |
1941 | assign ipv6_ah_spi = {shft3_tmp10_dout, shft3_tmp11_dout, | |
1942 | shft3_tmp12_dout, shft3_tmp13_dout}; | |
1943 | assign ipv6_esp_spi = {shft3_tmp6_dout, shft3_tmp7_dout, | |
1944 | shft3_tmp8_dout, shft3_tmp9_dout}; | |
1945 | */ | |
1946 | ||
1947 | /*******************************************/ | |
1948 | //Extract IPV4/TCP ports (shift5, stage6_en) | |
1949 | /*******************************************/ | |
1950 | always @ ( | |
1951 | ipv4_ip_hdr_len_r[1:0] or | |
1952 | shft2_tmp2_dout_r or | |
1953 | shft2_tmp3_dout_r or | |
1954 | shft2_tmp4_dout or | |
1955 | shft2_tmp5_dout or | |
1956 | ||
1957 | shft2_tmp6_dout or | |
1958 | shft2_tmp7_dout or | |
1959 | shft2_tmp8_dout or | |
1960 | shft2_tmp9_dout or | |
1961 | ||
1962 | shft2_tmp10_dout or | |
1963 | shft2_tmp11_dout or | |
1964 | shft2_tmp12_dout or | |
1965 | shft2_tmp13_dout) | |
1966 | ||
1967 | begin | |
1968 | ||
1969 | case (ipv4_ip_hdr_len_r[1:0]) //synopsys parallel_case full_case | |
1970 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_port_1" | |
1971 | ||
1972 | 2'b00, 2'b01: v4_tcp_port_01 = {shft2_tmp2_dout_r, shft2_tmp3_dout_r, shft2_tmp4_dout, shft2_tmp5_dout}; | |
1973 | 2'b10: v4_tcp_port_01 = {shft2_tmp6_dout, shft2_tmp7_dout, shft2_tmp8_dout, shft2_tmp9_dout}; | |
1974 | 2'b11: v4_tcp_port_01 = {shft2_tmp10_dout, shft2_tmp11_dout, shft2_tmp12_dout, shft2_tmp13_dout}; | |
1975 | default: v4_tcp_port_01 = 32'b0; | |
1976 | ||
1977 | endcase | |
1978 | end | |
1979 | ||
1980 | always @ ( | |
1981 | ipv4_ip_hdr_len_r[1:0] or | |
1982 | shft2_tmp14_dout or | |
1983 | shft2_tmp15_dout or | |
1984 | shft3_tmp0_dout or | |
1985 | shft3_tmp1_dout or | |
1986 | ||
1987 | shft3_tmp2_dout or | |
1988 | shft3_tmp3_dout or | |
1989 | shft3_tmp4_dout or | |
1990 | shft3_tmp5_dout or | |
1991 | ||
1992 | shft3_tmp6_dout or | |
1993 | shft3_tmp7_dout or | |
1994 | shft3_tmp8_dout or | |
1995 | shft3_tmp9_dout or | |
1996 | ||
1997 | shft3_tmp10_dout or | |
1998 | shft3_tmp11_dout or | |
1999 | shft3_tmp12_dout or | |
2000 | shft3_tmp13_dout) | |
2001 | ||
2002 | begin | |
2003 | case (ipv4_ip_hdr_len_r[1:0]) //synopsys parallel_case full_case | |
2004 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_port_2" | |
2005 | ||
2006 | 2'b00: v4_tcp_port_10 = {shft2_tmp14_dout, shft2_tmp15_dout, shft3_tmp0_dout, shft3_tmp1_dout}; | |
2007 | 2'b01: v4_tcp_port_10 = {shft3_tmp2_dout, shft3_tmp3_dout, shft3_tmp4_dout, shft3_tmp5_dout}; | |
2008 | 2'b10: v4_tcp_port_10 = {shft3_tmp6_dout, shft3_tmp7_dout, shft3_tmp8_dout, shft3_tmp9_dout}; | |
2009 | 2'b11: v4_tcp_port_10 = {shft3_tmp10_dout, shft3_tmp11_dout, shft3_tmp12_dout, shft3_tmp13_dout}; | |
2010 | default: v4_tcp_port_10 = 32'b0; | |
2011 | ||
2012 | endcase | |
2013 | end | |
2014 | ||
2015 | always @ ( | |
2016 | ipv4_ip_hdr_len_r[1:0] or | |
2017 | shft3_tmp14_dout or | |
2018 | shft3_tmp15_dout or | |
2019 | shft4_tmp0_dout or | |
2020 | shft4_tmp1_dout or | |
2021 | ||
2022 | shft4_tmp2_dout or | |
2023 | shft4_tmp3_dout or | |
2024 | shft4_tmp4_dout or | |
2025 | shft4_tmp5_dout or | |
2026 | ||
2027 | shft4_tmp6_dout or | |
2028 | shft4_tmp7_dout or | |
2029 | shft4_tmp8_dout or | |
2030 | shft4_tmp9_dout or | |
2031 | ||
2032 | shft4_tmp10_dout or | |
2033 | shft4_tmp11_dout or | |
2034 | shft4_tmp12_dout or | |
2035 | shft4_tmp13_dout) | |
2036 | ||
2037 | begin | |
2038 | ||
2039 | case (ipv4_ip_hdr_len_r[1:0]) //synopsys parallel_case full_case | |
2040 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_port_3" | |
2041 | ||
2042 | 2'b00: v4_tcp_port_11 = {shft3_tmp14_dout, shft3_tmp15_dout, shft4_tmp0_dout, shft4_tmp1_dout}; | |
2043 | 2'b01: v4_tcp_port_11 = {shft4_tmp2_dout, shft4_tmp3_dout, shft4_tmp4_dout, shft4_tmp5_dout}; | |
2044 | 2'b10: v4_tcp_port_11 = {shft4_tmp6_dout, shft4_tmp7_dout, shft4_tmp8_dout, shft4_tmp9_dout}; | |
2045 | 2'b11: v4_tcp_port_11 = {shft4_tmp10_dout, shft4_tmp11_dout, shft4_tmp12_dout, shft4_tmp13_dout}; | |
2046 | default: v4_tcp_port_11 = 32'b0; | |
2047 | ||
2048 | endcase | |
2049 | end | |
2050 | ||
2051 | ||
2052 | always @ ( | |
2053 | ipv4_ip_hdr_len_r[3:2] or | |
2054 | v4_tcp_port_01_r or | |
2055 | v4_tcp_port_10_r or | |
2056 | v4_tcp_port_11) | |
2057 | ||
2058 | begin | |
2059 | case (ipv4_ip_hdr_len_r[3:2]) //synopsys parallel_case full_case | |
2060 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_port_4" | |
2061 | ||
2062 | 2'b00, 2'b01: v4_tcp_port = v4_tcp_port_01_r; | |
2063 | 2'b10: v4_tcp_port = v4_tcp_port_10_r; | |
2064 | 2'b11: v4_tcp_port = v4_tcp_port_11; | |
2065 | default: v4_tcp_port = 32'b0; | |
2066 | ||
2067 | endcase | |
2068 | end | |
2069 | ||
2070 | ||
2071 | dffre #(32) v4_tcp_port_01_r_reg (cclk, reset, shft4_reg_en, v4_tcp_port_01, v4_tcp_port_01_r); | |
2072 | dffre #(32) v4_tcp_port_10_r_reg (cclk, reset, shft5_reg_en, v4_tcp_port_10, v4_tcp_port_10_r); | |
2073 | dffre #(8) ipv4_tos_r_reg (cclk, reset, shft5_reg_en, ipv4_tos, ipv4_tos_r); | |
2074 | dffre #(8) ipv4_protocol_r_reg (cclk, reset, shft5_reg_en, ipv4_protocol, ipv4_protocol_r); | |
2075 | dffre #(32) ipv4_src_addr_r_reg (cclk, reset, shft5_reg_en, ipv4_src_addr, ipv4_src_addr_r); | |
2076 | dffre #(32) ipv4_dest_addr_r_reg (cclk, reset, shft5_reg_en, ipv4_dest_addr, ipv4_dest_addr_r); | |
2077 | /* | |
2078 | dffre #(32) ipv4_ah_spi_r_reg (cclk, reset, shft5_reg_en, ipv4_ah_spi, ipv4_ah_spi_r); | |
2079 | dffre #(32) ipv4_esp_spi_r_reg (cclk, reset, shft5_reg_en, ipv4_esp_spi, ipv4_esp_spi_r); | |
2080 | */ | |
2081 | ||
2082 | dffre #(8) ipv6_tos_r_reg (cclk, reset, shft5_reg_en, ipv6_tos, ipv6_tos_r); | |
2083 | dffre #(8) ipv6_next_hdr_r_reg (cclk, reset, shft5_reg_en, ipv6_next_hdr, ipv6_next_hdr_r); | |
2084 | dffre #(128) ipv6_src_addr_r_reg (cclk, reset, shft5_reg_en, ipv6_src_addr, ipv6_src_addr_r); | |
2085 | dffre #(128) ipv6_dest_addr_r_reg (cclk, reset, shft5_reg_en, ipv6_dest_addr, ipv6_dest_addr_r); | |
2086 | dffre #(16) ipv6_tcp_src_port_r_reg (cclk, reset, shft5_reg_en, ipv6_tcp_src_port, ipv6_tcp_src_port_r); | |
2087 | dffre #(16) ipv6_tcp_dest_port_r_reg (cclk, reset, shft5_reg_en, ipv6_tcp_dest_port,ipv6_tcp_dest_port_r); | |
2088 | /* | |
2089 | dffre #(32) ipv6_ah_spi_r_reg (cclk, reset, shft5_reg_en, ipv6_ah_spi, ipv6_ah_spi_r); | |
2090 | dffre #(32) ipv6_esp_spi_r_reg (cclk, reset, shft5_reg_en, ipv6_esp_spi, ipv6_esp_spi_r); | |
2091 | */ | |
2092 | ||
2093 | dffre #(32) v4_tcp_port_r_reg (cclk, reset, shft6_reg_en, v4_tcp_port, v4_tcp_port_r); //{src, dest} | |
2094 | ||
2095 | assign v6_tcp_port_r = {ipv6_tcp_src_port_r, ipv6_tcp_dest_port_r}; | |
2096 | ||
2097 | /******************************/ | |
2098 | //Gen raw key | |
2099 | /******************************/ | |
2100 | assign do_raw_key = (class[4:2] == 3'b0) | (class[4] == 1'b1); | |
2101 | ||
2102 | assign raw_cam_key = {shft1_tmp8_dout, shft1_tmp7_dout, | |
2103 | shft1_tmp6_dout, shft1_tmp5_dout, | |
2104 | shft1_tmp4_dout, shft1_tmp3_dout, | |
2105 | shft1_tmp2_dout, shft1_tmp1_dout, | |
2106 | shft1_tmp0_dout, shft0_tmp15_dout, | |
2107 | shft0_tmp14_dout}; | |
2108 | ||
2109 | dffre #(88) raw_cam_key_r_reg (cclk, reset, shft3_reg_en, raw_cam_key, raw_cam_key_r); | |
2110 | dffre #(1) do_raw_key_r_reg (cclk, reset, shft6_reg_en, do_raw_key, do_raw_key_r); | |
2111 | ||
2112 | /********************************/ | |
2113 | //GEN TCAM key (stage7_en) | |
2114 | /********************************/ | |
2115 | dffre #(3) class_action_r_reg (cclk, reset, shft6_reg_en, class_action, class_action_r); | |
2116 | ||
2117 | assign class_action_ipaddr = class_action_r[0]; | |
2118 | ||
2119 | assign v4_cam_key = {class, 5'b0, l2_rdc_num_r, noport_r, 74'b0, ipv4_tos_r, ipv4_protocol_r, v4_tcp_port_r, ipv4_src_addr_r, ipv4_dest_addr_r}; | |
2120 | assign v4_cam_key_ah = {class, 5'b0, l2_rdc_num_r, noport_r, 74'b0, ipv4_tos_r, ipv4_protocol_r, v4_seq_num_r, ipv4_src_addr_r, ipv4_dest_addr_r}; | |
2121 | assign v4_cam_key_esp = {class, 5'b0, l2_rdc_num_r, noport_r, 74'b0, ipv4_tos_r, ipv4_protocol_r, v4_tcp_port_r, ipv4_src_addr_r, ipv4_dest_addr_r}; | |
2122 | ||
2123 | assign v6_cam_key_src = {class, 5'b0, l2_rdc_num_r, 11'b0, ipv6_tos_r, ipv6_next_hdr_r, v6_tcp_port_r, ipv6_src_addr_r}; | |
2124 | assign v6_cam_key_src_ah = {class, 5'b0, l2_rdc_num_r, 11'b0, ipv6_tos_r, ipv6_next_hdr_r, v6_seq_num_r, ipv6_src_addr_r}; | |
2125 | assign v6_cam_key_src_esp = {class, 5'b0, l2_rdc_num_r, 11'b0, ipv6_tos_r, ipv6_next_hdr_r, v6_tcp_port_r, ipv6_src_addr_r}; | |
2126 | ||
2127 | assign v6_cam_key_dest = {class, 5'b0, l2_rdc_num_r, 11'b0, ipv6_tos_r, ipv6_next_hdr_r, v6_tcp_port_r, ipv6_dest_addr_r}; | |
2128 | assign v6_cam_key_dest_ah = {class, 5'b0, l2_rdc_num_r, 11'b0, ipv6_tos_r, ipv6_next_hdr_r, v6_seq_num_r, ipv6_dest_addr_r}; | |
2129 | assign v6_cam_key_dest_esp = {class, 5'b0, l2_rdc_num_r, 11'b0, ipv6_tos_r, ipv6_next_hdr_r, v6_tcp_port_r, ipv6_dest_addr_r}; | |
2130 | ||
2131 | assign v4_5t_cam_key = v4_protocol[3] ? v4_cam_key_esp : | |
2132 | v4_protocol[2] ? v4_cam_key_ah : | |
2133 | v4_cam_key; | |
2134 | ||
2135 | assign v6_4t_cam_key = !class_action_ipaddr & v6_next_hdr[3] ? v6_cam_key_dest_esp : | |
2136 | !class_action_ipaddr & v6_next_hdr[2] ? v6_cam_key_dest_ah : | |
2137 | !class_action_ipaddr ? v6_cam_key_dest : | |
2138 | class_action_ipaddr & v6_next_hdr[3] ? v6_cam_key_src_esp : | |
2139 | class_action_ipaddr & v6_next_hdr[2] ? v6_cam_key_src_ah : | |
2140 | v6_cam_key_src; | |
2141 | ||
2142 | assign raw_cam_key_r0 = {class, 3'b0, raw_cam_key_r, 104'b0}; | |
2143 | ||
2144 | ||
2145 | assign tcam_key = do_raw_key_r ? raw_cam_key_r0 : | |
2146 | ether_type[0] ? v4_5t_cam_key : | |
2147 | v6_4t_cam_key; | |
2148 | ||
2149 | ||
2150 | dffre #(200) tcam_key_r_reg (cclk, reset, shft7_reg_en, tcam_key, tcam_key_r); | |
2151 | ||
2152 | /********************************/ | |
2153 | //GEN FLOW CAM key (stage7_en) | |
2154 | /********************************/ | |
2155 | dffre #(10) f_key_class_action_r_reg (cclk, reset, shft6_reg_en, f_key_class_action, f_key_class_action_r); | |
2156 | ||
2157 | assign f_key_class_action_l4_1 = f_key_class_action_r[1:0]; | |
2158 | assign f_key_class_action_l4_0 = f_key_class_action_r[3:2]; | |
2159 | assign f_key_class_action_prot = f_key_class_action_r[4]; | |
2160 | assign f_key_class_action_ip_da = f_key_class_action_r[5]; | |
2161 | assign f_key_class_action_ip_sa = f_key_class_action_r[6]; | |
2162 | assign f_key_class_action_vlan = f_key_class_action_r[7]; | |
2163 | assign f_key_class_action_l2_da = f_key_class_action_r[8]; | |
2164 | assign f_key_class_action_vport = f_key_class_action_r[9]; | |
2165 | ||
2166 | assign prot_bytes = ether_type[1] ? ipv6_next_hdr_r : ipv4_protocol_r; | |
2167 | assign ip_da_bytes_0 = ether_type[1] ? ipv6_dest_addr_r[31:0] : ipv4_dest_addr_r[31:0]; | |
2168 | assign ip_da_bytes_1 = ether_type[1] ? ipv6_dest_addr_r[63:32] : 32'b0; | |
2169 | assign ip_da_bytes_2 = ether_type[1] ? ipv6_dest_addr_r[95:64] : 32'b0; | |
2170 | assign ip_da_bytes_3 = ether_type[1] ? ipv6_dest_addr_r[127:96] : 32'b0; | |
2171 | ||
2172 | assign ip_sa_bytes_0 = ether_type[1] ? ipv6_src_addr_r[31:0] : ipv4_src_addr_r[31:0]; | |
2173 | assign ip_sa_bytes_1 = ether_type[1] ? ipv6_src_addr_r[63:32] : 32'b0; | |
2174 | assign ip_sa_bytes_2 = ether_type[1] ? ipv6_src_addr_r[95:64] : 32'b0; | |
2175 | assign ip_sa_bytes_3 = ether_type[1] ? ipv6_src_addr_r[127:96] : 32'b0; | |
2176 | ||
2177 | assign vlan_bytes_valid = encap_offset_reg[0] & f_key_class_action_vlan; | |
2178 | ||
2179 | assign f_key_l4_1_bytes = (f_key_class_action_l4_1 == 2'b00) ? 16'b0 : | |
2180 | (f_key_class_action_l4_1 == 2'b01) ? 16'b0 : | |
2181 | (f_key_class_action_l4_1 == 2'b10) ? tcp_port[15:0] : | |
2182 | tcp_seq_num[15:0]; | |
2183 | ||
2184 | assign f_key_l4_0_bytes = (f_key_class_action_l4_0 == 2'b00) ? 16'b0 : | |
2185 | (f_key_class_action_l4_0 == 2'b01) ? 16'b0 : | |
2186 | (f_key_class_action_l4_0 == 2'b10) ? tcp_port[31:16] : | |
2187 | tcp_seq_num[31:16]; | |
2188 | ||
2189 | assign f_key_prot_bytes = f_key_class_action_prot ? prot_bytes : 8'b0; | |
2190 | assign f_key_ip_da_bytes_0 = f_key_class_action_ip_da ? ip_da_bytes_0 : 32'b0; | |
2191 | assign f_key_ip_da_bytes_1 = f_key_class_action_ip_da ? ip_da_bytes_1 : 32'b0; | |
2192 | assign f_key_ip_da_bytes_2 = f_key_class_action_ip_da ? ip_da_bytes_2 : 32'b0; | |
2193 | assign f_key_ip_da_bytes_3 = f_key_class_action_ip_da ? ip_da_bytes_3 : 32'b0; | |
2194 | ||
2195 | assign f_key_ip_sa_bytes_0 = f_key_class_action_ip_sa ? ip_sa_bytes_0 : 32'b0; | |
2196 | assign f_key_ip_sa_bytes_1 = f_key_class_action_ip_sa ? ip_sa_bytes_1 : 32'b0; | |
2197 | assign f_key_ip_sa_bytes_2 = f_key_class_action_ip_sa ? ip_sa_bytes_2 : 32'b0; | |
2198 | assign f_key_ip_sa_bytes_3 = f_key_class_action_ip_sa ? ip_sa_bytes_3 : 32'b0; | |
2199 | ||
2200 | assign f_key_vlan_valid = vlan_bytes_valid ? 4'b1111 : 4'b0000; | |
2201 | assign f_key_vlan_bytes = vlan_bytes_valid ? vlan_tag_id[11:0] : 12'b0; | |
2202 | assign f_key_l2_da_bytes = f_key_class_action_l2_da ? mac_dest_addr : 48'b0; | |
2203 | assign f_key_vport_bytes = f_key_class_action_vport ? mac_port : 2'b0; | |
2204 | ||
2205 | assign flow_key = {f_key_vlan_valid, f_key_l2_da_bytes, f_key_vlan_bytes, | |
2206 | f_key_ip_sa_bytes_3, f_key_ip_sa_bytes_2, | |
2207 | f_key_ip_sa_bytes_1, f_key_ip_sa_bytes_0, | |
2208 | f_key_ip_da_bytes_3, f_key_ip_da_bytes_2, | |
2209 | f_key_ip_da_bytes_1, f_key_ip_da_bytes_0, | |
2210 | f_key_l4_0_bytes, f_key_l4_1_bytes, f_key_prot_bytes, f_key_vport_bytes}; | |
2211 | ||
2212 | dffre #(362) flow_key_r_reg (cclk, reset, shft7_reg_en, flow_key, flow_key_r); | |
2213 | ||
2214 | /********************************/ | |
2215 | //Extract TCP SEQUENCE NUMBER | |
2216 | /********************************/ | |
2217 | always @ ( | |
2218 | ipv4_ip_hdr_len_r0[1:0] or | |
2219 | shft2_tmp6_dout or | |
2220 | shft2_tmp7_dout or | |
2221 | shft2_tmp8_dout or | |
2222 | shft2_tmp9_dout or | |
2223 | ||
2224 | shft2_tmp10_dout or | |
2225 | shft2_tmp11_dout or | |
2226 | shft2_tmp12_dout or | |
2227 | shft2_tmp13_dout or | |
2228 | ||
2229 | shft2_tmp14_dout or | |
2230 | shft2_tmp15_dout or | |
2231 | shft3_tmp0_dout or | |
2232 | shft3_tmp1_dout) | |
2233 | ||
2234 | begin | |
2235 | ||
2236 | case (ipv4_ip_hdr_len_r0[1:0]) //synopsys parallel_case full_case | |
2237 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_seq_num_1" | |
2238 | ||
2239 | 2'b00, 2'b01: v4_seq_num_01 = {shft2_tmp6_dout, shft2_tmp7_dout, shft2_tmp8_dout, shft2_tmp9_dout}; | |
2240 | 2'b10: v4_seq_num_01 = {shft2_tmp10_dout, shft2_tmp11_dout, shft2_tmp12_dout, shft2_tmp13_dout}; | |
2241 | 2'b11: v4_seq_num_01 = {shft2_tmp14_dout, shft2_tmp15_dout, shft3_tmp0_dout, shft3_tmp1_dout}; | |
2242 | default: v4_seq_num_01 = 32'b0; | |
2243 | ||
2244 | endcase | |
2245 | end | |
2246 | ||
2247 | always @ ( | |
2248 | ipv4_ip_hdr_len_r0[1:0] or | |
2249 | shft3_tmp2_dout or | |
2250 | shft3_tmp3_dout or | |
2251 | shft3_tmp4_dout or | |
2252 | shft3_tmp5_dout or | |
2253 | ||
2254 | shft3_tmp6_dout or | |
2255 | shft3_tmp7_dout or | |
2256 | shft3_tmp8_dout or | |
2257 | shft3_tmp9_dout or | |
2258 | ||
2259 | shft3_tmp10_dout or | |
2260 | shft3_tmp11_dout or | |
2261 | shft3_tmp12_dout or | |
2262 | shft3_tmp13_dout or | |
2263 | ||
2264 | shft3_tmp14_dout or | |
2265 | shft3_tmp15_dout or | |
2266 | shft4_tmp0_dout or | |
2267 | shft4_tmp1_dout) | |
2268 | ||
2269 | begin | |
2270 | case (ipv4_ip_hdr_len_r0[1:0]) //synopsys parallel_case full_case | |
2271 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_seq_num_2" | |
2272 | ||
2273 | 2'b00: v4_seq_num_10 = {shft3_tmp2_dout, shft3_tmp3_dout, shft3_tmp4_dout, shft3_tmp5_dout}; | |
2274 | 2'b01: v4_seq_num_10 = {shft3_tmp6_dout, shft3_tmp7_dout, shft3_tmp8_dout, shft3_tmp9_dout}; | |
2275 | 2'b10: v4_seq_num_10 = {shft3_tmp10_dout, shft3_tmp11_dout, shft3_tmp12_dout, shft3_tmp13_dout}; | |
2276 | 2'b11: v4_seq_num_10 = {shft3_tmp14_dout, shft3_tmp15_dout, shft4_tmp0_dout, shft4_tmp1_dout}; | |
2277 | default: v4_seq_num_10 = 32'b0; | |
2278 | ||
2279 | endcase | |
2280 | end | |
2281 | ||
2282 | always @ ( | |
2283 | ipv4_ip_hdr_len_r0[1:0] or | |
2284 | shft4_tmp2_dout or | |
2285 | shft4_tmp3_dout or | |
2286 | shft4_tmp4_dout or | |
2287 | shft4_tmp5_dout or | |
2288 | ||
2289 | shft4_tmp6_dout or | |
2290 | shft4_tmp7_dout or | |
2291 | shft4_tmp8_dout or | |
2292 | shft4_tmp9_dout or | |
2293 | ||
2294 | shft4_tmp10_dout or | |
2295 | shft4_tmp11_dout or | |
2296 | shft4_tmp12_dout or | |
2297 | shft4_tmp13_dout or | |
2298 | ||
2299 | shft4_tmp14_dout or | |
2300 | shft4_tmp15_dout or | |
2301 | shft5_tmp0_dout or | |
2302 | shft5_tmp1_dout) | |
2303 | ||
2304 | begin | |
2305 | ||
2306 | case (ipv4_ip_hdr_len_r0[1:0]) //synopsys parallel_case full_case | |
2307 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_seq_num_3" | |
2308 | ||
2309 | 2'b00: v4_seq_num_11 = {shft4_tmp2_dout, shft4_tmp3_dout, shft4_tmp4_dout, shft4_tmp5_dout}; | |
2310 | 2'b01: v4_seq_num_11 = {shft4_tmp6_dout, shft4_tmp7_dout, shft4_tmp8_dout, shft4_tmp9_dout}; | |
2311 | 2'b10: v4_seq_num_11 = {shft4_tmp10_dout, shft4_tmp11_dout, shft4_tmp12_dout, shft4_tmp13_dout}; | |
2312 | 2'b11: v4_seq_num_11 = {shft4_tmp14_dout, shft4_tmp15_dout, shft5_tmp0_dout, shft5_tmp1_dout}; | |
2313 | default: v4_seq_num_11 = 32'b0; | |
2314 | ||
2315 | endcase | |
2316 | end | |
2317 | ||
2318 | ||
2319 | always @ ( | |
2320 | ipv4_ip_hdr_len_r0[3:2] or | |
2321 | v4_seq_num_01_r or | |
2322 | v4_seq_num_10_r or | |
2323 | v4_seq_num_11) | |
2324 | ||
2325 | begin | |
2326 | case (ipv4_ip_hdr_len_r0[3:2]) //synopsys parallel_case full_case | |
2327 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_seq_num_4" | |
2328 | ||
2329 | 2'b00, 2'b01: v4_seq_num = v4_seq_num_01_r; | |
2330 | 2'b10: v4_seq_num = v4_seq_num_10_r; | |
2331 | 2'b11: v4_seq_num = v4_seq_num_11; | |
2332 | default: v4_seq_num = 32'b0; | |
2333 | ||
2334 | endcase | |
2335 | end | |
2336 | ||
2337 | assign v6_seq_num = {shft3_tmp10_dout, shft3_tmp11_dout, shft3_tmp12_dout, shft3_tmp13_dout}; | |
2338 | ||
2339 | dffre #(32) v4_seq_num_01_r_reg (cclk, reset, shft4_reg_en, v4_seq_num_01, v4_seq_num_01_r); | |
2340 | dffre #(32) v4_seq_num_10_r_reg (cclk, reset, shft5_reg_en, v4_seq_num_10, v4_seq_num_10_r); | |
2341 | dffre #(32) v4_seq_num_r_reg (cclk, reset, shft6_reg_en, v4_seq_num, v4_seq_num_r); | |
2342 | dffre #(32) v6_seq_num_r_reg (cclk, reset, shft5_reg_en, v6_seq_num, v6_seq_num_r); | |
2343 | ||
2344 | /********************************/ | |
2345 | //Extract TCP LEN FIELD | |
2346 | /********************************/ | |
2347 | always @ ( | |
2348 | ipv4_ip_hdr_len_r0[1:0] or | |
2349 | shft2_tmp14_dout or | |
2350 | shft3_tmp2_dout or | |
2351 | shft3_tmp6_dout) | |
2352 | ||
2353 | begin | |
2354 | case (ipv4_ip_hdr_len_r0[1:0]) //synopsys parallel_case full_case | |
2355 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_len_1" | |
2356 | 2'b00, 2'b01: v4_tcp_len_01 = shft2_tmp14_dout[7:4]; | |
2357 | 2'b10: v4_tcp_len_01 = shft3_tmp2_dout[7:4]; | |
2358 | 2'b11: v4_tcp_len_01 = shft3_tmp6_dout[7:4]; | |
2359 | default: v4_tcp_len_01 = 4'b0; | |
2360 | ||
2361 | endcase | |
2362 | end | |
2363 | ||
2364 | always @ ( | |
2365 | ipv4_ip_hdr_len_r0[1:0] or | |
2366 | shft3_tmp10_dout or | |
2367 | shft3_tmp14_dout or | |
2368 | shft4_tmp2_dout or | |
2369 | shft4_tmp6_dout) | |
2370 | ||
2371 | begin | |
2372 | case (ipv4_ip_hdr_len_r0[1:0]) //synopsys parallel_case full_case | |
2373 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_len_2" | |
2374 | 2'b00: v4_tcp_len_10 = shft3_tmp10_dout[7:4]; | |
2375 | 2'b01: v4_tcp_len_10 = shft3_tmp14_dout[7:4]; | |
2376 | 2'b10: v4_tcp_len_10 = shft4_tmp2_dout[7:4]; | |
2377 | 2'b11: v4_tcp_len_10 = shft4_tmp6_dout[7:4]; | |
2378 | default: v4_tcp_len_10 = 4'b0; | |
2379 | ||
2380 | endcase | |
2381 | end | |
2382 | ||
2383 | always @ ( | |
2384 | ipv4_ip_hdr_len_r0[1:0] or | |
2385 | shft4_tmp10_dout or | |
2386 | shft4_tmp14_dout or | |
2387 | shft5_tmp2_dout or | |
2388 | shft5_tmp6_dout) | |
2389 | ||
2390 | begin | |
2391 | case (ipv4_ip_hdr_len_r0[1:0]) //synopsys parallel_case full_case | |
2392 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_len_3" | |
2393 | 2'b00: v4_tcp_len_11 = shft4_tmp10_dout[7:4]; | |
2394 | 2'b01: v4_tcp_len_11 = shft4_tmp14_dout[7:4]; | |
2395 | 2'b10: v4_tcp_len_11 = shft5_tmp2_dout[7:4]; | |
2396 | 2'b11: v4_tcp_len_11 = shft5_tmp6_dout[7:4]; | |
2397 | default: v4_tcp_len_11 = 4'b0; | |
2398 | ||
2399 | endcase | |
2400 | end | |
2401 | ||
2402 | ||
2403 | always @ ( | |
2404 | ipv4_ip_hdr_len_r0[3:2] or | |
2405 | v4_tcp_len_01_r or | |
2406 | v4_tcp_len_10_r or | |
2407 | v4_tcp_len_11) | |
2408 | ||
2409 | begin | |
2410 | case (ipv4_ip_hdr_len_r0[3:2]) //synopsys parallel_case full_case | |
2411 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_len_4" | |
2412 | ||
2413 | 2'b00, 2'b01: v4_tcp_len = v4_tcp_len_01_r; | |
2414 | 2'b10: v4_tcp_len = v4_tcp_len_10_r; | |
2415 | 2'b11: v4_tcp_len = v4_tcp_len_11; | |
2416 | default: v4_tcp_len = 4'b0; | |
2417 | ||
2418 | endcase | |
2419 | end | |
2420 | ||
2421 | ||
2422 | assign v6_tcp_len = shft4_tmp2_dout[7:4]; | |
2423 | ||
2424 | dffre #(4) v4_tcp_len_01_r_reg (cclk, reset, shft5_reg_en, v4_tcp_len_01, v4_tcp_len_01_r); | |
2425 | dffre #(4) v4_tcp_len_10_r_reg (cclk, reset, shft6_reg_en, v4_tcp_len_10, v4_tcp_len_10_r); | |
2426 | dffre #(4) v4_tcp_len_r_reg (cclk, reset, shft7_reg_en, v4_tcp_len, v4_tcp_len_r); | |
2427 | dffre #(4) v6_tcp_len_r_reg (cclk, reset, shft5_reg_en, v6_tcp_len, v6_tcp_len_r); | |
2428 | ||
2429 | /********************************/ | |
2430 | //Extract TCP CONTROL FLAG | |
2431 | /********************************/ | |
2432 | always @ ( | |
2433 | ipv4_ip_hdr_len_r0[1:0] or | |
2434 | shft2_tmp15_dout or shft2_tmp14_dout or | |
2435 | shft3_tmp3_dout or shft3_tmp2_dout or | |
2436 | shft3_tmp7_dout or shft3_tmp6_dout) | |
2437 | ||
2438 | begin | |
2439 | case (ipv4_ip_hdr_len_r0[1:0]) //synopsys parallel_case full_case | |
2440 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_flag_1" | |
2441 | ||
2442 | 2'b00, 2'b01: v4_tcp_flag_01 = {shft2_tmp14_dout[3:0], shft2_tmp15_dout[7:0]}; | |
2443 | 2'b10: v4_tcp_flag_01 = {shft3_tmp2_dout[3:0], shft3_tmp3_dout[7:0]}; | |
2444 | 2'b11: v4_tcp_flag_01 = {shft3_tmp6_dout[3:0], shft3_tmp7_dout[7:0]}; | |
2445 | default: v4_tcp_flag_01 = 12'b0; | |
2446 | ||
2447 | endcase | |
2448 | end | |
2449 | ||
2450 | always @ ( | |
2451 | ipv4_ip_hdr_len_r0[1:0] or | |
2452 | shft3_tmp11_dout or shft3_tmp10_dout or | |
2453 | shft3_tmp15_dout or shft3_tmp14_dout or | |
2454 | shft4_tmp3_dout or shft4_tmp2_dout or | |
2455 | shft4_tmp7_dout or shft4_tmp6_dout) | |
2456 | ||
2457 | begin | |
2458 | case (ipv4_ip_hdr_len_r0[1:0]) //synopsys parallel_case full_case | |
2459 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_flag_2" | |
2460 | ||
2461 | 2'b00: v4_tcp_flag_10 = {shft3_tmp10_dout[3:0], shft3_tmp11_dout[7:0]}; | |
2462 | 2'b01: v4_tcp_flag_10 = {shft3_tmp14_dout[3:0], shft3_tmp15_dout[7:0]}; | |
2463 | 2'b10: v4_tcp_flag_10 = {shft4_tmp2_dout[3:0], shft4_tmp3_dout[7:0]}; | |
2464 | 2'b11: v4_tcp_flag_10 = {shft4_tmp6_dout[3:0], shft4_tmp7_dout[7:0]}; | |
2465 | default: v4_tcp_flag_10 = 12'b0; | |
2466 | ||
2467 | endcase | |
2468 | end | |
2469 | ||
2470 | always @ ( | |
2471 | ipv4_ip_hdr_len_r0[1:0] or | |
2472 | shft4_tmp11_dout or shft4_tmp10_dout or | |
2473 | shft4_tmp15_dout or shft4_tmp14_dout or | |
2474 | shft5_tmp3_dout or shft5_tmp2_dout or | |
2475 | shft5_tmp7_dout or shft5_tmp6_dout) | |
2476 | ||
2477 | begin | |
2478 | case (ipv4_ip_hdr_len_r0[1:0]) //synopsys parallel_case full_case | |
2479 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_flag_3" | |
2480 | ||
2481 | 2'b00: v4_tcp_flag_11 = {shft4_tmp10_dout[3:0], shft4_tmp11_dout[7:0]}; | |
2482 | 2'b01: v4_tcp_flag_11 = {shft4_tmp14_dout[3:0], shft4_tmp15_dout[7:0]}; | |
2483 | 2'b10: v4_tcp_flag_11 = {shft5_tmp2_dout[3:0], shft5_tmp3_dout[7:0]}; | |
2484 | 2'b11: v4_tcp_flag_11 = {shft5_tmp6_dout[3:0], shft5_tmp7_dout[7:0]}; | |
2485 | default: v4_tcp_flag_11 = 12'b0; | |
2486 | ||
2487 | endcase | |
2488 | end | |
2489 | ||
2490 | ||
2491 | always @ ( | |
2492 | ipv4_ip_hdr_len_r0[3:2] or | |
2493 | v4_tcp_flag_01_r or | |
2494 | v4_tcp_flag_10_r or | |
2495 | v4_tcp_flag_11) | |
2496 | ||
2497 | begin | |
2498 | case (ipv4_ip_hdr_len_r0[3:2]) //synopsys parallel_case full_case | |
2499 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:v4_tcp_flag_4" | |
2500 | ||
2501 | ||
2502 | 2'b00, 2'b01: v4_tcp_flag = v4_tcp_flag_01_r; | |
2503 | 2'b10: v4_tcp_flag = v4_tcp_flag_10_r; | |
2504 | 2'b11: v4_tcp_flag = v4_tcp_flag_11; | |
2505 | default: v4_tcp_flag = 12'b0; | |
2506 | ||
2507 | endcase | |
2508 | end | |
2509 | ||
2510 | assign v6_tcp_flag = {shft4_tmp2_dout[3:0], shft4_tmp3_dout[7:0]}; | |
2511 | ||
2512 | dffre #(12) v4_tcp_flag_01_r_reg (cclk, reset, shft5_reg_en, v4_tcp_flag_01, v4_tcp_flag_01_r); | |
2513 | dffre #(12) v4_tcp_flag_10_r_reg (cclk, reset, shft6_reg_en, v4_tcp_flag_10, v4_tcp_flag_10_r); | |
2514 | dffre #(12) v4_tcp_flag_r_reg (cclk, reset, shft7_reg_en, v4_tcp_flag, v4_tcp_flag_r); | |
2515 | dffre #(12) v6_tcp_flag_r_reg (cclk, reset, shft5_reg_en, v6_tcp_flag, v6_tcp_flag_r); | |
2516 | ||
2517 | always @ (ether_type or | |
2518 | ipv4_ip_pkt_len_r or | |
2519 | ipv6_ip_pkt_len_r or | |
2520 | v4_tcp_port_r or | |
2521 | ipv6_tcp_src_port_r or | |
2522 | ipv6_tcp_dest_port_r or | |
2523 | v4_seq_num_r or | |
2524 | v6_seq_num_r or | |
2525 | v4_tcp_len_r or | |
2526 | v6_tcp_len_r or | |
2527 | v4_tcp_flag_r or | |
2528 | v6_tcp_flag_r) | |
2529 | ||
2530 | ||
2531 | if (ether_type[1]) | |
2532 | begin | |
2533 | tcp_port = {ipv6_tcp_src_port_r, ipv6_tcp_dest_port_r}; | |
2534 | tcp_seq_num = v6_seq_num_r; | |
2535 | tcp_hdr_len = v6_tcp_len_r; | |
2536 | tcp_ctrl_flag = v6_tcp_flag_r; | |
2537 | ip_pkt_len = ipv6_ip_pkt_len_r; | |
2538 | end | |
2539 | else | |
2540 | begin | |
2541 | tcp_port = v4_tcp_port_r; | |
2542 | tcp_seq_num = v4_seq_num_r; | |
2543 | tcp_hdr_len = v4_tcp_len_r; | |
2544 | tcp_ctrl_flag = v4_tcp_flag_r; | |
2545 | ip_pkt_len = ipv4_ip_pkt_len_r; | |
2546 | end | |
2547 | ||
2548 | ||
2549 | assign tcp_push_bit = |(tcp_ctrl_flag & (~hdr_ctrl_bit_mask_reg_dout)) & (l4_protocol_r == 2'b01); | |
2550 | ||
2551 | ||
2552 | assign fwd_info = {vlan_parity_err_r, mac_port, pkt_id, tcp_seq_num, tcp_push_bit, | |
2553 | tcp_hdr_len, ip_pkt_len, ipv4_ip_hdr_len_r, shft1_status}; //64+20=84 | |
2554 | ||
2555 | assign pkt_id_in = pkt_id + 4'd1; | |
2556 | ||
2557 | dffre #(4) pkt_id_reg (cclk, reset, hdr_shft_done, pkt_id_in, pkt_id); | |
2558 | ||
2559 | /*************************************/ | |
2560 | //Header fifo operation | |
2561 | /*************************************/ | |
2562 | assign hdr_fifo_wen = hdr_shft_done; | |
2563 | assign hdr_fifo_ren = fwd_sched; | |
2564 | assign hdr_fifo_din = {fwd_info, flow_key_r, tcam_key_r}; //84+362+200=646 | |
2565 | ||
2566 | assign hdr_fifo_space_avail = (hdr_fifo_cnt < 3'b011); | |
2567 | //assign hdr_fifo_lastwp = (hdr_fifo_cnt == 3'b001); | |
2568 | //assign hdr_fifo_lastrp = (hdr_fifo_cnt == 3'b011); | |
2569 | ||
2570 | ||
2571 | assign hdr_fifo_cnt_in = hdr_fifo_wen & hdr_fifo_ren ? hdr_fifo_cnt : | |
2572 | hdr_fifo_wen ? hdr_fifo_cnt + 3'd1 : | |
2573 | hdr_fifo_ren ? hdr_fifo_cnt - 3'd1 : | |
2574 | hdr_fifo_cnt; | |
2575 | assign hdr_fifo_cnt_en = hdr_fifo_wen | hdr_fifo_ren; | |
2576 | ||
2577 | dffre #(3) hdr_fifo_cnt_reg (cclk, reset, hdr_fifo_cnt_en, hdr_fifo_cnt_in, hdr_fifo_cnt); | |
2578 | ||
2579 | /* | |
2580 | always @ (posedge cclk) | |
2581 | if (reset) | |
2582 | hdr_fifo_full <= 1'b0; | |
2583 | else if (hdr_fifo_ren) | |
2584 | hdr_fifo_full <= 1'b0; | |
2585 | else if (hdr_fifo_lastwp && hdr_fifo_wen) | |
2586 | hdr_fifo_full <= 1'b1; | |
2587 | else | |
2588 | hdr_fifo_full <= hdr_fifo_full; | |
2589 | ||
2590 | always @ (posedge cclk) | |
2591 | if (reset) | |
2592 | hdr_fifo_empty <= 1'b1; | |
2593 | else if (hdr_fifo_wen) | |
2594 | hdr_fifo_empty <= 1'b0; | |
2595 | else if (hdr_fifo_lastrp & hdr_fifo_ren) | |
2596 | hdr_fifo_empty <= 1'b1; | |
2597 | else | |
2598 | hdr_fifo_empty <= hdr_fifo_empty; | |
2599 | */ | |
2600 | ||
2601 | /* 0in fifo | |
2602 | -enq hdr_fifo_wen | |
2603 | -deq hdr_fifo_ren | |
2604 | -depth 4 | |
2605 | -enq_data hdr_fifo_din | |
2606 | -deq_data hdr_fifo_dout | |
2607 | -clock cclk | |
2608 | -reset reset | |
2609 | -message "ASSERTION : fifo : fflp_hdr_dp : hdr_fifo0 failed" | |
2610 | */ | |
2611 | //instantiates hdr_fifo | |
2612 | fflp_hdr_fifo #(646) hdr_fifo0 ( | |
2613 | .clk (cclk), | |
2614 | .reset (reset), | |
2615 | .dout (hdr_fifo_dout), | |
2616 | .hdr_fifo_empty (hdr_fifo_empty), | |
2617 | .hdr_fifo_full (hdr_fifo_full), | |
2618 | .din (hdr_fifo_din), | |
2619 | .wen (hdr_fifo_wen), | |
2620 | .ren (hdr_fifo_ren) | |
2621 | ); | |
2622 | ||
2623 | dffre #(446) fwd_info_bus_reg (cclk, reset, fwd_sched, hdr_fifo_dout[645:200], fwd_info_bus); | |
2624 | dffre #(200) key_bus_reg (cclk, reset, fwd_sched, hdr_fifo_dout[199:0], key_bus); | |
2625 | ||
2626 | assign fwd_req = !hdr_fifo_empty; | |
2627 | ||
2628 | ||
2629 | /******************************/ | |
2630 | //VLAN table lookup | |
2631 | /******************************/ | |
2632 | /************************/ | |
2633 | //CPU access request | |
2634 | /************************/ | |
2635 | assign cpu_vlan_gnt = cpu_vlan_acc & !cpu_vlan_acc_dly; | |
2636 | assign cpu_vlan_acc_en = cpu_vlan_gnt_3 | cpu_vlan_req & !shft1_reg_en; | |
2637 | assign cpu_vlan_acc_in = cpu_vlan_gnt_3 ? 1'b0 : 1'b1; | |
2638 | ||
2639 | dffre #(1) cpu_vlan_acc_reg (cclk, reset, cpu_vlan_acc_en, cpu_vlan_acc_in, cpu_vlan_acc); | |
2640 | dffr #(1) cpu_vlan_acc_dly_reg (cclk, reset, cpu_vlan_acc, cpu_vlan_acc_dly); | |
2641 | ||
2642 | dffr #(1) cpu_vlan_gnt_1_reg (cclk, reset, cpu_vlan_gnt, cpu_vlan_gnt_1); | |
2643 | dffr #(1) cpu_vlan_gnt_2_reg (cclk, reset, cpu_vlan_gnt_1, cpu_vlan_gnt_2); | |
2644 | dffr #(1) cpu_vlan_gnt_3_reg (cclk, reset, cpu_vlan_gnt_2, cpu_vlan_gnt_3); | |
2645 | ||
2646 | assign cpu_vlan_rd_gnt = cpu_vlan_gnt & cpu_vlan_rd; | |
2647 | ||
2648 | assign cpu_vlan_wr_gnt = cpu_vlan_gnt & cpu_vlan_wr; | |
2649 | ||
2650 | /*************************/ | |
2651 | //Search access request | |
2652 | /*************************/ | |
2653 | assign srch_vlan_rd_in = or_tag & shft1_reg_en; | |
2654 | ||
2655 | dffr #(1) srch_vlan_rd_reg (cclk, reset, srch_vlan_rd_in, srch_vlan_rd); | |
2656 | ||
2657 | /*************************/ | |
2658 | //Vlan access control | |
2659 | /*************************/ | |
2660 | `ifdef NEPTUNE | |
2661 | assign vlan_tbl_cs_in = vlan_tbl_rd_in | vlan_tbl_wr_in; | |
2662 | `else | |
2663 | assign vlan_tbl_cs_in = vlan_tbl_rd_in; | |
2664 | `endif | |
2665 | ||
2666 | assign vlan_tbl_rd_in = srch_vlan_rd | cpu_vlan_rd_gnt; | |
2667 | assign vlan_tbl_wr_in = cpu_vlan_wr_gnt; | |
2668 | ||
2669 | assign vlan_tbl_addr_in = srch_vlan_rd ? vlan_tag_id[11:0] : cpu_vlan_addr; | |
2670 | ||
2671 | dffr #(1) vlan_tbl_cs_reg (cclk, reset, vlan_tbl_cs_in, vlan_tbl_cs); | |
2672 | dffr #(1) vlan_tbl_wr_reg (cclk, reset, vlan_tbl_wr_in, vlan_tbl_wr); | |
2673 | dffr #(12) vlan_tbl_addr_reg (cclk, reset, vlan_tbl_addr_in, vlan_tbl_addr); | |
2674 | dffr #(18) vlan_tbl_din_reg (cclk, reset, vlan_tbl_rd_din, vlan_tbl_din_reg_dout); | |
2675 | ||
2676 | /**********************************************************************/ | |
2677 | function [4:0] class_index_enc; | |
2678 | /**********************************************************************/ | |
2679 | input [15:0] hdr_class; | |
2680 | ||
2681 | reg [4:0] l3_class_index; | |
2682 | ||
2683 | begin | |
2684 | ||
2685 | casex (hdr_class) //synopsys full_case | |
2686 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:l3_class_index" | |
2687 | 16'b0000_0000_0000_0000: l3_class_index = 5'b00000; | |
2688 | 16'bxxxx_xxxx_xxxx_xxx1: l3_class_index = 5'b00010; | |
2689 | 16'bxxxx_xxxx_xxxx_xx10: l3_class_index = 5'b00011; | |
2690 | 16'bxxxx_xxxx_xxxx_x100: l3_class_index = 5'b00100; | |
2691 | 16'bxxxx_xxxx_xxxx_1000: l3_class_index = 5'b00101; | |
2692 | 16'bxxxx_xxxx_xxx1_0000: l3_class_index = 5'b00110; | |
2693 | 16'bxxxx_xxxx_xx10_0000: l3_class_index = 5'b00111; | |
2694 | 16'bxxxx_xxxx_x100_0000: l3_class_index = 5'b01000; | |
2695 | 16'bxxxx_xxxx_1000_0000: l3_class_index = 5'b01001; | |
2696 | 16'bxxxx_xxx1_0000_0000: l3_class_index = 5'b01010; | |
2697 | 16'bxxxx_xx10_0000_0000: l3_class_index = 5'b01011; | |
2698 | 16'bxxxx_x100_0000_0000: l3_class_index = 5'b01100; | |
2699 | 16'bxxxx_1000_0000_0000: l3_class_index = 5'b01101; | |
2700 | 16'bxxx1_0000_0000_0000: l3_class_index = 5'b01110; | |
2701 | 16'bxx10_0000_0000_0000: l3_class_index = 5'b01111; | |
2702 | 16'bx100_0000_0000_0000: l3_class_index = 5'b10000; | |
2703 | 16'b1000_0000_0000_0000: l3_class_index = 5'b10001; | |
2704 | default: l3_class_index = 5'b00000; | |
2705 | ||
2706 | endcase | |
2707 | ||
2708 | class_index_enc = l3_class_index; | |
2709 | ||
2710 | end | |
2711 | ||
2712 | endfunction | |
2713 | ||
2714 | /**********************************************************************/ | |
2715 | function [2:0] class_action_sel0; | |
2716 | /**********************************************************************/ | |
2717 | input [3:0] class; | |
2718 | input [2:0] l3_class_action_reg2_dout; | |
2719 | input [2:0] l3_class_action_reg3_dout; | |
2720 | input [2:0] l3_class_action_reg4_dout; | |
2721 | input [2:0] l3_class_action_reg5_dout; | |
2722 | input [2:0] l3_class_action_reg6_dout; | |
2723 | input [2:0] l3_class_action_reg7_dout; | |
2724 | input [2:0] l3_class_action_reg8_dout; | |
2725 | input [2:0] l3_class_action_reg9_dout; | |
2726 | input [2:0] l3_class_action_reg10_dout; | |
2727 | input [2:0] l3_class_action_reg11_dout; | |
2728 | input [2:0] l3_class_action_reg12_dout; | |
2729 | input [2:0] l3_class_action_reg13_dout; | |
2730 | input [2:0] l3_class_action_reg14_dout; | |
2731 | input [2:0] l3_class_action_reg15_dout; | |
2732 | ||
2733 | reg [2:0] class_action; | |
2734 | ||
2735 | begin | |
2736 | ||
2737 | case (class) //synopsys parallel_case full_case | |
2738 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:CAM_class_action" | |
2739 | 4'b0000: class_action = 3'b0; | |
2740 | 4'b0001: class_action = 3'b0; | |
2741 | 4'b0010: class_action = l3_class_action_reg2_dout; | |
2742 | 4'b0011: class_action = l3_class_action_reg3_dout; | |
2743 | 4'b0100: class_action = l3_class_action_reg4_dout; | |
2744 | 4'b0101: class_action = l3_class_action_reg5_dout; | |
2745 | 4'b0110: class_action = l3_class_action_reg6_dout; | |
2746 | 4'b0111: class_action = l3_class_action_reg7_dout; | |
2747 | 4'b1000: class_action = l3_class_action_reg8_dout; | |
2748 | 4'b1001: class_action = l3_class_action_reg9_dout; | |
2749 | 4'b1010: class_action = l3_class_action_reg10_dout; | |
2750 | 4'b1011: class_action = l3_class_action_reg11_dout; | |
2751 | 4'b1100: class_action = l3_class_action_reg12_dout; | |
2752 | 4'b1101: class_action = l3_class_action_reg13_dout; | |
2753 | 4'b1110: class_action = l3_class_action_reg14_dout; | |
2754 | 4'b1111: class_action = l3_class_action_reg15_dout; | |
2755 | ||
2756 | default: class_action = 3'b0; | |
2757 | ||
2758 | endcase | |
2759 | ||
2760 | class_action_sel0 = class_action; | |
2761 | end | |
2762 | endfunction | |
2763 | ||
2764 | ||
2765 | /**********************************************************************/ | |
2766 | function [9:0] class_action_sel1; | |
2767 | /**********************************************************************/ | |
2768 | input [3:0] class; | |
2769 | input [9:0] l3_class_action_reg2_dout; | |
2770 | input [9:0] l3_class_action_reg3_dout; | |
2771 | input [9:0] l3_class_action_reg4_dout; | |
2772 | input [9:0] l3_class_action_reg5_dout; | |
2773 | input [9:0] l3_class_action_reg6_dout; | |
2774 | input [9:0] l3_class_action_reg7_dout; | |
2775 | input [9:0] l3_class_action_reg8_dout; | |
2776 | input [9:0] l3_class_action_reg9_dout; | |
2777 | input [9:0] l3_class_action_reg10_dout; | |
2778 | input [9:0] l3_class_action_reg11_dout; | |
2779 | input [9:0] l3_class_action_reg12_dout; | |
2780 | input [9:0] l3_class_action_reg13_dout; | |
2781 | input [9:0] l3_class_action_reg14_dout; | |
2782 | input [9:0] l3_class_action_reg15_dout; | |
2783 | ||
2784 | reg [9:0] class_action; | |
2785 | ||
2786 | begin | |
2787 | ||
2788 | case (class) //synopsys parallel_case full_case | |
2789 | // 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:FCARM_class_action" | |
2790 | 4'b0000: class_action = 10'b0; | |
2791 | 4'b0001: class_action = 10'b0; | |
2792 | 4'b0010: class_action = l3_class_action_reg2_dout; | |
2793 | 4'b0011: class_action = l3_class_action_reg3_dout; | |
2794 | 4'b0100: class_action = l3_class_action_reg4_dout; | |
2795 | 4'b0101: class_action = l3_class_action_reg5_dout; | |
2796 | 4'b0110: class_action = l3_class_action_reg6_dout; | |
2797 | 4'b0111: class_action = l3_class_action_reg7_dout; | |
2798 | 4'b1000: class_action = l3_class_action_reg8_dout; | |
2799 | 4'b1001: class_action = l3_class_action_reg9_dout; | |
2800 | 4'b1010: class_action = l3_class_action_reg10_dout; | |
2801 | 4'b1011: class_action = l3_class_action_reg11_dout; | |
2802 | 4'b1100: class_action = l3_class_action_reg12_dout; | |
2803 | 4'b1101: class_action = l3_class_action_reg13_dout; | |
2804 | 4'b1110: class_action = l3_class_action_reg14_dout; | |
2805 | 4'b1111: class_action = l3_class_action_reg15_dout; | |
2806 | ||
2807 | default: class_action = 10'b0; | |
2808 | ||
2809 | endcase | |
2810 | ||
2811 | class_action_sel1 = class_action; | |
2812 | end | |
2813 | endfunction | |
2814 | ||
2815 | ||
2816 | `ifdef NEPTUNE | |
2817 | wire [3:0] do_nad; | |
2818 | wire [3:0] do_nor; | |
2819 | wire [3:0] do_inv; | |
2820 | wire [3:0] do_mux; | |
2821 | wire [3:0] do_q; | |
2822 | wire so; | |
2823 | ||
2824 | nep_spare_fflp spare_fflp_0 ( | |
2825 | .di_nd3 ({1'h1, 1'h1, do_q[3]}), | |
2826 | .di_nd2 ({1'h1, 1'h1, do_q[2]}), | |
2827 | .di_nd1 ({1'h1, 1'h1, do_q[1]}), | |
2828 | .di_nd0 ({1'h1, 1'h1, do_q[0]}), | |
2829 | .di_nr3 ({1'h0, 1'h0}), | |
2830 | .di_nr2 ({1'h0, 1'h0}), | |
2831 | .di_nr1 ({1'h0, 1'h0}), | |
2832 | .di_nr0 ({1'h0, 1'h0}), | |
2833 | .di_inv (do_nad[3:0]), | |
2834 | .di_mx3 ({1'h0, 1'h0}), | |
2835 | .di_mx2 ({1'h0, 1'h0}), | |
2836 | .di_mx1 ({1'h0, 1'h0}), | |
2837 | .di_mx0 ({1'h0, 1'h0}), | |
2838 | .mx_sel (do_nor[3:0]), | |
2839 | .di_reg (do_inv[3:0]), | |
2840 | .wt_ena (do_mux[3:0]), | |
2841 | .rst ({reset,reset,reset,reset}), | |
2842 | .si (1'h0), | |
2843 | .se (1'h0), | |
2844 | .clk (cclk), | |
2845 | .do_nad (do_nad[3:0]), | |
2846 | .do_nor (do_nor[3:0]), | |
2847 | .do_inv (do_inv[3:0]), | |
2848 | .do_mux (do_mux[3:0]), | |
2849 | .do_q (do_q[3:0]), | |
2850 | .so (so) | |
2851 | ); | |
2852 | ||
2853 | `endif | |
2854 | ||
2855 | ||
2856 | endmodule |