Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / niu / rtl / fflp_hdr_dp.v
CommitLineData
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
55module 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
128input cclk;
129input reset;
130input[127:0] ipp_fflp_data;
131input[11:0] ipp_fflp_mac_default;
132input[1:0] ipp_fflp_mac_port;
133input shft0_reg_en;
134input shft1_reg_en;
135input shft2_reg_en;
136input shft3_reg_en;
137input shft4_reg_en;
138input shft5_reg_en;
139input shft6_reg_en;
140input shft7_reg_en;
141input hdr_shft_done;
142input fwd_sched;
143input snap_en;
144input disable_chksum;
145
146input[16:0] class2_hdr_byte_value;
147input[16:0] class3_hdr_byte_value;
148input[25:0] class4_hdr_byte_value;
149input[25:0] class5_hdr_byte_value;
150input[25:0] class6_hdr_byte_value;
151input[25:0] class7_hdr_byte_value;
152
153input[2:0] class_action_reg4_dout;
154input[2:0] class_action_reg5_dout;
155input[2:0] class_action_reg6_dout;
156input[2:0] class_action_reg7_dout;
157input[2:0] class_action_reg8_dout;
158input[2:0] class_action_reg9_dout;
159input[2:0] class_action_reg10_dout;
160input[2:0] class_action_reg11_dout;
161input[2:0] class_action_reg12_dout;
162input[2:0] class_action_reg13_dout;
163input[2:0] class_action_reg14_dout;
164input[2:0] class_action_reg15_dout;
165input[9:0] f_key_class_action_reg4_dout;
166input[9:0] f_key_class_action_reg5_dout;
167input[9:0] f_key_class_action_reg6_dout;
168input[9:0] f_key_class_action_reg7_dout;
169input[9:0] f_key_class_action_reg8_dout;
170input[9:0] f_key_class_action_reg9_dout;
171input[9:0] f_key_class_action_reg10_dout;
172input[9:0] f_key_class_action_reg11_dout;
173input[9:0] f_key_class_action_reg12_dout;
174input[9:0] f_key_class_action_reg13_dout;
175input[9:0] f_key_class_action_reg14_dout;
176input[9:0] f_key_class_action_reg15_dout;
177input[11:0] hdr_ctrl_bit_mask_reg_dout;
178input cpu_vlan_req;
179input cpu_vlan_rd;
180input cpu_vlan_wr;
181input[11:0] cpu_vlan_addr;
182input[17:0] vlan_tbl_rd_din;
183
184output fwd_req;
185output[199:0] key_bus;
186output[445:0] fwd_info_bus;
187output hdr_fifo_space_avail;
188output hdr_fifo_full;
189output[3:0] fflp_ipp_dvalid;
190output[15:0] fflp_ipp_data;
191output vlan_tbl_cs;
192output vlan_tbl_wr;
193output[11:0] vlan_tbl_addr;
194output[17:0] vlan_tbl_din_reg_dout;
195output vlan_parity_err_log_en;
196output[11:0] vlan_tag_id;
197output cpu_vlan_gnt_3;
198
199wire hdr_fifo_cnt_en;
200wire[2:0] hdr_fifo_cnt_in;
201wire[2:0] hdr_fifo_cnt;
202wire[199:0] key_bus;
203wire[445:0] fwd_info_bus;
204
205reg[7:0] shft0_tmp12_dout;
206reg[7:0] shft0_tmp13_dout;
207reg[7:0] shft0_tmp14_dout;
208reg[7:0] shft0_tmp15_dout;
209
210reg[7:0] shft1_tmp0_dout;
211reg[7:0] shft1_tmp1_dout;
212reg[7:0] shft1_tmp2_dout;
213reg[7:0] shft1_tmp3_dout;
214reg[7:0] shft1_tmp4_dout;
215reg[7:0] shft1_tmp5_dout;
216reg[7:0] shft1_tmp6_dout;
217reg[7:0] shft1_tmp7_dout;
218reg[7:0] shft1_tmp8_dout;
219reg[7:0] shft1_tmp9_dout;
220reg[7:0] shft1_tmp10_dout;
221reg[7:0] shft1_tmp11_dout;
222reg[7:0] shft1_tmp12_dout;
223reg[7:0] shft1_tmp13_dout;
224reg[7:0] shft1_tmp14_dout;
225reg[7:0] shft1_tmp15_dout;
226
227reg[7:0] shft2_tmp0_dout;
228reg[7:0] shft2_tmp1_dout;
229reg[7:0] shft2_tmp2_dout;
230reg[7:0] shft2_tmp3_dout;
231reg[7:0] shft2_tmp4_dout;
232reg[7:0] shft2_tmp5_dout;
233reg[7:0] shft2_tmp6_dout;
234reg[7:0] shft2_tmp7_dout;
235reg[7:0] shft2_tmp8_dout;
236reg[7:0] shft2_tmp9_dout;
237reg[7:0] shft2_tmp10_dout;
238reg[7:0] shft2_tmp11_dout;
239reg[7:0] shft2_tmp12_dout;
240reg[7:0] shft2_tmp13_dout;
241reg[7:0] shft2_tmp14_dout;
242reg[7:0] shft2_tmp15_dout;
243
244reg[7:0] shft3_tmp0_dout;
245reg[7:0] shft3_tmp1_dout;
246reg[7:0] shft3_tmp2_dout;
247reg[7:0] shft3_tmp3_dout;
248reg[7:0] shft3_tmp4_dout;
249reg[7:0] shft3_tmp5_dout;
250reg[7:0] shft3_tmp6_dout;
251reg[7:0] shft3_tmp7_dout;
252reg[7:0] shft3_tmp8_dout;
253reg[7:0] shft3_tmp9_dout;
254reg[7:0] shft3_tmp10_dout;
255reg[7:0] shft3_tmp11_dout;
256reg[7:0] shft3_tmp12_dout;
257reg[7:0] shft3_tmp13_dout;
258reg[7:0] shft3_tmp14_dout;
259reg[7:0] shft3_tmp15_dout;
260
261reg[7:0] shft4_tmp0_dout;
262reg[7:0] shft4_tmp1_dout;
263reg[7:0] shft4_tmp2_dout;
264reg[7:0] shft4_tmp3_dout;
265reg[7:0] shft4_tmp4_dout;
266reg[7:0] shft4_tmp5_dout;
267reg[7:0] shft4_tmp6_dout;
268reg[7:0] shft4_tmp7_dout;
269reg[7:0] shft4_tmp8_dout;
270reg[7:0] shft4_tmp9_dout;
271reg[7:0] shft4_tmp10_dout;
272reg[7:0] shft4_tmp11_dout;
273reg[7:0] shft4_tmp12_dout;
274reg[7:0] shft4_tmp13_dout;
275reg[7:0] shft4_tmp14_dout;
276reg[7:0] shft4_tmp15_dout;
277
278reg[7:0] shft5_tmp0_dout;
279reg[7:0] shft5_tmp1_dout;
280reg[7:0] shft5_tmp2_dout;
281reg[7:0] shft5_tmp3_dout;
282//reg[7:0] shft5_tmp4_dout;
283//reg[7:0] shft5_tmp5_dout;
284reg[7:0] shft5_tmp6_dout;
285reg[7:0] shft5_tmp7_dout;
286
287wire[1:0] encap_offset_reg;
288wire[1:0] ether_type_in;
289wire[1:0] ether_type;
290wire[4:0] class;
291
292wire[4:0] v4_protocol_in;
293wire[4:0] v6_next_hdr_in;
294
295wire[4:0] v4_protocol;
296wire[4:0] v6_next_hdr;
297wire[1:0] l4_protocol_r;
298
299wire[7:0] shft2_tmp2_dout_r;
300wire[7:0] shft2_tmp3_dout_r;
301wire[3:0] ipv4_ip_hdr_len_r;
302wire[3:0] ipv4_ip_hdr_len_r0;
303wire[15:0] ipv4_ip_pkt_len_r;
304wire noport_r;
305wire badip_r;
306
307wire[15:0] shft0_tmp1312_trans_r;
308wire[15:0] valid_hdr_class_match_in;
309wire[15:0] valid_hdr_class_match;
310wire[16:0] addr_ind_hdr_byte_masked4_r;
311wire[16:0] addr_ind_hdr_byte_masked5_r;
312wire[16:0] addr_ind_hdr_byte_masked6_r;
313wire[16:0] addr_ind_hdr_byte_masked7_r;
314
315reg[2:0] l2_rdc_num;
316wire[2:0] l2_rdc_num_r;
317
318reg[31:0] v4_tcp_port_01;
319reg[31:0] v4_tcp_port_10;
320reg[31:0] v4_tcp_port_11;
321reg[31:0] v4_tcp_port;
322wire[31:0] v4_tcp_port_01_r;
323wire[31:0] v4_tcp_port_10_r;
324wire[31:0] v4_tcp_port_r;
325
326wire[7:0] ipv4_tos_r;
327wire[7:0] ipv4_protocol_r;
328wire[31:0] ipv4_src_addr_r;
329wire[31:0] ipv4_dest_addr_r;
330//wire[31:0] ipv4_ah_spi_r;
331//wire[31:0] ipv4_esp_spi_r;
332
333wire[7:0] ipv6_tos_r;
334wire[7:0] ipv6_next_hdr_r;
335wire[127:0] ipv6_src_addr_r;
336wire[127:0] ipv6_dest_addr_r;
337wire[15:0] ipv6_tcp_src_port_r;
338wire[15:0] ipv6_tcp_dest_port_r;
339//wire[31:0] ipv6_ah_spi_r;
340//wire[31:0] ipv6_esp_spi_r;
341wire[31:0] v6_tcp_port_r;
342
343wire[87:0] raw_cam_key_r;
344wire do_raw_key_r;
345wire[2:0] class_action_r;
346wire[199:0] tcam_key_r;
347wire[9:0] f_key_class_action_r;
348wire[361:0] flow_key_r;
349
350reg[31:0] v4_seq_num_01;
351reg[31:0] v4_seq_num_10;
352reg[31:0] v4_seq_num_11;
353reg[31:0] v4_seq_num;
354wire[31:0] v4_seq_num_01_r;
355wire[31:0] v4_seq_num_10_r;
356wire[31:0] v4_seq_num_r;
357
358wire[31:0] v6_seq_num;
359wire[31:0] v6_seq_num_r;
360
361reg[3:0] v4_tcp_len_01;
362reg[3:0] v4_tcp_len_10;
363reg[3:0] v4_tcp_len_11;
364reg[3:0] v4_tcp_len;
365wire[3:0] v4_tcp_len_01_r;
366wire[3:0] v4_tcp_len_10_r;
367wire[3:0] v4_tcp_len_r;
368
369wire[3:0] v6_tcp_len;
370wire[3:0] v6_tcp_len_r;
371
372reg[11:0] v4_tcp_flag_01;
373reg[11:0] v4_tcp_flag_10;
374reg[11:0] v4_tcp_flag_11;
375reg[11:0] v4_tcp_flag;
376wire[11:0] v4_tcp_flag_01_r;
377wire[11:0] v4_tcp_flag_10_r;
378wire[11:0] v4_tcp_flag_r;
379
380wire[11:0] v6_tcp_flag;
381wire[11:0] v6_tcp_flag_r;
382
383reg[31:0] tcp_port;
384reg[31:0] tcp_seq_num;
385reg[3:0] tcp_hdr_len;
386reg[11:0] tcp_ctrl_flag;
387reg[15:0] ip_pkt_len;
388
389wire[3:0] pkt_id_in;
390wire[3:0] pkt_id;
391
392
393wire[127:0] ipp_fflp_data_reg_dout;
394wire[13:0] ipp_fflp_status_reg_dout;
395wire[13:0] shft0_status_reg_dout;
396wire promiscuous;
397wire ph_match;
398wire[2:0] mac_rdc_num;
399//wire mpr;
400wire[1:0] mac_port;
401
402wire[127:0] shft0_reg_dout;
403wire[127:0] shft1_reg_dout;
404wire[127:0] shft2_reg_dout;
405wire[127:0] shft3_reg_dout;
406wire[127:0] shft4_reg_dout;
407wire[127:0] shft5_reg_dout;
408wire[31:0] shft6_reg_dout;
409
410wire[7:0] shft0_reg0_dout;
411wire[7:0] shft0_reg1_dout;
412wire[7:0] shft0_reg2_dout;
413wire[7:0] shft0_reg3_dout;
414wire[7:0] shft0_reg4_dout;
415wire[7:0] shft0_reg5_dout;
416/*
417wire[7:0] shft0_reg6_dout;
418wire[7:0] shft0_reg7_dout;
419wire[7:0] shft0_reg8_dout;
420wire[7:0] shft0_reg9_dout;
421wire[7:0] shft0_reg10_dout;
422wire[7:0] shft0_reg11_dout;
423*/
424wire[7:0] shft0_reg12_dout;
425wire[7:0] shft0_reg13_dout;
426wire[7:0] shft0_reg14_dout;
427wire[7:0] shft0_reg15_dout;
428
429wire[7:0] shft1_reg0_dout;
430wire[7:0] shft1_reg1_dout;
431wire[7:0] shft1_reg2_dout;
432wire[7:0] shft1_reg3_dout;
433wire[7:0] shft1_reg4_dout;
434wire[7:0] shft1_reg5_dout;
435wire[7:0] shft1_reg6_dout;
436wire[7:0] shft1_reg7_dout;
437wire[7:0] shft1_reg8_dout;
438wire[7:0] shft1_reg9_dout;
439wire[7:0] shft1_reg10_dout;
440wire[7:0] shft1_reg11_dout;
441wire[7:0] shft1_reg12_dout;
442wire[7:0] shft1_reg13_dout;
443wire[7:0] shft1_reg14_dout;
444wire[7:0] shft1_reg15_dout;
445
446wire[7:0] shft2_reg0_dout;
447wire[7:0] shft2_reg1_dout;
448wire[7:0] shft2_reg2_dout;
449wire[7:0] shft2_reg3_dout;
450wire[7:0] shft2_reg4_dout;
451wire[7:0] shft2_reg5_dout;
452wire[7:0] shft2_reg6_dout;
453wire[7:0] shft2_reg7_dout;
454wire[7:0] shft2_reg8_dout;
455wire[7:0] shft2_reg9_dout;
456wire[7:0] shft2_reg10_dout;
457wire[7:0] shft2_reg11_dout;
458wire[7:0] shft2_reg12_dout;
459wire[7:0] shft2_reg13_dout;
460wire[7:0] shft2_reg14_dout;
461wire[7:0] shft2_reg15_dout;
462
463wire[7:0] shft3_reg0_dout;
464wire[7:0] shft3_reg1_dout;
465wire[7:0] shft3_reg2_dout;
466wire[7:0] shft3_reg3_dout;
467wire[7:0] shft3_reg4_dout;
468wire[7:0] shft3_reg5_dout;
469wire[7:0] shft3_reg6_dout;
470wire[7:0] shft3_reg7_dout;
471wire[7:0] shft3_reg8_dout;
472wire[7:0] shft3_reg9_dout;
473wire[7:0] shft3_reg10_dout;
474wire[7:0] shft3_reg11_dout;
475wire[7:0] shft3_reg12_dout;
476wire[7:0] shft3_reg13_dout;
477wire[7:0] shft3_reg14_dout;
478wire[7:0] shft3_reg15_dout;
479
480wire[7:0] shft4_reg0_dout;
481wire[7:0] shft4_reg1_dout;
482wire[7:0] shft4_reg2_dout;
483wire[7:0] shft4_reg3_dout;
484wire[7:0] shft4_reg4_dout;
485wire[7:0] shft4_reg5_dout;
486wire[7:0] shft4_reg6_dout;
487wire[7:0] shft4_reg7_dout;
488wire[7:0] shft4_reg8_dout;
489wire[7:0] shft4_reg9_dout;
490wire[7:0] shft4_reg10_dout;
491wire[7:0] shft4_reg11_dout;
492wire[7:0] shft4_reg12_dout;
493wire[7:0] shft4_reg13_dout;
494wire[7:0] shft4_reg14_dout;
495wire[7:0] shft4_reg15_dout;
496
497wire[7:0] shft5_reg0_dout;
498wire[7:0] shft5_reg1_dout;
499wire[7:0] shft5_reg2_dout;
500wire[7:0] shft5_reg3_dout;
501wire[7:0] shft5_reg4_dout;
502wire[7:0] shft5_reg5_dout;
503wire[7:0] shft5_reg6_dout;
504wire[7:0] shft5_reg7_dout;
505wire[7:0] shft5_reg8_dout;
506wire[7:0] shft5_reg9_dout;
507wire[7:0] shft5_reg10_dout;
508wire[7:0] shft5_reg11_dout;
509wire[7:0] shft5_reg12_dout;
510wire[7:0] shft5_reg13_dout;
511wire[7:0] shft5_reg14_dout;
512wire[7:0] shft5_reg15_dout;
513
514wire[7:0] shft6_reg2_dout;
515wire[7:0] shft6_reg3_dout;
516
517/*
518wire[7:0] shft6_reg0_dout;
519wire[7:0] shft6_reg1_dout;
520
521wire[7:0] shft6_reg4_dout;
522wire[7:0] shft6_reg5_dout;
523wire[7:0] shft6_reg6_dout;
524wire[7:0] shft6_reg7_dout;
525wire[7:0] shft6_reg8_dout;
526wire[7:0] shft6_reg9_dout;
527wire[7:0] shft6_reg10_dout;
528wire[7:0] shft6_reg11_dout;
529wire[7:0] shft6_reg12_dout;
530wire[7:0] shft6_reg13_dout;
531wire[7:0] shft6_reg14_dout;
532wire[7:0] shft6_reg15_dout;
533*/
534
535wire[15:0] shft0_reg1312_trans;
536wire[15:0] shft0_reg1514_trans;
537wire[15:0] shft1_reg10_trans;
538wire[15:0] shft1_reg32_trans;
539wire[47:0] mac_dest_addr;
540
541wire or_tag;
542wire[11:0] vlan_tag_id;
543wire is_snap_type_0;
544wire is_aa_0;
545wire is_03_0;
546wire is_snap_type_1;
547wire is_aa_1;
548wire is_03_1;
549wire snap_type_0;
550wire snap_type_1;
551wire snap_type;
552wire[1:0] encap_offset;
553
554wire[15:0] shft0_tmp1312_trans;
555wire[15:0] shft1_tmp54_trans;
556wire is_ipv4;
557wire is_ipv6;
558wire is_ip_pkt;
559wire v4_prot_tcp;
560wire v4_prot_udp;
561wire v4_prot_ah;
562wire v4_prot_esp;
563wire v4_prot_sctp;
564wire v6_nhdr_tcp;
565wire v6_nhdr_udp;
566wire v6_nhdr_ah;
567wire v6_nhdr_esp;
568wire v6_nhdr_sctp;
569wire[2:0] l4_protocol_dec;
570wire[1:0] l4_protocol;
571
572wire[3:0] ipv4_ip_hdr_len;
573wire[15:0] ipv4_ip_pkt_len;
574wire[15:0] ipv4_frag_offset;
575wire noport;
576wire badip;
577
578wire[15:0] ipv6_ip_pkt_len; //IP payload len, not include IP hdr len (40 bytes)
579wire[15:0] ipv6_ip_pkt_len_r;
580
581wire[15:0] class_en_mask;
582wire[16:0] addr_ind_hdr_byte;
583wire[7:0] addr_ind_hdr_byte0;
584wire[7:0] addr_ind_hdr_byte1;
585wire[16:0] addr_ind_hdr_byte_masked4;
586wire[16:0] addr_ind_hdr_byte_masked5;
587wire[16:0] addr_ind_hdr_byte_masked6;
588wire[16:0] addr_ind_hdr_byte_masked7;
589
590wire[16:0] class4_hdr_byte_value_masked;
591wire[16:0] class5_hdr_byte_value_masked;
592wire[16:0] class6_hdr_byte_value_masked;
593wire[16:0] class7_hdr_byte_value_masked;
594
595wire l2_hdr_class_match2;
596wire l2_hdr_class_match3;
597wire l3_hdr_class_match4;
598wire l3_hdr_class_match5;
599wire l3_hdr_class_match6;
600wire l3_hdr_class_match7;
601wire l3_hdr_class_match8;
602wire l3_hdr_class_match9;
603wire l3_hdr_class_match10;
604wire l3_hdr_class_match11;
605wire l3_hdr_class_match12;
606wire l3_hdr_class_match13;
607wire l3_hdr_class_match14;
608wire l3_hdr_class_match15;
609wire l3_hdr_class_match16;
610wire l3_hdr_class_match17;
611
612wire[15:0] hdr_class_match;
613wire[4:0] class_index;
614wire[4:0] class_index_tmp;
615wire[2:0] class_action;
616wire[1:0] class_action_r0;
617wire[9:0] f_key_class_action;
618
619wire[2:0] vlan_rdc_num;
620wire vpr;
621wire[1:0] vlan_parity;
622wire vlan_rdc_prio;
623wire use_vlan_rdc;
624wire is_promis;
625
626wire[1:0] vlan_parity_bit;
627wire vlan_parity_err;
628wire vlan_parity_err_r;
629
630wire[19:0] shft1_status;
631
632wire[7:0] ipv4_tos;
633wire[7:0] ipv4_protocol;
634wire[31:0] ipv4_src_addr;
635wire[31:0] ipv4_dest_addr;
636//wire[31:0] ipv4_ah_spi;
637//wire[31:0] ipv4_esp_spi;
638wire[7:0] ipv6_tos;
639wire[7:0] ipv6_next_hdr;
640wire[127:0] ipv6_src_addr;
641wire[63:0] ipv6_dest_addr_pre;
642wire[63:0] ipv6_dest_addr_suf;
643wire[127:0] ipv6_dest_addr;
644wire[15:0] ipv6_tcp_src_port;
645wire[15:0] ipv6_tcp_dest_port;
646//wire[31:0] ipv6_ah_spi;
647//wire[31:0] ipv6_esp_spi;
648
649wire do_raw_key;
650wire[87:0] raw_cam_key;
651
652wire class_action_ipaddr;
653wire[199:0] v4_cam_key;
654wire[199:0] v4_cam_key_ah;
655wire[199:0] v4_cam_key_esp;
656wire[199:0] v6_cam_key_src;
657wire[199:0] v6_cam_key_src_ah;
658wire[199:0] v6_cam_key_src_esp;
659wire[199:0] v6_cam_key_dest;
660wire[199:0] v6_cam_key_dest_ah;
661wire[199:0] v6_cam_key_dest_esp;
662wire[199:0] v4_5t_cam_key;
663wire[199:0] v6_4t_cam_key;
664
665wire[199:0] raw_cam_key_r0;
666wire[199:0] tcam_key;
667
668wire[1:0] f_key_class_action_l4_1;
669wire[1:0] f_key_class_action_l4_0;
670wire f_key_class_action_prot;
671wire f_key_class_action_ip_da;
672wire f_key_class_action_ip_sa;
673wire f_key_class_action_vlan;
674wire f_key_class_action_l2_da;
675wire f_key_class_action_vport;
676wire[7:0] prot_bytes;
677wire[31:0] ip_da_bytes_0;
678wire[31:0] ip_da_bytes_1;
679wire[31:0] ip_da_bytes_2;
680wire[31:0] ip_da_bytes_3;
681wire[31:0] ip_sa_bytes_0;
682wire[31:0] ip_sa_bytes_1;
683wire[31:0] ip_sa_bytes_2;
684wire[31:0] ip_sa_bytes_3;
685wire vlan_bytes_valid;
686wire[15:0] f_key_l4_1_bytes;
687wire[15:0] f_key_l4_0_bytes;
688wire[7:0] f_key_prot_bytes;
689wire[31:0] f_key_ip_da_bytes_0;
690wire[31:0] f_key_ip_da_bytes_1;
691wire[31:0] f_key_ip_da_bytes_2;
692wire[31:0] f_key_ip_da_bytes_3;
693wire[31:0] f_key_ip_sa_bytes_0;
694wire[31:0] f_key_ip_sa_bytes_1;
695wire[31:0] f_key_ip_sa_bytes_2;
696wire[31:0] f_key_ip_sa_bytes_3;
697wire[3:0] f_key_vlan_valid;
698wire[11:0] f_key_vlan_bytes;
699wire[47:0] f_key_l2_da_bytes;
700wire[1:0] f_key_vport_bytes;
701wire[361:0] flow_key;
702
703wire tcp_push_bit;
704wire[83:0] fwd_info;
705
706wire hdr_fifo_wen;
707wire hdr_fifo_ren;
708wire hdr_fifo_space_avail;
709//wire hdr_fifo_lastwp;
710wire[645:0] hdr_fifo_din;
711wire[645:0] hdr_fifo_dout;
712wire hdr_fifo_empty;
713wire hdr_fifo_full;
714wire fwd_req;
715
716wire cpu_vlan_acc_en;
717wire cpu_vlan_acc_in;
718wire cpu_vlan_acc;
719wire cpu_vlan_acc_dly;
720
721wire cpu_vlan_gnt_1;
722wire cpu_vlan_gnt_2;
723wire cpu_vlan_gnt_3;
724
725wire cpu_vlan_gnt;
726wire cpu_vlan_rd_gnt;
727wire cpu_vlan_wr_gnt;
728
729wire srch_vlan_rd_in;
730wire srch_vlan_rd;
731
732wire vlan_tbl_cs_in;
733wire vlan_tbl_rd_in;
734wire vlan_tbl_wr_in;
735
736wire vlan_tbl_cs;
737wire vlan_tbl_wr;
738
739wire[11:0] vlan_tbl_addr_in;
740wire[11:0] vlan_tbl_addr;
741wire[17:0] vlan_tbl_din_reg_dout;
742wire vlan_parity_err_log_en;
743wire[17:0] masked_vlan_tbl_dout;
744wire[3:0] vlan_tbl_rd_data;
745
746wire[3:0] mac_port_dec;
747wire mac_port0, mac_port1, mac_port2, mac_port3;
748
749wire[3:0] fflp_ipp_dvalid_in;
750wire[3:0] fflp_ipp_dvalid;
751wire[15:0] fflp_ipp_data;
752
753
754/*
755dff #(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
764dff #(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
774assign ipp_fflp_data_reg_dout = ipp_fflp_data;
775assign ipp_fflp_status_reg_dout = {ipp_fflp_mac_port[1:0], ipp_fflp_mac_default[11:0]};
776
777dffre #(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
786dffre #(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
795dffre #(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
804dffre #(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
813dffre #(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
822dffre #(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
831dffre #(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
840dffre #(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/*
850dffre #(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
861assign promiscuous = shft0_status_reg_dout[0];
862assign ph_match = shft0_status_reg_dout[1];
863assign mac_rdc_num = shft0_status_reg_dout[4:2];
864//assign mpr = shft0_status_reg_dout[10];
865assign mac_port = shft0_status_reg_dout[13:12];
866
867assign shft0_reg0_dout = shft0_reg_dout[7:0];
868assign shft0_reg1_dout = shft0_reg_dout[15:8];
869assign shft0_reg2_dout = shft0_reg_dout[23:16];
870assign shft0_reg3_dout = shft0_reg_dout[31:24];
871assign shft0_reg4_dout = shft0_reg_dout[39:32];
872assign shft0_reg5_dout = shft0_reg_dout[47:40];
873/*
874assign shft0_reg6_dout = shft0_reg_dout[55:48];
875assign shft0_reg7_dout = shft0_reg_dout[63:56];
876assign shft0_reg8_dout = shft0_reg_dout[71:64];
877assign shft0_reg9_dout = shft0_reg_dout[79:72];
878assign shft0_reg10_dout = shft0_reg_dout[87:80];
879assign shft0_reg11_dout = shft0_reg_dout[95:88];
880*/
881assign shft0_reg12_dout = shft0_reg_dout[103:96];
882assign shft0_reg13_dout = shft0_reg_dout[111:104];
883assign shft0_reg14_dout = shft0_reg_dout[119:112];
884assign shft0_reg15_dout = shft0_reg_dout[127:120];
885
886assign shft1_reg0_dout = shft1_reg_dout[7:0];
887assign shft1_reg1_dout = shft1_reg_dout[15:8];
888assign shft1_reg2_dout = shft1_reg_dout[23:16];
889assign shft1_reg3_dout = shft1_reg_dout[31:24];
890assign shft1_reg4_dout = shft1_reg_dout[39:32];
891assign shft1_reg5_dout = shft1_reg_dout[47:40];
892assign shft1_reg6_dout = shft1_reg_dout[55:48];
893assign shft1_reg7_dout = shft1_reg_dout[63:56];
894assign shft1_reg8_dout = shft1_reg_dout[71:64];
895assign shft1_reg9_dout = shft1_reg_dout[79:72];
896assign shft1_reg10_dout = shft1_reg_dout[87:80];
897assign shft1_reg11_dout = shft1_reg_dout[95:88];
898assign shft1_reg12_dout = shft1_reg_dout[103:96];
899assign shft1_reg13_dout = shft1_reg_dout[111:104];
900assign shft1_reg14_dout = shft1_reg_dout[119:112];
901assign shft1_reg15_dout = shft1_reg_dout[127:120];
902
903assign shft2_reg0_dout = shft2_reg_dout[7:0];
904assign shft2_reg1_dout = shft2_reg_dout[15:8];
905assign shft2_reg2_dout = shft2_reg_dout[23:16];
906assign shft2_reg3_dout = shft2_reg_dout[31:24];
907assign shft2_reg4_dout = shft2_reg_dout[39:32];
908assign shft2_reg5_dout = shft2_reg_dout[47:40];
909assign shft2_reg6_dout = shft2_reg_dout[55:48];
910assign shft2_reg7_dout = shft2_reg_dout[63:56];
911assign shft2_reg8_dout = shft2_reg_dout[71:64];
912assign shft2_reg9_dout = shft2_reg_dout[79:72];
913assign shft2_reg10_dout = shft2_reg_dout[87:80];
914assign shft2_reg11_dout = shft2_reg_dout[95:88];
915assign shft2_reg12_dout = shft2_reg_dout[103:96];
916assign shft2_reg13_dout = shft2_reg_dout[111:104];
917assign shft2_reg14_dout = shft2_reg_dout[119:112];
918assign shft2_reg15_dout = shft2_reg_dout[127:120];
919
920assign shft3_reg0_dout = shft3_reg_dout[7:0];
921assign shft3_reg1_dout = shft3_reg_dout[15:8];
922assign shft3_reg2_dout = shft3_reg_dout[23:16];
923assign shft3_reg3_dout = shft3_reg_dout[31:24];
924assign shft3_reg4_dout = shft3_reg_dout[39:32];
925assign shft3_reg5_dout = shft3_reg_dout[47:40];
926assign shft3_reg6_dout = shft3_reg_dout[55:48];
927assign shft3_reg7_dout = shft3_reg_dout[63:56];
928assign shft3_reg8_dout = shft3_reg_dout[71:64];
929assign shft3_reg9_dout = shft3_reg_dout[79:72];
930assign shft3_reg10_dout = shft3_reg_dout[87:80];
931assign shft3_reg11_dout = shft3_reg_dout[95:88];
932assign shft3_reg12_dout = shft3_reg_dout[103:96];
933assign shft3_reg13_dout = shft3_reg_dout[111:104];
934assign shft3_reg14_dout = shft3_reg_dout[119:112];
935assign shft3_reg15_dout = shft3_reg_dout[127:120];
936
937assign shft4_reg0_dout = shft4_reg_dout[7:0];
938assign shft4_reg1_dout = shft4_reg_dout[15:8];
939assign shft4_reg2_dout = shft4_reg_dout[23:16];
940assign shft4_reg3_dout = shft4_reg_dout[31:24];
941assign shft4_reg4_dout = shft4_reg_dout[39:32];
942assign shft4_reg5_dout = shft4_reg_dout[47:40];
943assign shft4_reg6_dout = shft4_reg_dout[55:48];
944assign shft4_reg7_dout = shft4_reg_dout[63:56];
945assign shft4_reg8_dout = shft4_reg_dout[71:64];
946assign shft4_reg9_dout = shft4_reg_dout[79:72];
947assign shft4_reg10_dout = shft4_reg_dout[87:80];
948assign shft4_reg11_dout = shft4_reg_dout[95:88];
949assign shft4_reg12_dout = shft4_reg_dout[103:96];
950assign shft4_reg13_dout = shft4_reg_dout[111:104];
951assign shft4_reg14_dout = shft4_reg_dout[119:112];
952assign shft4_reg15_dout = shft4_reg_dout[127:120];
953
954assign shft5_reg0_dout = shft5_reg_dout[7:0];
955assign shft5_reg1_dout = shft5_reg_dout[15:8];
956assign shft5_reg2_dout = shft5_reg_dout[23:16];
957assign shft5_reg3_dout = shft5_reg_dout[31:24];
958assign shft5_reg4_dout = shft5_reg_dout[39:32];
959assign shft5_reg5_dout = shft5_reg_dout[47:40];
960assign shft5_reg6_dout = shft5_reg_dout[55:48];
961assign shft5_reg7_dout = shft5_reg_dout[63:56];
962assign shft5_reg8_dout = shft5_reg_dout[71:64];
963assign shft5_reg9_dout = shft5_reg_dout[79:72];
964assign shft5_reg10_dout = shft5_reg_dout[87:80];
965assign shft5_reg11_dout = shft5_reg_dout[95:88];
966assign shft5_reg12_dout = shft5_reg_dout[103:96];
967assign shft5_reg13_dout = shft5_reg_dout[111:104];
968assign shft5_reg14_dout = shft5_reg_dout[119:112];
969assign shft5_reg15_dout = shft5_reg_dout[127:120];
970
971assign shft6_reg2_dout = shft6_reg_dout[23:16];
972assign shft6_reg3_dout = shft6_reg_dout[31:24];
973
974/*
975assign shft6_reg0_dout = shft6_reg_dout[7:0];
976assign shft6_reg1_dout = shft6_reg_dout[15:8];
977
978assign shft6_reg4_dout = shft6_reg_dout[39:32];
979assign shft6_reg5_dout = shft6_reg_dout[47:40];
980assign shft6_reg6_dout = shft6_reg_dout[55:48];
981assign shft6_reg7_dout = shft6_reg_dout[63:56];
982assign shft6_reg8_dout = shft6_reg_dout[71:64];
983assign shft6_reg9_dout = shft6_reg_dout[79:72];
984assign shft6_reg10_dout = shft6_reg_dout[87:80];
985assign shft6_reg11_dout = shft6_reg_dout[95:88];
986assign shft6_reg12_dout = shft6_reg_dout[103:96];
987assign shft6_reg13_dout = shft6_reg_dout[111:104];
988assign shft6_reg14_dout = shft6_reg_dout[119:112];
989assign shft6_reg15_dout = shft6_reg_dout[127:120];
990
991assign shft7_reg0_dout = shft7_reg_dout[7:0];
992assign shft7_reg1_dout = shft7_reg_dout[15:8];
993assign shft7_reg2_dout = shft7_reg_dout[23:16];
994assign shft7_reg3_dout = shft7_reg_dout[31:24];
995assign shft7_reg4_dout = shft7_reg_dout[39:32];
996assign shft7_reg5_dout = shft7_reg_dout[47:40];
997assign shft7_reg6_dout = shft7_reg_dout[55:48];
998assign shft7_reg7_dout = shft7_reg_dout[63:56];
999assign shft7_reg8_dout = shft7_reg_dout[71:64];
1000assign shft7_reg9_dout = shft7_reg_dout[79:72];
1001assign shft7_reg10_dout = shft7_reg_dout[87:80];
1002assign shft7_reg11_dout = shft7_reg_dout[95:88];
1003assign shft7_reg12_dout = shft7_reg_dout[103:96];
1004assign shft7_reg13_dout = shft7_reg_dout[111:104];
1005assign shft7_reg14_dout = shft7_reg_dout[119:112];
1006assign shft7_reg15_dout = shft7_reg_dout[127:120];
1007*/
1008
1009assign mac_port0 = (mac_port == 2'b00);
1010assign mac_port1 = (mac_port == 2'b01);
1011assign mac_port2 = (mac_port == 2'b10);
1012assign mac_port3 = (mac_port == 2'b11);
1013assign mac_port_dec = {mac_port3, mac_port2, mac_port1, mac_port0};
1014
1015assign shft0_reg1312_trans = {shft0_reg12_dout, shft0_reg13_dout};
1016assign shft0_reg1514_trans = {shft0_reg14_dout, shft0_reg15_dout};
1017assign shft1_reg10_trans = {shft1_reg0_dout, shft1_reg1_dout};
1018assign shft1_reg32_trans = {shft1_reg2_dout, shft1_reg3_dout};
1019
1020assign mac_dest_addr = {shft0_reg0_dout, shft0_reg1_dout, shft0_reg2_dout,
1021 shft0_reg3_dout, shft0_reg4_dout, shft0_reg5_dout};
1022assign or_tag = (shft0_reg1312_trans == 16'h8100);
1023assign vlan_tag_id = shft0_reg1514_trans[11:0];
1024
1025assign 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
1032assign is_aa_0 = shft0_reg1514_trans == 16'haaaa;
1033assign is_03_0 = shft1_reg0_dout == 8'h03;
1034
1035assign 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
1042assign is_aa_1 = shft1_reg32_trans == 16'haaaa;
1043assign is_03_1 = shft1_reg4_dout == 8'h03;
1044
1045assign snap_type_0 = is_snap_type_0 & is_aa_0 & is_03_0;
1046assign snap_type_1 = is_snap_type_1 & is_aa_1 & is_03_1;
1047assign snap_type = or_tag ? snap_type_1 : snap_type_0;
1048assign encap_offset = {snap_type, or_tag};
1049
1050dffre #(2) encap_offset_reg0 (cclk, reset, shft2_reg_en, encap_offset, encap_offset_reg);
1051
1052always @ (
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
1091begin
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
1239end
1240
1241assign shft0_tmp1312_trans = {shft0_tmp12_dout,
1242 shft0_tmp13_dout};
1243assign shft1_tmp54_trans = {shft1_tmp4_dout,
1244 shft1_tmp5_dout};
1245
1246assign is_ipv4 = (shft0_tmp1312_trans == `TYPE_IPV4) &
1247 (shft0_tmp14_dout[7:4] == 4'b0100);
1248assign is_ipv6 = (shft0_tmp1312_trans == `TYPE_IPV6) &
1249 (shft0_tmp14_dout[7:4] == 4'b0110);
1250
1251assign ether_type_in = {is_ipv6, is_ipv4};
1252
1253dffre #(2) ether_type_reg (cclk, reset, shft2_reg_en, ether_type_in, ether_type);
1254
1255assign is_ip_pkt = |ether_type;
1256
1257assign v4_prot_tcp = (shft1_tmp7_dout == `TCP) & ether_type[0];
1258assign v4_prot_udp = (shft1_tmp7_dout == `UDP) & ether_type[0];
1259assign v4_prot_ah = (shft1_tmp7_dout == `AH) & ether_type[0];
1260assign v4_prot_esp = (shft1_tmp7_dout == `ESP) & ether_type[0];
1261assign v4_prot_sctp = (shft1_tmp7_dout == `SCTP) & ether_type[0];
1262
1263assign v6_nhdr_tcp = (shft1_tmp4_dout == `TCP) & ether_type[1];
1264assign v6_nhdr_udp = (shft1_tmp4_dout == `UDP) & ether_type[1];
1265assign v6_nhdr_ah = (shft1_tmp4_dout == `AH) & ether_type[1];
1266assign v6_nhdr_esp = (shft1_tmp4_dout == `ESP) & ether_type[1];
1267assign v6_nhdr_sctp = (shft1_tmp4_dout == `SCTP) & ether_type[1];
1268
1269assign l4_protocol_dec = {(v4_prot_sctp | v6_nhdr_sctp),
1270 (v4_prot_udp | v6_nhdr_udp),
1271 (v4_prot_tcp | v6_nhdr_tcp)};
1272
1273assign 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
1278assign v4_protocol_in = {v4_prot_sctp, v4_prot_esp, v4_prot_ah, v4_prot_udp, v4_prot_tcp};
1279assign v6_next_hdr_in = {v6_nhdr_sctp, v6_nhdr_esp, v6_nhdr_ah, v6_nhdr_udp, v6_nhdr_tcp};
1280
1281dffre #(2) l4_protocol_r_reg (cclk, reset, shft3_reg_en, l4_protocol, l4_protocol_r);
1282dffre #(5) v4_protocol_reg (cclk, reset, shft3_reg_en, v4_protocol_in, v4_protocol);
1283dffre #(5) v6_next_hdr_reg (cclk, reset, shft3_reg_en, v6_next_hdr_in, v6_next_hdr);
1284
1285assign ipv4_ip_hdr_len = shft0_tmp14_dout[3:0];
1286assign ipv4_ip_pkt_len = {shft1_tmp0_dout, shft1_tmp1_dout};
1287assign ipv4_frag_offset = shft1_tmp54_trans;
1288//assign noport = ether_type[0] & ((ipv4_frag_offset[15:13] == 3'b001) | (|ipv4_frag_offset[12:0]));
1289assign noport = ether_type[0] & (ipv4_frag_offset[13] | (|ipv4_frag_offset[12:0]));
1290assign badip = ether_type[0] & (ipv4_ip_hdr_len < 4'b0101);
1291
1292assign ipv6_ip_pkt_len = {shft1_tmp2_dout, shft1_tmp3_dout};
1293
1294
1295dffre #(8) shft2_tmp2_dout_r_reg (cclk, reset, shft3_reg_en, shft2_tmp2_dout, shft2_tmp2_dout_r);
1296dffre #(8) shft2_tmp3_dout_r_reg (cclk, reset, shft3_reg_en, shft2_tmp3_dout, shft2_tmp3_dout_r);
1297dffre #(4) ipv4_ip_hdr_len_r_reg (cclk, reset, shft3_reg_en, ipv4_ip_hdr_len, ipv4_ip_hdr_len_r);
1298dffre #(4) ipv4_ip_hdr_len_r0_reg (cclk, reset, shft3_reg_en, ipv4_ip_hdr_len, ipv4_ip_hdr_len_r0);
1299dffre #(16) ipv4_ip_pkt_len_r_reg (cclk, reset, shft3_reg_en, ipv4_ip_pkt_len, ipv4_ip_pkt_len_r);
1300dffre #(1) noport_r_reg (cclk, reset, shft3_reg_en, noport, noport_r);
1301dffre #(1) badip_r_reg (cclk, reset, shft3_reg_en, badip, badip_r);
1302
1303dffre #(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/******************************/
1308assign fflp_ipp_data = {2'b0, pkt_id, l4_protocol_r, ipv4_ip_hdr_len_r, ether_type, encap_offset_reg};
1309
1310assign fflp_ipp_dvalid_in = {4{shft3_reg_en}} & mac_port_dec[3:0];
1311
1312dffr #(4) fflp_ipp_dvalid_reg (cclk, reset, fflp_ipp_dvalid_in, fflp_ipp_dvalid);
1313
1314/*************************/
1315// Class
1316/*************************/
1317assign 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
1328assign addr_ind_hdr_byte1 = ether_type[1] ? ipv6_next_hdr : ipv4_protocol;
1329assign addr_ind_hdr_byte0 = ether_type[1] ? ipv6_tos : ipv4_tos;
1330assign 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
1337assign 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
1343assign 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
1348assign 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
1353assign 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
1359dffre #(16) shft0_tmp1312_trans_r_reg (cclk, reset, shft3_reg_en, shft0_tmp1312_trans, shft0_tmp1312_trans_r);
1360dffre #(17) addr_ind_hdr_byte_masked4_r_reg (cclk, reset, shft3_reg_en, addr_ind_hdr_byte_masked4, addr_ind_hdr_byte_masked4_r);
1361dffre #(17) addr_ind_hdr_byte_masked5_r_reg (cclk, reset, shft3_reg_en, addr_ind_hdr_byte_masked5, addr_ind_hdr_byte_masked5_r);
1362dffre #(17) addr_ind_hdr_byte_masked6_r_reg (cclk, reset, shft3_reg_en, addr_ind_hdr_byte_masked6, addr_ind_hdr_byte_masked6_r);
1363dffre #(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
1365assign 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
1371assign 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
1377assign 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
1383assign 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
1390assign l2_hdr_class_match2 = (shft0_tmp1312_trans_r == class2_hdr_byte_value[15:0]);
1391assign l2_hdr_class_match3 = (shft0_tmp1312_trans_r == class3_hdr_byte_value[15:0]);
1392
1393assign l3_hdr_class_match4 = (addr_ind_hdr_byte_masked4_r == class4_hdr_byte_value_masked) & is_ip_pkt;
1394assign l3_hdr_class_match5 = (addr_ind_hdr_byte_masked5_r == class5_hdr_byte_value_masked) & is_ip_pkt;
1395assign l3_hdr_class_match6 = (addr_ind_hdr_byte_masked6_r == class6_hdr_byte_value_masked) & is_ip_pkt;
1396assign l3_hdr_class_match7 = (addr_ind_hdr_byte_masked7_r == class7_hdr_byte_value_masked) & is_ip_pkt;
1397
1398assign l3_hdr_class_match8 = v4_protocol[0];
1399assign l3_hdr_class_match9 = v4_protocol[1];
1400assign l3_hdr_class_match10 = v4_protocol[2] | v4_protocol[3];
1401assign l3_hdr_class_match11 = v4_protocol[4];
1402assign l3_hdr_class_match12 = v6_next_hdr[0];
1403assign l3_hdr_class_match13 = v6_next_hdr[1];
1404assign l3_hdr_class_match14 = v6_next_hdr[2] | v6_next_hdr[3];
1405assign l3_hdr_class_match15 = v6_next_hdr[4];
1406assign l3_hdr_class_match16 = (shft0_tmp1312_trans_r == `TYPE_ARP);
1407assign l3_hdr_class_match17 = (shft0_tmp1312_trans_r == `TYPE_RARP);
1408
1409
1410assign 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
1431assign valid_hdr_class_match_in = hdr_class_match & class_en_mask;
1432assign class_index = class_index_enc (valid_hdr_class_match[15:0]);
1433assign class_index_tmp = (is_promis) ? 5'b0 : class_index;
1434
1435dffre #(16) valid_hdr_class_match_reg (cclk, reset, shft4_reg_en, valid_hdr_class_match_in, valid_hdr_class_match);
1436dffre #(5) class_reg (cclk, reset, shft5_reg_en, class_index_tmp, class);
1437
1438assign 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
1457assign 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/***************************************/
1480assign vlan_parity_err_log_en = vlan_parity_err & shft5_reg_en;
1481
1482assign masked_vlan_tbl_dout = {18{shft5_reg_en | cpu_vlan_gnt_3}} & vlan_tbl_din_reg_dout[17:0];
1483assign 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
1488assign vlan_rdc_num = vlan_tbl_rd_data[2:0];
1489assign vpr = vlan_tbl_rd_data[3];
1490assign vlan_parity = {masked_vlan_tbl_dout[17], masked_vlan_tbl_dout[8]};
1491
1492assign vlan_parity_bit = {^masked_vlan_tbl_dout[16:9], ^masked_vlan_tbl_dout[7:0]};
1493assign vlan_parity_err = !((vlan_parity_bit == vlan_parity) | disable_chksum) & encap_offset_reg[0];
1494
1495assign use_vlan_rdc = encap_offset_reg[0] & !vlan_parity_err;
1496assign vlan_rdc_prio = use_vlan_rdc & vpr;
1497assign is_promis = !ph_match & promiscuous;
1498
1499/*
1500always @ (use_vlan_rdc or vlan_rdc_prio or mpr or
1501 vlan_rdc_num or mac_rdc_num)
1502if (vlan_rdc_prio)
1503 l2_rdc_num = vlan_rdc_num;
1504else if (mpr)
1505 l2_rdc_num = mac_rdc_num;
1506else if (use_vlan_rdc)
1507 l2_rdc_num = vlan_rdc_num;
1508else
1509 l2_rdc_num = mac_rdc_num;
1510*/
1511
1512always @ (vlan_rdc_prio or vlan_rdc_num or mac_rdc_num)
1513if (vlan_rdc_prio)
1514 l2_rdc_num = vlan_rdc_num;
1515else
1516 l2_rdc_num = mac_rdc_num;
1517
1518dffre #(3) l2_rdc_num_r_reg (cclk, reset, shft5_reg_en, l2_rdc_num, l2_rdc_num_r);
1519dffre #(1) vlan_parity_err_r_reg (cclk, reset, shft5_reg_en, vlan_parity_err, vlan_parity_err_r);
1520
1521assign class_action_r0 = class[4] ? 2'b01 : class_action_r[2:1];
1522assign 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/***************************/
1531always @ (
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
1599begin
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
1898end
1899
1900assign ipv4_tos = shft0_tmp15_dout;
1901assign ipv4_protocol = shft1_tmp7_dout;
1902assign ipv4_src_addr = {shft1_tmp10_dout, shft1_tmp11_dout,
1903 shft1_tmp12_dout, shft1_tmp13_dout};
1904assign ipv4_dest_addr = {shft1_tmp14_dout, shft1_tmp15_dout,
1905 shft2_tmp0_dout, shft2_tmp1_dout};
1906
1907/*
1908assign ipv4_ah_spi = {shft2_tmp6_dout, shft2_tmp7_dout,
1909 shft2_tmp8_dout, shft2_tmp9_dout};
1910assign ipv4_esp_spi = {shft2_tmp2_dout, shft2_tmp3_dout,
1911 shft2_tmp4_dout, shft2_tmp5_dout};
1912*/
1913
1914assign ipv6_tos = {shft0_tmp14_dout[3:0], shft0_tmp15_dout[7:4]};
1915assign ipv6_next_hdr = shft1_tmp4_dout;
1916assign 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
1925assign 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
1930assign 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
1935assign ipv6_dest_addr = {ipv6_dest_addr_pre, ipv6_dest_addr_suf};
1936
1937assign ipv6_tcp_src_port = {shft3_tmp6_dout, shft3_tmp7_dout};
1938assign ipv6_tcp_dest_port = {shft3_tmp8_dout, shft3_tmp9_dout};
1939
1940/*
1941assign ipv6_ah_spi = {shft3_tmp10_dout, shft3_tmp11_dout,
1942 shft3_tmp12_dout, shft3_tmp13_dout};
1943assign 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/*******************************************/
1950always @ (
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
1967begin
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
1978end
1979
1980always @ (
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
2002begin
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
2013end
2014
2015always @ (
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
2037begin
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
2049end
2050
2051
2052always @ (
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
2058begin
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
2068end
2069
2070
2071dffre #(32) v4_tcp_port_01_r_reg (cclk, reset, shft4_reg_en, v4_tcp_port_01, v4_tcp_port_01_r);
2072dffre #(32) v4_tcp_port_10_r_reg (cclk, reset, shft5_reg_en, v4_tcp_port_10, v4_tcp_port_10_r);
2073dffre #(8) ipv4_tos_r_reg (cclk, reset, shft5_reg_en, ipv4_tos, ipv4_tos_r);
2074dffre #(8) ipv4_protocol_r_reg (cclk, reset, shft5_reg_en, ipv4_protocol, ipv4_protocol_r);
2075dffre #(32) ipv4_src_addr_r_reg (cclk, reset, shft5_reg_en, ipv4_src_addr, ipv4_src_addr_r);
2076dffre #(32) ipv4_dest_addr_r_reg (cclk, reset, shft5_reg_en, ipv4_dest_addr, ipv4_dest_addr_r);
2077/*
2078dffre #(32) ipv4_ah_spi_r_reg (cclk, reset, shft5_reg_en, ipv4_ah_spi, ipv4_ah_spi_r);
2079dffre #(32) ipv4_esp_spi_r_reg (cclk, reset, shft5_reg_en, ipv4_esp_spi, ipv4_esp_spi_r);
2080*/
2081
2082dffre #(8) ipv6_tos_r_reg (cclk, reset, shft5_reg_en, ipv6_tos, ipv6_tos_r);
2083dffre #(8) ipv6_next_hdr_r_reg (cclk, reset, shft5_reg_en, ipv6_next_hdr, ipv6_next_hdr_r);
2084dffre #(128) ipv6_src_addr_r_reg (cclk, reset, shft5_reg_en, ipv6_src_addr, ipv6_src_addr_r);
2085dffre #(128) ipv6_dest_addr_r_reg (cclk, reset, shft5_reg_en, ipv6_dest_addr, ipv6_dest_addr_r);
2086dffre #(16) ipv6_tcp_src_port_r_reg (cclk, reset, shft5_reg_en, ipv6_tcp_src_port, ipv6_tcp_src_port_r);
2087dffre #(16) ipv6_tcp_dest_port_r_reg (cclk, reset, shft5_reg_en, ipv6_tcp_dest_port,ipv6_tcp_dest_port_r);
2088/*
2089dffre #(32) ipv6_ah_spi_r_reg (cclk, reset, shft5_reg_en, ipv6_ah_spi, ipv6_ah_spi_r);
2090dffre #(32) ipv6_esp_spi_r_reg (cclk, reset, shft5_reg_en, ipv6_esp_spi, ipv6_esp_spi_r);
2091*/
2092
2093dffre #(32) v4_tcp_port_r_reg (cclk, reset, shft6_reg_en, v4_tcp_port, v4_tcp_port_r); //{src, dest}
2094
2095assign v6_tcp_port_r = {ipv6_tcp_src_port_r, ipv6_tcp_dest_port_r};
2096
2097/******************************/
2098//Gen raw key
2099/******************************/
2100assign do_raw_key = (class[4:2] == 3'b0) | (class[4] == 1'b1);
2101
2102assign 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
2109dffre #(88) raw_cam_key_r_reg (cclk, reset, shft3_reg_en, raw_cam_key, raw_cam_key_r);
2110dffre #(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/********************************/
2115dffre #(3) class_action_r_reg (cclk, reset, shft6_reg_en, class_action, class_action_r);
2116
2117assign class_action_ipaddr = class_action_r[0];
2118
2119assign 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};
2120assign 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};
2121assign 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
2123assign 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};
2124assign 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};
2125assign 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
2127assign 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};
2128assign 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};
2129assign 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
2131assign v4_5t_cam_key = v4_protocol[3] ? v4_cam_key_esp :
2132 v4_protocol[2] ? v4_cam_key_ah :
2133 v4_cam_key;
2134
2135assign 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
2142assign raw_cam_key_r0 = {class, 3'b0, raw_cam_key_r, 104'b0};
2143
2144
2145assign 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
2150dffre #(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/********************************/
2155dffre #(10) f_key_class_action_r_reg (cclk, reset, shft6_reg_en, f_key_class_action, f_key_class_action_r);
2156
2157assign f_key_class_action_l4_1 = f_key_class_action_r[1:0];
2158assign f_key_class_action_l4_0 = f_key_class_action_r[3:2];
2159assign f_key_class_action_prot = f_key_class_action_r[4];
2160assign f_key_class_action_ip_da = f_key_class_action_r[5];
2161assign f_key_class_action_ip_sa = f_key_class_action_r[6];
2162assign f_key_class_action_vlan = f_key_class_action_r[7];
2163assign f_key_class_action_l2_da = f_key_class_action_r[8];
2164assign f_key_class_action_vport = f_key_class_action_r[9];
2165
2166assign prot_bytes = ether_type[1] ? ipv6_next_hdr_r : ipv4_protocol_r;
2167assign ip_da_bytes_0 = ether_type[1] ? ipv6_dest_addr_r[31:0] : ipv4_dest_addr_r[31:0];
2168assign ip_da_bytes_1 = ether_type[1] ? ipv6_dest_addr_r[63:32] : 32'b0;
2169assign ip_da_bytes_2 = ether_type[1] ? ipv6_dest_addr_r[95:64] : 32'b0;
2170assign ip_da_bytes_3 = ether_type[1] ? ipv6_dest_addr_r[127:96] : 32'b0;
2171
2172assign ip_sa_bytes_0 = ether_type[1] ? ipv6_src_addr_r[31:0] : ipv4_src_addr_r[31:0];
2173assign ip_sa_bytes_1 = ether_type[1] ? ipv6_src_addr_r[63:32] : 32'b0;
2174assign ip_sa_bytes_2 = ether_type[1] ? ipv6_src_addr_r[95:64] : 32'b0;
2175assign ip_sa_bytes_3 = ether_type[1] ? ipv6_src_addr_r[127:96] : 32'b0;
2176
2177assign vlan_bytes_valid = encap_offset_reg[0] & f_key_class_action_vlan;
2178
2179assign 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
2184assign 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
2189assign f_key_prot_bytes = f_key_class_action_prot ? prot_bytes : 8'b0;
2190assign f_key_ip_da_bytes_0 = f_key_class_action_ip_da ? ip_da_bytes_0 : 32'b0;
2191assign f_key_ip_da_bytes_1 = f_key_class_action_ip_da ? ip_da_bytes_1 : 32'b0;
2192assign f_key_ip_da_bytes_2 = f_key_class_action_ip_da ? ip_da_bytes_2 : 32'b0;
2193assign f_key_ip_da_bytes_3 = f_key_class_action_ip_da ? ip_da_bytes_3 : 32'b0;
2194
2195assign f_key_ip_sa_bytes_0 = f_key_class_action_ip_sa ? ip_sa_bytes_0 : 32'b0;
2196assign f_key_ip_sa_bytes_1 = f_key_class_action_ip_sa ? ip_sa_bytes_1 : 32'b0;
2197assign f_key_ip_sa_bytes_2 = f_key_class_action_ip_sa ? ip_sa_bytes_2 : 32'b0;
2198assign f_key_ip_sa_bytes_3 = f_key_class_action_ip_sa ? ip_sa_bytes_3 : 32'b0;
2199
2200assign f_key_vlan_valid = vlan_bytes_valid ? 4'b1111 : 4'b0000;
2201assign f_key_vlan_bytes = vlan_bytes_valid ? vlan_tag_id[11:0] : 12'b0;
2202assign f_key_l2_da_bytes = f_key_class_action_l2_da ? mac_dest_addr : 48'b0;
2203assign f_key_vport_bytes = f_key_class_action_vport ? mac_port : 2'b0;
2204
2205assign 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
2212dffre #(362) flow_key_r_reg (cclk, reset, shft7_reg_en, flow_key, flow_key_r);
2213
2214/********************************/
2215//Extract TCP SEQUENCE NUMBER
2216/********************************/
2217always @ (
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
2234begin
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
2245end
2246
2247always @ (
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
2269begin
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
2280end
2281
2282always @ (
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
2304begin
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
2316end
2317
2318
2319always @ (
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
2325begin
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
2335end
2336
2337assign v6_seq_num = {shft3_tmp10_dout, shft3_tmp11_dout, shft3_tmp12_dout, shft3_tmp13_dout};
2338
2339dffre #(32) v4_seq_num_01_r_reg (cclk, reset, shft4_reg_en, v4_seq_num_01, v4_seq_num_01_r);
2340dffre #(32) v4_seq_num_10_r_reg (cclk, reset, shft5_reg_en, v4_seq_num_10, v4_seq_num_10_r);
2341dffre #(32) v4_seq_num_r_reg (cclk, reset, shft6_reg_en, v4_seq_num, v4_seq_num_r);
2342dffre #(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/********************************/
2347always @ (
2348 ipv4_ip_hdr_len_r0[1:0] or
2349 shft2_tmp14_dout or
2350 shft3_tmp2_dout or
2351 shft3_tmp6_dout)
2352
2353begin
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
2362end
2363
2364always @ (
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
2371begin
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
2381end
2382
2383always @ (
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
2390begin
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
2400end
2401
2402
2403always @ (
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
2409begin
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
2419end
2420
2421
2422assign v6_tcp_len = shft4_tmp2_dout[7:4];
2423
2424dffre #(4) v4_tcp_len_01_r_reg (cclk, reset, shft5_reg_en, v4_tcp_len_01, v4_tcp_len_01_r);
2425dffre #(4) v4_tcp_len_10_r_reg (cclk, reset, shft6_reg_en, v4_tcp_len_10, v4_tcp_len_10_r);
2426dffre #(4) v4_tcp_len_r_reg (cclk, reset, shft7_reg_en, v4_tcp_len, v4_tcp_len_r);
2427dffre #(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/********************************/
2432always @ (
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
2438begin
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
2448end
2449
2450always @ (
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
2457begin
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
2468end
2469
2470always @ (
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
2477begin
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
2488end
2489
2490
2491always @ (
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
2497begin
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
2508end
2509
2510assign v6_tcp_flag = {shft4_tmp2_dout[3:0], shft4_tmp3_dout[7:0]};
2511
2512dffre #(12) v4_tcp_flag_01_r_reg (cclk, reset, shft5_reg_en, v4_tcp_flag_01, v4_tcp_flag_01_r);
2513dffre #(12) v4_tcp_flag_10_r_reg (cclk, reset, shft6_reg_en, v4_tcp_flag_10, v4_tcp_flag_10_r);
2514dffre #(12) v4_tcp_flag_r_reg (cclk, reset, shft7_reg_en, v4_tcp_flag, v4_tcp_flag_r);
2515dffre #(12) v6_tcp_flag_r_reg (cclk, reset, shft5_reg_en, v6_tcp_flag, v6_tcp_flag_r);
2516
2517always @ (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
2531if (ether_type[1])
2532begin
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;
2538end
2539else
2540begin
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;
2546end
2547
2548
2549assign tcp_push_bit = |(tcp_ctrl_flag & (~hdr_ctrl_bit_mask_reg_dout)) & (l4_protocol_r == 2'b01);
2550
2551
2552assign 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
2555assign pkt_id_in = pkt_id + 4'd1;
2556
2557dffre #(4) pkt_id_reg (cclk, reset, hdr_shft_done, pkt_id_in, pkt_id);
2558
2559/*************************************/
2560//Header fifo operation
2561/*************************************/
2562assign hdr_fifo_wen = hdr_shft_done;
2563assign hdr_fifo_ren = fwd_sched;
2564assign hdr_fifo_din = {fwd_info, flow_key_r, tcam_key_r}; //84+362+200=646
2565
2566assign 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
2571assign 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;
2575assign hdr_fifo_cnt_en = hdr_fifo_wen | hdr_fifo_ren;
2576
2577dffre #(3) hdr_fifo_cnt_reg (cclk, reset, hdr_fifo_cnt_en, hdr_fifo_cnt_in, hdr_fifo_cnt);
2578
2579/*
2580always @ (posedge cclk)
2581if (reset)
2582 hdr_fifo_full <= 1'b0;
2583else if (hdr_fifo_ren)
2584 hdr_fifo_full <= 1'b0;
2585else if (hdr_fifo_lastwp && hdr_fifo_wen)
2586 hdr_fifo_full <= 1'b1;
2587else
2588 hdr_fifo_full <= hdr_fifo_full;
2589
2590always @ (posedge cclk)
2591if (reset)
2592 hdr_fifo_empty <= 1'b1;
2593else if (hdr_fifo_wen)
2594 hdr_fifo_empty <= 1'b0;
2595else if (hdr_fifo_lastrp & hdr_fifo_ren)
2596 hdr_fifo_empty <= 1'b1;
2597else
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
2612fflp_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
2623dffre #(446) fwd_info_bus_reg (cclk, reset, fwd_sched, hdr_fifo_dout[645:200], fwd_info_bus);
2624dffre #(200) key_bus_reg (cclk, reset, fwd_sched, hdr_fifo_dout[199:0], key_bus);
2625
2626assign fwd_req = !hdr_fifo_empty;
2627
2628
2629/******************************/
2630//VLAN table lookup
2631/******************************/
2632/************************/
2633//CPU access request
2634/************************/
2635assign cpu_vlan_gnt = cpu_vlan_acc & !cpu_vlan_acc_dly;
2636assign cpu_vlan_acc_en = cpu_vlan_gnt_3 | cpu_vlan_req & !shft1_reg_en;
2637assign cpu_vlan_acc_in = cpu_vlan_gnt_3 ? 1'b0 : 1'b1;
2638
2639dffre #(1) cpu_vlan_acc_reg (cclk, reset, cpu_vlan_acc_en, cpu_vlan_acc_in, cpu_vlan_acc);
2640dffr #(1) cpu_vlan_acc_dly_reg (cclk, reset, cpu_vlan_acc, cpu_vlan_acc_dly);
2641
2642dffr #(1) cpu_vlan_gnt_1_reg (cclk, reset, cpu_vlan_gnt, cpu_vlan_gnt_1);
2643dffr #(1) cpu_vlan_gnt_2_reg (cclk, reset, cpu_vlan_gnt_1, cpu_vlan_gnt_2);
2644dffr #(1) cpu_vlan_gnt_3_reg (cclk, reset, cpu_vlan_gnt_2, cpu_vlan_gnt_3);
2645
2646assign cpu_vlan_rd_gnt = cpu_vlan_gnt & cpu_vlan_rd;
2647
2648assign cpu_vlan_wr_gnt = cpu_vlan_gnt & cpu_vlan_wr;
2649
2650/*************************/
2651//Search access request
2652/*************************/
2653assign srch_vlan_rd_in = or_tag & shft1_reg_en;
2654
2655dffr #(1) srch_vlan_rd_reg (cclk, reset, srch_vlan_rd_in, srch_vlan_rd);
2656
2657/*************************/
2658//Vlan access control
2659/*************************/
2660`ifdef NEPTUNE
2661assign vlan_tbl_cs_in = vlan_tbl_rd_in | vlan_tbl_wr_in;
2662`else
2663assign vlan_tbl_cs_in = vlan_tbl_rd_in;
2664`endif
2665
2666assign vlan_tbl_rd_in = srch_vlan_rd | cpu_vlan_rd_gnt;
2667assign vlan_tbl_wr_in = cpu_vlan_wr_gnt;
2668
2669assign vlan_tbl_addr_in = srch_vlan_rd ? vlan_tag_id[11:0] : cpu_vlan_addr;
2670
2671dffr #(1) vlan_tbl_cs_reg (cclk, reset, vlan_tbl_cs_in, vlan_tbl_cs);
2672dffr #(1) vlan_tbl_wr_reg (cclk, reset, vlan_tbl_wr_in, vlan_tbl_wr);
2673dffr #(12) vlan_tbl_addr_reg (cclk, reset, vlan_tbl_addr_in, vlan_tbl_addr);
2674dffr #(18) vlan_tbl_din_reg (cclk, reset, vlan_tbl_rd_din, vlan_tbl_din_reg_dout);
2675
2676/**********************************************************************/
2677function [4:0] class_index_enc;
2678/**********************************************************************/
2679input [15:0] hdr_class;
2680
2681reg [4:0] l3_class_index;
2682
2683begin
2684
2685casex (hdr_class) //synopsys full_case
2686// 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:l3_class_index"
268716'b0000_0000_0000_0000: l3_class_index = 5'b00000;
268816'bxxxx_xxxx_xxxx_xxx1: l3_class_index = 5'b00010;
268916'bxxxx_xxxx_xxxx_xx10: l3_class_index = 5'b00011;
269016'bxxxx_xxxx_xxxx_x100: l3_class_index = 5'b00100;
269116'bxxxx_xxxx_xxxx_1000: l3_class_index = 5'b00101;
269216'bxxxx_xxxx_xxx1_0000: l3_class_index = 5'b00110;
269316'bxxxx_xxxx_xx10_0000: l3_class_index = 5'b00111;
269416'bxxxx_xxxx_x100_0000: l3_class_index = 5'b01000;
269516'bxxxx_xxxx_1000_0000: l3_class_index = 5'b01001;
269616'bxxxx_xxx1_0000_0000: l3_class_index = 5'b01010;
269716'bxxxx_xx10_0000_0000: l3_class_index = 5'b01011;
269816'bxxxx_x100_0000_0000: l3_class_index = 5'b01100;
269916'bxxxx_1000_0000_0000: l3_class_index = 5'b01101;
270016'bxxx1_0000_0000_0000: l3_class_index = 5'b01110;
270116'bxx10_0000_0000_0000: l3_class_index = 5'b01111;
270216'bx100_0000_0000_0000: l3_class_index = 5'b10000;
270316'b1000_0000_0000_0000: l3_class_index = 5'b10001;
2704default: l3_class_index = 5'b00000;
2705
2706endcase
2707
2708class_index_enc = l3_class_index;
2709
2710end
2711
2712endfunction
2713
2714/**********************************************************************/
2715function [2:0] class_action_sel0;
2716/**********************************************************************/
2717input [3:0] class;
2718input [2:0] l3_class_action_reg2_dout;
2719input [2:0] l3_class_action_reg3_dout;
2720input [2:0] l3_class_action_reg4_dout;
2721input [2:0] l3_class_action_reg5_dout;
2722input [2:0] l3_class_action_reg6_dout;
2723input [2:0] l3_class_action_reg7_dout;
2724input [2:0] l3_class_action_reg8_dout;
2725input [2:0] l3_class_action_reg9_dout;
2726input [2:0] l3_class_action_reg10_dout;
2727input [2:0] l3_class_action_reg11_dout;
2728input [2:0] l3_class_action_reg12_dout;
2729input [2:0] l3_class_action_reg13_dout;
2730input [2:0] l3_class_action_reg14_dout;
2731input [2:0] l3_class_action_reg15_dout;
2732
2733reg [2:0] class_action;
2734
2735begin
2736
2737case (class) //synopsys parallel_case full_case
2738// 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:CAM_class_action"
27394'b0000: class_action = 3'b0;
27404'b0001: class_action = 3'b0;
27414'b0010: class_action = l3_class_action_reg2_dout;
27424'b0011: class_action = l3_class_action_reg3_dout;
27434'b0100: class_action = l3_class_action_reg4_dout;
27444'b0101: class_action = l3_class_action_reg5_dout;
27454'b0110: class_action = l3_class_action_reg6_dout;
27464'b0111: class_action = l3_class_action_reg7_dout;
27474'b1000: class_action = l3_class_action_reg8_dout;
27484'b1001: class_action = l3_class_action_reg9_dout;
27494'b1010: class_action = l3_class_action_reg10_dout;
27504'b1011: class_action = l3_class_action_reg11_dout;
27514'b1100: class_action = l3_class_action_reg12_dout;
27524'b1101: class_action = l3_class_action_reg13_dout;
27534'b1110: class_action = l3_class_action_reg14_dout;
27544'b1111: class_action = l3_class_action_reg15_dout;
2755
2756default: class_action = 3'b0;
2757
2758endcase
2759
2760class_action_sel0 = class_action;
2761end
2762endfunction
2763
2764
2765/**********************************************************************/
2766function [9:0] class_action_sel1;
2767/**********************************************************************/
2768input [3:0] class;
2769input [9:0] l3_class_action_reg2_dout;
2770input [9:0] l3_class_action_reg3_dout;
2771input [9:0] l3_class_action_reg4_dout;
2772input [9:0] l3_class_action_reg5_dout;
2773input [9:0] l3_class_action_reg6_dout;
2774input [9:0] l3_class_action_reg7_dout;
2775input [9:0] l3_class_action_reg8_dout;
2776input [9:0] l3_class_action_reg9_dout;
2777input [9:0] l3_class_action_reg10_dout;
2778input [9:0] l3_class_action_reg11_dout;
2779input [9:0] l3_class_action_reg12_dout;
2780input [9:0] l3_class_action_reg13_dout;
2781input [9:0] l3_class_action_reg14_dout;
2782input [9:0] l3_class_action_reg15_dout;
2783
2784reg [9:0] class_action;
2785
2786begin
2787
2788case (class) //synopsys parallel_case full_case
2789// 0in < case -full -parallel -message "0in ERROR: case check in fflp_hdr_dp:FCARM_class_action"
27904'b0000: class_action = 10'b0;
27914'b0001: class_action = 10'b0;
27924'b0010: class_action = l3_class_action_reg2_dout;
27934'b0011: class_action = l3_class_action_reg3_dout;
27944'b0100: class_action = l3_class_action_reg4_dout;
27954'b0101: class_action = l3_class_action_reg5_dout;
27964'b0110: class_action = l3_class_action_reg6_dout;
27974'b0111: class_action = l3_class_action_reg7_dout;
27984'b1000: class_action = l3_class_action_reg8_dout;
27994'b1001: class_action = l3_class_action_reg9_dout;
28004'b1010: class_action = l3_class_action_reg10_dout;
28014'b1011: class_action = l3_class_action_reg11_dout;
28024'b1100: class_action = l3_class_action_reg12_dout;
28034'b1101: class_action = l3_class_action_reg13_dout;
28044'b1110: class_action = l3_class_action_reg14_dout;
28054'b1111: class_action = l3_class_action_reg15_dout;
2806
2807default: class_action = 10'b0;
2808
2809endcase
2810
2811class_action_sel1 = class_action;
2812end
2813endfunction
2814
2815
2816`ifdef NEPTUNE
2817wire [3:0] do_nad;
2818wire [3:0] do_nor;
2819wire [3:0] do_inv;
2820wire [3:0] do_mux;
2821wire [3:0] do_q;
2822wire so;
2823
2824nep_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
2856endmodule