Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / common / vera / niu_ippktgen / node_db_tasks.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: node_db_tasks.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_defines.vri"
37#include "pcg_types.vri"
38#include "pcg_classes.vrh"
39extern class node_db;
40extern class fr_cl;
41
42extern node_db node[32];
43extern tup_descr tud[32];
44extern fr_cl fr[8];
45
46
47
48class node_db {
49 node_desc ip[8];
50 }
51
52
53task node_db_init() {
54integer n,i,z;
55bit [31:0] my_node, my_ip;
56bit [47:0] my_da;
57bit [15:0] tci;
58
59for(n=0;n<32;n=n+1) {
60 node[n] = new;
61 node[n].ip[0] = new;
62 node[n].ip[0].src_port = 0;
63 if(n<20) node[n].ip[0].src_port[n] = 1;
64 else node[n].ip[0].src_port = 20'hfffff;
65 my_node = n;
66 my_ip = {8'h0, my_node[7:0]+1,16'h0000};
67 my_da = {16'h0, my_node[7:0]+1, 24'h0};
68 tci = random();
69 _setup_node( node[my_node], my_da, random(),
70 my_ip++, my_ip++, my_ip++, my_ip++,
71 my_ip++, my_ip++, my_ip++, my_ip++ );
72 }
73
74for(n=0;n<32;n=n+1) {
75 tud[n] = new;
76 tud[n].src_tcp_udp_port = random();
77 tud[n].dst_tcp_udp_port = random();
78 }
79
80
81for(n=0;n<8;n++) {
82 fr[n] = new;
83 for(i=0;i<32;i++) {
84 fr[n].cl[i] = new;
85 for(z=0;z<12;z++) {
86 fr[n].cl[i].sz[z] = new;
87 case(n) {
88 L2: fr[n].cl[i].sz[z].frame_type = 3'b000;
89 L2T: fr[n].cl[i].sz[z].frame_type = 3'b100;
90 L3: fr[n].cl[i].sz[z].frame_type = 3'b010;
91 L3T: fr[n].cl[i].sz[z].frame_type = 3'b110;
92 L3L: fr[n].cl[i].sz[z].frame_type = 3'b011;
93 L3LT:fr[n].cl[i].sz[z].frame_type = 3'b111;
94 }
95 fr[n].cl[i].sz[z].frame_class = i;
96 fr[n].cl[i].sz[z].class_mask = NONE;
97 fr[n].cl[i].sz[z].class_funct = 0;
98 if(z>5) fr[n].cl[i].sz[z].data_type = DAT_RAND;
99 else fr[n].cl[i].sz[z].data_type = DAT_SEQ;
100 fr[n].cl[i].sz[z].data_seed = 8'hc0;
101 fr[n].cl[i].sz[z].type = -1;
102/*
103 case(z) {
104 0: fr[n].cl[i].sz[z].data_length = -1;
105 1: fr[n].cl[i].sz[z].data_length = -2;
106 2: fr[n].cl[i].sz[z].data_length = -3;
107 3: fr[n].cl[i].sz[z].data_length = -4;
108 4: fr[n].cl[i].sz[z].data_length = -5;
109 5: fr[n].cl[i].sz[z].data_length = -6;
110 6: fr[n].cl[i].sz[z].data_length = -1;
111 7: fr[n].cl[i].sz[z].data_length = -2;
112 8: fr[n].cl[i].sz[z].data_length = -3;
113 9: fr[n].cl[i].sz[z].data_length = -4;
114 10: fr[n].cl[i].sz[z].data_length = -5;
115 11: fr[n].cl[i].sz[z].data_length = -6;
116 }
117*/
118 }
119 }
120 }
121
122
123}
124
125// -----------------------------------------
126
127class cl_cl {
128 frame_desc sz[12];
129 }
130
131class fr_cl {
132 cl_cl cl[32];
133 }
134
135/*
136fr[frame_select].cl[class_select].sz[size_select]
137
138frame_select
139L2
140L2T
141L3
142L3T
143L3L
144L2LT
145
146class_select
147
148size_select
1490 - 64 (SEQ)
1501 - 128 (SEQ)
1512 - 256 (SEQ)
1523 - 512 (SEQ)
1534 - 1024 (SEQ)
1545 - max (1518|1522) (SEQ)
155
1566 - 64 (SEQ)
1577 - 128 (SEQ)
1588 - 256 (SEQ)
1599 - 512 (SEQ)
16010 - 1024 (SEQ)
16111 - max (1518|1522) (SEQ)
162
163*/
164
165
166task _setup_node(node_db node, bit [47:0] l2_addr, bit [15:0] tci,
167 bit [31:0] ip_addr0, bit [31:0] ip_addr1, bit [31:0] ip_addr2,
168 bit [31:0] ip_addr3, bit [31:0] ip_addr4, bit [31:0] ip_addr5,
169 bit [31:0] ip_addr6, bit [31:0] ip_addr7 ) {
170integer i;
171
172node.ip[0].l2_addr = l2_addr;
173node.ip[0].tci = tci;
174node.ip[0].ip_addr = ip_addr0;
175node.ip[0].ipv6_addr = {ip_addr0, ip_addr0, ip_addr0, ip_addr0};
176for(i=1;i<8;i++) node.ip[i] = new node.ip[0];
177
178node.ip[1].ip_addr = ip_addr1;
179node.ip[2].ip_addr = ip_addr2;
180node.ip[3].ip_addr = ip_addr3;
181node.ip[4].ip_addr = ip_addr4;
182node.ip[5].ip_addr = ip_addr5;
183node.ip[6].ip_addr = ip_addr6;
184node.ip[7].ip_addr = ip_addr7;
185
186node.ip[1].ipv6_addr = {ip_addr1, ip_addr1, ip_addr1, ip_addr1};
187node.ip[2].ipv6_addr = {ip_addr2, ip_addr2, ip_addr2, ip_addr2};
188node.ip[3].ipv6_addr = {ip_addr3, ip_addr3, ip_addr3, ip_addr3};
189node.ip[4].ipv6_addr = {ip_addr4, ip_addr4, ip_addr4, ip_addr4};
190node.ip[5].ipv6_addr = {ip_addr5, ip_addr5, ip_addr5, ip_addr5};
191node.ip[6].ipv6_addr = {ip_addr6, ip_addr6, ip_addr6, ip_addr6};
192node.ip[7].ipv6_addr = {ip_addr7, ip_addr7, ip_addr7, ip_addr7};
193}
194
195