File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / fpevent / pipe11.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:30:17 2019 UTC (6 years, 11 months ago) by root
Branches: bsd, MAIN
CVS tags: v121, HEAD
Power 6/32 Unix version 1.21



#include "evt_defs.h"

/*
 *********************************************************************
 *	FPP PIPELINED EVENTS TEST #11
 *
 *  This test will execute the following code: "LDF ADDF CVLF"
 * with an overflow fault on the ADDF. We will make sure that:
 * 1. The fault is detected, and
 * 2. the Convert Longword Intger to SGL Floating instruction is not executed.
 *********************************************************************
*/
pipe11()
{
	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 _pipe11_ret,_event_return"); /* set event return address  */
	dbl_value_2.m = 24;			/* set the CVLF data         */
	max_index = adf_ov_cnt;			/* set max operand index     */
	for( index = 0; index < max_index; index++ )
	{
	     dbl_ld_acc  = adf_ov_dat[index].op_1;	/* get the Acc data  */
	     dbl_value_1 = adf_ov_dat[index].op_2;	/* get the '0' data  */
	     asm(".globl _pipe11_lp1");
	     asm("_pipe11_lp1:");
	     asm("bispsw $0x60");		/* enable ovfl & undfl events*/
	     asm("movl _dbl_value_2,r4");	/* set the dummy load data   */
	     asm("ldf _dbl_ld_acc");		/* load the Acc.             */
	     exp_event = test_event;		/* set the expect event flag */
	     asm("addf _dbl_value_1");		/* trigger the event         */
	     asm("cvlf r4");			/* we shouldn't get to here  */
/*
 * If we got to here then there was no event
*/
	     if( force_loop )
		  asm("brw _pipe11_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_pipe11_evt();;			/* report the error          */
/*
 * Come here after the event
*/
	     asm(".globl _pipe11_ret");
	     asm("_pipe11_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 _pipe11_lp1");;	/* loop on the error         */
	     asm("bicpsw $0x60");		/* disable ovfl & undfl evts */
	     if( post_evt_acc.m == 0x42c00000 )	/* Acc = CVLF data? ( 24.0 ) */
		  pipe11_queue_er();		/* yes it was -error! error! */
	     else if( post_evt_acc.m )		/* was the Acc cleared?      */
		  bad_pipe11_result();		/* incorrect result error    */
	     
	}
}



/****************************************************************************
*		Report an "EVENT NOT DETECTED" error
*
* Cycle: xx. EVT test xx. subtest xx. No overflow fault seen. index = xx
* inst = LDF op1, ADDF op2, CVLF op3    (overflow fault on the ADDF)
* op1 = xxxxxxxx,   op2 = xxxxxxxx  
****************************************************************************/
no_pipe11_evt()
{
	errcnt++;				/* bump the error count    */
	if ( prt_error ) 
	{
	     print_pipe11_er( ". No overflow fault seen" );
	     writes("op1 = ");
	     write32h( dbl_ld_acc.m );
	     writes(",   op2 = ");
	     write32h( dbl_value_1.m );
	     writec('\n');
	}
	if ( halt_flg ) 			/* halt on error?          */
	     pipe11_halt( 1 );			/* halt with a code of 1   */
	if ( loop_on_err ) 
	{
	     force_loop = TRUE;			/* set the force loop flag */
	     asm("jmp _pipe11_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, ADDF op2, CVLF op3    (overflow fault on the ADDF)
* The CVLF should not be executed.
* op1 = xxxxxxxx, final Acc. = xxxxxxxx,   op3 = xxxxxxxx
* op2 = xxxxxxxx,   expected = xxxxxxxx 
****************************************************************************/
bad_pipe11_result()
{
	errcnt++;				/* bump the error count    */
	if ( prt_error ) 
	{
	     print_pipe11_er( ". Bad final Accumulator" );
	     writes(
	      "The CVLF should not be executed\n");
	     writes("op1 = ");
	     write32h( dbl_ld_acc.m );
	     writes(",  final Acc. = ");
	     write32h( post_evt_acc.m );
	     writes(",   op3 = ");
	     write32h( dbl_value_2.m );
	     writes("\nop2 = ");
	     write32h( dbl_value_1.m );
	     writes(",    expected = ");
	     write32h( 0 );			/* the expected result = 0 */
	     writec('\n');
	}
	if ( halt_flg ) 			/* halt on error?           */
	     pipe11_halt( 2 );			/* halt with a code of 2    */
	if ( loop_on_err ) 
	{
	     force_loop = TRUE;			/* set the force loop flag */
	     asm("jmp _pipe11_lp1");		/* and loop                */
	};
}





/****************************************************************************
*		Report an "FPP queue not cleared" message
*
* Cycle: xx. EVT test xx. subtest xx. Fpp queue not cleared. index = xx
* inst = LDF op1, ADDF op2, CVLF op3    (overflow fault on the ADDF)
* The CVLF should not have been executed but apparently was.
* op1 = xxxxxxxx,  final Acc. = xxxxxxxx,  op3 = xxxxxxxx
* op2 = xxxxxxxx,    expected = xxxxxxxx 
****************************************************************************/
pipe11_queue_er()
{
	errcnt++;				/* bump the error count    */
	if ( prt_error ) 
	{
	     print_pipe11_er( ". Fpp queue not cleared" );
	     writes(
	   "The CVLF should not have been executed but apparently was.\n");
	     writes("op1 = ");
	     write32h( dbl_ld_acc.m );
	     writes(",  final Acc. = ");
	     write32h( post_evt_acc.m );
	     writes(",  op3 = ");
	     write32h( dbl_value_2.m );
	     writes("\nop2 = ");
	     write32h( dbl_value_1.m );
	     writes(",    expected = ");
	     write32h( 0 );			/* the expected result = 0 */
	     writec('\n');
	}
	if ( halt_flg ) 			/* halt on error?           */
	     pipe11_halt( 3 );			/* halt with a code of 3    */
	if ( loop_on_err ) 
	{
	     force_loop = TRUE;		/* set the force loop flag */
	     asm("jmp _pipe11_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, ADDF op2, CVLF op3    (overflow fault on the ADDF)
****************************************************************************/
print_pipe11_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, ADDF op2, CVLF op3    (overflow fault on the ADDF)\n");
}



/****************************************************************************
*		halt on error routine
****************************************************************************/
pipe11_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;
	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 accumulator  */
	asm("movl _sgl_value_2,r5");		/* r5 = ADDF operand         */
	asm("movl _sgl_value_3,r6");		/* r6 = final accumulator    */
	asm("clrl r7");				/* r7 = expected accumulator */
	asm("movl _index,r8");			/* r8 = data index           */
	asm("halt");				/* HALT ...                  */
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.