|
|
Power 6/32 Unix version 1.21
#include "evt_defs.h"
/*
*********************************************************************
* FPP PIPELINED EVENTS TEST #15
*
* This test will execute the following code: "LDF MULF STF"
* with an overflow fault on the MULF. We will make sure that:
* 1. The fault is detected,
* 2. the accumulator is cleared, and
* 3. a floating '0' is stored if anything.
*********************************************************************
*/
pipe15()
{
#define PIPE15_PAT 0x12341234
asm("moval (r13),_pre_event_fp"); /* save the frame pointer */
asm("moval (r14),_pre_event_sp"); /* save the stack pointer */
precision = SGL;
test_event = ARITH_CODE; /* expect an arithmetic fault */
exp_code = FLT_OVFL_CODE; /* - specificly overflow */
exp_event = FALSE; /* ... but not yet */
asm("movab _pipe15_ret,_event_return"); /* set event return address */
max_index = muf_ov_cnt; /* set max operand index */
for( index = 0; index < max_index; index++ ) {
dbl_ld_acc = muf_ov_dat[index].op_1; /* get the Acc data */
dbl_value_1 = muf_ov_dat[index].op_2; /* get the '0' data */
dbl_value_2.m = PIPE15_PAT; /* background for STF*/
asm(".globl _pipe15_lp1");
asm("_pipe15_lp1:");
asm("bispsw $0x60"); /* enable ovfl & undfl events*/
asm("ldf _dbl_ld_acc"); /* load the Acc. */
exp_event = test_event; /* set the expect event flag */
asm("mulf _dbl_value_1"); /* trigger the event */
asm("stf _dbl_value_2"); /* FPP stores before the evt.*/
/*
* If we got to here then there was no event
*/
if( force_loop )
asm("jmp _pipe15_lp1");; /* loop on the error */
exp_event = FALSE; /* reset event expected flag */
asm("movl _pre_event_fp,fp"); /* restore the frame pointer */
asm("movl _pre_event_sp,sp"); /* restore the stack pointer */
asm("bicpsw $0x60"); /* disable ovfl & undfl evts */
no_pipe15_evt();; /* report the error */
/*
* Come here after the event
*/
asm(".globl _pipe15_ret");
asm("_pipe15_ret:");
asm("movl _pre_event_fp,fp"); /* restore the frame pointer */
asm("movl _pre_event_sp,sp"); /* restore the stack pointer */
if( force_loop )
asm("jmp _pipe15_lp1");; /* loop on the error */
asm("bicpsw $0x60"); /* disable ovfl & undfl evts */
if( post_evt_acc.m ) /* was the Acc cleared? */
bad_pipe15_result(); /* incorrect result error */
else if( (dbl_value_2.m ) && /* either a ZERO s/b stored, */
(dbl_value_2.m != 0x80000000) && /* or a RESERVED OP, */
(dbl_value_2.m != PIPE15_PAT) ) /* or no store at all */
bad_pipe15_store(); /* incorrect store error */
}
}
/****************************************************************************
* Report an "EVENT NOT DETECTED" error
*
* Cycle: xx. EVT test xx. subtest xx. No overflow fault seen. index = xx
* inst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)
* op1 = xxxxxxxx, op2 = xxxxxxxx, init op3 = xxxxxxxx, final op3 = xxxxxxxx
****************************************************************************/
no_pipe15_evt()
{
errcnt++; /* bump the error count */
if ( prt_error )
{
print_pipe15_er( ". No overflow fault seen" );
writes("op1 = ");
write32h( dbl_ld_acc.m );
writes(", op2 = ");
write32h( dbl_value_1.m );
writes(", init op3 = ");
write32h( PIPE15_PAT );
writes(", final op3 = ");
write32h( dbl_value_2.m );
writec('\n');
}
if ( halt_flg ) /* halt on error? */
pipe15_halt( 1 ); /* halt with a code of 1 */
if ( loop_on_err )
{
force_loop = TRUE; /* set the force loop flag */
asm("jmp _pipe15_lp1"); /* and loop */
};
}
/****************************************************************************
* Report an "BAD ACCUMULATOR AFTER THE EVENT" error
*
* Cycle: xx. EVT test xx. subtest xx. Bad final Accumulator. index = xx
* inst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)
* op1 = xxxxxxxx, final Acc. = xxxxxxxx, initial op3 = xxxxxxxx
* op2 = xxxxxxxx, expected = xxxxxxxx, final op3 = xxxxxxxx
****************************************************************************/
bad_pipe15_result()
{
errcnt++; /* bump the error count */
if ( prt_error )
{
print_pipe15_er( ". Bad final Accumulator" );
writes("op1 = ");
write32h( dbl_ld_acc.m );
writes(", final Acc. = ");
write32h( post_evt_acc.m );
writes(", initial op3 = ");
write32h( PIPE15_PAT );
writes("\nop2 = ");
write32h( dbl_value_1.m );
writes(", expected = ");
write32h( 0 ); /* the expected result = 0 */
writes(", final op3 = ");
write32h( dbl_value_2.m );
writec('\n');
}
if ( halt_flg ) /* halt on error? */
pipe15_halt( 2 ); /* halt with a code of 2 */
if ( loop_on_err )
{
force_loop = TRUE; /* set the force loop flag */
asm("jmp _pipe15_lp1"); /* and loop */
};
}
/****************************************************************************
* Report a "BAD RESULT STORED AFTER THE EVENT" error
*
* Cycle: xx. EVT test xx. subtest xx. Bad STF OP3 result. index = xx
* inst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)
* op1 = xxxxxxxx, initial op3 = xxxxxxxx, final Acc. = xxxxxxxx
* op2 = xxxxxxxx, final op3 = xxxxxxxx, op3 expected = xxxxxxxx
****************************************************************************/
bad_pipe15_store()
{
errcnt++; /* bump the error count */
if ( prt_error )
{
print_pipe15_er( ". Bad STF OP3 result" );
writes("op1 = ");
write32h( dbl_ld_acc.m );
writes(", initial op3 = ");
write32h( PIPE15_PAT );
writes(", final Acc. = ");
write32h( post_evt_acc.m );
writes("\nop2 = ");
write32h( dbl_value_1.m );
writes(", final op3 = ");
write32h( dbl_value_2.m );
writes(", op3 expected = 80000000\n"); /* exp = Reserved Op */
}
if ( halt_flg ) /* halt on error? */
pipe15_halt( 3 ); /* halt with a code of 2 */
if ( loop_on_err )
{
force_loop = TRUE; /* set the force loop flag */
asm("jmp _pipe15_lp1"); /* and loop */
};
}
/****************************************************************************
* Report an error message of the form:
*
* Cycle: xx. EVT test xx. subtest xx. <your message here>. index = xx
* inst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)
****************************************************************************/
print_pipe15_er( msg )
char *msg; /* error message to print */
{
if( errcnt == 1 ) /* 1st error? */
writes(" \n"); /* start a new print line */
writes("Cycle: ");
writed( cycle );
writes(" EVT test ");
writed( test_no );
writes(". subtest ");
writed( subtest );
writes( msg ); /* print the message */
writes(". index = ");
writed( index );
writes(
"\ninst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)\n");
}
/****************************************************************************
* halt on error routine
****************************************************************************/
pipe15_halt( code )
int code; /* error code to halt with */
{
err_code = code;
sgl_value_1 = dbl_ld_acc.m;
sgl_value_2 = dbl_value_1.m;
sgl_value_3 = post_evt_acc.m;
sgl_value_4 = PIPE15_PAT;
sgl_value_5 = dbl_value_2.m;
asm("movl _test_no,r0"); /* r0 = test number */
asm("movl _subtest,r1"); /* r1 = subtest number */
asm("movl _err_code,r2"); /* r2 = error code */
asm("movl _cycle,r3"); /* r3 = cycle count */
asm("movl _sgl_value_1,r4"); /* r4 = initial acc. */
asm("movl _sgl_value_2,r5"); /* r5 = MULF operand */
asm("movl _sgl_value_3,r6"); /* r6 = final acc. */
asm("clrl r7"); /* r7 = expected acc. */
asm("movl _sgl_value_4,r8"); /* r8 = initial op3 value */
asm("movl _sgl_value_5,r9"); /* r9 = final op3 value */
asm("clrl r10"); /* r10 = expected op3 value */
asm("movl _index,r11"); /* r11 = data index */
asm("halt"); /* HALT ... */
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.