Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: N2ErrTlpPEUCtx.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 | class ErrTlpPEUCtx extends PEUCtxBase | |
36 | { | |
37 | local string f_mode; | |
38 | local integer f_index; | |
39 | local integer f_errQueue; | |
40 | ||
41 | bit f_expectInterrupt; | |
42 | ||
43 | // added for incorrect length testing | |
44 | integer f_pyldDelta_min; | |
45 | integer f_pyldDelta_max; | |
46 | integer f_pyldDelta_chance_negative; | |
47 | integer f_pyld_set_TD; | |
48 | bit f_pyld_set_TD_value; | |
49 | integer f_pyld_Length; | |
50 | bit[4:0] f_pyld_Type; | |
51 | bit[1:0] f_pyld_Fmt; | |
52 | integer f_pyld_ReqWeight; | |
53 | integer f_pyld_CplWeight; | |
54 | integer f_pyld_Cpl_solicited_chance; | |
55 | ||
56 | // added by for crossing 4KB boundary testing | |
57 | integer f_cross4k_DW_max; | |
58 | integer f_cross4k_DW_min; | |
59 | bit [9:0] mps; | |
60 | ||
61 | bit [7:0] f_msgCode; | |
62 | ||
63 | bit f_abort; | |
64 | ||
65 | //Receiver Error Testing | |
66 | integer f_nmbrRcvrErrsToInject = 10; //Total number of packets that get error | |
67 | integer f_rcvrErrPct = 10; //% of packets that get an error | |
68 | //Set the percentage weight of each type of receiver error | |
69 | integer f_rcvrErr8b10bWeight = 10; | |
70 | integer f_rcvrErrFramingWeight = 10; | |
71 | integer f_rcvrErrDisparityWeight = 10; | |
72 | integer f_rcvrErrFlipBitWeight = 10; | |
73 | integer f_rcvrErrLcrcWeight = 10; | |
74 | integer f_rcvrErrDupSeqNmbrWeight = 0; | |
75 | integer f_rcvrErrOutOfSeqNmbrWeight = 0; | |
76 | integer f_rcvrErrBadSeqNmbrWeight = 0; | |
77 | bit f_optional_CE_BTP = 0; //Make the check of BTP optional | |
78 | ||
79 | ||
80 | // Unsupport DLLP Error Testing | |
81 | integer f_nmbrDLLPErrsToInject = 10; //Total number of packets that get error | |
82 | integer f_DLLPErrPct = 10; //% of packets that get an error | |
83 | ||
84 | //Set the percentage weight of each type of DLLP error | |
85 | integer f_DLLPErrUnsupportWeight = 10; | |
86 | integer f_DLLPErrBadCRCWeight = 10; | |
87 | ||
88 | // Ack Nak Error Testing | |
89 | integer f_nmbrAckNakErrsToInject = 10; | |
90 | integer f_DLLPAckLessthanAckedErrWeight = 10; | |
91 | integer f_DLLPNakLessthanAckedErrWeight = 10; | |
92 | integer f_DLLPAckmorethanTLPNxtSeqErrWeight = 10; | |
93 | integer f_DLLPNakmorethanTLPNxtSeqErrWeight = 10; | |
94 | ||
95 | // Invert LCRC, EDB Injections | |
96 | integer f_nmbrInvertLCRCEDBErrsToInject = 1; | |
97 | integer f_InvertLCRCErrWeight = 0; | |
98 | integer f_EDBErrWeight = 0; | |
99 | integer f_InvertLCRCAndEDBErrWeight = 0; | |
100 | ||
101 | ||
102 | integer f_nmbrnullTlpErrsToInject = 0; | |
103 | integer f_nullTlpErrWeight = 0; | |
104 | ||
105 | ||
106 | // Flow control protocol Error Testing | |
107 | integer f_nmbrFCPErrsToInject = 0; //Total number of packets that get error injected | |
108 | //Set the percentage weight of each type of FCP errors | |
109 | integer f_DLLP_FCP_Infinite_FC_PH_ErrWeight = 0; | |
110 | integer f_DLLP_FCP_Infinite_FC_PD_ErrWeight = 0; | |
111 | integer f_DLLP_FCP_Infinite_FC_NPH_ErrWeight = 0; | |
112 | integer f_DLLP_FCP_Infinite_FC_NPD_ErrWeight = 0; | |
113 | integer f_DLLP_FCP_Infinite_FC_CLPH_ErrWeight = 0; | |
114 | integer f_DLLP_FCP_Infinite_FC_CLPD_ErrWeight = 0; | |
115 | ||
116 | integer f_DLLP_FCP_Infinite_FC_all_P_ErrWeight = 0; | |
117 | integer f_DLLP_FCP_Infinite_FC_all_NP_ErrWeight = 0; | |
118 | integer f_DLLP_FCP_Infinite_FC_all_CLP_ErrWeight = 0; | |
119 | ||
120 | integer f_DLLP_FCP_over128_FC_PH_ErrWeight = 0; | |
121 | integer f_DLLP_FCP_over2048_FC_PD_ErrWeight = 0; | |
122 | integer f_DLLP_FCP_over128_FC_NPH_ErrWeight = 0; | |
123 | integer f_DLLP_FCP_over2048_FC_NPD_ErrWeight = 0; | |
124 | integer f_DLLP_FCP_over128_FC_CLPH_ErrWeight = 0; | |
125 | integer f_DLLP_FCP_over2048_FC_CLPD_ErrWeight = 0; | |
126 | ||
127 | ||
128 | static bit[4:0] f_badType = 4'b0; | |
129 | static bit[1:0] f_badFmt = 2'b0; | |
130 | static integer f_badCpl = 0; | |
131 | static integer f_badIndex = 0; | |
132 | ||
133 | string mode; | |
134 | string error_List[29] = {"invalid type", | |
135 | "incorrect length", | |
136 | "cross 4KB", | |
137 | "excessive pyld", | |
138 | "MsgNonZeroTC", | |
139 | "MsgData", | |
140 | "ErrCpl", | |
141 | "unexpected completion", | |
142 | "locked completion", | |
143 | "completion length", | |
144 | "completion count", | |
145 | "completion address", | |
146 | "completion TC", | |
147 | "completion attr", | |
148 | "RdlkReq", | |
149 | "Msg", | |
150 | "CfgIoReq", | |
151 | "CfgIoReqPoison", | |
152 | "PoisonReq", | |
153 | "PoisonCpl", | |
154 | "IncorrectCpl", | |
155 | "NonConfigCRS", | |
156 | "DWBE", | |
157 | "RdCplUr", | |
158 | "WrCplUr", | |
159 | "RdCplCa", | |
160 | "WrCplCa", | |
161 | "CRS completion", | |
162 | "Receiver Errors" | |
163 | }; | |
164 | ||
165 | ||
166 | task new( string a_name, PEUTestEnv a_env, string a_mode ) | |
167 | { | |
168 | super.new(a_name,a_env); | |
169 | f_mode = a_mode; | |
170 | f_index = 0; | |
171 | f_expectInterrupt = 1; | |
172 | ||
173 | if (f_mode == "Random") { | |
174 | mode = error_List[(urandom() % 28)]; | |
175 | } | |
176 | ||
177 | // default values for incorrect length | |
178 | // parameter values | |
179 | f_pyldDelta_min = 2; | |
180 | f_pyldDelta_max = 6; | |
181 | f_pyldDelta_chance_negative = 50; | |
182 | f_pyld_set_TD = 0; | |
183 | f_pyld_Length = -1; | |
184 | f_pyld_Type = 5'bxxxxx; // illegal value for Type | |
185 | f_pyld_Fmt = 2'b00; | |
186 | f_pyld_ReqWeight = 1; | |
187 | f_pyld_CplWeight = 1; | |
188 | f_pyld_Cpl_solicited_chance = 50; | |
189 | ||
190 | f_cross4k_DW_max = 5; | |
191 | f_cross4k_DW_min = 1; | |
192 | f_msgCode = 8'bxxxxxxxx; | |
193 | f_abort = 0; | |
194 | f_errQueue = 0; | |
195 | ||
196 | //Default values for Receiver Error | |
197 | f_nmbrRcvrErrsToInject = 10; | |
198 | f_rcvrErrPct = 10; | |
199 | f_rcvrErr8b10bWeight = 10; | |
200 | f_rcvrErrFramingWeight = 10; | |
201 | f_rcvrErrDisparityWeight = 10; | |
202 | f_rcvrErrFlipBitWeight = 10; | |
203 | f_rcvrErrLcrcWeight = 10; | |
204 | f_rcvrErrDupSeqNmbrWeight = 0; | |
205 | f_rcvrErrOutOfSeqNmbrWeight = 0; | |
206 | f_rcvrErrBadSeqNmbrWeight = 0; | |
207 | f_DLLPAckLessthanAckedErrWeight = 0; | |
208 | f_DLLPNakLessthanAckedErrWeight = 0; | |
209 | f_DLLPAckmorethanTLPNxtSeqErrWeight = 0; | |
210 | f_DLLPNakmorethanTLPNxtSeqErrWeight = 0; | |
211 | f_optional_CE_BTP = 0; | |
212 | ||
213 | // Flow control protocol Error | |
214 | f_DLLP_FCP_Infinite_FC_PH_ErrWeight = 0; | |
215 | f_DLLP_FCP_Infinite_FC_PD_ErrWeight = 0; | |
216 | f_DLLP_FCP_Infinite_FC_NPH_ErrWeight = 0; | |
217 | f_DLLP_FCP_Infinite_FC_NPD_ErrWeight = 0; | |
218 | f_DLLP_FCP_Infinite_FC_CLPH_ErrWeight = 0; | |
219 | f_DLLP_FCP_Infinite_FC_CLPD_ErrWeight = 0; | |
220 | ||
221 | f_DLLP_FCP_Infinite_FC_all_P_ErrWeight = 0; | |
222 | f_DLLP_FCP_Infinite_FC_all_NP_ErrWeight = 0; | |
223 | f_DLLP_FCP_Infinite_FC_all_CLP_ErrWeight = 0; | |
224 | ||
225 | f_DLLP_FCP_over128_FC_PH_ErrWeight = 0; | |
226 | f_DLLP_FCP_over2048_FC_PD_ErrWeight = 0; | |
227 | f_DLLP_FCP_over128_FC_NPH_ErrWeight = 0; | |
228 | f_DLLP_FCP_over2048_FC_NPD_ErrWeight = 0; | |
229 | f_DLLP_FCP_over128_FC_CLPH_ErrWeight = 0; | |
230 | f_DLLP_FCP_over2048_FC_CLPD_ErrWeight = 0; | |
231 | ||
232 | // Default values for Unsupport DLLP Error | |
233 | f_nmbrDLLPErrsToInject = 10; | |
234 | f_DLLPErrPct = 10; | |
235 | ||
236 | // Default values for ack Nak Error | |
237 | f_nmbrAckNakErrsToInject = 10; | |
238 | ||
239 | // Default value for flow control protocol error | |
240 | f_nmbrFCPErrsToInject = 0; | |
241 | } | |
242 | ||
243 | task Execute() | |
244 | { | |
245 | super.Execute(); | |
246 | } | |
247 | ||
248 | protected function CTStrategyBase ProvideStrategy() | |
249 | { | |
250 | integer f_pyldDelta; | |
251 | PEUStrBase thisStrategy; | |
252 | PEUStrBase nullStr; | |
253 | ErrChkPEUStr errChk; // The guy who checks error state | |
254 | MalReqPEUStr badReq; // Generate a bad read/write request | |
255 | MalCplPEUStr badCpl; | |
256 | ErrCplPEUStr errCpl; | |
257 | bit [ 63:0 ] csr; | |
258 | integer cross_4k_DW_cnt; | |
259 | ||
260 | PioBasePEUStr pioBase; // Need strategies to generate bad | |
261 | PioMRdPEUStr pioMRd; // ingress completions. | |
262 | PioCfgIOWrPEUStr pioCfgIOWr; | |
263 | PioCfgIORdPEUStr pioCfgIORd; | |
264 | ||
265 | DmaURCfgIORdWrPEUStr dmaURCfgIOWrRd; // Need Strategies to | |
266 | DmaURMsgDPEUStr dmaURMsgD; // generate unsupported | |
267 | DmaURMsgPEUStr dmaURMsg; // ingress (DMA) requests | |
268 | DmaURRdLkPEUStr dmaURRdLk; | |
269 | ||
270 | DmaPoisonPEUStr dmaPreq; // A poisoned DMA request | |
271 | IngressRcvrErr RcvrErr; // Injects Receiver errors on | |
272 | // background traffic | |
273 | ilupeuIngressDLLPErr DLLPErr; // for Unsupport and BAD CRC DLLPs | |
274 | // on background traffic | |
275 | ilupeuIngressAckNakErr AckNakErr; // | |
276 | ilupeuIngressduplicateSeqNmbrReq duplicateSeqNmbrReq; // injects duplicate | |
277 | // sequence number TLP without skip | |
278 | ||
279 | ilupeuIngressnullTlpErr nullTlpErr; | |
280 | ||
281 | ilupeuIngressFCPErr FCPErr; | |
282 | ||
283 | f_index = f_index + 1; | |
284 | ||
285 | if (f_mode == "random"){ | |
286 | mode = error_List[ urandom_range(28,5) ]; //4 and down are unrecoverable UE mfp errors | |
287 | // mode = error_List[(urandom() % (f_abort?23:28))]; | |
288 | f_env.Report.report(RTYP_INFO,"ErrTlpPEUCtx f_mode == random - mode=%s f_index=%0d \n",mode,f_index); | |
289 | } | |
290 | else if (f_mode != "Random"){ | |
291 | mode = f_mode; | |
292 | } | |
293 | ||
294 | printf("ErrTlpPEUCtx mode=%s f_index=%0d \n",mode,f_index); | |
295 | ||
296 | if ( f_index > 1 && !this.StratStop ) | |
297 | printf("ErrTlp (cycle %0d) %s\n", get_cycle(), mode); | |
298 | ||
299 | // If the "StratStop" (within the base | |
300 | // context class) has been set, then | |
301 | // just return a base context which | |
302 | // does nothing. | |
303 | if ( this.StratStop ) | |
304 | { | |
305 | nullStr = new( f_env ); | |
306 | thisStrategy = nullStr; | |
307 | } | |
308 | ||
309 | // The first strategy? Build a | |
310 | // mailbox and fire up the guy | |
311 | // who'll check interrupt status | |
312 | // after it's all over. | |
313 | // The test uses "NumStrat" to tell us | |
314 | // how many errors to generate. | |
315 | // Every error-generating strategy will | |
316 | // add something to the "f_errQueue". | |
317 | else if ( f_index == 1 && !f_abort ) | |
318 | { | |
319 | f_errQueue = alloc( MAILBOX, 0, 1 ); | |
320 | errChk = new( f_env, f_errQueue, this.NumStrat-1 ); | |
321 | ||
322 | // The "errChk" strategy will enable | |
323 | // interrupt checking when it's done. | |
324 | if ( f_expectInterrupt ) f_env.disableInterrupt(); | |
325 | thisStrategy = errChk; | |
326 | } | |
327 | ||
328 | // The directed "invalid type" test | |
329 | // does every such type (and format). | |
330 | // Malformed requests are sent either | |
331 | // singly or in pairs. We want to make | |
332 | // sure that every undefined type is | |
333 | // recorded as malformed. | |
334 | else if ( mode == "invalid type" ) | |
335 | { | |
336 | badReq = new( f_env ); | |
337 | badReq.SetErrQueue( f_errQueue ); | |
338 | // this loop will quit if isInvalid | |
339 | while (1) // while (!badReq.SetType( f_badFmt, f_badType ) ) | |
340 | { | |
341 | f_badType = f_badType + 1; | |
342 | if ( f_badType == 0 ) f_badFmt = f_badFmt + 1; | |
343 | printf("f_badType = %x f_badFmt = %x\n", | |
344 | f_badType, f_badFmt); | |
345 | if ( badReq.SetType( f_badFmt, f_badType ) ) break; | |
346 | } | |
347 | thisStrategy = badReq; | |
348 | } | |
349 | ||
350 | // The directed "incorrect length" test | |
351 | else if ( mode == "incorrect length" ) { | |
352 | ||
353 | // do this only for the random condition. | |
354 | if (f_mode == "Random" || f_mode == "random") { | |
355 | randcase { | |
356 | 1: { // 4KB/2KB/1KB... Mem Wr without data | |
357 | f_pyld_Length = 1 << (urandom() % 11); | |
358 | f_pyld_set_TD = 1; | |
359 | f_pyld_set_TD_value = urandom()%2; | |
360 | f_pyldDelta_min = (f_pyld_Length == 0) ? 1024 : f_pyld_Length; | |
361 | f_pyldDelta_max = f_pyldDelta_min; | |
362 | f_pyldDelta_chance_negative = 100; | |
363 | f_pyld_ReqWeight = 1; | |
364 | f_pyld_CplWeight = 0; | |
365 | if ( urandom()%2 ) | |
366 | f_pyld_Fmt = PEC_PCI__FMT_DATA_3DW; | |
367 | else | |
368 | f_pyld_Fmt = PEC_PCI__FMT_DATA_4DW; | |
369 | f_pyld_Type = PEC_PCI__TYPE_MEM; | |
370 | } | |
371 | 1: { // Mem Rd/Wr off by one | |
372 | f_pyld_Length = (urandom() % (16-1)) + 1; | |
373 | f_pyld_set_TD = 1; | |
374 | f_pyld_set_TD_value = urandom()%2; | |
375 | f_pyldDelta_min = 1; | |
376 | f_pyldDelta_max = 1; | |
377 | f_pyldDelta_chance_negative = 50; | |
378 | f_pyld_ReqWeight = 1; | |
379 | f_pyld_CplWeight = 0; | |
380 | f_pyld_Fmt = urandom() % 4; | |
381 | f_pyld_Type = PEC_PCI__TYPE_MEM; | |
382 | } | |
383 | 1: { // Cpl off by one | |
384 | f_pyld_Length = (urandom() % (16-1)) + 1; | |
385 | f_pyld_set_TD = 1; | |
386 | f_pyld_set_TD_value = urandom()%2; | |
387 | f_pyldDelta_min = 1; | |
388 | f_pyldDelta_max = 1; | |
389 | f_pyldDelta_chance_negative = 50; | |
390 | f_pyld_ReqWeight = 0; | |
391 | f_pyld_CplWeight = 1; | |
392 | f_pyld_Fmt = PEC_PCI__FMT_NO_DATA_3DW; | |
393 | f_pyld_Type = PEC_PCI__TYPE_MEM; | |
394 | f_pyld_Cpl_solicited_chance = 100; | |
395 | } | |
396 | 1: { // Mem-write off by as much as possible | |
397 | f_pyld_Length = (urandom() % (16-1)) + 2; | |
398 | f_pyld_set_TD = 1; | |
399 | f_pyld_set_TD_value = urandom()%2; | |
400 | f_pyldDelta_min = 1; | |
401 | f_pyldDelta_max = f_pyld_Length; | |
402 | f_pyldDelta_chance_negative = 50; | |
403 | f_pyld_ReqWeight = 1; | |
404 | f_pyld_CplWeight = 0; | |
405 | if ( urandom()%2 ) | |
406 | f_pyld_Fmt = PEC_PCI__FMT_DATA_3DW; | |
407 | else | |
408 | f_pyld_Fmt = PEC_PCI__FMT_DATA_4DW; | |
409 | f_pyld_Type = PEC_PCI__TYPE_MEM; | |
410 | } | |
411 | } | |
412 | } | |
413 | ||
414 | randcase { | |
415 | f_pyld_ReqWeight : { | |
416 | badReq = new( f_env ); | |
417 | badReq.SetErrQueue( f_errQueue ); | |
418 | // Use requested {Fmt,Type} | |
419 | if ( f_pyld_Type !== 5'bxxxxx ) | |
420 | if ( badReq.SetField( "FmtType", {f_pyld_Fmt,f_pyld_Type} ) ) | |
421 | error( "(%0d) ErrTlpPEUCtx(%s): setting invalid {fmt,type} = %b\n", | |
422 | get_cycle(), mode, {f_pyld_Fmt,f_pyld_Type} ); | |
423 | // Use requested length | |
424 | if ( f_pyld_Length >= 0 ) | |
425 | badReq.SetLength( f_pyld_Length ); | |
426 | // Adjust the packet length by random amt | |
427 | // between f_pyldDelta_min and f_pyldDelta_max | |
428 | f_pyldDelta = | |
429 | urandom() % (f_pyldDelta_max - f_pyldDelta_min + 1) + f_pyldDelta_min; | |
430 | // Choose whether adjustment is neg or pos | |
431 | if ( ((urandom() % 100) + 1) <= f_pyldDelta_chance_negative ) | |
432 | f_pyldDelta *= -1; | |
433 | ||
434 | printf( "(%0d) ErrTlpPEUCtx(%s): adjusting req payload by %0d DWs\n", | |
435 | get_cycle(), mode, f_pyldDelta ); | |
436 | ||
437 | badReq.AdjustLen( f_pyldDelta ); | |
438 | if ( f_pyld_set_TD ) | |
439 | badReq.SetTD( f_pyld_set_TD_value ); | |
440 | ||
441 | thisStrategy = badReq; | |
442 | } | |
443 | f_pyld_CplWeight : { | |
444 | badCpl = new( f_env ); | |
445 | badCpl.SetErrQueue( f_errQueue ); | |
446 | // Use requested {Fmt,Type} | |
447 | if ( f_pyld_Type !== 5'bxxxxx ) | |
448 | if ( badCpl.SetType( f_pyld_Fmt, f_pyld_Type ) ) | |
449 | error( "(%0d) ErrTlpPEUCtx(%s): setting invalid {fmt,type} = %b\n", | |
450 | get_cycle(), mode, {f_pyld_Fmt,f_pyld_Type} ); | |
451 | // Use requested length | |
452 | if ( f_pyld_Length >= 0 ) | |
453 | badCpl.SetLength( f_pyld_Length ); | |
454 | // Adjust the packet length by random amt | |
455 | // between f_pyldDelta_min and f_pyldDelta_max | |
456 | f_pyldDelta = | |
457 | urandom() % (f_pyldDelta_max - f_pyldDelta_min + 1) + f_pyldDelta_min; | |
458 | // Choose whether adjustment is neg or pos | |
459 | if ( ((urandom() % 100) + 1) <= f_pyldDelta_chance_negative ) | |
460 | f_pyldDelta *= -1; | |
461 | ||
462 | printf( "(%0d) ErrTlpPEUCtx(%s): adjusting cpl payload by %0d DWs\n", | |
463 | get_cycle(), mode, f_pyldDelta ); | |
464 | ||
465 | badCpl.AdjustLen( f_pyldDelta ); | |
466 | if ( f_pyld_set_TD ) | |
467 | badCpl.SetTD( f_pyld_set_TD_value ); | |
468 | ||
469 | if ( ((urandom() % 100) + 1) <= f_pyld_Cpl_solicited_chance ) | |
470 | badCpl.SetSolicited( 1 ); | |
471 | else { | |
472 | badCpl.SetSolicited( 0 ); | |
473 | } | |
474 | ||
475 | thisStrategy = badCpl; | |
476 | } | |
477 | } | |
478 | } | |
479 | ||
480 | else if ( mode == "cross 4KB" ) { | |
481 | badReq = new( f_env ); | |
482 | badReq.SetErrQueue( f_errQueue ); | |
483 | // Use requested {Fmt,Type} | |
484 | if ( f_pyld_Type !== 5'bxxxxx ) | |
485 | if ( badReq.SetField( "FmtType", {f_pyld_Fmt,f_pyld_Type} ) ) | |
486 | error( "(%0d) ErrTlpPEUCtx(%s): setting invalid {fmt,type} = %b\n", | |
487 | get_cycle(), mode, {f_pyld_Fmt,f_pyld_Type} ); | |
488 | // call strategy Cross4K() | |
489 | mps = f_env.getMaxPayloadSize(); | |
490 | //Make sure we don't go bigger than mps | |
491 | if ( f_badIndex < ( (mps == 512) ? 7 : (mps == 256) ? 6 : 5 ) ) | |
492 | cross_4k_DW_cnt = 1 << f_badIndex; | |
493 | else | |
494 | cross_4k_DW_cnt = urandom_range( f_cross4k_DW_max, | |
495 | f_cross4k_DW_min ); | |
496 | badReq.Cross4K( cross_4k_DW_cnt ); | |
497 | ||
498 | f_badIndex = f_badIndex + 1; | |
499 | thisStrategy = badReq; | |
500 | } | |
501 | ||
502 | else if ( mode == "excessive pyld" ) { | |
503 | ||
504 | badReq = new( f_env ); | |
505 | badReq.SetErrQueue( f_errQueue ); | |
506 | ||
507 | if ( urandom()%2 ) | |
508 | f_pyld_Fmt = PEC_PCI__FMT_DATA_3DW; | |
509 | else | |
510 | f_pyld_Fmt = PEC_PCI__FMT_DATA_4DW; | |
511 | f_pyld_Type = PEC_PCI__TYPE_MEM; | |
512 | void = badReq.SetField( "FmtType", {f_pyld_Fmt,f_pyld_Type} ); | |
513 | ||
514 | f_pyld_Length = f_env.getMaxPayloadSize() / 4; | |
515 | randcase | |
516 | { | |
517 | 1: f_pyld_Length = f_pyld_Length + ( 1 << (urandom()%10) ); | |
518 | 1: f_pyld_Length = f_pyld_Length + urandom()%15 + 1; | |
519 | 1: f_pyld_Length = f_pyld_Length << (urandom()%3 + 1); | |
520 | } | |
521 | badReq.SetLength( f_pyld_Length ); | |
522 | if ( f_pyld_Length > 1000 ) f_env.setIngressThrottle(0); | |
523 | ||
524 | thisStrategy = badReq; | |
525 | } | |
526 | ||
527 | else if ( mode == "MsgNonZeroTC" ) { | |
528 | badReq = new( f_env ); | |
529 | badReq.SetErrQueue( f_errQueue ); | |
530 | // Use Msg (no data) fmt and type | |
531 | void = badReq.SetField( "FmtType", | |
532 | {PEC_PCI__FMT_NO_DATA_4DW,PEC_PCI__TYPE_MSG} ); | |
533 | ||
534 | if ( f_msgCode === 8'bxxxxxxxx ) { | |
535 | // Randomly choose a message code | |
536 | randcase { | |
537 | 1 : f_msgCode = PEC_PCI__MSG_CODE_ASSERT_INTA; | |
538 | 1 : f_msgCode = PEC_PCI__MSG_CODE_ASSERT_INTB; | |
539 | 1 : f_msgCode = PEC_PCI__MSG_CODE_ASSERT_INTC; | |
540 | 1 : f_msgCode = PEC_PCI__MSG_CODE_ASSERT_INTD; | |
541 | 1 : f_msgCode = PEC_PCI__MSG_CODE_DEASSERT_INTA; | |
542 | 1 : f_msgCode = PEC_PCI__MSG_CODE_DEASSERT_INTB; | |
543 | 1 : f_msgCode = PEC_PCI__MSG_CODE_DEASSERT_INTC; | |
544 | 1 : f_msgCode = PEC_PCI__MSG_CODE_DEASSERT_INTD; | |
545 | 1 : f_msgCode = PEC_PCI__MSG_CODE_PM_PME; | |
546 | 1 : f_msgCode = PEC_PCI__MSG_CODE_PM_TO_ACK; | |
547 | 1 : f_msgCode = PEC_PCI__MSG_CODE_ERR_COR; | |
548 | 1 : f_msgCode = PEC_PCI__MSG_CODE_ERR_NONFATAL; | |
549 | 1 : f_msgCode = PEC_PCI__MSG_CODE_ERR_FATAL; | |
550 | } | |
551 | } | |
552 | void = badReq.SetField( "MsgCode", f_msgCode ); | |
553 | // Use random TC != 0 | |
554 | void = badReq.SetField( "TC", (urandom() % 7) + 1 ); | |
555 | ||
556 | thisStrategy = badReq; | |
557 | } | |
558 | ||
559 | else if ( mode == "INTxData" ) { | |
560 | badReq = new( f_env ); | |
561 | badReq.SetErrQueue( f_errQueue ); | |
562 | ||
563 | // Use Msg (with data) fmt and type | |
564 | void = badReq.SetField( "FmtType", | |
565 | {PEC_PCI__FMT_DATA_4DW,PEC_PCI__TYPE_MSG} ); | |
566 | ||
567 | // Select the next INT message code | |
568 | case( f_badIndex % 8 ) | |
569 | { | |
570 | 0 : f_msgCode = PEC_PCI__MSG_CODE_ASSERT_INTA; | |
571 | 1 : f_msgCode = PEC_PCI__MSG_CODE_ASSERT_INTB; | |
572 | 2 : f_msgCode = PEC_PCI__MSG_CODE_ASSERT_INTC; | |
573 | 3 : f_msgCode = PEC_PCI__MSG_CODE_ASSERT_INTD; | |
574 | 4 : f_msgCode = PEC_PCI__MSG_CODE_DEASSERT_INTA; | |
575 | 5 : f_msgCode = PEC_PCI__MSG_CODE_DEASSERT_INTB; | |
576 | 6 : f_msgCode = PEC_PCI__MSG_CODE_DEASSERT_INTC; | |
577 | 7 : f_msgCode = PEC_PCI__MSG_CODE_DEASSERT_INTD; | |
578 | } | |
579 | void = badReq.SetField( "MsgCode", f_msgCode ); | |
580 | ||
581 | // ...and a payload length | |
582 | case( f_badIndex / 8 ) | |
583 | { | |
584 | 0 : badReq.SetLength( 1 ); | |
585 | 1 : badReq.SetLength( 4 ); | |
586 | 2 : badReq.SetLength( 16 ); | |
587 | 3 : badReq.SetLength( 3 ); | |
588 | 4 : badReq.SetLength( 7 ); | |
589 | 5 : badReq.SetLength( 32 ); | |
590 | default: badReq.SetLength( f_badIndex / 8 ); | |
591 | } | |
592 | ||
593 | f_badIndex = f_badIndex + 1; | |
594 | thisStrategy = badReq; | |
595 | } | |
596 | ||
597 | else if ( mode == "CfgIoReq" ) { | |
598 | ||
599 | dmaURCfgIOWrRd = new( f_env, f_errQueue ); | |
600 | ||
601 | dmaURCfgIOWrRd._ep_req_prob_false = 100; | |
602 | dmaURCfgIOWrRd._ep_req_prob_true = 0; | |
603 | ||
604 | thisStrategy = dmaURCfgIOWrRd; | |
605 | } | |
606 | ||
607 | else if ( mode == "CfgIoReqPoison" ) { | |
608 | printf("ErrTlpPEUCtx CfgIoReqPoison f_index=%0d \n",f_index); | |
609 | ||
610 | dmaURCfgIOWrRd = new( f_env, f_errQueue ); | |
611 | ||
612 | dmaURCfgIOWrRd._ep_req_prob_false = 0; | |
613 | dmaURCfgIOWrRd._ep_req_prob_true = 100; | |
614 | ||
615 | thisStrategy = dmaURCfgIOWrRd; | |
616 | } | |
617 | ||
618 | ||
619 | ||
620 | else if ( mode == "RdlkReq" ) { | |
621 | ||
622 | dmaURRdLk = new( f_env, f_errQueue ); | |
623 | ||
624 | dmaURRdLk._ep_req_prob_false = 100; | |
625 | dmaURRdLk._ep_req_prob_true = 0; | |
626 | ||
627 | thisStrategy = dmaURRdLk; | |
628 | } | |
629 | ||
630 | ||
631 | else if ( mode == "MsgData" ) { | |
632 | ||
633 | dmaURMsgD = new( f_env, f_errQueue ); | |
634 | ||
635 | dmaURMsgD._ep_req_prob_false = 100; | |
636 | dmaURMsgD._ep_req_prob_true = 0; | |
637 | ||
638 | thisStrategy = dmaURMsgD; | |
639 | } | |
640 | ||
641 | ||
642 | else if ( mode == "Msg" ) { | |
643 | ||
644 | dmaURMsg = new( f_env, f_errQueue ); | |
645 | ||
646 | dmaURMsg._ep_req_prob_false = 100; | |
647 | dmaURMsg._ep_req_prob_true = 0; | |
648 | ||
649 | thisStrategy = dmaURMsg; | |
650 | } | |
651 | ||
652 | ||
653 | else if ( mode == "RdCplUr" ) { | |
654 | ||
655 | randcase { | |
656 | ||
657 | 1 : { pioMRd = new( f_env, f_errQueue ); pioBase = pioMRd; } | |
658 | 1 : { pioCfgIORd = new( f_env, f_errQueue ); pioBase = pioCfgIORd; } | |
659 | } | |
660 | ||
661 | pioBase._ep_cpl_prob_true = 0; | |
662 | pioBase._ep_cpl_prob_false = 100; | |
663 | ||
664 | pioBase._cpl_status_prob_sc = 0; | |
665 | pioBase._cpl_status_prob_ur = 1; | |
666 | pioBase._cpl_status_prob_crs = 0; | |
667 | pioBase._cpl_status_prob_ca = 0; | |
668 | pioBase._cpl_status_prob_rsvd1 = 1; | |
669 | pioBase._cpl_status_prob_rsvd2 = 1; | |
670 | pioBase._cpl_status_prob_rsvd3 = 1; | |
671 | pioBase._cpl_status_prob_rsvd4 = 1; | |
672 | ||
673 | thisStrategy = pioBase; | |
674 | } | |
675 | ||
676 | ||
677 | else if ( mode == "WrCplUr" ) { | |
678 | ||
679 | pioCfgIOWr = new( f_env, f_errQueue ); pioBase = pioCfgIOWr; | |
680 | ||
681 | pioBase._ep_cpl_prob_true = 0; | |
682 | pioBase._ep_cpl_prob_false = 100; | |
683 | ||
684 | pioBase._cpl_status_prob_sc = 0; | |
685 | pioBase._cpl_status_prob_ur = 1; | |
686 | pioBase._cpl_status_prob_crs = 0; | |
687 | pioBase._cpl_status_prob_ca = 0; | |
688 | pioBase._cpl_status_prob_rsvd1 = 1; | |
689 | pioBase._cpl_status_prob_rsvd2 = 1; | |
690 | pioBase._cpl_status_prob_rsvd3 = 1; | |
691 | pioBase._cpl_status_prob_rsvd4 = 1; | |
692 | ||
693 | thisStrategy = pioBase; | |
694 | } | |
695 | ||
696 | ||
697 | else if ( mode == "RdCplCa" ) { | |
698 | ||
699 | randcase { | |
700 | ||
701 | 1 : { pioMRd = new( f_env, f_errQueue ); pioBase = pioMRd; } | |
702 | 1 : { pioCfgIORd = new( f_env, f_errQueue ); pioBase = pioCfgIORd; } | |
703 | } | |
704 | ||
705 | pioBase._ep_cpl_prob_true = 0; | |
706 | pioBase._ep_cpl_prob_false = 100; | |
707 | ||
708 | pioBase._cpl_status_prob_sc = 0; | |
709 | pioBase._cpl_status_prob_ur = 0; | |
710 | pioBase._cpl_status_prob_crs = 0; | |
711 | pioBase._cpl_status_prob_ca = 1; | |
712 | pioBase._cpl_status_prob_rsvd1 = 0; | |
713 | pioBase._cpl_status_prob_rsvd2 = 0; | |
714 | pioBase._cpl_status_prob_rsvd3 = 0; | |
715 | pioBase._cpl_status_prob_rsvd4 = 0; | |
716 | ||
717 | thisStrategy = pioBase; | |
718 | } | |
719 | ||
720 | ||
721 | else if ( mode == "WrCplCa" ) { | |
722 | ||
723 | pioCfgIOWr = new( f_env, f_errQueue ); pioBase = pioCfgIOWr; | |
724 | ||
725 | pioBase._ep_cpl_prob_true = 0; | |
726 | pioBase._ep_cpl_prob_false = 100; | |
727 | ||
728 | pioBase._cpl_status_prob_sc = 0; | |
729 | pioBase._cpl_status_prob_ur = 0; | |
730 | pioBase._cpl_status_prob_crs = 0; | |
731 | pioBase._cpl_status_prob_ca = 1; | |
732 | pioBase._cpl_status_prob_rsvd1 = 0; | |
733 | pioBase._cpl_status_prob_rsvd2 = 0; | |
734 | pioBase._cpl_status_prob_rsvd3 = 0; | |
735 | pioBase._cpl_status_prob_rsvd4 = 0; | |
736 | ||
737 | thisStrategy = pioBase; | |
738 | } | |
739 | ||
740 | ||
741 | ||
742 | else if ( mode == "ErrCpl" ) { | |
743 | errCpl = new( f_env ); | |
744 | errCpl.SetErrQueue( f_errQueue ); | |
745 | thisStrategy = errCpl; | |
746 | } | |
747 | ||
748 | ||
749 | else if ( mode == "ErrCplCpl" ) { | |
750 | errCpl = new( f_env ); | |
751 | errCpl.SetErrQueue( f_errQueue ); | |
752 | errCpl.SendCpl(); | |
753 | thisStrategy = errCpl; | |
754 | } | |
755 | ||
756 | ||
757 | else if ( mode == "CRS completion" ) { | |
758 | errCpl = new( f_env ); | |
759 | errCpl.SetErrQueue( f_errQueue ); | |
760 | errCpl.CRS(); | |
761 | case( f_badCpl % 4 ) | |
762 | { | |
763 | 0: errCpl.SetType( PEC_PCI__TYPE_CFG0, 0 ); | |
764 | 1: errCpl.SetType( PEC_PCI__TYPE_CFG0, 1 ); | |
765 | 2: errCpl.SetType( PEC_PCI__TYPE_CFG1, 0 ); | |
766 | 3: errCpl.SetType( PEC_PCI__TYPE_CFG1, 1 ); | |
767 | } | |
768 | case ( f_badCpl ) | |
769 | { | |
770 | 11: errCpl.AdjustLen( 1 ); | |
771 | 12: errCpl.AdjustCount( 1 ); | |
772 | 13: errCpl.BadReqID( 8'h80 ); | |
773 | } | |
774 | f_badCpl = f_badCpl + 1; | |
775 | thisStrategy = errCpl; | |
776 | } | |
777 | ||
778 | else if ( mode == "NonConfig CRS completion") { | |
779 | f_badCpl = urandom_range(1,0) ; | |
780 | printf("# F_Mode = NonConfig CRS completion =%d\n", | |
781 | f_badCpl); | |
782 | errCpl = new( f_env ); | |
783 | errCpl.SetErrQueue( f_errQueue ); | |
784 | errCpl.CRS(); | |
785 | case ( f_badCpl % 3 ) | |
786 | { | |
787 | 0: errCpl.SetType( PEC_PCI__TYPE_IO, 0); | |
788 | 1: errCpl.SetType( PEC_PCI__TYPE_IO, 1); | |
789 | 2: errCpl.SetType( PEC_PCI__TYPE_MEM, 0); | |
790 | } | |
791 | case ( f_badCpl / 3 ) | |
792 | { | |
793 | 1: errCpl.AdjustLen( 1 ); | |
794 | 2: errCpl.AdjustCount( 1 ); | |
795 | 3: errCpl.BadReqID( 8'h80 ); | |
796 | } | |
797 | thisStrategy = errCpl; | |
798 | } | |
799 | ||
800 | else if ( mode == "unexpected completion" ) { | |
801 | errCpl = new( f_env ); | |
802 | errCpl.SetErrQueue( f_errQueue ); | |
803 | if ( f_badCpl == 0 ) | |
804 | errCpl.NoRequest(); | |
805 | else if ( f_badCpl <= 7 ) | |
806 | errCpl.BadTag( f_badCpl << 5 ); | |
807 | else if ( f_badCpl < 24 ) | |
808 | errCpl.BadReqID( 1 << (f_badCpl-8) ); | |
809 | else if ( f_badCpl == 24 ) | |
810 | { | |
811 | errCpl.BadStatus(); | |
812 | errCpl.BadReqID(); | |
813 | } | |
814 | else randcase | |
815 | { | |
816 | 1: errCpl.BadReqID(); | |
817 | 1: { errCpl.BadReqID(); errCpl.BadStatus(); } | |
818 | 1: errCpl.BadTag(); | |
819 | 1: errCpl.NoRequest(); | |
820 | } | |
821 | f_badCpl = f_badCpl + 1; | |
822 | thisStrategy = errCpl; | |
823 | } | |
824 | ||
825 | else if ( mode == "locked completion" ) { | |
826 | errCpl = new( f_env ); | |
827 | errCpl.SetErrQueue( f_errQueue ); | |
828 | errCpl.SendCplLk(); | |
829 | if ( f_badCpl % 2 ) errCpl.NoRequest(); | |
830 | case (f_badCpl % 7) | |
831 | { | |
832 | 0: errCpl.SetType( PEC_PCI__TYPE_MEM, 0 ); | |
833 | 1: errCpl.SetType( PEC_PCI__TYPE_CFG1, 0 ); | |
834 | 2: errCpl.SetType( PEC_PCI__TYPE_CFG1, 0 ); | |
835 | 3: errCpl.SetType( PEC_PCI__TYPE_IO, 0 ); | |
836 | 4: errCpl.SetType( PEC_PCI__TYPE_CFG0, 1 ); | |
837 | 5: errCpl.SetType( PEC_PCI__TYPE_CFG1, 1 ); | |
838 | 6: errCpl.SetType( PEC_PCI__TYPE_IO, 1 ); | |
839 | } | |
840 | f_badCpl = f_badCpl + 1; | |
841 | thisStrategy = errCpl; | |
842 | } | |
843 | ||
844 | else if ( mode == "completion count" ) { | |
845 | errCpl = new( f_env ); | |
846 | errCpl.SetErrQueue( f_errQueue ); | |
847 | case (f_badCpl % 5) | |
848 | { | |
849 | 0: errCpl.AdjustCount(1); | |
850 | 1: errCpl.AdjustCount(-1); | |
851 | 2: errCpl.AdjustCount(512); | |
852 | 3: errCpl.AdjustCount(64); // for code coverage | |
853 | 4: errCpl.AdjustCount(128); // for code coverage | |
854 | } | |
855 | case (f_badCpl % 4) | |
856 | { | |
857 | 0: errCpl.SetType( PEC_PCI__TYPE_MEM, 0 ); | |
858 | 1: errCpl.SetType( PEC_PCI__TYPE_CFG0, 0 ); | |
859 | 2: errCpl.SetType( PEC_PCI__TYPE_CFG1, 0 ); | |
860 | 3: errCpl.SetType( PEC_PCI__TYPE_IO, 0 ); | |
861 | } | |
862 | f_badCpl = f_badCpl + 1; | |
863 | thisStrategy = errCpl; | |
864 | } | |
865 | ||
866 | else if ( mode == "completion address" ) { | |
867 | errCpl = new( f_env ); | |
868 | errCpl.SetErrQueue( f_errQueue ); | |
869 | case (f_badCpl % 3) | |
870 | { | |
871 | 0: errCpl.AdjustAddr(1); | |
872 | 1: errCpl.AdjustAddr(-1); | |
873 | 2: errCpl.AdjustAddr(64); | |
874 | } | |
875 | case (f_badCpl % 4) | |
876 | { | |
877 | 0: errCpl.SetType( PEC_PCI__TYPE_MEM, 0 ); | |
878 | 1: errCpl.SetType( PEC_PCI__TYPE_CFG0, 0 ); | |
879 | 2: errCpl.SetType( PEC_PCI__TYPE_CFG1, 0 ); | |
880 | 3: errCpl.SetType( PEC_PCI__TYPE_IO, 0 ); | |
881 | } | |
882 | f_badCpl = f_badCpl + 1; | |
883 | thisStrategy = errCpl; | |
884 | } | |
885 | ||
886 | else if ( mode == "completion TC" ) { | |
887 | errCpl = new( f_env ); | |
888 | errCpl.SetErrQueue( f_errQueue ); | |
889 | errCpl.BadTC( (f_badCpl%7) + 1 ); | |
890 | f_badCpl = f_badCpl + 1; | |
891 | thisStrategy = errCpl; | |
892 | } | |
893 | ||
894 | else if ( mode == "completion attr" ) { | |
895 | errCpl = new( f_env ); | |
896 | errCpl.SetErrQueue( f_errQueue ); | |
897 | errCpl.BadAttr( (f_badCpl%3) + 1 ); | |
898 | f_badCpl = f_badCpl + 1; | |
899 | thisStrategy = errCpl; | |
900 | } | |
901 | ||
902 | else if ( mode == "completion length" ) { | |
903 | errCpl = new( f_env ); | |
904 | errCpl.SetErrQueue( f_errQueue ); | |
905 | case (f_badCpl % 4) | |
906 | { | |
907 | 0: errCpl.SetType( PEC_PCI__TYPE_MEM, 0 ); | |
908 | 1: errCpl.SetType( PEC_PCI__TYPE_CFG0, 0 ); | |
909 | 2: errCpl.SetType( PEC_PCI__TYPE_CFG1, 0 ); | |
910 | 3: errCpl.SetType( PEC_PCI__TYPE_IO, 0 ); | |
911 | } | |
912 | ||
913 | if ( f_badCpl < 4 ) errCpl.AdjustLen( 1 ); | |
914 | else if ( f_badCpl < 8 ) errCpl.AdjustLen( -1 ); | |
915 | else if ( f_badCpl < 10 ) errCpl.AdjustLen( 2 ); | |
916 | else if ( f_badCpl < 12 ) errCpl.AdjustLen( 4 ); | |
917 | else if ( f_badCpl < 14 ) errCpl.AdjustLen( 8 ); | |
918 | else if ( f_badCpl < 15 ) errCpl.AdjustLen( 16 ); | |
919 | else if ( f_badCpl < 16 ) errCpl.AdjustLen( 32 ); | |
920 | else errCpl.AdjustLen( urandom()%8 + 1 ); | |
921 | ||
922 | f_badCpl = f_badCpl + 1; | |
923 | thisStrategy = errCpl; | |
924 | } | |
925 | ||
926 | else if ( mode == "NonConfigCRS" ) { | |
927 | errCpl = new( f_env ); | |
928 | errCpl.SetErrQueue( f_errQueue ); | |
929 | case (f_badCpl % 3) | |
930 | { | |
931 | 0: errCpl.SetType( PEC_PCI__TYPE_MEM, 0 ); | |
932 | 1: errCpl.SetType( PEC_PCI__TYPE_IO, 0 ); | |
933 | 2: errCpl.SetType( PEC_PCI__TYPE_IO, 1 ); | |
934 | } | |
935 | //N2 Only allow NonConfigCRS errors | |
936 | // case ( f_badCpl / 3 ) | |
937 | // { | |
938 | // 1: errCpl.AdjustLen( 1 ); | |
939 | // 2: errCpl.AdjustCount( 1 ); | |
940 | // 3: errCpl.BadReqID( 8'h80 ); | |
941 | // } | |
942 | errCpl.CRS(); | |
943 | f_badCpl = f_badCpl + 1; | |
944 | thisStrategy = errCpl; | |
945 | } | |
946 | ||
947 | else if ( mode == "IncorrectCpl" ) { | |
948 | errCpl = new( f_env ); | |
949 | errCpl.SetErrQueue( f_errQueue ); | |
950 | case (f_badCpl % 7) | |
951 | { | |
952 | 0: errCpl.SetType( PEC_PCI__TYPE_MEM, 0 ); | |
953 | 1: errCpl.SetType( PEC_PCI__TYPE_CFG0, 0 ); | |
954 | 2: errCpl.SetType( PEC_PCI__TYPE_CFG0, 1 ); | |
955 | 3: errCpl.SetType( PEC_PCI__TYPE_CFG1, 0 ); | |
956 | 4: errCpl.SetType( PEC_PCI__TYPE_CFG1, 1 ); | |
957 | 5: errCpl.SetType( PEC_PCI__TYPE_IO, 0 ); | |
958 | 6: errCpl.SetType( PEC_PCI__TYPE_IO, 1 ); | |
959 | } | |
960 | case ((f_badCpl/7) % 2) | |
961 | { | |
962 | 0: errCpl.WrongData(); | |
963 | 1: errCpl.WrongStatus(); | |
964 | } | |
965 | f_badCpl = f_badCpl + 1; | |
966 | thisStrategy = errCpl; | |
967 | } | |
968 | ||
969 | else if ( mode == "PoisonReq" ) { | |
970 | dmaPreq = new( f_env ); | |
971 | dmaPreq.SetErrQueue( f_errQueue ); | |
972 | ||
973 | case (f_badIndex%4) | |
974 | { | |
975 | 0: dmaPreq.SetType( PEC_PCI__TYPE_MEM, 0 ); | |
976 | 1: dmaPreq.SetType( PEC_PCI__TYPE_MEM, 1 ); | |
977 | 2: dmaPreq.SetType( PEC_PCI__TYPE_MSG, 0 ); | |
978 | 3: dmaPreq.SetType( PEC_PCI__TYPE_MEM, 1 ); | |
979 | } | |
980 | case ( f_badIndex / 4 ) | |
981 | { | |
982 | 0: dmaPreq.SetLen( 1 ); | |
983 | 1: dmaPreq.SetLen( 16 ); | |
984 | 2: dmaPreq.SetLen( f_env.getMaxPayloadSize() / 4 ); | |
985 | default: dmaPreq.SetLen( 9 ); | |
986 | } | |
987 | f_badIndex = f_badIndex + 1; | |
988 | thisStrategy = dmaPreq; | |
989 | } | |
990 | ||
991 | else if ( mode == "PoisonReqP2252" ) { | |
992 | dmaPreq = new( f_env ); | |
993 | dmaPreq.SetErrQueue( f_errQueue ); | |
994 | ||
995 | case (f_badIndex%4) | |
996 | { | |
997 | 0: dmaPreq.SetType( PEC_PCI__TYPE_MEM, 1 ); | |
998 | 1: dmaPreq.SetType( PEC_PCI__TYPE_MEM, 1 ); | |
999 | 2: dmaPreq.SetType( PEC_PCI__TYPE_MEM, 1 ); | |
1000 | 3: dmaPreq.SetType( PEC_PCI__TYPE_MEM, 1 ); | |
1001 | } | |
1002 | case ( f_badIndex / 4 ) | |
1003 | { | |
1004 | 0: dmaPreq.SetLen( 4 ); | |
1005 | 1: dmaPreq.SetLen( 16 ); | |
1006 | 2: dmaPreq.SetLen( f_env.getMaxPayloadSize() / 4 ); | |
1007 | default: dmaPreq.SetLen( 32 ); | |
1008 | } | |
1009 | f_badIndex = f_badIndex + 1; | |
1010 | thisStrategy = dmaPreq; | |
1011 | } | |
1012 | ||
1013 | ||
1014 | else if ( mode == "PoisonCpl" ) { | |
1015 | ||
1016 | randcase { | |
1017 | ||
1018 | 1 : { pioMRd = new( f_env, f_errQueue ); pioBase = pioMRd; } | |
1019 | 1 : { pioCfgIORd = new( f_env, f_errQueue ); pioBase = pioCfgIORd; } | |
1020 | } | |
1021 | ||
1022 | pioBase._ep_cpl_prob_true = 100; | |
1023 | pioBase._ep_cpl_prob_false = 0; | |
1024 | ||
1025 | thisStrategy = pioBase; | |
1026 | } | |
1027 | ||
1028 | ||
1029 | else if ( mode == "DWBE" ) { | |
1030 | badReq = new( f_env ); | |
1031 | badReq.SetErrQueue( f_errQueue ); | |
1032 | randcase | |
1033 | { | |
1034 | 1: badReq.SetLength(1); | |
1035 | 2: badReq.SetLength(2); | |
1036 | 1: badReq.SetLength(3); | |
1037 | 1: badReq.SetLength(4); | |
1038 | } | |
1039 | while ( !badReq.SetDWBE( urandom()%16, urandom()%16, urandom()%2 ) ) | |
1040 | { | |
1041 | // Pick another DWBE-pair... | |
1042 | } | |
1043 | thisStrategy = badReq; | |
1044 | } | |
1045 | ||
1046 | else if ( mode == "Receiver Errors" ) { | |
1047 | RcvrErr = new( f_env ); | |
1048 | RcvrErr.SetErrQueue( f_errQueue ); | |
1049 | ||
1050 | RcvrErr.nmbrRcvrErrsToInject = f_nmbrRcvrErrsToInject; | |
1051 | RcvrErr.rcvrErrPct = f_rcvrErrPct; | |
1052 | RcvrErr.rcvrErr8b10bWeight = f_rcvrErr8b10bWeight; | |
1053 | RcvrErr.rcvrErrFramingWeight = f_rcvrErrFramingWeight; | |
1054 | RcvrErr.rcvrErrDisparityWeight = f_rcvrErrDisparityWeight; | |
1055 | RcvrErr.rcvrErrFlipBitWeight = f_rcvrErrFlipBitWeight; | |
1056 | RcvrErr.rcvrErrLcrcWeight = f_rcvrErrLcrcWeight; | |
1057 | RcvrErr.rcvrErrDupSeqNmbrWeight = f_rcvrErrDupSeqNmbrWeight; | |
1058 | RcvrErr.rcvrErrOutOfSeqNmbrWeight = f_rcvrErrOutOfSeqNmbrWeight; | |
1059 | RcvrErr.rcvrErrBadSeqNmbrWeight = f_rcvrErrBadSeqNmbrWeight; | |
1060 | RcvrErr.optional_CE_BTP = f_optional_CE_BTP; | |
1061 | ||
1062 | RcvrErr.InvertLCRCErrWeight = f_InvertLCRCErrWeight; | |
1063 | RcvrErr.EDBErrWeight = f_EDBErrWeight; | |
1064 | // RcvrErr.InvertLCRCAndEDBErrWeight = f_InvertLCRCAndEDBErrWeight; | |
1065 | printf("AC: mode = Receiver Errors at time %d\n",get_time(LO)); | |
1066 | ||
1067 | ||
1068 | thisStrategy = RcvrErr; | |
1069 | } | |
1070 | ||
1071 | ||
1072 | else if ( mode == "DLLP Errors") { | |
1073 | DLLPErr = new(f_env); | |
1074 | DLLPErr.SetErrQueue( f_errQueue); | |
1075 | DLLPErr.nmbrDLLPErrsToInject = f_nmbrDLLPErrsToInject; | |
1076 | DLLPErr.DLLPErrUnsupportWeight = f_DLLPErrUnsupportWeight; | |
1077 | DLLPErr.DLLPErrBadCRCWeight = f_DLLPErrBadCRCWeight; | |
1078 | printf("AC: mode = DLLP Errors at time %d\n",get_time(LO)); | |
1079 | ||
1080 | thisStrategy = DLLPErr; | |
1081 | } | |
1082 | ||
1083 | else if ( mode == "ACK NAK Errors") { | |
1084 | AckNakErr = new(f_env); | |
1085 | AckNakErr.SetErrQueue( f_errQueue); | |
1086 | AckNakErr.nmbrAckNakErrsToInject = f_nmbrAckNakErrsToInject; | |
1087 | AckNakErr.DLLPAckLessthanAckedErrWeight = f_DLLPAckLessthanAckedErrWeight; | |
1088 | AckNakErr.DLLPNakLessthanAckedErrWeight = f_DLLPNakLessthanAckedErrWeight; | |
1089 | AckNakErr.DLLPAckmorethanTLPNxtSeqErrWeight = f_DLLPAckmorethanTLPNxtSeqErrWeight; | |
1090 | AckNakErr.DLLPNakmorethanTLPNxtSeqErrWeight = f_DLLPNakmorethanTLPNxtSeqErrWeight; | |
1091 | printf("AC: mode = Ack Nak Errors at time %d\n",get_time(LO)); | |
1092 | ||
1093 | ||
1094 | thisStrategy = AckNakErr; | |
1095 | } | |
1096 | ||
1097 | // else if ( mode == "Invert LCRC and EDB Errors") { | |
1098 | else if ( mode == "Null TLP Errors") { | |
1099 | ||
1100 | nullTlpErr = new(f_env); | |
1101 | nullTlpErr.SetErrQueue( f_errQueue); | |
1102 | nullTlpErr.nmbrnullTlpErrsToInject = f_nmbrnullTlpErrsToInject; | |
1103 | nullTlpErr.nullTlpErrWeight = f_nullTlpErrWeight; | |
1104 | ||
1105 | // nullTlpErr.InvertLCRCErrWeight = f_InvertLCRCErrWeight; | |
1106 | // nullTlpErr.EDBErrWeight = f_EDBErrWeight; | |
1107 | // nullTlpErr.NormalLCRCENDErrWeight = f_NormalLCRCENDErrWeight; | |
1108 | printf("AC: mode = Null TLP (Invert LCRC and EDB) Errors at time %d\n",get_time(LO)); | |
1109 | ||
1110 | thisStrategy = nullTlpErr; | |
1111 | } | |
1112 | ||
1113 | ||
1114 | ||
1115 | ||
1116 | // duplicate sequence number non skip error. Not forced by Denali | |
1117 | else if ( mode == "DuplicateSeqNmbrNoSkip" ) { | |
1118 | // dmaPreq = new( f_env ); | |
1119 | duplicateSeqNmbrReq = new( f_env ); | |
1120 | duplicateSeqNmbrReq.SetErrQueue( f_errQueue ); | |
1121 | ||
1122 | randcase | |
1123 | { | |
1124 | 10: duplicateSeqNmbrReq.SetType( PEC_PCI__TYPE_MEM, 0 ); | |
1125 | 10: duplicateSeqNmbrReq.SetType( PEC_PCI__TYPE_MEM, 1 ); | |
1126 | 20: duplicateSeqNmbrReq.SetType( PEC_PCI__TYPE_MSG, 0 ); | |
1127 | } | |
1128 | randcase | |
1129 | { | |
1130 | 10: duplicateSeqNmbrReq.SetLen( 1 ); | |
1131 | 10: duplicateSeqNmbrReq.SetLen( 16 ); | |
1132 | 10: duplicateSeqNmbrReq.SetLen( f_env.getMaxPayloadSize() / 4 ); | |
1133 | 10: duplicateSeqNmbrReq.SetLen( urandom_range(0, 255) ); | |
1134 | } | |
1135 | ||
1136 | thisStrategy = duplicateSeqNmbrReq; | |
1137 | } | |
1138 | ||
1139 | ||
1140 | else if ( mode == "Flow Control Protocol Errors") { | |
1141 | FCPErr = new(f_env); | |
1142 | FCPErr.SetErrQueue( f_errQueue); | |
1143 | FCPErr.nmbrFCPErrsToInject = f_nmbrFCPErrsToInject; | |
1144 | FCPErr.DLLP_FCP_Infinite_FC_PH_ErrWeight = f_DLLP_FCP_Infinite_FC_PH_ErrWeight; | |
1145 | FCPErr.DLLP_FCP_Infinite_FC_PD_ErrWeight = f_DLLP_FCP_Infinite_FC_PD_ErrWeight; | |
1146 | FCPErr.DLLP_FCP_Infinite_FC_NPH_ErrWeight = f_DLLP_FCP_Infinite_FC_NPH_ErrWeight; | |
1147 | FCPErr.DLLP_FCP_Infinite_FC_NPD_ErrWeight = f_DLLP_FCP_Infinite_FC_NPD_ErrWeight; | |
1148 | FCPErr.DLLP_FCP_Infinite_FC_CLPH_ErrWeight = f_DLLP_FCP_Infinite_FC_CLPH_ErrWeight; | |
1149 | FCPErr.DLLP_FCP_Infinite_FC_CLPD_ErrWeight = f_DLLP_FCP_Infinite_FC_CLPD_ErrWeight; | |
1150 | ||
1151 | FCPErr.DLLP_FCP_Infinite_FC_all_P_ErrWeight = f_DLLP_FCP_Infinite_FC_all_P_ErrWeight; | |
1152 | FCPErr.DLLP_FCP_Infinite_FC_all_NP_ErrWeight = f_DLLP_FCP_Infinite_FC_all_NP_ErrWeight; | |
1153 | FCPErr.DLLP_FCP_Infinite_FC_all_CLP_ErrWeight = f_DLLP_FCP_Infinite_FC_all_CLP_ErrWeight; | |
1154 | ||
1155 | FCPErr.DLLP_FCP_over128_FC_PH_ErrWeight = f_DLLP_FCP_over128_FC_PH_ErrWeight; | |
1156 | FCPErr.DLLP_FCP_over2048_FC_PD_ErrWeight = f_DLLP_FCP_over2048_FC_PD_ErrWeight; | |
1157 | FCPErr.DLLP_FCP_over128_FC_NPH_ErrWeight = f_DLLP_FCP_over128_FC_NPH_ErrWeight; | |
1158 | FCPErr.DLLP_FCP_over2048_FC_NPD_ErrWeight = f_DLLP_FCP_over2048_FC_NPD_ErrWeight; | |
1159 | FCPErr.DLLP_FCP_over128_FC_CLPH_ErrWeight = f_DLLP_FCP_over128_FC_CLPH_ErrWeight; | |
1160 | FCPErr.DLLP_FCP_over2048_FC_CLPD_ErrWeight = f_DLLP_FCP_over2048_FC_CLPD_ErrWeight; | |
1161 | ||
1162 | printf("AC: mode = Flow Control Protocol Errors at time %d\n",get_time(LO)); | |
1163 | ||
1164 | ||
1165 | thisStrategy = FCPErr; | |
1166 | } | |
1167 | ||
1168 | ||
1169 | ||
1170 | ||
1171 | ||
1172 | ||
1173 | ||
1174 | ||
1175 | ||
1176 | // An unknown sort of error... | |
1177 | // The "ErrChk" strategy will hang. | |
1178 | else | |
1179 | { | |
1180 | printf("ErrTlp (cycle %0d) '%s' is undefined\n", get_cycle(), mode); | |
1181 | nullStr = new( f_env ); | |
1182 | thisStrategy = nullStr; | |
1183 | } | |
1184 | ||
1185 | if ( f_abort ) thisStrategy.f_abortErrTlp = 1; | |
1186 | ||
1187 | ProvideStrategy = thisStrategy; | |
1188 | ||
1189 | } /* end ProvideStrategy */ | |
1190 | ||
1191 | protected function CTStrategyBase FinalizeParms( CTStrategyBase a_strategy ) | |
1192 | { | |
1193 | FinalizeParms = a_strategy; | |
1194 | } /* end FinalizeParms */ | |
1195 | ||
1196 | } /* end ErrTlpPEUCtx */ |