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

#include "fpp_defs.h"


/*****************************************************************************
*
*		DBL PIPELINE TEST #20 MONITOR
*
*  This test will do a series of 2, 3, 4, 5, and 6 NEGDs.
*  The data used will be the LDD data patterns.
*
*****************************************************************************/
pipe_20()
{
	asm(".globl _pipeline_20_t");
	asm("_pipeline_20_t:");			/* entry address            */
	if( (cycle == 1) && (prt_hdrs) )	/* print headers on 1st cycle */
	     writes(" PIPE_20");
	pipe20_1();				/* 2 NOPs  */
	pipe20_2();				/* 3 NOPs  */
	pipe20_3();				/* 4 NOPs  */
	pipe20_4();				/* 5 NOPs  */
	pipe20_5();				/* 6 NOPs  */
	asm("jmp *return");			/* return to the test monitor */
}





/************************************************************************
*
*		SUBTEST 1 :  2 NEGDs
*
************************************************************************/
pipe20_1() 
{
	subtest = 1;
	force_loop = FALSE;
	for( index = 0; index < max_ldd_1_index; index++ ) 
	{
	   dbl_value_1  = ldd_1_data[index].ld;   /* get operand 1        */
	   dbl_expected = ldd_1_data[index].exp;  /* get expected results */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe20_1_lp1:");
	   asm("ldd _dbl_value_1");		/* load the operand       */
	   asm("negd");				/* negate it ( twice )    */
	   asm("negd");
	   asm("std _dbl_st_acc");		/* store the result       */
	   if( force_loop )
	       asm("brb _pipe20_1_lp1");	/* loop on an error       */
/* 
 * verify the results
*/
	   if( (dbl_st_acc.m != dbl_expected.m) ||  /* COMPARE the stored */
	       (dbl_st_acc.l != dbl_expected.l) ) { /*  to the expected   */
	      errcnt++;				/* bump the error count   */
	      if( prt_error )
		  pipe20_print( 2 );		/* print error msg -2 NOPs */
	      if( halt_flg ) 			/* halt on error?          */
		  pipe20_halt( 2 );		/* error halt  -2 NOPs     */
	      if( loop_on_err ) {
		  force_loop = TRUE;		/* set the force loop flag */
		  asm("jmp _pipe20_1_lp1");	/*      and loop           */
	      }  
	   }
	}  /* end of FOR loop */
}  /* end of subtest 1 */





/************************************************************************
*
*		SUBTEST 2 :  3 NEGDs
*
************************************************************************/
pipe20_2() 
{
	subtest = 2;
	force_loop = FALSE;
	for( index = 0; index < max_ldd_1_index; index++ ) 
	{
	   dbl_value_1  = ldd_1_data[index].ld;   /* get operand 1        */
	   dbl_expected = ldd_1_data[index].exp;  /* get expected results */
	   if( dbl_expected.m )
	       dbl_expected.m ^= 0x80000000;	  /* negate exptd results */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe20_2_lp1:");
	   asm("ldd _dbl_value_1");		/* load the operand       */
	   asm("negd");				/* negate it ( 3 times )  */
	   asm("negd");
	   asm("negd");
	   asm("std _dbl_st_acc");		/* store the result       */
	   if( force_loop )
	       asm("brb _pipe20_2_lp1");	/* loop on an error       */
/* 
 * verify the results
*/
	   if( (dbl_st_acc.m != dbl_expected.m) ||  /* COMPARE the stored */
	       (dbl_st_acc.l != dbl_expected.l) ) { /*  to the expected   */
	      errcnt++;				/* bump the error count   */
	      if( prt_error )
		  pipe20_print( 3 );		/* print error msg -3 NOPs */
	      if( halt_flg ) 			/* halt on error?          */
		  pipe20_halt( 3 );		/* error halt  -3 NOPs     */
	      if( loop_on_err ) {
		  force_loop = TRUE;		/* set the force loop flag */
		  asm("jmp _pipe20_2_lp1");	/*      and loop           */
	      }  
	   }
	}  /* end of FOR loop */
}  /* end of subtest 2 */





/************************************************************************
*
*		SUBTEST 3 :  4 NEGDs
*
************************************************************************/
pipe20_3() 
{
	subtest = 3;
	force_loop = FALSE;
	for( index = 0; index < max_ldd_1_index; index++ ) 
	{
	   dbl_value_1  = ldd_1_data[index].ld;   /* get operand 1        */
	   dbl_expected = ldd_1_data[index].exp;  /* get expected results */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe20_3_lp1:");
	   asm("ldd _dbl_value_1");		/* load the operand       */
	   asm("negd");				/* negate it ( 4 times )  */
	   asm("negd");
	   asm("negd");
	   asm("negd");
	   asm("std _dbl_st_acc");		/* store the result       */
	   if( force_loop )
	       asm("brb _pipe20_3_lp1");	/* loop on an error       */
/* 
 * verify the results
*/
	   if( (dbl_st_acc.m != dbl_expected.m) ||  /* COMPARE the stored */
	       (dbl_st_acc.l != dbl_expected.l) ) { /*  to the expected   */
	      errcnt++;				/* bump the error count   */
	      if( prt_error )
		  pipe20_print( 4 );		/* print error msg -4 NOPs */
	      if( halt_flg ) 			/* halt on error?          */
		  pipe20_halt( 4 );		/* error halt  -4 NOPs     */
	      if( loop_on_err ) {
		  force_loop = TRUE;		/* set the force loop flag */
		  asm("jmp _pipe20_3_lp1");	/*      and loop           */
	      }  
	   }
	}  /* end of FOR loop */
}  /* end of subtest 3 */






/************************************************************************
*
*		SUBTEST 4 :  5 NEGDs
*
************************************************************************/
pipe20_4() 
{
	subtest = 4;
	force_loop = FALSE;
	for( index = 0; index < max_ldd_1_index; index++ ) 
	{
	   dbl_value_1  = ldd_1_data[index].ld;   /* get operand 1        */
	   dbl_expected = ldd_1_data[index].exp;  /* get expected results */
	   if( dbl_expected.m )
	       dbl_expected.m ^= 0x80000000;	  /* negate exptd results */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe20_4_lp1:");
	   asm("ldd _dbl_value_1");		/* load the operand       */
	   asm("negd");				/* negate it ( 5 times )  */
	   asm("negd");
	   asm("negd");
	   asm("negd");
	   asm("negd");
	   asm("std _dbl_st_acc");		/* store the result       */
	   if( force_loop )
	       asm("brb _pipe20_4_lp1");	/* loop on an error       */
/* 
 * verify the results
*/
	   if( (dbl_st_acc.m != dbl_expected.m) ||  /* COMPARE the stored */
	       (dbl_st_acc.l != dbl_expected.l) ) { /*  to the expected   */
	      errcnt++;				/* bump the error count   */
	      if( prt_error )
		  pipe20_print( 5 );		/* print error msg -5 NOPs */
	      if( halt_flg ) 			/* halt on error?          */
		  pipe20_halt( 5 );		/* error halt  -5 NOPs     */
	      if( loop_on_err ) {
		  force_loop = TRUE;		/* set the force loop flag */
		  asm("jmp _pipe20_4_lp1");	/*      and loop           */
	      }  
	   }
	}  /* end of FOR loop */
}  /* end of subtest 4 */





/************************************************************************
*
*		SUBTEST 5 :  6 NEGDs
*
************************************************************************/
pipe20_5() 
{
	subtest = 5;
	force_loop = FALSE;
	for( index = 0; index < max_ldd_1_index; index++ ) 
	{
	   dbl_value_1  = ldd_1_data[index].ld;   /* get operand 1        */
	   dbl_expected = ldd_1_data[index].exp;  /* get expected results */
/*
 * If LOOP ON ERROR is set, this is the loop for this subtest.
 * The force loop flag is set after the first error.
*/
	   asm("_pipe20_5_lp1:");
	   asm("ldd _dbl_value_1");		/* load the operand       */
	   asm("negd");				/* negate it ( 6 times )  */
	   asm("negd");
	   asm("negd");
	   asm("negd");
	   asm("negd");
	   asm("negd");
	   asm("std _dbl_st_acc");		/* store the result       */
	   if( force_loop )
	       asm("brb _pipe20_5_lp1");	/* loop on an error       */
/* 
 * verify the results
*/
	   if( (dbl_st_acc.m != dbl_expected.m) ||  /* COMPARE the stored */
	       (dbl_st_acc.l != dbl_expected.l) ) { /*  to the expected   */
	      errcnt++;				/* bump the error count   */
	      if( prt_error )
		  pipe20_print( 6 );		/* print error msg -6 NOPs */
	      if( halt_flg ) 			/* halt on error?          */
		  pipe20_halt( 6 );		/* error halt  -6 NOPs     */
	      if( loop_on_err ) {
		  force_loop = TRUE;		/* set the force loop flag */
		  asm("jmp _pipe20_5_lp1");	/*      and loop           */
	      }  
	   }
	}  /* end of FOR loop */
}  /* end of subtest 5 */




/****************************************************************************
*
*			PRINT AN ERROR MESSAGE
*
* cycle dd   PIPELINE 20, subtest dd error
*  LDD op, {NEGD}, STD
* operand = xxxxxxxx xxxxxxxx,  final Acc = xxxxxxxx xxxxxxxx,   index = dd
*                            expected Acc = xxxxxxxx xxxxxxxx
*
****************************************************************************/
pipe20_print( nop_count )
int nop_count;					/* # of NOP instructions */
{
	writes(" \n");		/* start a new print line   */
	writes("cycle: ");
	writed( cycle );
	writes("  PIPELINE 20, subtest ");
	writed( subtest );
	writes(" error\n");
	writes(" LDD(op), NEGD");
	while( --nop_count )
	     writes(", NEGD");
	writes(", STD\n");
	writes("operand = ");
	write32h( dbl_value_1.m );
	writec(' ');
	write32h( dbl_value_1.l );
	writes(",  final Acc = ");
	write32h( dbl_st_acc.m );
	writec(' ');
	write32h( dbl_st_acc.l );
	writes(",   index = ");
	writed( index );
	writes("\n                           expected Acc = ");
	write32h( dbl_expected.m );
	writec(' ');
	write32h( dbl_expected.l );
	writec('\n');
}



/****************************************************************************
*
*		SET UP THE REGISTERS AND HALT
*
****************************************************************************/
pipe20_halt( nop_count )
int nop_count;					/* # of NOP instructions */
{
	sgl_dummy1 = nop_count;
	sgl_value_1 = dbl_value_1.m;
	sgl_value_2 = dbl_value_1.l;
	sgl_value_3 = dbl_st_acc.m;
	sgl_value_4 = dbl_st_acc.l;
	sgl_value_5 = dbl_expected.m;
	sgl_value_6 = dbl_expected.l;
	asm("movl _test_no,r0");	/* r0  = test number     */
	asm("movl _subtest,r1");	/* r1  = subtest number  */
	asm("movl $1,r2");		/* r2  = error code      */
	asm("movl _cycle,r3");		/* r3  = cycle count     */
	asm("movl _sgl_dummy1,r4");	/* r4  = # of NEGDS      */
	asm("movl _sgl_value_1,r5");	/* r5  = MS operand      */
	asm("movl _sgl_value_2,r6");	/* r6  = LS operand      */
	asm("movl _sgl_value_3,r7");	/* r7  = MS stored       */
	asm("movl _sgl_value_4,r8");	/* r8  = LS stored       */
	asm("movl _sgl_value_5,r9");	/* r9  = MS expected     */
	asm("movl _sgl_value_6,r10");	/* r10 = LS expected     */
	asm("movl _index,r11");		/* r11 = 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.