File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / fpevent / pipe16.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:30:17 2019 UTC (7 years 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 #16
 *
 *  This test will execute the following code: "LDD ADDD STD"
 * with an overflow fault on the ADDD. We will make sure that:
 * 1. The fault is detected, 
 * 2. the accumulator is cleared, and
 * 3. that a floating '0' is stored by the STD or that there is no store.
 *********************************************************************
*/
pipe16()
{
#define PIPE16_PAT1 0x11223344
#define PIPE16_PAT2 0x55667788
	asm("moval (r13),_pre_event_fp");	/* save the frame pointer */
	asm("moval (r14),_pre_event_sp");	/* save the stack pointer */
	precision = DBL;
	test_event = ARITH_CODE;		/* expect an arithmetic fault */
	exp_code = FLT_OVFL_CODE;		/*  - specificly overflow     */
	exp_event = FALSE;			/* ... but not yet            */
	asm("movab _pipe16_ret,_event_return"); /* set event return address   */
	max_index = add_ov_cnt;			/* set max operand index      */
	for( index = 0; index < max_index; index++ )
	{
	     dbl_ld_acc = add_ov_dat[index].op_1;	/* get the Acc data  */
	     dbl_value_1 = add_ov_dat[index].op_2;	/* get the B operand */
	     dbl_value_2.m = PIPE16_PAT1;		/* set the initial   */
	     dbl_value_2.l = PIPE16_PAT2;		/* STD op's contents */
	     asm(".globl _pipe16_lp1");
	     asm("_pipe16_lp1:");
	     asm("bispsw $0x60");			/* enable ovfl,undfl */
	     asm("ldd _dbl_ld_acc");			/* load the Acc.     */
	     exp_event = test_event;			/* expect event soon */
	     asm("addd _dbl_value_1");			/* trigger the event */
	     asm("std _dbl_value_2");			/* shouldn't get here*/
/*
 * If we got to here then there was no event
*/
	     if( force_loop )
		  asm("brw _pipe16_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_pipe16_evt();;			/* report the error          */
/*
 * Come here after the event
*/
	     asm(".globl _pipe16_ret");
	     asm("_pipe16_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 _pipe16_lp1");;	/* loop on the error         */
	     asm("bicpsw $0x60");		/* disable ovfl & undfl evts */
	     if( (post_evt_acc.m) || (post_evt_acc.l) )  /* is Acc = 0? */
		  bad_pipe16_result();		/* incorrect result error    */
	     else if( ( (dbl_value_2.m) ||
			(dbl_value_2.l) ) 	/* either a '0' s/b stored,  */
		   && (dbl_value_2.m != 0x80000000)  /* or a RESERVED OP, or */
	           && ( (dbl_value_2.m != PIPE16_PAT1) || /* there s/b no    */
			(dbl_value_2.l != PIPE16_PAT2) ) )  /* store at all  */
		  bad_pipe16_store();		/* incorrect store error     */
	}
}



/****************************************************************************
*		Report an "EVENT NOT DETECTED" error
*
* Cycle: xx. EVT test xx. subtest xx. No overflow fault seen. index = xx
* inst = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)
* op1 = xxxxxxxx xxxxxxxx,   initial op3 = xxxxxxxx xxxxxxxx
* op2 = xxxxxxxx xxxxxxxx,     final op3 = xxxxxxxx xxxxxxxx
****************************************************************************/
no_pipe16_evt()
{
	errcnt++;				/* bump the error count    */
	if ( prt_error ) 
	{
	     sgl_value_1 = PIPE16_PAT1;
	     sgl_value_2 = PIPE16_PAT2;
	     print_pipe16_er( ". No overflow fault seen." );
	     writes("op1 = ");
	     write32h( dbl_ld_acc.m );
	     writec(' ');
	     write32h( dbl_ld_acc.l );
	     writes(",   initial op3 = ");
	     write32h( sgl_value_1 );
	     writec(' ');
	     write32h( sgl_value_2 );
	     writes("\nop2 = ");
	     write32h( dbl_value_1.m );
	     writec(' ');
	     write32h( dbl_value_1.l );
	     writes(",     final op3 = ");
	     write32h( dbl_value_2.m );
	     writec(' ');
	     write32h( dbl_value_2.l );
	     writec('\n');
	}
	if ( halt_flg ) 			/* halt on error?          */
	     pipe16_halt( 1 );			/* halt with a code of 1   */
	if ( loop_on_err ) 
	{
	     force_loop = TRUE;			/* set the force loop flag */
	     asm("jmp _pipe16_lp1");		/* and loop                */
	};
}




/****************************************************************************
*		Report an "BAD ACCUMULATOR AFTER THE EVENT" error
*
* Cycle: xx. EVT test xx. subtest xx. Bad final Accumulator. index = xx
* inst = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)
* op1 = xxxxxxxx xxxxxxxx,  final Acc = xxxxxxxx xxxxxxxx
* op2 = xxxxxxxx xxxxxxxx,   expected = xxxxxxxx xxxxxxxx
* init op3 = xxxxxxxx xxxxxxxx,  final op3 = xxxxxxxx xxxxxxxx
****************************************************************************/
bad_pipe16_result()
{
	errcnt++;				/* bump the error count    */
	if ( prt_error ) 
	{
	     sgl_value_1 = PIPE16_PAT1;
	     sgl_value_2 = PIPE16_PAT2;
	     print_pipe16_er( ". Bad final Accumulator" );
	     writes("op1 = ");
	     write32h( dbl_ld_acc.m );
	     writec(' ');
	     write32h( dbl_ld_acc.l );
	     writes(", final Acc. = ");
	     write32h( post_evt_acc.l );
	     writec(' ');
	     write32h( post_evt_acc.l );
	     writes("\nop2 = ");
	     write32h( dbl_value_1.m );
	     writec(' ');
	     write32h( dbl_value_1.l );
	     writes(",   expected = ");
	     write32h( 0 );			/* the expected result = 0 */
	     writec(' ');
	     write32h( 0 );
	     writes("\ninit op3 = ");
	     write32h( sgl_value_1 );
	     writec(' ');
	     write32h( sgl_value_2 );
	     writes(",  final op3 = ");
	     write32h( dbl_value_2.m );
	     writec(' ');
	     write32h( dbl_value_2.l );
	     writec('\n');
	}
	if ( halt_flg ) 			/* halt on error?           */
	     pipe16_halt( 2 );			/* halt with a code of 2    */
	if ( loop_on_err ) 
	{
	     force_loop = TRUE;			/* set the force loop flag */
	     asm("jmp _pipe16_lp1");		/* and loop                */
	};
}





/****************************************************************************
*		Report an "BAD VALUE STORED INTO OPERAND 3" error
*
* Cycle: xx. EVT test xx. subtest xx. Bad STD OP3 result. index = xx
* inst = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)
*      op1 = xxxxxxxx xxxxxxxx,     final Acc = xxxxxxxx xxxxxxxx
*      op2 = xxxxxxxx xxxxxxxx,  expected op3 = xxxxxxxx xxxxxxxx
* init op3 = xxxxxxxx xxxxxxxx,     final op3 = xxxxxxxx xxxxxxxx
****************************************************************************/
bad_pipe16_store()
{
	errcnt++;				/* bump the error count    */
	if ( prt_error ) 
	{
	     sgl_value_1 = PIPE16_PAT1;
	     sgl_value_2 = PIPE16_PAT2;
	     print_pipe16_er( ".  Bad STD OP3 result" );
	     writes("     op1 = ");
	     write32h( dbl_ld_acc.m );
	     writec(' ');
	     write32h( dbl_ld_acc.l );
	     writes(",    final Acc. = ");
	     write32h( post_evt_acc.l );
	     writec(' ');
	     write32h( post_evt_acc.l );
	     writes("\n     op2 = ");
	     write32h( dbl_value_1.m );
	     writec(' ');
	     write32h( dbl_value_1.l );
	     writes(",  expected op3 = ");
	     write32h( 0x80000000 );		/* the expected result = 0 */
	     writec(' ');
	     write32h( 0 );
	     writes("\ninit op3 = ");
	     write32h( sgl_value_1 );
	     writec(' ');
	     write32h( sgl_value_2 );
	     writes(",     final op3 = ");
	     write32h( dbl_value_2.m );
	     writec(' ');
	     write32h( dbl_value_2.l );
	     writec('\n');
	}
	if ( halt_flg ) 			/* halt on error?           */
	     pipe16_halt( 3 );			/* halt with a code of 2    */
	if ( loop_on_err ) 
	{
	     force_loop = TRUE;			/* set the force loop flag */
	     asm("jmp _pipe16_lp1");		/* and loop                */
	};
}






/****************************************************************************
*		Report an error message of the form:
*
* Cycle: xx. EVT test xx. subtest xx. <your message here>. index = xx
* inst = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)
****************************************************************************/
print_pipe16_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 = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)\n");
}



/****************************************************************************
*		halt on error routine
****************************************************************************/
pipe16_halt( code )
int code;				/* error code to halt with */
{
	err_code = code;
	sgl_value_1 = dbl_ld_acc.m;
	sgl_value_2 = dbl_ld_acc.l;
	sgl_value_3 = dbl_value_1.m;
	sgl_value_4 = dbl_value_1.l;
	sgl_value_5 = post_evt_acc.m;
	sgl_value_6 = post_evt_acc.l;
	sgl_value_7 = dbl_value_2.m;
	sgl_value_8 = dbl_value_2.l;
	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  = MSW of operand 1  */
	asm("movl _sgl_value_2,r5");		/* r5  = LSW of operand 1  */
	asm("movl _sgl_value_3,r6");		/* r6  = MSW of operand 2  */
	asm("movl _sgl_value_4,r7");		/* r7  = LSW of operand 2  */
	asm("movl _sgl_value_5,r8");		/* r8  = MSW of final Acc. */
	asm("movl _sgl_value_6,r9");		/* r9  = LSW of final Acc. */
	asm("clrl r10");			/* r10 = 0 (expected Acc.) */
	asm("movl _sgl_value_7,r11");		/* r11 = MSW of store data */
	asm("movl _sgl_value_8,r12");		/* r12 = LSW of store data */
	asm("movl _index,r13");			/* r13 = 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.