Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / niu / txc_sat / vera / niu_tx_test_control.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: niu_tx_test_control.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 "cMesg.vrh"
37extern Mesg be_msg;
38
39
40class niu_tx_test_control {
41
42 integer rand_var;
43 integer pkt_len; // 0 is random pkt-len from 64-9216 bytes
44 // 1 is byte-sweep from 64 bytes
45 // 2 is byte-sweep from 500 bytes
46 // 3 is byte-sweep from 1000 bytes
47 // 4 is byte-sweep from 1500 bytes
48 // 5 is byte-sweep from 2000 bytes
49 // 6 is byte-sweep from 2500 bytes
50 // 7 is byte-sweep from 3000 bytes
51 // 8 is byte-sweep from 3500 bytes
52 // 9 is byte-sweep from 4000 bytes
53 // 10 is byte-sweep from 4500 bytes
54 // 11 is byte-sweep from 5000 bytes
55 // 12 is byte-sweep from 5500 bytes
56 // 13 is byte-sweep from 6000 bytes
57 // 14 is byte-sweep from 6500 bytes
58 // 15 is byte-sweep from 7000 bytes
59 // 16 is byte-sweep from 7500 bytes
60 // 17 is byte-sweep from 8000 bytes
61 // 18 is byte-sweep from 8500 bytes
62 // 19 is byte-sweep from 9000 bytes
63
64 integer pkt_type; // 0 random pkt_type
65 // 1 L2(no options)
66 // 2 L2(vlan)
67 // 3 L2(llc)
68 // 4 L2(llc+vlan)
69 // 5 L2(no options) + L3 Ipv4 no options
70 // 6 L2(no options) + L3 Ipv4 (random hdr len from 5 to 15)
71 // 7 L2(no options) + L3 Ipv4 (random hdr len from 5 to 15) + L4 TCP
72 // 8 L2(no options) + L3 Ipv4 (random hdr len from 5 to 15) + L4 UDP
73 // 9 L2(vlan) + L3 Ipv4 (random hdr len from 5 to 15)
74 // 10 L2(vlan) + L3 Ipv4 (random hdr len from 5 to 15) + L4 TCP
75 // 11 L2(vlan) + L3 Ipv4 (random hdr len from 5 to 15) + L4 UDP
76 // 12 L2(llc) + L3 Ipv4 (random hdr len from 5 to 15)
77 // 13 L2(llc) + L3 Ipv4 (random hdr len from 5 to 15) + L4 TCP
78 // 14 L2(llc) + L3 Ipv4 (random hdr len from 5 to 15) + L4 UDP
79 // 15 L2(vlan + llc) + L3 Ipv4 (random hdr len from 5 to 15)
80 // 16 L2(vlan + llc) + L3 Ipv4 (random hdr len from 5 to 15) + L4 TCP
81 // 17 L2(vlan + llc) + L3 Ipv4 (random hdr len from 5 to 15) + L4 UDP
82 // 18 L2(no options) + L3 Ipv6
83 // 19 L2(no options) + L3 Ipv6 + L4 TCP
84 // 20 L2(no options) + L3 Ipv6 + L4 UDP
85 // 21 L2(vlan) + L3 Ipv6
86 // 22 L2(vlan) + L3 Ipv6 + L4 TCP
87 // 23 L2(vlan) + L3 Ipv6 + L4 UDP
88 // 24 L2(llc) + L3 Ipv6
89 // 25 L2(llc) + L3 Ipv6 + L4 TCP
90 // 26 L2(llc) + L3 Ipv6 + L4 UDP
91 // 27 L2(vlan + llc) + L3 Ipv6
92 // 28 L2(vlan + llc) + L3 Ipv6 + L4 TCP
93 // 29 L2(vlan + llc) + L3 Ipv6 + L4 UDP
94
95 integer no_of_pkts;
96 integer enable_mb;
97 integer gather_mode; // 0 not in gather mode
98 // 1 ingather mode
99
100 integer random_gmode; // 0 not in random gather mode
101 // 1 in random gather mode (this use the gen_txgatherpkts fn)
102
103 integer insert_pad; // 0 no pad inserted
104 // 1 random pad inserted
105
106
107 integer kick_mode; // 0 kick descriptors randomly
108 // 1 setup all pkts and kick them'al
109 // 2 setup x pkts and kick x pkts
110
111 integer pad_bytes;
112
113 integer port0_max_burst;
114 integer port1_max_burst;
115 integer port2_max_burst;
116 integer port3_max_burst;
117
118 integer random_maxburst;
119
120 integer random_dmabinds;
121
122 integer random_addroffset;
123
124 integer random_num_pkts; // enables random number of pkst per DMA
125 integer num_pkts_mthld;
126
127 bit [23:0] port0_dmas;
128 bit [23:0] port1_dmas;
129 bit [23:0] port2_dmas;
130 bit [23:0] port3_dmas;
131
132 bit [31:0] tx_port;
133 string str_port, temp_port;
134
135 integer port_no[4];
136
137 integer port0_enb = 0;
138 integer port1_enb = 0;
139 integer port2_enb = 0;
140 integer port3_enb = 0;
141
142 integer no_of_dmas;
143
144 integer ring_len;
145
146 integer enb_intr;
147 integer tx_func_num;
148 integer mb_pkts;
149
150 integer kmode2_npkts;
151
152 integer byte_align;
153
154 integer tx_vir_pio;
155
156 integer kick_partial;
157
158 integer stop_unstall;
159
160 integer sync_dmas;
161
162 integer km2_rand_numpkts;
163
164 bit specweb_enabled;
165
166 integer pktcnt_rd_intv;
167
168 integer random_rst;
169
170 integer mac_speed0;
171 integer mac_speed1;
172 integer mac_speed2;
173 integer mac_speed3;
174
175 integer tx_uniform_pkt_distribution;
176
177
178
179 task new();
180}
181
182task niu_tx_test_control :: new()
183{
184 integer i;
185
186 if (get_plus_arg(CHECK,"TX_PKT_CNT="))
187 no_of_pkts = get_plus_arg(NUM,"TX_PKT_CNT=");
188 else
189 no_of_pkts = 16;
190
191 if (get_plus_arg(CHECK,"TX_PKT_LEN="))
192 pkt_len = get_plus_arg(NUM,"TX_PKT_LEN=");
193 else
194 pkt_len = 48;
195
196 if (get_plus_arg(CHECK,"ENB_MB="))
197 enable_mb = get_plus_arg(NUM,"ENB_MB=");
198 else
199 enable_mb = 1;
200
201 if (get_plus_arg(CHECK,"PORT0_DMAS="))
202 port0_dmas = get_plus_arg(HNUM,"PORT0_DMAS=");
203 else
204 port0_dmas = 24'h1;
205
206 if (get_plus_arg(CHECK,"PORT1_DMAS="))
207 port1_dmas = get_plus_arg(HNUM,"PORT1_DMAS=");
208 else
209 port1_dmas = 24'h2;
210
211 if (get_plus_arg(CHECK,"PORT2_DMAS="))
212 port2_dmas = get_plus_arg(HNUM,"PORT2_DMAS=");
213 else
214 port2_dmas = 24'h4;
215
216 if (get_plus_arg(CHECK,"PORT3_DMAS="))
217 port3_dmas = get_plus_arg(HNUM,"PORT3_DMAS=");
218 else
219 port3_dmas = 24'h8;
220
221 if (get_plus_arg(CHECK,"PORT0_MAXBURST="))
222 port0_max_burst = get_plus_arg(NUM,"PORT0_MAXBURST=");
223 else
224 port0_max_burst = 500;
225
226 if (get_plus_arg(CHECK,"PORT1_MAXBURST="))
227 port1_max_burst = get_plus_arg(NUM,"PORT1_MAXBURST=");
228 else
229 port1_max_burst = 500;
230
231 if (get_plus_arg(CHECK,"PORT2_MAXBURST="))
232 port2_max_burst = get_plus_arg(NUM,"PORT2_MAXBURST=");
233 else
234 port2_max_burst = 500;
235
236 if (get_plus_arg(CHECK,"PORT3_MAXBURST="))
237 port3_max_burst = get_plus_arg(NUM,"PORT3_MAXBURST=");
238 else
239 port3_max_burst = 500;
240
241 if (get_plus_arg(CHECK,"RAND_MAXBURST="))
242 random_maxburst = get_plus_arg(NUM,"RAND_MAXBURST=");
243 else
244 random_maxburst = 0;
245
246 if (get_plus_arg(CHECK,"RAND_DMABINDS="))
247 random_dmabinds = get_plus_arg(NUM,"RAND_DMABINDS=");
248 else
249 random_dmabinds = 0;
250
251 if (get_plus_arg(CHECK,"RANDOM_ADDROFFSET="))
252 random_addroffset = get_plus_arg(NUM,"RANDOM_ADDROFFSET=");
253 else
254 random_addroffset = 0;
255
256 if (get_plus_arg(CHECK,"GATHER_MODE="))
257 gather_mode = get_plus_arg(NUM,"GATHER_MODE=");
258 else
259 gather_mode = 0;
260
261 if (get_plus_arg(CHECK,"RANDOM_GMODE="))
262 random_gmode = get_plus_arg(NUM,"RANDOM_GMODE=");
263 else
264 random_gmode = 0;
265
266 if (get_plus_arg(CHECK,"INSERT_PAD="))
267 insert_pad = get_plus_arg(NUM,"INSERT_PAD=");
268 else
269 insert_pad = 0;
270
271 if (get_plus_arg(CHECK,"TX_KICK_MODE="))
272 kick_mode = get_plus_arg(NUM,"TX_KICK_MODE=");
273 else
274 kick_mode = 1;
275
276 if (get_plus_arg(CHECK,"NO_OF_PAD_BYTES="))
277 pad_bytes = get_plus_arg(NUM,"NO_OF_PAD_BYTES=");
278 else
279 pad_bytes = 0;
280
281 if (get_plus_arg(CHECK,"NO_OF_TXDMA="))
282 no_of_dmas = get_plus_arg(NUM,"NO_OF_TXDMA=");
283 else {
284 no_of_dmas = 16;
285 }
286
287 if (get_plus_arg(CHECK,"TX_PKT_TYPE="))
288 pkt_type = get_plus_arg(NUM,"TX_PKT_TYPE=");
289 else
290 pkt_type = 3;
291
292
293 if (get_plus_arg(CHECK,"RANDOM_NUM_PKTS="))
294 random_num_pkts = get_plus_arg(NUM,"RANDOM_NUM_PKTS=");
295 else
296 random_num_pkts = 0;
297
298 if (get_plus_arg(CHECK,"KM2_RAND_NUMPKTS="))
299 km2_rand_numpkts = get_plus_arg(NUM,"KM2_RAND_NUMPKTS=");
300 else
301 km2_rand_numpkts = 16;
302
303 if (get_plus_arg(CHECK,"NUM_PKTS_MTHLD="))
304 num_pkts_mthld = get_plus_arg(NUM,"NUM_PKTS_MTHLD=");
305 else
306 num_pkts_mthld = 1;
307
308 if (get_plus_arg(CHECK,"TX_RING_LEN="))
309 ring_len = get_plus_arg(NUM,"TX_RING_LEN=");
310 else
311 ring_len = 0;
312
313 if (get_plus_arg(CHECK,"MB_NUM_PKTS="))
314 mb_pkts = get_plus_arg(NUM,"MB_NUM_PKTS=");
315 else
316 mb_pkts = 15;
317
318 if (get_plus_arg(CHECK,"ENB_TX_INTR="))
319 enb_intr = get_plus_arg(NUM,"ENB_TX_INTR=");
320 else
321 enb_intr = 0;
322
323 if (get_plus_arg(CHECK,"DMA_FUNC_NUM="))
324 tx_func_num = get_plus_arg(NUM,"DMA_FUNC_NUM=");
325 else
326 tx_func_num = 0;
327
328 if (get_plus_arg(CHECK,"KMODE2_NPKTS="))
329 kmode2_npkts = get_plus_arg(NUM,"KMODE2_NPKTS=");
330 else
331 kmode2_npkts = 8;
332
333 if (get_plus_arg(CHECK,"BYTE_ALIGN="))
334 byte_align = get_plus_arg(NUM,"BYTE_ALIGN=");
335 else
336 byte_align = 16;
337
338 if (get_plus_arg(CHECK,"TX_VIR_PIO="))
339 tx_vir_pio = get_plus_arg(NUM,"TX_VIR_PIO=");
340 else
341 tx_vir_pio = 0;
342
343 if (get_plus_arg(CHECK,"KICK_PARTIAL="))
344 kick_partial = get_plus_arg(NUM,"KICK_PARTIAL=");
345 else
346 kick_partial = 0;
347
348 if (get_plus_arg(CHECK,"STOP_UNSTALL="))
349 stop_unstall = get_plus_arg(NUM,"STOP_UNSTALL=");
350 else
351 stop_unstall = 0;
352
353 if (get_plus_arg(CHECK,"SYNC_TX_DMAS"))
354 sync_dmas = 1;
355 else
356 sync_dmas = 0;
357
358 if (get_plus_arg(CHECK,"NIU_TX_RX_PERF_SPECWEB_TX_PATTERN="))
359 specweb_enabled = 1'b1;
360 else
361 specweb_enabled = 1'b0;
362
363 if(get_plus_arg(CHECK,"TX_PKTCNT_RD_INTV"))
364 pktcnt_rd_intv = get_plus_arg(NUM,"TX_PKTCNT_RD_INTV=");
365 else
366 pktcnt_rd_intv = 500;
367
368 if(get_plus_arg(CHECK,"ENB_RANDOM_RST"))
369 random_rst = get_plus_arg(NUM,"ENB_RANDOM_RST");
370 else
371 random_rst = 0;
372
373 if(get_plus_arg(CHECK,"MAC_SPEED0="))
374 mac_speed0 = get_plus_arg(NUM,"MAC_SPEED0=");
375 else
376 mac_speed0 = 10000;
377
378 if(get_plus_arg(CHECK,"MAC_SPEED1="))
379 mac_speed1 = get_plus_arg(NUM,"MAC_SPEED1=");
380 else
381 mac_speed1 = 10000;
382
383 if(get_plus_arg(CHECK,"MAC_SPEED2="))
384 mac_speed2 = get_plus_arg(NUM,"MAC_SPEED2=");
385 else
386 mac_speed2 = 1000;
387
388 if(get_plus_arg(CHECK,"MAC_SPEED3="))
389 mac_speed3 = get_plus_arg(NUM,"MAC_SPEED3=");
390 else
391 mac_speed3 = 1000;
392
393
394 if(get_plus_arg(CHECK,"TX_UNIFORM_PKT_DISTRIBUTION"))
395 tx_uniform_pkt_distribution = 1;
396 else
397 tx_uniform_pkt_distribution = 0;
398
399 //--- code to parse the TX_PORT string
400
401 if( get_plus_arg(CHECK,"TX_PORT=")) {
402 tx_port = get_plus_arg(STR,"TX_PORT=");
403 printf("TX_TEST_CL : val of tx_port is %h\n",tx_port);
404
405 str_port.bittostr(tx_port);
406 printf("TX_TEST_CL : val of LEN %0d\n",str_port.len());
407
408 for (i=0; i<str_port.len();i++) {
409 temp_port =str_port.substr(i,i);
410 port_no[i] = temp_port.atoi();
411 printf("TX_TEST_CL : val of Temp_port %d\n",temp_port.atoi());
412 }
413
414 for(i=0;i<str_port.len();i++) {
415 case(port_no[i]) {
416 0 : port0_enb = 1;
417 1 : port1_enb = 1;
418 2 : port2_enb = 1;
419 3 : port3_enb = 1;
420 }
421 }
422 }
423}