Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / niu / txc_sat / vera / niu_tx_test_control.vr
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T2 Processor File: niu_tx_test_control.vr
// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
//
// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// For the avoidance of doubt, and except that if any non-GPL license
// choice is available it will apply instead, Sun elects to use only
// the General Public License version 2 (GPLv2) at this time for any
// software where a choice of GPL license versions is made
// available with the language indicating that GPLv2 or any later version
// may be used, or where a choice of which version of the GPL is applied is
// otherwise unspecified.
//
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
// CA 95054 USA or visit www.sun.com if you need additional information or
// have any questions.
//
// ========== Copyright Header End ============================================
#include <vera_defines.vrh>
#include "cMesg.vrh"
extern Mesg be_msg;
class niu_tx_test_control {
integer rand_var;
integer pkt_len; // 0 is random pkt-len from 64-9216 bytes
// 1 is byte-sweep from 64 bytes
// 2 is byte-sweep from 500 bytes
// 3 is byte-sweep from 1000 bytes
// 4 is byte-sweep from 1500 bytes
// 5 is byte-sweep from 2000 bytes
// 6 is byte-sweep from 2500 bytes
// 7 is byte-sweep from 3000 bytes
// 8 is byte-sweep from 3500 bytes
// 9 is byte-sweep from 4000 bytes
// 10 is byte-sweep from 4500 bytes
// 11 is byte-sweep from 5000 bytes
// 12 is byte-sweep from 5500 bytes
// 13 is byte-sweep from 6000 bytes
// 14 is byte-sweep from 6500 bytes
// 15 is byte-sweep from 7000 bytes
// 16 is byte-sweep from 7500 bytes
// 17 is byte-sweep from 8000 bytes
// 18 is byte-sweep from 8500 bytes
// 19 is byte-sweep from 9000 bytes
integer pkt_type; // 0 random pkt_type
// 1 L2(no options)
// 2 L2(vlan)
// 3 L2(llc)
// 4 L2(llc+vlan)
// 5 L2(no options) + L3 Ipv4 no options
// 6 L2(no options) + L3 Ipv4 (random hdr len from 5 to 15)
// 7 L2(no options) + L3 Ipv4 (random hdr len from 5 to 15) + L4 TCP
// 8 L2(no options) + L3 Ipv4 (random hdr len from 5 to 15) + L4 UDP
// 9 L2(vlan) + L3 Ipv4 (random hdr len from 5 to 15)
// 10 L2(vlan) + L3 Ipv4 (random hdr len from 5 to 15) + L4 TCP
// 11 L2(vlan) + L3 Ipv4 (random hdr len from 5 to 15) + L4 UDP
// 12 L2(llc) + L3 Ipv4 (random hdr len from 5 to 15)
// 13 L2(llc) + L3 Ipv4 (random hdr len from 5 to 15) + L4 TCP
// 14 L2(llc) + L3 Ipv4 (random hdr len from 5 to 15) + L4 UDP
// 15 L2(vlan + llc) + L3 Ipv4 (random hdr len from 5 to 15)
// 16 L2(vlan + llc) + L3 Ipv4 (random hdr len from 5 to 15) + L4 TCP
// 17 L2(vlan + llc) + L3 Ipv4 (random hdr len from 5 to 15) + L4 UDP
// 18 L2(no options) + L3 Ipv6
// 19 L2(no options) + L3 Ipv6 + L4 TCP
// 20 L2(no options) + L3 Ipv6 + L4 UDP
// 21 L2(vlan) + L3 Ipv6
// 22 L2(vlan) + L3 Ipv6 + L4 TCP
// 23 L2(vlan) + L3 Ipv6 + L4 UDP
// 24 L2(llc) + L3 Ipv6
// 25 L2(llc) + L3 Ipv6 + L4 TCP
// 26 L2(llc) + L3 Ipv6 + L4 UDP
// 27 L2(vlan + llc) + L3 Ipv6
// 28 L2(vlan + llc) + L3 Ipv6 + L4 TCP
// 29 L2(vlan + llc) + L3 Ipv6 + L4 UDP
integer no_of_pkts;
integer enable_mb;
integer gather_mode; // 0 not in gather mode
// 1 ingather mode
integer random_gmode; // 0 not in random gather mode
// 1 in random gather mode (this use the gen_txgatherpkts fn)
integer insert_pad; // 0 no pad inserted
// 1 random pad inserted
integer kick_mode; // 0 kick descriptors randomly
// 1 setup all pkts and kick them'al
// 2 setup x pkts and kick x pkts
integer pad_bytes;
integer port0_max_burst;
integer port1_max_burst;
integer port2_max_burst;
integer port3_max_burst;
integer random_maxburst;
integer random_dmabinds;
integer random_addroffset;
integer random_num_pkts; // enables random number of pkst per DMA
integer num_pkts_mthld;
bit [23:0] port0_dmas;
bit [23:0] port1_dmas;
bit [23:0] port2_dmas;
bit [23:0] port3_dmas;
bit [31:0] tx_port;
string str_port, temp_port;
integer port_no[4];
integer port0_enb = 0;
integer port1_enb = 0;
integer port2_enb = 0;
integer port3_enb = 0;
integer no_of_dmas;
integer ring_len;
integer enb_intr;
integer tx_func_num;
integer mb_pkts;
integer kmode2_npkts;
integer byte_align;
integer tx_vir_pio;
integer kick_partial;
integer stop_unstall;
integer sync_dmas;
integer km2_rand_numpkts;
bit specweb_enabled;
integer pktcnt_rd_intv;
integer random_rst;
integer mac_speed0;
integer mac_speed1;
integer mac_speed2;
integer mac_speed3;
integer tx_uniform_pkt_distribution;
task new();
}
task niu_tx_test_control :: new()
{
integer i;
if (get_plus_arg(CHECK,"TX_PKT_CNT="))
no_of_pkts = get_plus_arg(NUM,"TX_PKT_CNT=");
else
no_of_pkts = 16;
if (get_plus_arg(CHECK,"TX_PKT_LEN="))
pkt_len = get_plus_arg(NUM,"TX_PKT_LEN=");
else
pkt_len = 48;
if (get_plus_arg(CHECK,"ENB_MB="))
enable_mb = get_plus_arg(NUM,"ENB_MB=");
else
enable_mb = 1;
if (get_plus_arg(CHECK,"PORT0_DMAS="))
port0_dmas = get_plus_arg(HNUM,"PORT0_DMAS=");
else
port0_dmas = 24'h1;
if (get_plus_arg(CHECK,"PORT1_DMAS="))
port1_dmas = get_plus_arg(HNUM,"PORT1_DMAS=");
else
port1_dmas = 24'h2;
if (get_plus_arg(CHECK,"PORT2_DMAS="))
port2_dmas = get_plus_arg(HNUM,"PORT2_DMAS=");
else
port2_dmas = 24'h4;
if (get_plus_arg(CHECK,"PORT3_DMAS="))
port3_dmas = get_plus_arg(HNUM,"PORT3_DMAS=");
else
port3_dmas = 24'h8;
if (get_plus_arg(CHECK,"PORT0_MAXBURST="))
port0_max_burst = get_plus_arg(NUM,"PORT0_MAXBURST=");
else
port0_max_burst = 500;
if (get_plus_arg(CHECK,"PORT1_MAXBURST="))
port1_max_burst = get_plus_arg(NUM,"PORT1_MAXBURST=");
else
port1_max_burst = 500;
if (get_plus_arg(CHECK,"PORT2_MAXBURST="))
port2_max_burst = get_plus_arg(NUM,"PORT2_MAXBURST=");
else
port2_max_burst = 500;
if (get_plus_arg(CHECK,"PORT3_MAXBURST="))
port3_max_burst = get_plus_arg(NUM,"PORT3_MAXBURST=");
else
port3_max_burst = 500;
if (get_plus_arg(CHECK,"RAND_MAXBURST="))
random_maxburst = get_plus_arg(NUM,"RAND_MAXBURST=");
else
random_maxburst = 0;
if (get_plus_arg(CHECK,"RAND_DMABINDS="))
random_dmabinds = get_plus_arg(NUM,"RAND_DMABINDS=");
else
random_dmabinds = 0;
if (get_plus_arg(CHECK,"RANDOM_ADDROFFSET="))
random_addroffset = get_plus_arg(NUM,"RANDOM_ADDROFFSET=");
else
random_addroffset = 0;
if (get_plus_arg(CHECK,"GATHER_MODE="))
gather_mode = get_plus_arg(NUM,"GATHER_MODE=");
else
gather_mode = 0;
if (get_plus_arg(CHECK,"RANDOM_GMODE="))
random_gmode = get_plus_arg(NUM,"RANDOM_GMODE=");
else
random_gmode = 0;
if (get_plus_arg(CHECK,"INSERT_PAD="))
insert_pad = get_plus_arg(NUM,"INSERT_PAD=");
else
insert_pad = 0;
if (get_plus_arg(CHECK,"TX_KICK_MODE="))
kick_mode = get_plus_arg(NUM,"TX_KICK_MODE=");
else
kick_mode = 1;
if (get_plus_arg(CHECK,"NO_OF_PAD_BYTES="))
pad_bytes = get_plus_arg(NUM,"NO_OF_PAD_BYTES=");
else
pad_bytes = 0;
if (get_plus_arg(CHECK,"NO_OF_TXDMA="))
no_of_dmas = get_plus_arg(NUM,"NO_OF_TXDMA=");
else {
no_of_dmas = 16;
}
if (get_plus_arg(CHECK,"TX_PKT_TYPE="))
pkt_type = get_plus_arg(NUM,"TX_PKT_TYPE=");
else
pkt_type = 3;
if (get_plus_arg(CHECK,"RANDOM_NUM_PKTS="))
random_num_pkts = get_plus_arg(NUM,"RANDOM_NUM_PKTS=");
else
random_num_pkts = 0;
if (get_plus_arg(CHECK,"KM2_RAND_NUMPKTS="))
km2_rand_numpkts = get_plus_arg(NUM,"KM2_RAND_NUMPKTS=");
else
km2_rand_numpkts = 16;
if (get_plus_arg(CHECK,"NUM_PKTS_MTHLD="))
num_pkts_mthld = get_plus_arg(NUM,"NUM_PKTS_MTHLD=");
else
num_pkts_mthld = 1;
if (get_plus_arg(CHECK,"TX_RING_LEN="))
ring_len = get_plus_arg(NUM,"TX_RING_LEN=");
else
ring_len = 0;
if (get_plus_arg(CHECK,"MB_NUM_PKTS="))
mb_pkts = get_plus_arg(NUM,"MB_NUM_PKTS=");
else
mb_pkts = 15;
if (get_plus_arg(CHECK,"ENB_TX_INTR="))
enb_intr = get_plus_arg(NUM,"ENB_TX_INTR=");
else
enb_intr = 0;
if (get_plus_arg(CHECK,"DMA_FUNC_NUM="))
tx_func_num = get_plus_arg(NUM,"DMA_FUNC_NUM=");
else
tx_func_num = 0;
if (get_plus_arg(CHECK,"KMODE2_NPKTS="))
kmode2_npkts = get_plus_arg(NUM,"KMODE2_NPKTS=");
else
kmode2_npkts = 8;
if (get_plus_arg(CHECK,"BYTE_ALIGN="))
byte_align = get_plus_arg(NUM,"BYTE_ALIGN=");
else
byte_align = 16;
if (get_plus_arg(CHECK,"TX_VIR_PIO="))
tx_vir_pio = get_plus_arg(NUM,"TX_VIR_PIO=");
else
tx_vir_pio = 0;
if (get_plus_arg(CHECK,"KICK_PARTIAL="))
kick_partial = get_plus_arg(NUM,"KICK_PARTIAL=");
else
kick_partial = 0;
if (get_plus_arg(CHECK,"STOP_UNSTALL="))
stop_unstall = get_plus_arg(NUM,"STOP_UNSTALL=");
else
stop_unstall = 0;
if (get_plus_arg(CHECK,"SYNC_TX_DMAS"))
sync_dmas = 1;
else
sync_dmas = 0;
if (get_plus_arg(CHECK,"NIU_TX_RX_PERF_SPECWEB_TX_PATTERN="))
specweb_enabled = 1'b1;
else
specweb_enabled = 1'b0;
if(get_plus_arg(CHECK,"TX_PKTCNT_RD_INTV"))
pktcnt_rd_intv = get_plus_arg(NUM,"TX_PKTCNT_RD_INTV=");
else
pktcnt_rd_intv = 500;
if(get_plus_arg(CHECK,"ENB_RANDOM_RST"))
random_rst = get_plus_arg(NUM,"ENB_RANDOM_RST");
else
random_rst = 0;
if(get_plus_arg(CHECK,"MAC_SPEED0="))
mac_speed0 = get_plus_arg(NUM,"MAC_SPEED0=");
else
mac_speed0 = 10000;
if(get_plus_arg(CHECK,"MAC_SPEED1="))
mac_speed1 = get_plus_arg(NUM,"MAC_SPEED1=");
else
mac_speed1 = 10000;
if(get_plus_arg(CHECK,"MAC_SPEED2="))
mac_speed2 = get_plus_arg(NUM,"MAC_SPEED2=");
else
mac_speed2 = 1000;
if(get_plus_arg(CHECK,"MAC_SPEED3="))
mac_speed3 = get_plus_arg(NUM,"MAC_SPEED3=");
else
mac_speed3 = 1000;
if(get_plus_arg(CHECK,"TX_UNIFORM_PKT_DISTRIBUTION"))
tx_uniform_pkt_distribution = 1;
else
tx_uniform_pkt_distribution = 0;
//--- code to parse the TX_PORT string
if( get_plus_arg(CHECK,"TX_PORT=")) {
tx_port = get_plus_arg(STR,"TX_PORT=");
printf("TX_TEST_CL : val of tx_port is %h\n",tx_port);
str_port.bittostr(tx_port);
printf("TX_TEST_CL : val of LEN %0d\n",str_port.len());
for (i=0; i<str_port.len();i++) {
temp_port =str_port.substr(i,i);
port_no[i] = temp_port.atoi();
printf("TX_TEST_CL : val of Temp_port %d\n",temp_port.atoi());
}
for(i=0;i<str_port.len();i++) {
case(port_no[i]) {
0 : port0_enb = 1;
1 : port1_enb = 1;
2 : port2_enb = 1;
3 : port3_enb = 1;
}
}
}
}