|
|
Power 6/32 Unix version 1.21
#include "evt_defs.h"
/*
*********************************************************************
* FPP PIPELINED EVENTS TEST #3
*
* This test will execute the following code: "LDF LOGF CMPF2 LOGF"
* with a reserved operand fault on the CMPF2. We will make sure that:
* 1. The fault is detected,
* 2. the 1st log operation completes, and
* 3. the 2nd log instruction is not executed.
*********************************************************************
*/
pipe3()
{
asm("moval (r13),_pre_event_fp"); /* save the frame pointer */
asm("moval (r14),_pre_event_sp"); /* save the stack pointer */
precision = SGL;
test_event = RESOP_CODE; /* reserved op.fault expected */
exp_event = FALSE; /* ... but not yet */
asm("movab _pipe3_ret,_event_return"); /* post event addr */
for( index = 0; index < max_pipe3_index; index++ ) {
dbl_ld_acc = pipe3_data[index].op_1; /* get the data */
dbl_expected = pipe3_data[index].exp;
dbl_value_1 = cmp2_resops[index].op_1; /* get reserved ops. */
dbl_value_2 = cmp2_resops[index].op_2;
asm(".globl _pipe3_lp1");
asm("_pipe3_lp1:");
asm("bispsw $0x60"); /* enable ovfl,undfl */
asm("ldf _dbl_ld_acc"); /* load the Acc. */
exp_event = test_event; /* expect event soon */
asm("logf"); /* get the log */
asm("cmpf2 _dbl_value_1,_dbl_value_2"); /* cause the event */
asm("logf"); /* shouldn't get here*/
/*
* If we got to here then there was no event
*/
if( force_loop )
asm("brw _pipe3_lp1");; /* loop on the error */
exp_event = FALSE; /* reset event expected flag */
asm("bicpsw $0x60"); /* disable ovfl & undfl evts */
asm("movl _pre_event_fp,fp"); /* restore the frame pointer */
asm("movl _pre_event_sp,sp"); /* restore the stack pointer */
no_pipe3_evt();; /* report the error */
/*
* Come here after the event
*/
asm(".globl _pipe3_ret");
asm("_pipe3_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("brw _pipe3_lp1");; /* loop on the error */
asm("bicpsw $0x60"); /* disable ovfl & undfl evts */
if( post_evt_acc.m != dbl_expected.m )
bad_pipe3_result(); /* incorrect result error */
}
}
/****************************************************************************
* Report an "EVENT NOT DETECTED" error
*
* Cycle: xx. EVT test xx. subtest xx. No reserved operand fault. index = xx
* inst = LDF op_1, LOGF, CMPF2 op_2,op_3, LOGF (reserved op. fault on CMPF2)
* op_1 = xxxxxxxx, op_2 = xxxxxxxx, op_3 = xxxxxxxx
****************************************************************************/
no_pipe3_evt()
{
errcnt++; /* bump the error count */
if ( prt_error ) {
print_pipe3_er( ". No reserved operand fault. " );
writes("op_1 = ");
write32h( dbl_ld_acc.m );
writes(", op_2 = ");
write32h( dbl_value_1.m );
writes(", op_3 = ");
write32h( dbl_value_2.m );
writec('\n');
}
if ( halt_flg ) /* halt on error? */
pipe3_halt( 1 ); /* halt with a code of 1 */
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("jmp _pipe3_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 op_1, LOGF, CMPF2 op_2,op_3, LOGF (reserved op. fault on CMPF2)
* The 2nd LOGF should not be executed.
* op_1 = xxxxxxxx, final Acc. = xxxxxxxx, expected = xxxxxxxx
****************************************************************************/
bad_pipe3_result()
{
errcnt++; /* bump the error count */
if ( prt_error ) {
print_pipe3_er( ". Bad final Accumulator. " );
writes("The 2nd LOGF should not be executed\n");
writes("op_1 = ");
write32h( dbl_ld_acc.m );
writes(", final Acc. = ");
write32h( post_evt_acc.m );
writes(", expected = ");
write32h( dbl_expected.m );
writec('\n');
}
if ( halt_flg ) /* halt on error? */
pipe3_halt( 2 ); /* halt with a code of 2 */
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("jmp _pipe3_lp1"); /* and loop */
};
}
/****************************************************************************
* Report an error message of the form:
*
* Cycle: xx. EVT test xx. subtest xx. <your message here>. index = xx
* inst = LDF op_1, LOGF, CMPF2 op_2,op_3, LOGF (reserved op. fault on CMPF2)
****************************************************************************/
print_pipe3_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 op_1, LOGF, CMPF2 op_2,op_3, LOGF");
writes(" (reserved op. fault on CMPF2)\n");
}
/****************************************************************************
* halt on error routine
****************************************************************************/
pipe3_halt( code )
int code; /* error code to halt with */
{
err_code = code;
sgl_value_1 = dbl_ld_acc.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 operand */
if( code == 1 ) {
sgl_value_2 = dbl_value_1.m;
sgl_value_3 = dbl_value_2.m;
asm("movl _sgl_value_2,r5"); /* r5 = 1st CMPF2 operand */
asm("movl _sgl_value_3,r6"); /* r6 = 2nd CMPF2 operand */
} else {
sgl_value_2 = post_evt_acc.m;
sgl_value_3 = dbl_expected.m;
asm("movl _sgl_value_2,r5"); /* r5 = final accumulator */
asm("movl _sgl_value_3,r6"); /* r6 = expected accumulator */
}
asm("movl _index,r7"); /* r7 = data index */
asm("halt"); /* HALT ... */
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.