Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / common / vera / niu_ippktgen / flow_db.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: flow_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 "niu_byte_array.vrh"
38
39
40// ----- Node Descriptor -----
41class node_desc {
42 bit [47:0] l2_addr; // L2 address for this station
43 bit [15:0] tci; // Tag Control Information
44 bit [31:0] ip_addr; // IPv4 address of this substation
45 bit [128:0] ipv6_addr=128'h0; // IPv6 address of this substation
46 bit [7:0] tos =0; // TOS v4/Frame Class v6
47 bit [19:0] src_port; // Which ports may use this node as source
48 bit [31:0] spi = 0; // Security Parameter Index for AH /ESP
49 bit [7:0] nxthdr = 06;
50 bit [31:0] esp_ah_seq_no = 0; // Sequence Number for AH/ ESP
51
52}
53
54// ----- TCP/UDP Ports Descriptor -----
55class tup_descr {
56 bit [15:0] src_tcp_udp_port; // Source TCP/UDP Port
57 bit [15:0] dst_tcp_udp_port; // Destination TCP/UDP Port
58 bit [31:0] tcp_seq_no=0;
59
60}
61class sctp_descr {
62
63 bit [15:0] src_sctp_port=0; // Source TCP/UDP Port
64 bit [15:0] dst_sctp_port=0; // Destination TCP/UDP Port
65 bit [31:0] sctp_vtag=0;
66}
67
68class arp_descr {
69
70 bit [15:0] hw_type=1; // Hardware type (e.g., Ethernet-0x0001, Packet Radio Net.)
71 bit [15:0] proto_type=16'h0800; // Protocol type (e.g., IP - 0x0800)
72 bit [7:0] hlen=6; // byte length of each hardware address
73 bit [7:0] plen=4; // byte length of each protocol address
74 bit [15:0] operation=1; // opcode (e.g. REQ or REPLY)
75 bit [47:0] src_hw_addr=0; // Hardware address of sender of this packet
76 bit [31:0] src_proto_addr=0; // Protocol address of the sender
77 bit [47:0] dst_hw_addr=0; // Hardware address of target of this packet (if known)
78 bit [31:0] dst_proto_addr=0; // Protocol address of the target
79
80}
81
82// ----- Frame Descriptor -----
83class frame_desc {
84 bit [4:0] frame_type = 0; // Frame Type (bit 3: 0=IPv4 Header 1=IPv6 Header)
85 // bit 4: 0=Tunneling off
86 bit [1:0] tunnel_type = 0;// selects between different tunneling combinations
87 // 00: IPv4/IPv4 (default)
88 // 01: IPv4/IPv6
89 // 10: IPv6/IPv4
90 // 11: IPv6/IPv6
91 integer frame_class; // L3 IP class
92 integer type; // L3 IP class type (-1 = auto: length or type from class);
93 integer tpid; // L2 Tagged frames custopm TPID value (-1 = use default)
94 integer class_mask; // Mask to be applied to class
95 integer class_funct; // Mask Operation (0-AND, 1-OR)
96 integer data_type; // Type of payload
97 integer data_seed; // Seed for random data
98 //integer data_length; // Length of payload (-1=make exactly 64 byte packets)
99 integer header_length; // min value = 5, max value = 15; header length including options would be 4*header_length;
100 integer l2_pad_length;
101 bit[15:0] error_chksum;
102 bit [15:0] error_type_len;
103 bit [7:0] l4_proto_field;
104 bit [15:0] ip_frag;
105 integer error_code;
106
107
108 task new() {
109 frame_type = 0;
110 tunnel_type = 0;
111 frame_class = 0;
112 type = -1;
113 tpid = -1;
114 class_mask = 0;
115 class_funct = 0;
116 data_type = 0;
117 data_seed = 0;
118 error_code = 0;
119 error_chksum = 0;
120 error_type_len = 0;
121 header_length = 5;
122 l2_pad_length = 0;
123 l4_proto_field = 0;
124 ip_frag = 16'h20fa; // choose something else?
125 //data_length = 0;
126 }
127}
128
129
130// ----- TCP Tx Parameters -----
131class tmt_param {
132 bit [31:0] adv_isn;
133 bit [31:0] last_seqno;
134 bit retr_timeout; //Initialize to zero
135 bit [15:0] adv_window_size;//Initialize to zero
136
137 task new() {
138 retr_timeout = 0;
139 adv_window_size = 0;
140 last_seqno = 0;
141 }
142
143
144 }
145
146// ----- TCP Rx Parameters -----
147class rcv_param {
148 bit [31:0] rcv_isn;//User Programs while Setting "SYN"
149 bit [31:0] last_ackno;
150 bit timeout; //Initialize to zero
151 bit [15:0] rmt_window_size;//Initialize to zero
152
153 task new() {
154 timeout = 0;
155 rmt_window_size = 0;
156 }
157 }
158
159
160// ----- TCP State Parameters -----
161
162class tcp_state {
163 bit [5:0] tcp_flags;
164 bit [3:0] tcp_st;//Initialise to zero now
165
166 task new() {
167 //tcp_flags = 6'b00_0010;//{(URG,ACK,PSH,RST,SYN,FIN}
168 tcp_st = 0;
169 }
170}
171
172
173// ----- FLow Descriptor To Generate Packets of Various Flows -----
174class flow_desc {
175
176 frame_desc frame = new;
177 node_desc src_node = new;
178 node_desc dst_node = new;
179
180 tup_descr tup = new;
181 sctp_descr sctp = new;
182 arp_descr arp = new;
183 rcv_param rx_param = new;
184 tmt_param tx_param = new;
185 tcp_state fl_state = new ;
186 integer flow_no;
187
188 integer partial_chksum=0; // ONLY FOR TX
189 bit [7:0] psu_hdr[2]; // ONLY FOR TX
190 bit[31:0] options = 32'h0;
191 integer preamble_cnt = 0;
192 integer sfd = 32'hd5;
193
194
195
196}
197
198
199// ----- Forwarding Descriptor -----
200class fwd_desc {
201 // Forwarding Decision from FFLP
202 bit [23:0] fwd_decision[5];
203}
204
205// ----- Class Descriptor -----
206class l3_class_desc {
207 bit [7:0] val[14];
208}
209
210// ----- Class Mask Descriptor -----
211class l3_class_mask {
212 bit [7:0] val[14];
213}
214
215// ----- Global Flow DB Entry -----
216class flow_db_entry {
217
218 flow_desc flow;
219 tup_descr tup; // TCP/UDP Ports
220 rcv_param rx_param; // TCP Rx Parameters
221 tmt_param tx_param; // TCP Tx Parameters
222 tcp_state fl_state; // TCP State Parameters
223
224 integer org_port; // Originating Port Number
225
226 integer flow_num; // Flow counter for this packet generator
227
228
229
230 integer data_length;
231
232
233 bit [63:0] options; // Options
234 integer preamble_cnt = 0;
235 integer sfd = 32'hd5;
236
237 }
238
239
240//
241
242