1 //Original:/proj/frio/dv/testcases/debug/dbg_brprd_ntkn_src_kill/dbg_brprd_ntkn_src_kill.dsp
2 // Description: This test checks that the trace buffer keeps track of a
3 // branch source instruction that is predicted but not taken getting killed
4 // at each stage in the pipe. The test consists of 8 instances of an EXCPT
5 // instruction followed by 0 to 7 NOPs and a BRF instruction (and bp), with
6 // the trace buffer enabled.
8 # sim: --environment operating
11 .include "testutils.inc"
14 /////////////////////////////////////////////////////////////////////////////
15 ///////////////////////// Include Files /////////////////////////////
16 /////////////////////////////////////////////////////////////////////////////
19 include(selfcheck.inc)
23 /////////////////////////////////////////////////////////////////////////////
24 ///////////////////////// Defines /////////////////////////////
25 /////////////////////////////////////////////////////////////////////////////
27 #ifndef USER_CODE_SPACE
28 #define USER_CODE_SPACE CODE_ADDR_1 //
31 #define STACKSIZE 0x00000020
34 #define ITABLE CODE_ADDR_2 //
38 /////////////////////////////////////////////////////////////////////////////
39 ///////////////////////// RESET ISR /////////////////////////////
40 /////////////////////////////////////////////////////////////////////////////
50 // Initialize ILBM Registers
56 // Initialize the Address of the Checkreg data segment
57 // **** THIS IS NEEDED WHENEVER CHECKREG IS USED ****
58 CHECK_INIT_DEF(p5); //CHECK_INIT(p5, 0x00BFFFFC);
61 LD32_LABEL(sp, USTACK);
65 LD32_LABEL(sp, KSTACK);
67 // Setup Frame Pointer
70 // Setup Event Vector Table
73 LD32_LABEL(r0, EMU_ISR); // Emulation Handler (Int0)
75 LD32_LABEL(r0, RST_ISR); // Reset Handler (Int1)
77 LD32_LABEL(r0, NMI_ISR); // NMI Handler (Int2)
79 LD32_LABEL(r0, EXC_ISR); // Exception Handler (Int3)
81 [ P0 ++ ] = R0; // IVT4 not used
82 LD32_LABEL(r0, HWE_ISR); // HW Error Handler (Int5)
84 LD32_LABEL(r0, TMR_ISR); // Timer Handler (Int6)
86 LD32_LABEL(r0, IGV7_ISR); // IVG7 Handler
88 LD32_LABEL(r0, IGV8_ISR); // IVG8 Handler
90 LD32_LABEL(r0, IGV9_ISR); // IVG9 Handler
92 LD32_LABEL(r0, IGV10_ISR); // IVG10 Handler
94 LD32_LABEL(r0, IGV11_ISR); // IVG11 Handler
96 LD32_LABEL(r0, IGV12_ISR); // IVG12 Handler
98 LD32_LABEL(r0, IGV13_ISR); // IVG13 Handler
100 LD32_LABEL(r0, IGV14_ISR); // IVG14 Handler
102 LD32_LABEL(r0, IGV15_ISR); // IVG15 Handler
105 // Setup the EVT_OVERRIDE MMR
107 LD32(p0, EVT_OVERRIDE);
110 // Setup Interrupt Mask
115 // Return to Supervisor Code
119 LD32_LABEL(r0, USER_CODE);
131 /////////////////////////////////////////////////////////////////////////////
134 /////////////////////////////////////////////////////////////////////////////
135 ///////////////////////// EMU ISR /////////////////////////////
136 /////////////////////////////////////////////////////////////////////////////
150 /////////////////////////////////////////////////////////////////////////////
151 ///////////////////////// NMI ISR /////////////////////////////
152 /////////////////////////////////////////////////////////////////////////////
166 /////////////////////////////////////////////////////////////////////////////
167 ///////////////////////// EXC ISR /////////////////////////////
168 /////////////////////////////////////////////////////////////////////////////
172 // Save all the registers used in the ISR
182 // Get EXCAUSE bits out of SEQSTAT
187 // Check for Trace Exception
188 // Load r1 with EXCAUSE for Trace Exception
190 // Check for Trace Exception
192 // Branch to OUT if the EXCAUSE is not TRACE.
195 // Read out the Trace Buffer.
200 // if p1 is zero skip the loop.
204 // Read out the Entire Trace Buffer.
206 LSETUP ( l0s , l0e ) LC0 = P1;
211 // Check for other exception, if any.
213 // Restore all saved registers.
234 /////////////////////////////////////////////////////////////////////////////
235 ///////////////////////// HWE ISR /////////////////////////////
236 /////////////////////////////////////////////////////////////////////////////
250 /////////////////////////////////////////////////////////////////////////////
251 ///////////////////////// TMR ISR /////////////////////////////
252 /////////////////////////////////////////////////////////////////////////////
266 /////////////////////////////////////////////////////////////////////////////
267 ///////////////////////// IGV7 ISR /////////////////////////////
268 /////////////////////////////////////////////////////////////////////////////
282 /////////////////////////////////////////////////////////////////////////////
283 ///////////////////////// IGV8 ISR /////////////////////////////
284 /////////////////////////////////////////////////////////////////////////////
298 /////////////////////////////////////////////////////////////////////////////
299 ///////////////////////// IGV9 ISR /////////////////////////////
300 /////////////////////////////////////////////////////////////////////////////
314 /////////////////////////////////////////////////////////////////////////////
315 ///////////////////////// IGV10 ISR /////////////////////////////
316 /////////////////////////////////////////////////////////////////////////////
330 /////////////////////////////////////////////////////////////////////////////
331 ///////////////////////// IGV11 ISR /////////////////////////////
332 /////////////////////////////////////////////////////////////////////////////
346 /////////////////////////////////////////////////////////////////////////////
347 ///////////////////////// IGV12 ISR /////////////////////////////
348 /////////////////////////////////////////////////////////////////////////////
362 /////////////////////////////////////////////////////////////////////////////
363 ///////////////////////// IGV13 ISR /////////////////////////////
364 /////////////////////////////////////////////////////////////////////////////
378 /////////////////////////////////////////////////////////////////////////////
379 ///////////////////////// IGV14 ISR /////////////////////////////
380 /////////////////////////////////////////////////////////////////////////////
394 /////////////////////////////////////////////////////////////////////////////
395 ///////////////////////// IGV15 ISR /////////////////////////////
396 /////////////////////////////////////////////////////////////////////////////
400 WR_MMR(TBUFCTL, 0x7, p0, r0); // Enable trace buffer & overflow
402 CSYNC; // Wait for MMR write to complete
404 CC = R7 == R6; // Set CC
406 IF !CC JUMP 4 (BP); // Mispredicted branch gets killed in WB stage
412 IF !CC JUMP 4 (BP); // Mispredicted branch gets killed in EX3 stage
419 IF !CC JUMP 4 (BP); // Mispredicted branch gets killed in EX2 stage
427 IF !CC JUMP 4 (BP); // Mispredicted branch gets killed in EX1 stage
436 IF !CC JUMP 4 (BP); // Mispredicted branch gets killed in AC stage
446 IF !CC JUMP 4 (BP); // Mispredicted branch gets killed in DEC stage
456 IF !CC JUMP 4 (BP); // Mispredicted branch gets killed in IF2 stage
468 IF !CC JUMP 4 (BP); // Mispredicted branch gets killed in IF1 stage
472 // Read out the Rest of the Trace Buffer.
477 // if p1 is zero skip the loop.
481 // Read out the Entire Trace Buffer.
483 LSETUP ( l1s , l1e ) LC0 = P1;
487 // Don't RTI if you never wish to go to User Mode
488 // use END_TEST instead.
503 /////////////////////////////////////////////////////////////////////////////
504 ///////////////////////// USER CODE /////////////////////////////
505 /////////////////////////////////////////////////////////////////////////////
510 // YOUR USER CODE GOES HERE.
512 dbg_pass; // Call Endtest Macro
514 /////////////////////////////////////////////////////////////////////////////
515 ///////////////////////// DATA MEMRORY /////////////////////////////
516 /////////////////////////////////////////////////////////////////////////////
518 .section MEM_DATA_ADDR_1 //.data 0x00F00100,"aw"
535 // Define Kernal Stack
536 .section MEM_DATA_ADDR_2 //.data 0x00F00210,"aw"
543 /////////////////////////////////////////////////////////////////////////////
544 ///////////////////////// END OF TEST /////////////////////////////
545 /////////////////////////////////////////////////////////////////////////////