Commit | Line | Data |
---|---|---|
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" | |
39 | extern class node_db; | |
40 | extern class fr_cl; | |
41 | ||
42 | extern node_db node[32]; | |
43 | extern tup_descr tud[32]; | |
44 | extern fr_cl fr[8]; | |
45 | ||
46 | ||
47 | ||
48 | class node_db { | |
49 | node_desc ip[8]; | |
50 | } | |
51 | ||
52 | ||
53 | task node_db_init() { | |
54 | integer n,i,z; | |
55 | bit [31:0] my_node, my_ip; | |
56 | bit [47:0] my_da; | |
57 | bit [15:0] tci; | |
58 | ||
59 | for(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 | ||
74 | for(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 | ||
81 | for(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 | ||
127 | class cl_cl { | |
128 | frame_desc sz[12]; | |
129 | } | |
130 | ||
131 | class fr_cl { | |
132 | cl_cl cl[32]; | |
133 | } | |
134 | ||
135 | /* | |
136 | fr[frame_select].cl[class_select].sz[size_select] | |
137 | ||
138 | frame_select | |
139 | L2 | |
140 | L2T | |
141 | L3 | |
142 | L3T | |
143 | L3L | |
144 | L2LT | |
145 | ||
146 | class_select | |
147 | ||
148 | size_select | |
149 | 0 - 64 (SEQ) | |
150 | 1 - 128 (SEQ) | |
151 | 2 - 256 (SEQ) | |
152 | 3 - 512 (SEQ) | |
153 | 4 - 1024 (SEQ) | |
154 | 5 - max (1518|1522) (SEQ) | |
155 | ||
156 | 6 - 64 (SEQ) | |
157 | 7 - 128 (SEQ) | |
158 | 8 - 256 (SEQ) | |
159 | 9 - 512 (SEQ) | |
160 | 10 - 1024 (SEQ) | |
161 | 11 - max (1518|1522) (SEQ) | |
162 | ||
163 | */ | |
164 | ||
165 | ||
166 | task _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 ) { | |
170 | integer i; | |
171 | ||
172 | node.ip[0].l2_addr = l2_addr; | |
173 | node.ip[0].tci = tci; | |
174 | node.ip[0].ip_addr = ip_addr0; | |
175 | node.ip[0].ipv6_addr = {ip_addr0, ip_addr0, ip_addr0, ip_addr0}; | |
176 | for(i=1;i<8;i++) node.ip[i] = new node.ip[0]; | |
177 | ||
178 | node.ip[1].ip_addr = ip_addr1; | |
179 | node.ip[2].ip_addr = ip_addr2; | |
180 | node.ip[3].ip_addr = ip_addr3; | |
181 | node.ip[4].ip_addr = ip_addr4; | |
182 | node.ip[5].ip_addr = ip_addr5; | |
183 | node.ip[6].ip_addr = ip_addr6; | |
184 | node.ip[7].ip_addr = ip_addr7; | |
185 | ||
186 | node.ip[1].ipv6_addr = {ip_addr1, ip_addr1, ip_addr1, ip_addr1}; | |
187 | node.ip[2].ipv6_addr = {ip_addr2, ip_addr2, ip_addr2, ip_addr2}; | |
188 | node.ip[3].ipv6_addr = {ip_addr3, ip_addr3, ip_addr3, ip_addr3}; | |
189 | node.ip[4].ipv6_addr = {ip_addr4, ip_addr4, ip_addr4, ip_addr4}; | |
190 | node.ip[5].ipv6_addr = {ip_addr5, ip_addr5, ip_addr5, ip_addr5}; | |
191 | node.ip[6].ipv6_addr = {ip_addr6, ip_addr6, ip_addr6, ip_addr6}; | |
192 | node.ip[7].ipv6_addr = {ip_addr7, ip_addr7, ip_addr7, ip_addr7}; | |
193 | } | |
194 | ||
195 |