Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / common / vera / classes / asmEventsToVera.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: asmEventsToVera.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
37#define STD_DISP this.dbg
38
39#define ITEMCOUNT 15
40#define TMPEVENT 1
41
42#include <plusArgMacros.vri>
43
44#include <std_display_class.vrh>
45
46// common
47#include <asmEvent.vrh>
48#include <asmEventsToVera.if.vrh>
49#include <baseAsmToVeraIntf.vrh>
50
51// class and header *MUST* be created in each bench that uses User Events.
52// Make sure Vera compiles with the right asmToVeraIntf file for your
53// bench. (Use -I paths!)
54#include <asmToVeraIntf.vrh>
55
56
57//#define DEBUGASMEVENTSTOVERA
58
59class AsmEventsToVera {
60 local string className = "AsmEventsToVera";
61 local AsmToVeraIntf asmToVeraIntf; // each bench creates & compiles this class!!
62 local asmEventCore probes[64];
63 local reg [63:0] enabledTids;
64 local reg [63:0] outOfBoot = 0;
65 local reg [63:0] startBoot = 0;
66 local reg [63:0] inBoot = 0;
67 local StandardDisplay dbg;
68 //// local reg debug = 0;
69 local bit debug = 0;
70 local EventClass userEventsList []; // pc's that have user event(s)
71 local integer eventCount = 0;
72 local integer listLock;
73
74 // never retire an event (asm runs again after reset)
75 local reg eventsNeverDone;
76
77 task new(StandardDisplay dbg,
78 reg [63:0] enabledTids,
79 reg asm_err_en = 0,
80 reg err_inj_dbg = 0);
81
82 task readEventFile(string file,
83 integer kind = 0,
84 string lvl = null,
85 string name = null);
86
87 local task extract(string str, var string items [ITEMCOUNT]);
88 local task parseTrig(string items [ITEMCOUNT]);
89 local task mainMonitor();
90 local task serviceEvent(reg [63:0] pc, reg [5:0] fromTid);
91
92
93} // end
94
95
96
97
98/////////////////////////////////////////////////////////////////////////
99// process $EV user event line from .s file, create and store user event.
100//
101// None of this will make sense until you read:
102//
103// Add to the case below to add a new User Event
104/////////////////////////////////////////////////////////////////////////
105task AsmEventsToVera::parseTrig(string items [ITEMCOUNT])
106{
107 EventClass evnt = null;
108 string str = "";
109 reg [63:0] pc = 0;
110 integer i = 0;
111
112// NOTE: The "1," in trig_pc_d(1, @VA... has no know use today. N1 called
113// this paramater "kind" and it had values of 0, 1, 2, and 3 in
114// diags. The first pass vera code looked for values of 1 and
115// 2. The second pass code, done in C, does not use this paramater
116// at all. In the first pass vera code, a value of 2 meant that an
117// intp task should send an interrupt to the given thread at each
118// of 8 cores. A value of 1 for kind meant that the target core
119// should be what was specified in the $EV, else the target core
120// will be core 0 (or all cores if kind is 2). N2 ignores this
121// paramater.
122
123// reg [63:0] firstParam = 0; // The "1," in trig_pc_d(1, @VA... has no know use today.
124
125
126 i = 0;
127 if (items[i] !== "trig_pc_d") error("first item not trig_pc_d\n");
128 i++;
129 str = items[i]; i++;
130// firstParam = str.atohex();
131 str = items[i]; i++;
132 pc = str.atohex();
133
134
135 case(items[i]) {
136
137 "generic_ev" : { // generic user event for general use (6/06)
138 evnt = new;
139 evnt.pc = pc;
140 evnt.routine = items[i]; i++;
141
142 str = items[i]; i++;
143 evnt.miscStrA = str; // arg1 is a string
144
145 str = items[i]; i++;
146 if (str.match("0x")) str = str.postmatch();
147 evnt.misc64A = str.atohex(); // arg2 is a 64-bit value
148
149 str = items[i]; i++;
150 if (str.match("0x")) str = str.postmatch();
151 evnt.misc64B = str.atohex(); // arg3 is a 64-bit value
152
153 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
154 else userEventsList[pc] = evnt;
155
156#ifdef DEBUGASMEVENTSTOVERA
157 userEventsList[pc].printList();
158#endif
159 }
160
161 "intp": { // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) -> intp(1, 1, 1)
162 evnt = new;
163 evnt.pc = pc;
164 evnt.routine = items[i]; i++;
165 str = items[i]; i++;
166 evnt.tid = str.atohex(); // 64 tids // target tid
167 str = items[i]; i++;
168 evnt.intType = str.atohex(); // type
169 str = items[i]; i++;
170 evnt.misc64A = str.atohex(); // vec
171 // optional params
172 str = items[i]; i++;
173 if (str == "*") evnt.src = 64;
174 else evnt.src = str.atohex(); // srcTid
175 str = items[i]; i++;
176 if (str == "*") evnt.wait = 0;
177 else evnt.wait = str.atoi(); // wait
178 str = items[i]; i++;
179 if (str == "*") evnt.thisTid = 64;
180 else evnt.thisTid = str.atohex(); // thisTid
181 str = items[i]; i++;
182 if (str == "*") evnt.tidMask = 0;
183 else evnt.tidMask = str.atohex(); // targetTidMask
184 str = items[i]; i++;
185 if (str !== "*") evnt.multiShot = str.atohex(); // multiShot
186
187 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
188 else userEventsList[pc] = evnt;
189
190
191#ifdef DEBUGASMEVENTSTOVERA
192 userEventsList[pc].printList();
193#endif
194
195 }
196
197 "extint": {
198 evnt = new;
199 evnt.pc = pc;
200 evnt.routine = items[i]; i++;
201
202 str = items[i]; i++;
203 if (str == "*") evnt.wait = 0;
204 else evnt.wait = str.atoi();
205
206 str = items[i]; i++;
207 if (str == "*") evnt.miscIntA = 0;
208 else evnt.miscIntA = str.atoi();
209
210 //making this permanently multishot
211 evnt.multiShot = 1; // multiShot
212
213 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
214 else userEventsList[pc] = evnt;
215
216#ifdef DEBUGASMEVENTSTOVERA
217 userEventsList[pc].printList();
218#endif
219
220 }
221
222 "warmrst": {
223 evnt = new;
224 evnt.pc = pc;
225 evnt.routine = items[i]; i++;
226
227 // optional params
228 str = items[i]; i++;
229 if (str == "*") evnt.wait = 0;
230 else evnt.wait = str.atoi();
231
232 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
233 else userEventsList[pc] = evnt;
234
235#ifdef DEBUGASMEVENTSTOVERA
236 userEventsList[pc].printList();
237#endif
238
239 }
240
241
242 // Does not use CPX stall input! Starves SPC of response pkts.
243 "cpx_stall": {
244 evnt = new;
245 evnt.pc = pc;
246 evnt.routine = items[i]; i++;
247 str = items[i]; i++;
248 evnt.tid = str.atohex(); // 64 tids
249 str = items[i]; i++;
250 evnt.miscIntA = str.atoi(); // duration
251 // optional params
252 str = items[i]; i++;
253 if (str == "*") evnt.wait = 0;
254 else evnt.wait = str.atoi();
255
256 if(evnt.tid <= 63) {
257 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
258 else userEventsList[pc] = evnt;
259 } else error("cpx_stall: thread ID too high: 0x%0h\n",evnt.tid);
260
261#ifdef DEBUGASMEVENTSTOVERA
262 userEventsList[pc].printList();
263#endif
264 }
265
266 // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) -> printf("your text", thisTid, multiShot)
267 "printf" : {
268 evnt = new;
269 evnt.pc = pc;
270 evnt.routine = items[i]; i++;
271 evnt.miscStrA = items[i]; i++;
272 // optional params
273 str = items[i]; i++;
274 if (str !== "*") evnt.thisTid = str.atohex(); // thisTid
275 str = items[i]; i++;
276 if (str !== "*") evnt.multiShot = str.atohex(); // multiShot
277
278 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
279 else userEventsList[pc] = evnt;
280
281#ifdef DEBUGASMEVENTSTOVERA
282 userEventsList[pc].printList();
283#endif
284 }
285
286 "dump_mem" : {
287 evnt = new;
288 evnt.pc = pc;
289 evnt.routine = items[i]; i++;
290 str = items[i]; i++;
291 evnt.misc64A = str.atohex(); // addr
292 str = items[i]; i++;
293 evnt.misc64B = str.atohex(); // amount
294
295 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
296 else userEventsList[pc] = evnt;
297
298#ifdef DEBUGASMEVENTSTOVERA
299 userEventsList[pc].printList();
300#endif
301 }
302
303 // SPC BFM will do a store to L2. Pick correct port w/ BFM!!!
304 "store": {
305 evnt = new;
306 evnt.pc = pc;
307 evnt.routine = items[i]; i++;
308 str = items[i]; i++;
309 evnt.tid = str.atohex(); // 8 cores
310 str = items[i]; i++;
311 evnt.misc64A = str.atohex(); // addr
312 str = items[i]; i++;
313 evnt.misc64B = str.atohex(); // data
314
315 if(evnt.tid <= 63) {
316 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
317 else userEventsList[pc] = evnt;
318 } else error("store: CPU ID too high: 0x%0h\n",evnt.tid);
319
320#ifdef DEBUGASMEVENTSTOVERA
321 userEventsList[pc].printList();
322#endif
323 }
324
325// ************* Trap Counting Task **************
326
327 "L2ErrTrapCount": {
328 evnt = new;
329 evnt.pc = pc;
330 evnt.routine = items[i]; i++;
331 str = items[i]; i++;
332 evnt.misc64A = str.atohex(); // injectErr
333 str = items[i]; i++;
334
335 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
336 else userEventsList[pc] = evnt;
337 }
338
339
340
341// ************* Data Array Injection **************
342
343 "L2DAErrInjection": {
344 evnt = new;
345 evnt.pc = pc;
346 evnt.routine = items[i]; i++;
347 str = items[i]; i++;
348 evnt.misc64A = str.atohex(); // injectErr
349 str = items[i]; i++;
350
351 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
352 else userEventsList[pc] = evnt;
353 }
354
355// ************* Tag Array Injection **************
356
357 "L2TAErrInjection": {
358 evnt = new;
359 evnt.pc = pc;
360 evnt.routine = items[i]; i++;
361 str = items[i]; i++;
362 evnt.misc64A = str.atohex(); // injectErr
363 str = items[i]; i++;
364
365 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
366 else userEventsList[pc] = evnt;
367 }
368
369// ************* IOS Err Injection **************
370
371 "IosErrInj": {
372 evnt = new;
373 evnt.pc = pc;
374 evnt.routine = items[i]; i++;
375
376 str = items[i]; i++;
377 evnt.miscStrA = str; // Error type
378
379 str = items[i]; i++;
380 evnt.misc64A = str.atohex(); // Tag
381
382 str = items[i]; i++;
383 evnt.misc64B = str.atohex(); // PA
384
385 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
386 else userEventsList[pc] = evnt;
387 }
388
389 "IosRandErrInj": {
390 evnt = new;
391 evnt.pc = pc;
392 evnt.routine = items[i]; i++;
393
394 str = items[i]; i++;
395 evnt.miscStrA = str; // Error type
396
397 str = items[i]; i++;
398 evnt.misc64A = str.atohex(); //
399
400 str = items[i]; i++;
401 evnt.misc64B = str.atohex(); //
402
403 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
404 else userEventsList[pc] = evnt;
405 }
406
407 "siuDmaRd": {
408 evnt = new;
409 evnt.pc = pc;
410 evnt.routine = items[i]; i++;
411 str = items[i]; i++;
412 evnt.misc64A = str.atohex(); // addr
413 str = items[i]; i++;
414 evnt.misc64B = str.atohex(); // amount
415
416 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
417 else userEventsList[pc] = evnt;
418 }
419
420 "siuDmaWri": {
421 evnt = new;
422 evnt.pc = pc;
423 evnt.routine = items[i]; i++;
424 str = items[i]; i++;
425 evnt.misc64A = str.atohex(); // addr
426 str = items[i]; i++;
427 evnt.misc64B = str.atohex(); // amount
428
429 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
430 else userEventsList[pc] = evnt;
431 }
432
433 "jtagRdWrL2": {
434 evnt = new;
435 evnt.pc = pc;
436 evnt.routine = items[i]; i++;
437
438 str = items[i]; i++;
439 if (str.match("0x")) str = str.postmatch();
440 evnt.misc64A = str.atohex(); // addr
441
442 str = items[i]; i++;
443 if (str.match("0x")) str = str.postmatch();
444 evnt.misc64B = str.atohex(); // data
445
446 str = items[i]; i++;
447 if (str.match("0x")) str = str.postmatch();
448 evnt.misc64C = str.atohex(); // jtagDoneAddrMem
449
450 str = items[i]; i++;
451 evnt.misc01A = str.atobin(); // rdWr rd=0, wr=1
452
453 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
454 else userEventsList[pc] = evnt;
455 }
456
457 "pktGenConfig": {
458 evnt = new;
459 evnt.pc = pc;
460 evnt.routine = items[i]; i++;
461
462 str = items[i]; i++;
463 evnt.tid = str.atohex(); // mac_port
464
465 str = items[i]; i++;
466 if (str.match("0x")) str = str.postmatch();
467 evnt.misc64A = str.atohex(); // frame_type
468
469 str = items[i]; i++;
470 if (str.match("0x")) str = str.postmatch();
471 evnt.misc64B = str.atohex(); // frame_class
472
473 str = items[i]; i++;
474 if (str.match("0x")) str = str.postmatch();
475 evnt.misc64C = str.atohex(); // data_length
476
477 str = items[i]; i++;
478 evnt.misc01A = str.atohex(); // tx_multi_port
479
480 str = items[i]; i++;
481 if (str.match("0x")) str = str.postmatch();
482 evnt.misc64D = str.atohex(); // data_length_p1
483
484 str = items[i]; i++;
485 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
486
487 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
488 else userEventsList[pc] = evnt;
489
490#ifdef DEBUGASMEVENTSTOVERA
491 userEventsList[pc].printList();
492#endif
493
494 }
495
496 "NIU_AddTxChannels": {
497 evnt = new;
498 evnt.pc = pc;
499 evnt.routine = items[i]; i++;
500
501 str = items[i]; i++;
502 evnt.tid = str.atohex(); // mac_port
503
504 str = items[i]; i++;
505 evnt.misc64B = str.atohex(); // dma_no
506
507// str = items[i]; i++;
508// if (str == "*") evnt.miscIntA = 0;
509// else evnt.miscIntA = str.atoi(); dma_no
510
511 str = items[i]; i++;
512 evnt.misc01A = str.atohex(); // tx_multi_port
513
514 str = items[i]; i++;
515 if (str.match("0x")) str = str.postmatch();
516 evnt.misc64C = str.atohex(); // tx_multi_dma_p0
517
518 str = items[i]; i++;
519 if (str.match("0x")) str = str.postmatch();
520 evnt.misc64D = str.atohex(); // tx_multi_dma_p1
521
522 str = items[i]; i++;
523 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
524
525 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
526 else userEventsList[pc] = evnt;
527
528#ifdef DEBUGASMEVENTSTOVERA
529 userEventsList[pc].printList();
530#endif
531 }
532
533 "NIU_SetTxRingKick": {
534 evnt = new;
535 evnt.pc = pc;
536 evnt.routine = items[i]; i++;
537
538 str = items[i]; i++;
539 evnt.tid = str.atohex(); // mac_port
540
541 str = items[i]; i++;
542 evnt.misc64B = str.atohex(); // dma_no
543
544 str = items[i]; i++;
545 evnt.misc01A = str.atohex(); // tx_multi_port
546
547 str = items[i]; i++;
548 if (str.match("0x")) str = str.postmatch();
549 evnt.misc64C = str.atohex(); // tx_multi_dma_p0
550
551 str = items[i]; i++;
552 if (str.match("0x")) str = str.postmatch();
553 evnt.misc64D = str.atohex(); // tx_multi_dma_p1
554
555 str = items[i]; i++;
556 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
557
558 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
559 else userEventsList[pc] = evnt;
560
561#ifdef DEBUGASMEVENTSTOVERA
562 userEventsList[pc].printList();
563#endif
564 }
565
566 "NIU_SetTxMaxBurst": {
567 evnt = new;
568 evnt.pc = pc;
569 evnt.routine = items[i]; i++;
570
571 str = items[i]; i++;
572 evnt.misc01B = str.atohex(); // mac_port
573
574 str = items[i]; i++;
575 evnt.misc64B = str.atohex(); // dma_no
576
577 str = items[i]; i++;
578 evnt.misc64A = str.atohex(); // SetTxMaxBurst_Data
579
580 str = items[i]; i++;
581 evnt.misc01A = str.atohex(); // tx_multi_port
582
583 str = items[i]; i++;
584 if (str.match("0x")) str = str.postmatch();
585 evnt.misc64C = str.atohex(); // tx_multi_dma_p0
586
587 str = items[i]; i++;
588 if (str.match("0x")) str = str.postmatch();
589 evnt.misc64D = str.atohex(); // tx_multi_dma_p1
590
591 str = items[i]; i++;
592 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
593
594 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
595 else userEventsList[pc] = evnt;
596
597#ifdef DEBUGASMEVENTSTOVERA
598 userEventsList[pc].printList();
599#endif
600 }
601
602 "NIU_InitTxDma": {
603 evnt = new;
604 evnt.pc = pc;
605 evnt.routine = items[i]; i++;
606
607 str = items[i]; i++;
608 evnt.misc01B = str.atohex(); // mac_port
609
610 str = items[i]; i++;
611 evnt.misc64B = str.atohex(); // dma_no
612
613// str = items[i]; i++;
614// evnt.tid = str.atohex(); dma_no
615
616 str = items[i]; i++;
617 evnt.misc64A = str.atohex(); // Xlate
618
619 str = items[i]; i++;
620 evnt.misc01A = str.atohex(); // tx_multi_port
621
622 str = items[i]; i++;
623 if (str.match("0x")) str = str.postmatch();
624 evnt.misc64C = str.atohex(); // tx_multi_dma_p0
625
626 str = items[i]; i++;
627 if (str.match("0x")) str = str.postmatch();
628 evnt.misc64D = str.atohex(); // tx_multi_dma_p1
629
630 str = items[i]; i++;
631 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
632
633 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
634 else userEventsList[pc] = evnt;
635
636#ifdef DEBUGASMEVENTSTOVERA
637 userEventsList[pc].printList();
638#endif
639
640 }
641
642
643 "NIU_TxDMAActivate": {
644 evnt = new;
645 evnt.pc = pc;
646 evnt.routine = items[i]; i++;
647
648 str = items[i]; i++;
649 evnt.misc64B = str.atohex(); // mac_port
650
651 str = items[i]; i++;
652 evnt.tid = str.atohex(); // dma_activelist
653// i++;
654
655 str = items[i]; i++;
656 evnt.misc01A = str.atohex(); // tx_multi_port
657
658 str = items[i]; i++;
659 if (str.match("0x")) str = str.postmatch();
660 evnt.misc64C = str.atohex(); // tx_multi_dma_p0
661
662 str = items[i]; i++;
663 if (str.match("0x")) str = str.postmatch();
664 evnt.misc64D = str.atohex(); // tx_multi_dma_p1
665
666 str = items[i]; i++;
667 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
668
669 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
670 else userEventsList[pc] = evnt;
671
672#ifdef DEBUGASMEVENTSTOVERA
673 userEventsList[pc].printList();
674#endif
675
676 }
677
678 "NIU_EXIT_chk": {
679 evnt = new;
680 evnt.pc = pc;
681 evnt.routine = items[i]; i++;
682 str = items[i]; i++;
683 evnt.misc64B = str.atohex(); // mac_port
684
685 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
686 else userEventsList[pc] = evnt;
687
688#ifdef DEBUGASMEVENTSTOVERA
689 userEventsList[pc].printList();
690#endif
691
692 }
693
694 "TxPktGen": {
695 evnt = new;
696 evnt.pc = pc;
697 evnt.routine = items[i]; i++;
698
699 str = items[i]; i++;
700 evnt.misc64A = str.atohex(); // mac_port
701
702 str = items[i]; i++;
703 evnt.tid = str.atohex(); // dma channel
704
705 str = items[i]; i++;
706 if (str.match("0x")) str = str.postmatch();
707 evnt.misc64B = str.atohex(); // num of packets
708
709 str = items[i]; i++;
710 evnt.misc01A = str.atohex(); // tx_multi_port
711
712 str = items[i]; i++;
713 if (str.match("0x")) str = str.postmatch();
714 evnt.misc64C = str.atohex(); // tx_multi_dma_p0
715
716 str = items[i]; i++;
717 if (str.match("0x")) str = str.postmatch();
718 evnt.misc64D = str.atohex(); // tx_multi_dma_p1
719
720 str = items[i]; i++;
721 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
722
723 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
724 else userEventsList[pc] = evnt;
725
726#ifdef DEBUGASMEVENTSTOVERA
727 userEventsList[pc].printList();
728#endif
729
730 }
731
732 "NIU_InitRxDma": {
733 evnt = new;
734 evnt.pc = pc;
735 evnt.routine = items[i]; i++;
736
737 str = items[i]; i++;
738 if (str.match("0x")) str = str.postmatch();
739 evnt.tid = str.atohex(); // RxDmaChnlNo
740
741 str = items[i]; i++;
742 if (str.match("0x")) str = str.postmatch();
743 evnt.misc64A = str.atohex(); // RxDescRingLen
744
745 str = items[i]; i++;
746 if (str.match("0x")) str = str.postmatch();
747 evnt.misc64B = str.atohex(); // RxRingStartAddr
748
749 str = items[i]; i++;
750 if (str.match("0x")) str = str.postmatch();
751 evnt.misc64C = str.atohex(); // RbrConfData
752
753 str = items[i]; i++;
754 if (str.match("0x")) str = str.postmatch();
755 evnt.misc64D = str.atohex(); // RxInitKick
756
757 str = items[i]; i++;
758 evnt.misc01A = str.atohex(); // Xlate
759
760 str = items[i]; i++;
761 if (str.match("0x")) str = str.postmatch();
762 evnt.misc64E = str.atohex(); // multi_dma
763
764 str = items[i]; i++;
765 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
766
767 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
768 else userEventsList[pc] = evnt;
769
770#ifdef DEBUGASMEVENTSTOVERA
771 userEventsList[pc].printList();
772#endif
773
774 }
775
776 "NIU_RxPktConf": {
777 evnt = new;
778 evnt.pc = pc;
779 evnt.routine = items[i]; i++;
780 str = items[i]; i++;
781 if (str.match("0x")) str = str.postmatch();
782 evnt.tid = str.atohex(); // RxPktCnt
783//KH
784 str = items[i]; i++;
785 if (str.match("0x")) str = str.postmatch();
786 evnt.misc64A = str.atohex(); // iport
787
788 str = items[i]; i++;
789 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
790
791 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
792 else userEventsList[pc] = evnt;
793
794#ifdef DEBUGASMEVENTSTOVERA
795 userEventsList[pc].printList();
796#endif
797
798 }
799
800 "NIU_RxGenPkt": {
801 evnt = new;
802 evnt.pc = pc;
803 evnt.routine = items[i]; i++;
804 str = items[i]; i++;
805 evnt.tid = str.atohex(); // mac_port
806
807 str = items[i]; i++;
808 if (str.match("0x")) str = str.postmatch();
809 evnt.misc64A = str.atohex(); // RxDmaChnlNo
810
811 str = items[i]; i++;
812 if (str.match("0x")) str = str.postmatch();
813 evnt.misc64B = str.atohex(); // RxPktCnt
814
815 str = items[i]; i++;
816 if (str.match("0x")) str = str.postmatch();
817 evnt.misc64C = str.atohex(); // RxPktLen
818
819//KH
820 str = items[i]; i++;
821 evnt.misc01B = str.atohex(); // multi_port
822
823 str = items[i]; i++;
824 if (str.match("0x")) str = str.postmatch();
825 evnt.misc64D = str.atohex(); // multi_dma
826
827 str = items[i]; i++;
828 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
829
830 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
831 else userEventsList[pc] = evnt;
832
833#ifdef DEBUGASMEVENTSTOVERA
834 userEventsList[pc].printList();
835#endif
836
837 }
838
839
840 // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) -> marker("text", thisTid, multiShot) bootEnd|goodTrap|badTrap
841 "marker": {
842 evnt = new;
843 evnt.pc = pc;
844 evnt.routine = items[i]; i++;
845 evnt.miscStrA = items[i]; i++;
846 // optional params
847 str = items[i]; i++;
848 if (str !== "*") evnt.thisTid = str.atohex(); // thisTid
849 str = items[i]; i++;
850 if (str !== "*") evnt.multiShot = str.atohex(); // multiShot
851
852 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
853 else userEventsList[pc] = evnt;
854
855#ifdef DEBUGASMEVENTSTOVERA
856 userEventsList[pc].printList();
857#endif
858
859 }
860
861 "reset_now": {
862 evnt = new;
863 evnt.pc = pc;
864 evnt.routine = items[i]; i++;
865 evnt.miscStrA = items[i]; i++;
866 // optional params
867 str = items[i]; i++;
868 if (str !== "*") evnt.multiShot = str.atohex(); // multiShot
869
870 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
871 else userEventsList[pc] = evnt;
872
873#ifdef DEBUGASMEVENTSTOVERA
874 userEventsList[pc].printList();
875#endif
876
877 }
878
879
880 //-----------------------------------------------------------
881 // Start PCIe link training after boot
882 //-----------------------------------------------------------
883 "set_StartPEUTest": {
884 evnt = new;
885 evnt.pc = pc;
886 evnt.routine = items[i]; i++;
887
888 str = items[i]; i++;
889 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
890
891 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
892 else userEventsList[pc] = evnt;
893
894#ifdef DEBUGASMEVENTSTOVERA
895 userEventsList[pc].printList();
896#endif
897
898 }
899
900 //-----------------------------------------------------------
901 // Transmit a PCIe Egress command.
902 // detailed description in
903 // :/verif/env/fc/vera/classes/asmToVeraIntf.vr
904 //-----------------------------------------------------------
905 "EnablePCIeEgCmd": {
906 evnt = new;
907 evnt.pc = pc;
908 evnt.routine = items[i]; i++;
909
910 str = items[i]; i++;
911 evnt.miscStrA = str; // Command type
912
913 str = items[i]; i++;
914 evnt.misc64A = str.atohex(); // Address
915
916 str = items[i]; i++;
917 evnt.misc64B = str.atohex(); // length
918
919 str = items[i]; i++;
920 evnt.misc64C = str.atohex(); // start data. Denali generates incr. data
921
922 str = items[i]; i++;
923 if (str == "*") evnt.miscStrB = ""; // default value
924 else evnt.miscStrB = str; // optional errors
925
926 str = items[i]; i++;
927 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
928
929
930 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
931 else userEventsList[pc] = evnt;
932
933#ifdef DEBUGASMEVENTSTOVERA
934 userEventsList[pc].printList();
935#endif
936
937 }
938
939 //-----------------------------------------------------------
940 // Transmit a PCIe Ingress command.
941 // detailed description in
942 // :/verif/env/fc/vera/classes/asmToVeraIntf.vr
943 //-----------------------------------------------------------
944 "EnablePCIeIgCmd": {
945 evnt = new;
946 evnt.pc = pc;
947 evnt.routine = items[i]; i++;
948
949 str = items[i]; i++;
950 evnt.miscStrA = str; // Command type
951
952 str = items[i]; i++;
953 evnt.misc64A = str.atohex(); // Start of Address range
954
955 str = items[i]; i++;
956 evnt.misc64B = str.atohex(); // End of Address range
957
958 str = items[i]; i++;
959 evnt.miscStrC = str; // length
960
961 str = items[i]; i++;
962 evnt.misc64D = str.atohex(); // # of commands
963
964 str = items[i]; i++;
965 if (str == "*") evnt.miscStrB = ""; // default value
966 else evnt.miscStrB = str; // optional errors
967
968 str = items[i]; i++;
969 if (str == "*") evnt.multiShot = 1; // default to always multishot
970 else evnt.multiShot = str.atohex(); // optional multiShot
971
972
973 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
974 else userEventsList[pc] = evnt;
975
976#ifdef DEBUGASMEVENTSTOVERA
977 userEventsList[pc].printList();
978#endif
979
980 }
981
982
983 //////////////////////////////////////////////////////////////////
984 // ERROR exents in this section
985
986 "errCpxPkt": { // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) -> errCpxPkt(0,0,2)
987 evnt = new;
988 evnt.pc = pc;
989 evnt.routine = items[i]; i++;
990 str = items[i]; i++;
991 evnt.tid = str.atohex(); // match tid
992 str = items[i]; i++;
993 evnt.misc64D = str.atohex(); // pkt type match for err
994 str = items[i]; i++;
995 evnt.misc64C = str.atohex(); // value for error bits
996 // optional params
997 str = items[i]; i++;
998 if (str == "*") evnt.misc64A = 0;
999 else evnt.misc64A = str.atohex(); // optional ifill2 indicator
1000 str = items[i]; i++;
1001 if (str == "*") evnt.misc64B = 64'hffffffffffffffff;
1002 else evnt.misc64B = str.atohex(); // optional addr to match as well
1003 str = items[i]; i++;
1004 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
1005// str = items[i]; i++;
1006// if (str !== "*") evnt.wait = str.atohex(); // optional wait
1007
1008 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
1009 else userEventsList[pc] = evnt;
1010
1011
1012#ifdef DEBUGASMEVENTSTOVERA
1013 userEventsList[pc].printList();
1014#endif
1015
1016 }
1017
1018 "errIndicationL2Pkt": { // !$EV trig_pc_d(1, @VA(.MAIN.label_3)) -> errIndicationL2Pkt(3, 2, 1)
1019 evnt = new;
1020 evnt.pc = pc;
1021 evnt.routine = items[i]; i++;
1022 str = items[i]; i++;
1023 evnt.tid = str.atohex(); // drive tid
1024 str = items[i]; i++;
1025 evnt.misc64A = str.atohex(); // value to drive for error bits
1026 str = items[i]; i++;
1027 evnt.misc01A = str.atohex(); // pkt NC field value on error
1028
1029 // optional params
1030 str = items[i]; i++;
1031 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
1032// str = items[i]; i++;
1033// if (str !== "*") evnt.wait = str.atohex(); // optional wait
1034
1035 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
1036 else userEventsList[pc] = evnt;
1037
1038
1039#ifdef DEBUGASMEVENTSTOVERA
1040 userEventsList[pc].printList();
1041#endif
1042
1043 }
1044
1045 "errIndicationSOCPkt": { // !$EV trig_pc_d(1, @VA(.MAIN.label_3)) -> errIndicationSOCPkt(3, 2, 1)
1046 evnt = new;
1047 evnt.pc = pc;
1048 evnt.routine = items[i]; i++;
1049 str = items[i]; i++;
1050 evnt.tid = str.atohex(); // drive tid
1051 str = items[i]; i++;
1052 evnt.misc64A = str.atohex(); // value to drive for error bits
1053 // optional params
1054 str = items[i]; i++;
1055 if (str !== "*") evnt.multiShot = str.atohex(); // optional multiShot
1056// str = items[i]; i++;
1057// if (str !== "*") evnt.wait = str.atohex(); // optional wait
1058
1059 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
1060 else userEventsList[pc] = evnt;
1061
1062
1063#ifdef DEBUGASMEVENTSTOVERA
1064 userEventsList[pc].printList();
1065#endif
1066
1067 }
1068// The way parameter is overloaded. For ICDP errors it represents the
1069// inst in which to inject err. ICDP errors are injected in way 0.
1070// For ICVP, ICTP, and ICMH it represets the way.
1071 // ! $EV trig_pc_d(1,@VA(.MAIN.label)) ->
1072 // IC_hard_err_inj(reg [3:0] err_type, reg [48:0] va, reg [2:0] way, reg [7:0] tid)
1073 //
1074 "IC_hard_err_inj": {
1075 evnt = new;
1076 evnt.pc = pc;
1077 evnt.routine = items[i]; i++;
1078 str = items[i]; i++;
1079 evnt.misc64A = str.atohex(); // err_type
1080 str = items[i]; i++;
1081 evnt.misc64B = str.atohex(); // address
1082 str = items[i]; i++;
1083 if (str == "*") evnt.misc64C = 3'h0;
1084 else evnt.misc64C = str.atohex(); // way
1085 str = items[i]; i++;
1086 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1087
1088 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
1089 else userEventsList[pc] = evnt;
1090
1091#ifdef DEBUGASMEVENTSTOVERA
1092 userEventsList[pc].printList();
1093#endif
1094 }
1095
1096 // ! $EV trig_pc_d(1,@VA(.MAIN.label)) ->
1097 // DC_hard_err_inj(reg [3:0] err_type, reg [6:0] index, reg [1:0] way, reg [7:0] tid)
1098 //
1099 "DC_hard_err_inj": {
1100 evnt = new;
1101 evnt.pc = pc;
1102 evnt.routine = items[i]; i++;
1103 str = items[i]; i++;
1104 evnt.misc64A = str.atohex(); // err_type
1105 str = items[i]; i++;
1106 evnt.misc64B = str.atohex(); // address
1107 str = items[i]; i++;
1108 if (str == "*") evnt.misc64C = 2'h0;
1109 else evnt.misc64C = str.atohex(); // way
1110 str = items[i]; i++;
1111 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1112
1113 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
1114 else userEventsList[pc] = evnt;
1115
1116#ifdef DEBUGASMEVENTSTOVERA
1117 userEventsList[pc].printList();
1118#endif
1119 }
1120
1121 // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1122 // DTLB_err_enable(reg [2:0] err_type, integer err_freq, reg merr,
1123 // integer burst_len, integer burst_freq,reg [7:0] tid)
1124 //
1125 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1126 "DTLB_err_enable": {
1127
1128 evnt = new(TMPEVENT);
1129 evnt.routine = items[i]; i++;
1130
1131 // all optional params
1132 str = items[i]; i++;
1133 if (str == "*") evnt.misc64A = 3'h7;
1134 else evnt.misc64A = str.atohex(); // err_type = 3'h7
1135 str = items[i]; i++;
1136 if (str == "*") evnt.miscIntA = -1;
1137 else evnt.miscIntA = str.atoi(); // err_freq = -1
1138 str = items[i]; i++;
1139 if (str == "*") evnt.misc64B = 2'h3;
1140 else evnt.misc64B = str.atohex(); // merr = 2'h3
1141 str = items[i]; i++;
1142 if (str == "*") evnt.miscIntB = -1;
1143 else evnt.miscIntB = str.atoi(); // burst_len = -1
1144 str = items[i]; i++;
1145 if (str == "*") evnt.miscIntC = -1;
1146 else evnt.miscIntC = str.atoi(); // burst_freq = -1
1147 str = items[i]; i++;
1148 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1149
1150 asmToVeraIntf.DTLB_err_enable(evnt.misc64A,
1151 evnt.miscIntA,
1152 evnt.misc64B,
1153 evnt.miscIntB,
1154 evnt.miscIntC,
1155 evnt.tid);
1156
1157#ifdef DEBUGASMEVENTSTOVERA
1158 evnt.printList();
1159#endif
1160 evnt = null;
1161
1162 }
1163
1164 // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1165 // ITLB_err_enable(reg [2:0] err_type, integer err_freq, reg merr,
1166 // integer burst_len, integer burst_freq,bit [7:0] tid)
1167 //
1168 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1169 "ITLB_err_enable": {
1170
1171 evnt = new(TMPEVENT);
1172 evnt.routine = items[i]; i++;
1173
1174 // all optional params
1175 str = items[i]; i++;
1176 if (str == "*") evnt.misc64A = 3'h7;
1177 else evnt.misc64A = str.atohex(); // err_type = 3'h7
1178 str = items[i]; i++;
1179 if (str == "*") evnt.miscIntA = -1;
1180 else evnt.miscIntA = str.atoi(); // err_freq = -1
1181 str = items[i]; i++;
1182 if (str == "*") evnt.misc64B = 2'h3;
1183 else evnt.misc64B = str.atohex(); // merr = 2'h3
1184 str = items[i]; i++;
1185 if (str == "*") evnt.miscIntB = -1;
1186 else evnt.miscIntB = str.atoi(); // burst_len = -1
1187 str = items[i]; i++;
1188 if (str == "*") evnt.miscIntC = -1;
1189 else evnt.miscIntC = str.atoi(); // burst_freq = -1
1190 str = items[i]; i++;
1191 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1192
1193 asmToVeraIntf.ITLB_err_enable(evnt.misc64A,
1194 evnt.miscIntA,
1195 evnt.misc64B,
1196 evnt.miscIntB,
1197 evnt.miscIntC,
1198 evnt.tid);
1199
1200#ifdef DEBUGASMEVENTSTOVERA
1201 evnt.printList();
1202#endif
1203 evnt = null;
1204
1205 }
1206
1207 // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1208 // DC_err_enable(reg [3:0] err_type, integer err_freq, reg merr,
1209 // integer burst_len, integer burst_freq,reg [7:0] tid)
1210 //
1211 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1212 "DC_err_enable": {
1213
1214 evnt = new(TMPEVENT);
1215 evnt.routine = items[i]; i++;
1216
1217 // all optional params
1218 str = items[i]; i++;
1219 if (str == "*") evnt.misc64A = 4'hF;
1220 else evnt.misc64A = str.atohex(); // err_type = 4'hF
1221 str = items[i]; i++;
1222 if (str == "*") evnt.miscIntA = -1;
1223 else evnt.miscIntA = str.atoi(); // err_freq = -1
1224 str = items[i]; i++;
1225 if (str == "*") evnt.misc64B = 2'h3;
1226 else evnt.misc64B = str.atohex(); // merr = 2'h3
1227 str = items[i]; i++;
1228 if (str == "*") evnt.miscIntB = -1;
1229 else evnt.miscIntB = str.atoi(); // burst_len = -1
1230 str = items[i]; i++;
1231 if (str == "*") evnt.miscIntC = -1;
1232 else evnt.miscIntC = str.atoi(); // burst_freq = -1
1233 str = items[i]; i++;
1234 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1235
1236
1237 asmToVeraIntf.DC_err_enable(evnt.misc64A,
1238 evnt.miscIntA,
1239 evnt.misc64B,
1240 evnt.miscIntB,
1241 evnt.miscIntC,
1242 evnt.tid);
1243
1244#ifdef DEBUGASMEVENTSTOVERA
1245 evnt.printList();
1246#endif
1247 evnt = null;
1248
1249 }
1250
1251 // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1252 // IC_err_enable(reg [3:0] err_type, integer err_freq, reg merr,
1253 // integer burst_len, integer burst_freq,reg [7:0] tid)
1254 //
1255 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1256 "IC_err_enable": {
1257
1258 evnt = new(TMPEVENT);
1259 evnt.routine = items[i]; i++;
1260
1261 // all optional params
1262 str = items[i]; i++;
1263 if (str == "*") evnt.misc64A = 4'hF;
1264 else evnt.misc64A = str.atohex(); // err_type = 4'hF
1265 str = items[i]; i++;
1266 if (str == "*") evnt.miscIntA = -1;
1267 else evnt.miscIntA = str.atoi(); // err_freq = -1
1268 str = items[i]; i++;
1269 if (str == "*") evnt.misc64B = 2'h3;
1270 else evnt.misc64B = str.atohex(); // merr = 2'h3
1271 str = items[i]; i++;
1272 if (str == "*") evnt.miscIntB = -1;
1273 else evnt.miscIntB = str.atoi(); // burst_len = -1
1274 str = items[i]; i++;
1275 if (str == "*") evnt.miscIntC = -1;
1276 else evnt.miscIntC = str.atoi(); // burst_freq = -1
1277 str = items[i]; i++;
1278 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1279
1280
1281 asmToVeraIntf.IC_err_enable(evnt.misc64A,
1282 evnt.miscIntA,
1283 evnt.misc64B,
1284 evnt.miscIntB,
1285 evnt.miscIntC,
1286 evnt.tid);
1287
1288#ifdef DEBUGASMEVENTSTOVERA
1289 evnt.printList();
1290#endif
1291 evnt = null;
1292
1293 }
1294 // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1295 // STB_err_enable(reg [4:0] err_type, integer err_freq, reg merr,
1296 // integer burst_len, integer burst_freq, reg ue_en,
1297 // integer ce_wt, reg [7:0] tid)
1298 //
1299 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1300 "STB_err_enable": {
1301
1302 evnt = new(TMPEVENT);
1303 evnt.routine = items[i]; i++;
1304
1305 // all optional params
1306 str = items[i]; i++;
1307 if (str == "*") evnt.misc64A = 5'h1F;
1308 else evnt.misc64A = str.atohex(); // err_type = 5'h1F
1309 str = items[i]; i++;
1310 if (str == "*") evnt.miscIntA = -1;
1311 else evnt.miscIntA = str.atoi(); // err_freq = -1
1312 str = items[i]; i++;
1313 if (str == "*") evnt.misc64B = 2'h3;
1314 else evnt.misc64B = str.atohex(); // merr = 2'h3
1315 str = items[i]; i++;
1316 if (str == "*") evnt.miscIntB = -1;
1317 else evnt.miscIntB = str.atoi(); // burst_len = -1
1318 str = items[i]; i++;
1319 if (str == "*") evnt.miscIntC = -1;
1320 else evnt.miscIntC = str.atoi(); // burst_freq = -1
1321 str = items[i]; i++;
1322 if (str == "*") evnt.misc64C = 2'h3;
1323 else evnt.misc64C = str.atohex(); // ue_en = 2'h3
1324 str = items[i]; i++;
1325 if (str == "*") evnt.miscIntD = -1;
1326 else evnt.miscIntD = str.atoi(); // ce_wt = -1
1327 str = items[i]; i++;
1328 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1329
1330
1331 asmToVeraIntf.STB_err_enable(evnt.misc64A,
1332 evnt.miscIntA,
1333 evnt.misc64B,
1334 evnt.miscIntB,
1335 evnt.miscIntC,
1336 evnt.misc64C,
1337 evnt.miscIntD,
1338 evnt.tid);
1339
1340#ifdef DEBUGASMEVENTSTOVERA
1341 evnt.printList();
1342#endif
1343 evnt = null;
1344
1345 }
1346
1347// ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1348 // MRA_err_enable(reg [1:0] err_type, integer err_freq, reg [7:0] mra_entry,
1349 // reg wr_en, integer burst_len, integer burst_freq, reg [7:0] tid)
1350 //
1351 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1352 "MRA_err_enable": {
1353
1354 evnt = new(TMPEVENT);
1355 evnt.routine = items[i]; i++;
1356
1357 // all optional params
1358 str = items[i]; i++;
1359 if (str == "*") evnt.misc64A = 2'h3;
1360 else evnt.misc64A = str.atohex(); // err_type = 2'h3
1361 str = items[i]; i++;
1362 if (str == "*") evnt.miscIntA = -1;
1363 else evnt.miscIntA = str.atoi(); // err_freq = -1
1364 str = items[i]; i++;
1365 if (str == "*") evnt.misc64B = 8'hff;
1366 else evnt.misc64B = str.atohex(); // mra_entry = 8'hff
1367 str = items[i]; i++;
1368 if (str == "*") evnt.misc64C = 2'h3;
1369 else evnt.misc64C = str.atohex(); // wr_en = 2'h3
1370 str = items[i]; i++;
1371 if (str == "*") evnt.miscIntB = -1;
1372 else evnt.miscIntB = str.atoi(); // burst_len = -1
1373 str = items[i]; i++;
1374 if (str == "*") evnt.miscIntC = -1;
1375 else evnt.miscIntC = str.atoi(); // burst_freq = -1
1376 str = items[i]; i++;
1377 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1378
1379
1380 asmToVeraIntf.MRA_err_enable(evnt.misc64A,
1381 evnt.miscIntA,
1382 evnt.misc64B,
1383 evnt.misc64C,
1384 evnt.miscIntB,
1385 evnt.miscIntC,
1386 evnt.tid);
1387
1388#ifdef DEBUGASMEVENTSTOVERA
1389 evnt.printList();
1390#endif
1391 evnt = null;
1392
1393 }
1394
1395// ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1396 // IRF_err_enable(reg [2:0] err_type, integer err_freq, integer ce_wt, reg merr,
1397 // integer burst_len, integer burst_freq,reg [7:0] tid)
1398 //
1399 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1400 "IRF_err_enable": {
1401
1402 evnt = new(TMPEVENT);
1403 evnt.routine = items[i]; i++;
1404
1405 // all optional params
1406 str = items[i]; i++;
1407 if (str == "*") evnt.misc64A = 3'h7;
1408 else evnt.misc64A = str.atohex(); // err_type = 3'h7
1409 str = items[i]; i++;
1410 if (str == "*") evnt.miscIntA = -1;
1411 else evnt.miscIntA = str.atoi(); // err_freq = -1
1412 str = items[i]; i++;
1413 if (str == "*") evnt.miscIntB = -1;
1414 else evnt.miscIntB = str.atoi(); // ce_wt = -1
1415 str = items[i]; i++;
1416 if (str == "*") evnt.misc64B = 2'h3;
1417 else evnt.misc64B = str.atohex(); // merr = 2'h3
1418 str = items[i]; i++;
1419 if (str == "*") evnt.miscIntC = -1;
1420 else evnt.miscIntC = str.atoi(); // burst_len = -1
1421 str = items[i]; i++;
1422 if (str == "*") evnt.miscIntD = -1;
1423 else evnt.miscIntD = str.atoi(); // burst_freq = -1
1424 str = items[i]; i++;
1425 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1426
1427
1428 asmToVeraIntf.IRF_err_enable(evnt.misc64A,
1429 evnt.miscIntA,
1430 evnt.miscIntB,
1431 evnt.misc64B,
1432 evnt.miscIntC,
1433 evnt.miscIntD,
1434 evnt.tid);
1435
1436#ifdef DEBUGASMEVENTSTOVERA
1437 evnt.printList();
1438#endif
1439 evnt = null;
1440
1441 }
1442
1443// ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1444 // FRF_err_enable(reg [2:0] err_type, integer err_freq, integer ce_wt, reg merr,
1445 // integer burst_len, integer burst_freq,reg [7:0] tid)
1446 //
1447 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1448 "FRF_err_enable": {
1449
1450 evnt = new(TMPEVENT);
1451 evnt.routine = items[i]; i++;
1452
1453 // all optional params
1454 str = items[i]; i++;
1455 if (str == "*") evnt.misc64A = 3'h7;
1456 else evnt.misc64A = str.atohex(); // err_type = 3'h7
1457 str = items[i]; i++;
1458 if (str == "*") evnt.miscIntA = -1;
1459 else evnt.miscIntA = str.atoi(); // err_freq = -1
1460 str = items[i]; i++;
1461 if (str == "*") evnt.miscIntB = -1;
1462 else evnt.miscIntB = str.atoi(); // ce_wt = -1
1463 str = items[i]; i++;
1464 if (str == "*") evnt.misc64B = 2'h3;
1465 else evnt.misc64B = str.atohex(); // merr = 2'h3
1466 str = items[i]; i++;
1467 if (str == "*") evnt.miscIntC = -1;
1468 else evnt.miscIntC = str.atoi(); // burst_len = -1
1469 str = items[i]; i++;
1470 if (str == "*") evnt.miscIntD = -1;
1471 else evnt.miscIntD = str.atoi(); // burst_freq = -1
1472 str = items[i]; i++;
1473 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1474
1475
1476 asmToVeraIntf.FRF_err_enable(evnt.misc64A,
1477 evnt.miscIntA,
1478 evnt.miscIntB,
1479 evnt.misc64B,
1480 evnt.miscIntC,
1481 evnt.miscIntD,
1482 evnt.tid);
1483
1484#ifdef DEBUGASMEVENTSTOVERA
1485 evnt.printList();
1486#endif
1487 evnt = null;
1488
1489 }
1490
1491// ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1492 // SCA_err_enable(integer err_freq, integer ce_wt,
1493 // integer burst_len, integer burst_freq, reg [7:0] tid)
1494 //
1495 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1496 "SCA_err_enable": {
1497
1498 evnt = new(TMPEVENT);
1499 evnt.routine = items[i]; i++;
1500
1501 // all optional params
1502 str = items[i]; i++;
1503 if (str == "*") evnt.miscIntA = -1;
1504 else evnt.miscIntA = str.atoi(); // err_freq = -1
1505 str = items[i]; i++;
1506 if (str == "*") evnt.miscIntB = -1;
1507 else evnt.miscIntB = str.atoi(); // ce_wt = -1
1508 str = items[i]; i++;
1509 if (str == "*") evnt.miscIntC = -1;
1510 else evnt.miscIntC = str.atoi(); // burst_len = -1
1511 str = items[i]; i++;
1512 if (str == "*") evnt.miscIntD = -1;
1513 else evnt.miscIntD = str.atoi(); // burst_freq = -1
1514 str = items[i]; i++;
1515 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1516
1517
1518 asmToVeraIntf.SCA_err_enable(evnt.miscIntA,
1519 evnt.miscIntB,
1520 evnt.miscIntC,
1521 evnt.miscIntD,
1522 evnt.tid);
1523
1524#ifdef DEBUGASMEVENTSTOVERA
1525 evnt.printList();
1526#endif
1527 evnt = null;
1528
1529 }
1530
1531// ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1532 // TSA_err_enable(reg [1:0] err_type, integer err_freq, reg [6:0] tsa_entry,
1533 // reg wr_en, integer ce_wt, integer burst_len, integer burst_freq, reg [7:0] tid)
1534 //
1535 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1536 "TSA_err_enable": {
1537
1538 evnt = new(TMPEVENT);
1539 evnt.routine = items[i]; i++;
1540
1541 // all optional params
1542 str = items[i]; i++;
1543 if (str == "*") evnt.misc64A = 2'h3;
1544 else evnt.misc64A = str.atohex(); // err_type = 2'h3
1545 str = items[i]; i++;
1546 if (str == "*") evnt.miscIntA = -1;
1547 else evnt.miscIntA = str.atoi(); // err_freq = -1
1548 str = items[i]; i++;
1549 if (str == "*") evnt.misc64B = 7'h7f;
1550 else evnt.misc64B = str.atohex(); // tsa_entry = 7'h7f
1551 str = items[i]; i++;
1552 if (str == "*") evnt.misc64C = 2'h3;
1553 else evnt.misc64C = str.atohex(); // wr_en = 2'h3
1554 str = items[i]; i++;
1555 if (str == "*") evnt.miscIntB = -1;
1556 else evnt.miscIntB = str.atoi(); // ce_wt = -1
1557 str = items[i]; i++;
1558 if (str == "*") evnt.miscIntC = -1;
1559 else evnt.miscIntC = str.atoi(); // burst_len = -1
1560 str = items[i]; i++;
1561 if (str == "*") evnt.miscIntD = -1;
1562 else evnt.miscIntD = str.atoi(); // burst_freq = -1
1563 str = items[i]; i++;
1564 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1565
1566
1567 asmToVeraIntf.TSA_err_enable(evnt.misc64A,
1568 evnt.miscIntA,
1569 evnt.misc64B,
1570 evnt.misc64C,
1571 evnt.miscIntB,
1572 evnt.miscIntC,
1573 evnt.miscIntD,
1574 evnt.tid);
1575
1576#ifdef DEBUGASMEVENTSTOVERA
1577 evnt.printList();
1578#endif
1579 evnt = null;
1580
1581 }
1582
1583 // ! $EV trig_pc_d(1,@VA(.MAIN.R3_th3r1)) ->
1584 // TCC_err_enable(reg [1:0] err_type, integer err_freq, integer ce_wt,
1585 // integer burst_len, integer burst_freq,bit [7:0] tid)
1586 //
1587 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1588 "TCC_err_enable": {
1589
1590 evnt = new(TMPEVENT);
1591 evnt.routine = items[i]; i++;
1592
1593 // all optional params
1594 str = items[i]; i++;
1595 if (str == "*") evnt.misc64A = 2'h3;
1596 else evnt.misc64A = str.atohex(); // err_type = 2'h3
1597 str = items[i]; i++;
1598 if (str == "*") evnt.miscIntA = -1;
1599 else evnt.miscIntA = str.atoi(); // err_freq = -1
1600 str = items[i]; i++;
1601 if (str == "*") evnt.miscIntB = -1;
1602 else evnt.miscIntB = str.atoi(); // ce_wt = -1
1603 str = items[i]; i++;
1604 if (str == "*") evnt.miscIntC = -1;
1605 else evnt.miscIntC = str.atoi(); // burst_len = -1
1606 str = items[i]; i++;
1607 if (str == "*") evnt.miscIntD = -1;
1608 else evnt.miscIntD = str.atoi(); // burst_freq = -1
1609 str = items[i]; i++;
1610 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1611
1612 asmToVeraIntf.TCC_err_enable(evnt.misc64A,
1613 evnt.miscIntA,
1614 evnt.miscIntB,
1615 evnt.miscIntC,
1616 evnt.miscIntD,
1617 evnt.tid);
1618
1619#ifdef DEBUGASMEVENTSTOVERA
1620 evnt.printList();
1621#endif
1622 evnt = null;
1623
1624 }
1625
1626 // L2C_err_enable(bit [5:0] err_type, integer err_freq, integer ce_wt, integer nd_wt
1627 // integer burst_len, integer burst_freq
1628 // bit [7:0] tid)
1629 //
1630 // THIS IS AN IMMEDIATE ACTION AT TIME ZERO SO JUST CALL THE FINAL TASK NOW.
1631 "L2C_err_enable": {
1632
1633 evnt = new(TMPEVENT);
1634 evnt.routine = items[i]; i++;
1635
1636 // all optional params
1637 str = items[i]; i++;
1638 if (str == "*") evnt.misc64A = 6'h3F;
1639 else evnt.misc64A = str.atohex(); // err_type = 6'h3F
1640 str = items[i]; i++;
1641
1642 if (str == "*") evnt.miscIntA = -1;
1643 else evnt.miscIntA = str.atoi(); // err_freq = -1
1644 str = items[i]; i++;
1645
1646 if (str == "*") evnt.miscIntB = -1;
1647 else evnt.miscIntB = str.atoi(); // ce_wt = -1
1648 str = items[i]; i++;
1649
1650 if (str == "*") evnt.miscIntC = -1;
1651 else evnt.miscIntC = str.atoi(); // nd_wt = -1
1652 str = items[i]; i++;
1653
1654 if (str == "*") evnt.miscIntD = -1;
1655 else evnt.miscIntD = str.atoi(); // burst_len = -1
1656 str = items[i]; i++;
1657
1658 if (str == "*") evnt.miscIntE = -1;
1659 else evnt.miscIntE = str.atoi(); // burst_freq = -1
1660 str = items[i]; i++;
1661
1662 if (str !== "*") evnt.tid = str.atohex(); // 64 tids // target tid
1663
1664
1665 asmToVeraIntf.L2C_err_enable(evnt.misc64A,
1666 evnt.miscIntA,
1667 evnt.miscIntB,
1668 evnt.miscIntC,
1669 evnt.miscIntD,
1670 evnt.miscIntE,
1671 evnt.tid);
1672
1673#ifdef DEBUGASMEVENTSTOVERA
1674 evnt.printList();
1675#endif
1676 evnt = null;
1677
1678 }
1679
1680 // end ERROR events in this section
1681 //////////////////////////////////////////////////////////////////
1682
1683
1684 "registerSlam": {
1685 evnt = new;
1686 evnt.pc = pc;
1687 evnt.routine = items[i]; i++;
1688
1689 str = items[i]; i++;
1690 evnt.miscStrA = str; //The Name of the register to slam
1691 str = items[i]; i++;
1692 evnt.misc128A = str.atohex(); // The value to slam the register
1693 str = items[i]; i++;
1694 if (str !== "*") evnt.tid = str.atohex(); // 64 tids
1695
1696 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
1697 else userEventsList[pc] = evnt;
1698
1699#ifdef DEBUGASMEVENTSTOVERA
1700 userEventsList[pc].printList();
1701#endif
1702
1703 }
1704
1705 //task watchDebugReg(integer which, integer wait=0,
1706 // integer verbose=0, reg [1:0] checkValue)
1707 "watchDebugReg": {
1708 evnt = new;
1709 evnt.pc = pc;
1710 evnt.routine = items[i]; i++;
1711 str = items[i]; i++;
1712 evnt.miscIntA = str.atoi(); // wait
1713 str = items[i]; i++;
1714 evnt.miscIntB = str.atoi(); // verbose
1715 str = items[i]; i++;
1716 evnt.miscIntC = str.atoi(); // verbose
1717 str = items[i]; i++;
1718 if (str !== "*") evnt.misc64A = str.atohex(); // checkValue
1719
1720 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
1721 else userEventsList[pc] = evnt;
1722
1723#ifdef DEBUGASMEVENTSTOVERA
1724 userEventsList[pc].printList();
1725#endif
1726 }
1727
1728 "spc_warm_reset": {
1729 evnt = new;
1730 evnt.pc = pc;
1731 evnt.routine = items[i]; i++;
1732
1733 if (assoc_index(CHECK, userEventsList, pc)) userEventsList[pc].push(evnt);
1734 else userEventsList[pc] = evnt;
1735
1736#ifdef DEBUGASMEVENTSTOVERA
1737 userEventsList[pc].printList();
1738#endif
1739 }
1740
1741 default: error("AsmEventsToVera::parseTrig invalid case!\n");
1742
1743 }
1744
1745}
1746
1747
1748/////////////////////////////////////////////////////////////////////////
1749// see what we have to do for this address and do it.
1750//
1751// None of this will make sense until you read:
1752//
1753// Add to the case below to add a new User Event
1754/////////////////////////////////////////////////////////////////////////
1755task AsmEventsToVera::serviceEvent(reg [63:0] pc, reg [5:0] fromTid) {
1756
1757 EventClass evntHndlHead = null;
1758 EventClass evnt = null;
1759 integer remain, notDone=0;
1760
1761 evntHndlHead = userEventsList[pc];
1762 if (evntHndlHead !== null) evnt = evntHndlHead.getHeadEvent();
1763
1764 // keep processing until all events for this address are done
1765 while (evnt !== null) {
1766
1767 PR_NORMAL (className, MON_NORMAL,
1768 psprintf("serviceEvent: routine = %s, evnt.pc = 0x%0h, evnt.tid = 0x%0h, evnt.tidMask = 0x%0h, fromTid = %0d, passed pc = 0x%0h",
1769 evnt.routine,evnt.pc,evnt.tid,evnt.tidMask,fromTid, pc));
1770
1771#ifdef DEBUGASMEVENTSTOVERA
1772 evnt.printSelf();
1773#endif
1774
1775 case (evnt.routine) {
1776
1777 "generic_ev" : { // generic user event for general use (6/06)
1778 asmToVeraIntf.generic_ev(evnt.miscStrA,
1779 evnt.misc64A,
1780 evnt.misc64B);
1781 }
1782
1783 "intp": {
1784 reg [63:0] mask;
1785 integer tid = 0;
1786 integer wait = 0;
1787
1788 // if user set thisTid to < 64 then thisTid == fromTid must be true
1789 // else pass over this intp this time.
1790 if (evnt.thisTid >= 64 || evnt.thisTid == fromTid) {
1791
1792 // mask always wins.
1793 // did user set mask.
1794 mask = evnt.tidMask;
1795
1796 // mask always wins.
1797 // use evnt.tid if no mask.
1798 if (!mask) {
1799 mask = 1 << evnt.tid;
1800 // user wants to target only the thread that is at this PC now.
1801 if (evnt.tid > 63) mask = 1 << fromTid;
1802 }
1803
1804 // dont target non existent tids
1805 mask = mask & enabledTids;
1806
1807 while (mask) {
1808 if (mask[0]) {
1809
1810 // special value 999 to enable random wait times
1811 if (evnt.wait == 9999) wait = urandom_range(10, 0);
1812 else wait = evnt.wait;
1813
1814 PR_NORMAL (className, MON_NORMAL,
1815 psprintf("serviceEvent: calling intp for tid %0d (mask=%h,wait=%0d)",
1816 tid,evnt.tidMask,wait));
1817
1818#ifdef DEBUGASMEVENTSTOVERA
1819 evnt.printSelf();
1820#endif
1821
1822 asmToVeraIntf.intp(tid,
1823 evnt.intType,
1824 evnt.misc64A,
1825 *, // use bench default. not in use! evnt.src,
1826 wait
1827 );
1828 }
1829 mask = mask >> 1;
1830 tid++;
1831 }
1832 } else notDone = 1; // preserve this event
1833 }
1834
1835 "extint": {
1836 asmToVeraIntf.extint(evnt.wait, evnt.miscIntA);
1837 }
1838
1839 "warmrst": {
1840 asmToVeraIntf.warmrst();
1841 }
1842
1843 "cpx_stall": {
1844 asmToVeraIntf.cpx_stall(evnt.tid,
1845 evnt.miscIntA,
1846 evnt.wait);
1847 }
1848
1849 "printf": {
1850 // if user set thisTid to < 64 then thisTid == fromTid must be true
1851 // else pass over it this time.
1852 if (evnt.thisTid >= 64 || evnt.thisTid == fromTid) {
1853 PR_ALWAYS("AsmEventsToVera", MON_ALWAYS, evnt.miscStrA);
1854 } else notDone = 1; // preserve this event
1855 }
1856
1857 "dump_mem": {
1858 asmToVeraIntf.dump_mem(evnt.misc64A,
1859 evnt.misc64B);
1860 }
1861
1862 // SPC BFM will do a store. Pick correct port w/ BFM!!!
1863 "store": {
1864 asmToVeraIntf.store(evnt.tid,
1865 evnt.misc64A,
1866 evnt.misc64B);
1867 }
1868
1869 // Trap conuting Random Error Injection in CCM (L2)
1870 "L2ErrTrapCount": {
1871 asmToVeraIntf.L2ErrTrapCount(evnt.misc64A);
1872 }
1873
1874 // Random Error Injection in CCM Data Array
1875 "L2DAErrInjection": {
1876 asmToVeraIntf.L2DAErrInjection(evnt.misc64A);
1877 }
1878
1879 // Random Error Injection in CCM Tag Array
1880 "L2TAErrInjection": {
1881 asmToVeraIntf.L2TAErrInjection(evnt.misc64A);
1882 }
1883
1884 "IosErrInj": {
1885 asmToVeraIntf.IosErrInj(evnt.miscStrA,
1886 evnt.misc64A,
1887 evnt.misc64B);
1888 }
1889
1890
1891 "IosRandErrInj": {
1892 asmToVeraIntf.IosRandErrInj(evnt.miscStrA,
1893 evnt.misc64A,
1894 evnt.misc64B);
1895 }
1896
1897 "siuDmaRd": {
1898 asmToVeraIntf.siuDmaRd(evnt.misc64A,
1899 evnt.misc64B);
1900 }
1901 "siuDmaWri": {
1902 asmToVeraIntf.siuDmaWri(evnt.misc64A,
1903 evnt.misc64B);
1904 }
1905 "jtagRdWrL2": {
1906 asmToVeraIntf.jtagRdWrL2(evnt.misc64A,
1907 evnt.misc64B,
1908 evnt.misc64C,
1909 evnt.misc01A);
1910 }
1911 "pktGenConfig": {
1912 asmToVeraIntf.pktGenConfig(evnt.tid,
1913 evnt.misc64A,
1914 evnt.misc64B,
1915 evnt.misc64C,
1916 evnt.misc01A,
1917 evnt.misc64D);
1918 }
1919
1920 "NIU_SetTxMaxBurst": {
1921 asmToVeraIntf.NIU_SetTxMaxBurst(evnt.misc01B,
1922 evnt.misc64B,
1923 evnt.misc64A,
1924 evnt.misc01A,
1925 evnt.misc64C,
1926 evnt.misc64D);
1927 }
1928
1929 "NIU_SetTxRingKick": {
1930 asmToVeraIntf.NIU_SetTxRingKick(evnt.tid,
1931 evnt.misc64B,
1932 evnt.misc01A,
1933 evnt.misc64C,
1934 evnt.misc64D);
1935 }
1936
1937 "NIU_AddTxChannels": {
1938 asmToVeraIntf.NIU_AddTxChannels(evnt.tid,
1939 evnt.misc64B,
1940 evnt.misc01A,
1941 evnt.misc64C,
1942 evnt.misc64D);
1943 }
1944
1945 "NIU_InitTxDma": {
1946 asmToVeraIntf.NIU_InitTxDma(evnt.misc01B,
1947 evnt.misc64B,
1948 evnt.misc64A,
1949 evnt.misc01A,
1950 evnt.misc64C,
1951 evnt.misc64D);
1952 }
1953
1954 "NIU_TxDMAActivate": {
1955 asmToVeraIntf.NIU_TxDMAActivate(evnt.misc64B,
1956 evnt.tid,
1957 evnt.misc01A,
1958 evnt.misc64C,
1959 evnt.misc64D);
1960 }
1961
1962 "NIU_EXIT_chk": {
1963 asmToVeraIntf.NIU_EXIT_chk(evnt.misc64B);
1964 }
1965
1966
1967 "TxPktGen": {
1968 asmToVeraIntf.TxPktGen(evnt.misc64A,
1969 evnt.tid,
1970 evnt.misc64B,
1971 evnt.misc01A,
1972 evnt.misc64C,
1973 evnt.misc64D);
1974 }
1975
1976
1977 "NIU_InitRxDma": {
1978 asmToVeraIntf.NIU_InitRxDma(evnt.tid,
1979 evnt.misc64A,
1980 evnt.misc64B,
1981 evnt.misc64C,
1982 evnt.misc64D,
1983 evnt.misc01A,
1984 evnt.misc64E);
1985 }
1986
1987 "NIU_RxPktConf": {
1988 asmToVeraIntf.NIU_RxPktConf(evnt.tid,
1989 evnt.misc64A);
1990 }
1991
1992 "NIU_RxGenPkt": {
1993 asmToVeraIntf.NIU_RxGenPkt(evnt.tid,
1994 evnt.misc64A,
1995 evnt.misc64B,
1996 evnt.misc64C,
1997 evnt.misc01B,
1998 evnt.misc64D);
1999 }
2000
2001
2002 "marker": {
2003 PR_NORMAL (className, MON_NORMAL,
2004 psprintf("serviceEvent: Doing: routine = marker, string = %s, from tid = %0d at pc = 0x%0h",
2005 evnt.miscStrA,fromTid,pc));
2006 asmToVeraIntf.marker(evnt.miscStrA,fromTid,pc);
2007
2008#ifndef FC_BENCH
2009 // special case to improve performance.
2010 // once last thread gets done, allow multiShot event to retire
2011 if (evnt.miscStrA == "bootEnd") {
2012 outOfBoot[fromTid] = 1;
2013 // printf("%0d outOfBoot = 0x%h\n",get_time(LO),outOfBoot);
2014 if (outOfBoot == enabledTids) {
2015 evnt.multiShot = 0;
2016 //evnt.setDone(1);
2017 }
2018 }
2019 if (evnt.miscStrA == "bootStart") {
2020 startBoot[fromTid] = 1;
2021 // printf("%0d startBoot = 0x%h\n",get_time(LO),startBoot);
2022 if (startBoot == enabledTids) {
2023 evnt.multiShot = 0;
2024 //evnt.setDone(1);
2025 }
2026 }
2027#endif
2028
2029 }
2030
2031 "reset_now": {
2032 asmToVeraIntf.reset_now(evnt.miscStrA);
2033 }
2034
2035 "set_StartPEUTest": {
2036 asmToVeraIntf.set_StartPEUTest();
2037 }
2038
2039 "EnablePCIeEgCmd": {
2040 asmToVeraIntf.EnablePCIeEgCmd(evnt.miscStrA,
2041 evnt.misc64A,
2042 evnt.misc64B,
2043 evnt.misc64C,
2044 evnt.miscStrB);
2045 }
2046
2047 "EnablePCIeIgCmd": {
2048 asmToVeraIntf.EnablePCIeIgCmd(evnt.miscStrA,
2049 evnt.misc64A,
2050 evnt.misc64B,
2051 evnt.miscStrC,
2052 evnt.misc64D,
2053 evnt.miscStrB);
2054 }
2055
2056 "errCpxPkt": {
2057 asmToVeraIntf.errCpxPkt(evnt.tid,
2058 evnt.misc64D,
2059 evnt.misc64C,
2060 evnt.misc64A,
2061 evnt.misc64B,
2062 evnt.misc01A);
2063 }
2064
2065 "IC_hard_err_inj": {
2066 asmToVeraIntf.IC_hard_err_inj(evnt.misc64A,
2067 evnt.misc64B,
2068 evnt.misc64C,
2069 evnt.tid);
2070 }
2071
2072 "DC_hard_err_inj": {
2073 asmToVeraIntf.DC_hard_err_inj(evnt.misc64A,
2074 evnt.misc64B,
2075 evnt.misc64C,
2076 evnt.tid);
2077 }
2078
2079 "errIndicationL2Pkt": {
2080 asmToVeraIntf.errCpxPkt(evnt.tid,
2081 4'b1100,
2082 evnt.misc64A,
2083 0,
2084 64'hffffffffffffffff,
2085 evnt.misc01A);
2086 }
2087
2088 "errIndicationSOCPkt": {
2089 asmToVeraIntf.errCpxPkt(evnt.tid,
2090 4'b1101,
2091 evnt.misc64A,
2092 0,
2093 64'hffffffffffffffff,
2094 evnt.misc01A);
2095
2096 }
2097
2098 "registerSlam": {
2099 asmToVeraIntf.registerSlam(evnt.miscStrA,
2100 evnt.misc128A,
2101 evnt.tid);
2102 }
2103
2104 "watchDebugReg": {
2105 asmToVeraIntf.watchDebugReg(evnt.miscIntA, evnt.miscIntB,
2106 evnt.miscIntC, evnt.misc64A);
2107 }
2108
2109 "spc_warm_reset": {
2110 asmToVeraIntf.spc_warm_reset();
2111 }
2112
2113 default: error("AsmEventsToVera::serviceEvent invalid case!\n");
2114 }
2115
2116 // next?
2117 if (eventsNeverDone) notDone = 1; // for reset testing. Code will repeat.
2118 evnt = evntHndlHead.getNextEvent(remain,notDone,eventCount);
2119 notDone = 0;
2120
2121 // kill off this PC's list, we are all finished with it
2122 if (!remain) {
2123 userEventsList[pc].delete();
2124 userEventsList[pc] = null;
2125 assoc_index (DELETE, userEventsList, pc);
2126 }
2127
2128
2129 } // while
2130
2131}
2132
2133
2134
2135
2136
2137
2138////////////////////////////////////////////////////////////////
2139// new
2140////////////////////////////////////////////////////////////////
2141task AsmEventsToVera::new(StandardDisplay dbg,
2142 reg [63:0] enabledTids,
2143 reg asm_err_en = 0,
2144 reg err_inj_dbg = 0) {
2145
2146 this.dbg = dbg;
2147 this.enabledTids = enabledTids;
2148 listLock = alloc(SEMAPHORE, 0, 1, 1);
2149
2150#ifdef DEBUGASMEVENTSTOVERA
2151 this.debug = 1;
2152#endif
2153
2154 if (mChkPlusarg(eventsNeverDone)) eventsNeverDone = 1;
2155 else eventsNeverDone = 0;
2156
2157 probes[0] = asmEventCore0;
2158 probes[1] = asmEventCore1;
2159 probes[2] = asmEventCore2;
2160 probes[3] = asmEventCore3;
2161 probes[4] = asmEventCore4;
2162 probes[5] = asmEventCore5;
2163 probes[6] = asmEventCore6;
2164 probes[7] = asmEventCore7;
2165 probes[8] = asmEventCore8;
2166 probes[9] = asmEventCore9;
2167 probes[10] = asmEventCore10;
2168 probes[11] = asmEventCore11;
2169 probes[12] = asmEventCore12;
2170 probes[13] = asmEventCore13;
2171 probes[14] = asmEventCore14;
2172 probes[15] = asmEventCore15;
2173 probes[16] = asmEventCore16;
2174 probes[17] = asmEventCore17;
2175 probes[18] = asmEventCore18;
2176 probes[19] = asmEventCore19;
2177 probes[20] = asmEventCore20;
2178 probes[21] = asmEventCore21;
2179 probes[22] = asmEventCore22;
2180 probes[23] = asmEventCore23;
2181 probes[24] = asmEventCore24;
2182 probes[25] = asmEventCore25;
2183 probes[26] = asmEventCore26;
2184 probes[27] = asmEventCore27;
2185 probes[28] = asmEventCore28;
2186 probes[29] = asmEventCore29;
2187 probes[30] = asmEventCore30;
2188 probes[31] = asmEventCore31;
2189 probes[32] = asmEventCore32;
2190 probes[33] = asmEventCore33;
2191 probes[34] = asmEventCore34;
2192 probes[35] = asmEventCore35;
2193 probes[36] = asmEventCore36;
2194 probes[37] = asmEventCore37;
2195 probes[38] = asmEventCore38;
2196 probes[39] = asmEventCore39;
2197 probes[40] = asmEventCore40;
2198 probes[41] = asmEventCore41;
2199 probes[42] = asmEventCore42;
2200 probes[43] = asmEventCore43;
2201 probes[44] = asmEventCore44;
2202 probes[45] = asmEventCore45;
2203 probes[46] = asmEventCore46;
2204 probes[47] = asmEventCore47;
2205 probes[48] = asmEventCore48;
2206 probes[49] = asmEventCore49;
2207 probes[50] = asmEventCore50;
2208 probes[51] = asmEventCore51;
2209 probes[52] = asmEventCore52;
2210 probes[53] = asmEventCore53;
2211 probes[54] = asmEventCore54;
2212 probes[55] = asmEventCore55;
2213 probes[56] = asmEventCore56;
2214 probes[57] = asmEventCore57;
2215 probes[58] = asmEventCore58;
2216 probes[59] = asmEventCore59;
2217 probes[60] = asmEventCore60;
2218 probes[61] = asmEventCore61;
2219 probes[62] = asmEventCore62;
2220 probes[63] = asmEventCore63;
2221
2222}
2223
2224////////////////////////////////////////////////////////////////
2225// read diag.ev file and build up sync routine.
2226////////////////////////////////////////////////////////////////
2227
2228// N1 calls as: read_vera_tasks("diag.ev", 0, "", "");
2229task AsmEventsToVera::readEventFile(string file,
2230 integer kind = 0,
2231 string lvl = null,
2232 string name = null) {
2233 integer fp,i;
2234 string line, items[ITEMCOUNT];
2235 reg [63:0] tmp64;
2236
2237 if (mChkPlusarg(noUserEvents)) {
2238 printf("%9d: AsmEventsToVera[]: +noUserEvents detected. AsmEventsToVera class dissabled!\n", get_cycle());
2239 return;
2240 }
2241
2242 fp = fopen(file, "r", SILENT);
2243 while(fp){
2244 line = freadstr(fp, SILENT);
2245 if (line == null) break;
2246 if (line.match("printhex")) continue;
2247 if (line.match("printdec")) continue;
2248 if (line.match("^\s*$")) continue;
2249 if (line.match("^\s*//")) continue;
2250 // Do not process N1 errors
2251 // or we end up with garbage in list! jp
2252 if (line.match("error(")) continue;
2253
2254 // seperates fields by ( and comma, always excluding any 64'h
2255 this.extract(line, items);
2256
2257 if (items[0] == "trig_pc_d") parseTrig(items);
2258 else {
2259 printf("AsmEventsToVera::readVeraTasks ERROR: This stuff is bad ->");
2260 for (i=0;i<ITEMCOUNT;i++) if (items[i] != null) printf("%s \n",items[i]);
2261 printf("<-\n");
2262 error("AsmEventsToVera::readVeraTasks ERROR: invalid user event found in file %s\n",file);
2263 }
2264 }
2265
2266 if (fp) fclose(fp);
2267
2268 // if no events, do nothing.
2269 if (assoc_index(FIRST, userEventsList, tmp64)) {
2270 eventCount = userEventsList[tmp64].getEventCount();
2271 asmToVeraIntf = new(); // Each bench's $EVENTs implementation tasks
2272 fork mainMonitor(); join none
2273 }
2274
2275}
2276
2277////////////////////////////////////////////////////////////////
2278// parse line, used by readVeraTasks
2279////////////////////////////////////////////////////////////////
2280// trig_pc_d(0,64'h0000000020000d90) -> intp(0, 0, 3a)
2281// error(0,64'h0000000020000d90,1,IRF,ce,8,x, x,x,x, x,x,x)
2282
2283task AsmEventsToVera::extract(string str, var string items [ITEMCOUNT]) {
2284
2285 integer i = 0;
2286
2287#ifdef DEBUGASMEVENTSTOVERA
2288if (debug) printf("\nExtract: input=%s\n",str);
2289#endif
2290
2291 for (i=0;i<ITEMCOUNT;i++) items[i] = "*";
2292 i = 0;
2293
2294 // seperates fields by ( and comma, always excluding any 64'h
2295 while(str.match("\s*(64'h)*([\w\*]+)"))
2296 {
2297 items[i] = str.backref(1); //str_list.push_back(str.backref(1));
2298#ifdef DEBUGASMEVENTSTOVERA
2299 printf("Extract:push_backA: [%0d] %s\n", i, items[i]);
2300#endif
2301 i++;
2302 str = str.postmatch();
2303
2304 if(str.match("^\(\s*\"")){
2305 str = str.postmatch();
2306 str.match("\"");
2307 items[i] = str.prematch(); // str_list.push_back(str.prematch());
2308#ifdef DEBUGASMEVENTSTOVERA
2309 printf("Extract:push_backB: [%0d] %s\n", i, items[i]);
2310#endif
2311 i++;
2312 str = str.postmatch();
2313 }
2314 }
2315
2316}
2317
2318
2319
2320//
2321// watch for instruction completion, get address, check hash.
2322// if user event is dumping a register, get CWP and reg too.
2323//
2324// Uses new() input enabledTids to determine which threads to monitor.
2325//
2326task AsmEventsToVera::mainMonitor() {
2327
2328 integer i, maxTidBit=64, minTidBit=0, serviceTime;
2329 reg [5:0] thread;
2330 reg [63:0] pc, localReady;
2331 reg [2:0] core, tid;
2332
2333 repeat (2) @(posedge probes[0].$clk);
2334
2335 if (mChkPlusarg(noUserEvents)) {
2336 printf("%9d: AsmEventsToVera[]: +noUserEvents detected. AsmEventsToVera class dissabled!\n", get_cycle());
2337 return;
2338 }
2339
2340 if (eventCount) {
2341
2342 printf("%9d: AsmEventsToVera[]: $EV User Events detected. Input enabledTids=0x%h\n", get_cycle(), enabledTids);
2343 if (! enabledTids) printf("%9d: AsmEventsToVera[]: $EV User Events enabledTids is 0! No User Events will happen!\n", get_cycle());
2344
2345// printf("%0d AsmEventsToVera: core_running_status 0x%h\n",
2346// get_cycle(),asmEventsToVera_if.core_running_status);
2347
2348 for (i=0;i<64;i++) if (enabledTids[i]) maxTidBit = i;
2349 for (i=63;i<=0;i--) if (enabledTids[i]) minTidBit = i;
2350
2351 while (1) {
2352
2353// printf("%0d AsmEventsToVera: while loop waiting for readies\n", get_cycle());
2354
2355 @(asmEventsToVera_if.ev_ready); // wait for any change
2356
2357// printf("%0d AsmEventsToVera: outer while loop see a ready\n", get_cycle());
2358
2359 while (asmEventsToVera_if.ev_ready) { // any high/staying high?
2360
2361 localReady = asmEventsToVera_if.ev_ready;
2362
2363// printf("%0d AsmEventsToVera: inner while loop still see ready: %h\n", get_cycle(),localReady);
2364
2365 for (i=minTidBit;i<=maxTidBit;i++) {
2366 if (enabledTids[i] && localReady[i]) {
2367
2368 pc = probes[i].$ev_pc;
2369
2370#ifdef DEBUGASMEVENTSTOVERA
2371 printf("%0d AsmEventsToVera: TID %0d @%0d ready = %b pc = 0x%h\n",
2372 get_cycle(), i, get_time(LO), localReady[i],pc[43:0]);
2373#endif
2374
2375 // check the hash w/ this pc and serviceEvent.
2376 // only do one thread at a time.
2377 if (assoc_index(CHECK, userEventsList, pc)) {
2378 serviceTime = get_time(LO);
2379 serviceEvent(pc,i);
2380 if (serviceTime != get_time(LO))
2381 printf("\nERROR: When servicing an event, time advanced (from %0d to %0d).\nThis will cause events to be missed. Advancing time is not allowed.\nKeep in mind that checking and driving interfaces CAN advance time!!!\nCheck your asmToVeraIntf.vr file - use forks as needed.\n",serviceTime,get_time(LO));
2382 }
2383 }
2384 } // for
2385
2386 @(negedge probes[0].$clk);
2387 if (eventCount == 0) {
2388 @(negedge probes[0].$clk);
2389 wait_child();
2390 printf("%0d: AsmEventsToVera: All User Events consumed, no child threads, goodbye.\n", get_cycle());
2391 break;
2392 }
2393 } // while ready continues back to back
2394 if (eventCount == 0) {
2395 wait_child(); // overkill
2396 break;
2397 }
2398 } // while waiting for a ready
2399 } // have events
2400}
2401
2402