Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: pack_db.vr | |
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 | #include <vera_defines.vrh> | |
36 | #include "pcg_types.vri" | |
37 | #include "flow_db.vrh" | |
38 | #include "mac_db.vrh" | |
39 | #include "ipp_db.vrh" | |
40 | #include "fflp_db.vrh" | |
41 | ||
42 | class out_header_class { | |
43 | byte_array header[]; // Output header (OPP to MAC to PC) | |
44 | integer use_header = -1; | |
45 | integer header_len[]; | |
46 | bit ifedx = 0; // This is a interfedx packet | |
47 | bit [15:0] ifedx_ctrl = 0; // control word for each port | |
48 | bit [15:0] txmac_status = 0; // txmac status word for each port | |
49 | bit [63:0] txbmac_status = 0; // txmac status word forP1-P3 | |
50 | } | |
51 | ||
52 | ||
53 | // ----- Global Packet DB Entry ----- | |
54 | class pack_db_entry { | |
55 | ||
56 | flow_desc flow; // Flow Descriptor | |
57 | frame_desc frame; // Frame Descriptor | |
58 | node_desc src_node; // Source Port Descriptor | |
59 | node_desc dst_node; // Destanation Port Descriptor | |
60 | tup_descr tup; // TCP/UDP Ports | |
61 | rcv_param rx_param; // TCP Rx Parameters | |
62 | tmt_param tx_param; // TCP Tx Parameters | |
63 | tcp_state fl_state; // TCP State Parameters | |
64 | integer ttl; // Frames ttl field (only for L3 frames) | |
65 | integer data_length = 0; // Frames ttl field (only for L3 frames) | |
66 | integer org_port; // Originating Port Number | |
67 | integer order_seq; // Ordering sequence number | |
68 | integer pckt_num; // Packet counter for this packet generator | |
69 | bit [3:0] port_type; // Port Type | |
70 | bit [63:0] options; // Options | |
71 | bit pg_done; // 0-packet is queued in pg; 1-packet was sent out | |
72 | bit [15:0] ifedx_control; // Interfedx packet control word | |
73 | bit [31:0] ifedx_crc; // Interfedx CRC | |
74 | bit [31:0] pack_crc; // Original Packet CRC | |
75 | integer frame_len; // Total frame length as genereted by the PG | |
76 | integer pc_check[]; // Status of the packet after packet checker checked | |
77 | byte_array header[]; // A working copy of the header as it's being modified | |
78 | integer header_len[]; // Length of the header | |
79 | integer use_hdr; // Points to header in header array | |
80 | out_header_class out_header[]; // Output header array for each port; | |
81 | ||
82 | integer pass; // Packet pass/fail flag | |
83 | // | |
84 | // MAC/IPP Interface Checker | |
85 | // | |
86 | integer im_check; // Status of the packet after ipp/mac i/f checker checked | |
87 | bit [19:0] final_fwd_dec; // True Forwarding Decision | |
88 | // | |
89 | // MAC Descriptor / Parameters | |
90 | // | |
91 | ||
92 | mac_db mac; // MAC variables database | |
93 | ipp_db ipp; // MAC variables database | |
94 | fflp_db fflp; | |
95 | integer gId; | |
96 | bit [95:0] psu_hdr; // pseudo header for checksum | |
97 | integer preamble_cnt=0; | |
98 | integer sfd = 32'hd5; | |
99 | ||
100 | ||
101 | task new ( integer i = 0) { | |
102 | gId = i; | |
103 | } | |
104 | function integer add(integer org_port, flow_desc flow,frame_desc frame, node_desc src_node, | |
105 | node_desc dst_node, tup_descr tup, rcv_param rx_param, tmt_param tx_param, | |
106 | tcp_state fl_state, integer data_length, integer ttl, bit[63:0] options, integer order_seq, | |
107 | integer pckt_num, bit [15:0] ifedxc) ; | |
108 | ||
109 | task add_header( byte_array buf, integer start, integer len); | |
110 | ||
111 | } | |
112 | ||
113 | ||
114 | ||
115 | // | |
116 | function integer pack_db_entry::add(integer org_port, flow_desc flow,frame_desc frame, node_desc src_node, | |
117 | node_desc dst_node, tup_descr tup, rcv_param rx_param, tmt_param tx_param, tcp_state fl_state, integer data_length, integer ttl, bit[63:0] options, integer order_seq, | |
118 | integer pckt_num, bit [15:0] ifedxc) { | |
119 | integer n; | |
120 | ||
121 | this.org_port = org_port; | |
122 | this.order_seq = order_seq; | |
123 | this.pckt_num = pckt_num; | |
124 | this.flow = new flow; | |
125 | this.frame = new frame; | |
126 | this.src_node = new src_node; | |
127 | this.dst_node = new dst_node; | |
128 | this.tup = new tup; | |
129 | this.rx_param = new rx_param; | |
130 | this.tx_param = new tx_param; | |
131 | this.fl_state = new fl_state; | |
132 | this.ttl = ttl; | |
133 | this.data_length = data_length; | |
134 | this.options = options; | |
135 | this.ifedx_control= ifedxc; | |
136 | this.pg_done = 0; | |
137 | this.im_check = 0; | |
138 | ||
139 | for(n=0;n<20;n++) | |
140 | this.pc_check[n] = 0; | |
141 | ||
142 | this.mac = new; | |
143 | this.ipp = new; | |
144 | this.fflp = new; | |
145 | this.use_hdr = 0; | |
146 | this.pass = 0; | |
147 | add = this.gId; | |
148 | } | |
149 | ||
150 | task pack_db_entry:: add_header( byte_array buf, integer start, integer len) { | |
151 | integer n; | |
152 | len = len-start; | |
153 | this.header[ this.use_hdr ] = new; | |
154 | len++; | |
155 | for(n=0;n<len;n++) | |
156 | this.header[ this.use_hdr ].val[n] = buf.val[start+n]; | |
157 | this.header_len[ this.use_hdr ] = len; | |
158 | ||
159 | printf(" in add_header - len - %d use_hdr - %d \n",len,this.use_hdr); | |
160 | ||
161 | } | |
162 | ||
163 |