File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / macro4 / pipe18.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"


/*****************************************************************************
*
*		PIPELINE TEST #18 
*
*	LDD(op1), MULD(op2), CVDL r0, SUBD operand[r0], STD
*
*  -where the operands are the fmacro1 MULD data patterns. The SUBD operand's
*   address is based on the result of the CVDL.
*  -The load, multiply, and convert will be done twice. The first time will
*   be to get the index and the data to subtract. The data to subtract will 
*   be the same as the accumulator so we'll expect a reasult of zero. The 
*   data will be stored based on the 1st CVDL result.
*  -If the 2nd CVDL doesn't get done before the SUBD operand is fetched then
*   we won't get a final accumulator of zero.
*  -For size reasons, only the MULD data with a result between -100 and +100
*   will be used for this test.
*****************************************************************************/
pipe_18()
{
	asm(".globl _pipeline_18_t");
	asm("_pipeline_18_t:");
	if( (cycle == 1) && (prt_hdrs) )	/* print headers on 1st cycle */
	   writes(" PIPE_18");
	force_loop = FALSE;			/* clear force_loop flag */
	for( index = 0; index <= max_muld_1_index; index++ ) {
	      dbl_value_1  = muld_1_data[index].op_1;	/* get the data  */
	      dbl_value_2  = muld_1_data[index].op_2;	/*   operands    */
	      dbl_expected.m = dbl_expected.l = 0;	/* result s/b 0  */
	      asm("ldd _dbl_value_1");
	      asm("muld _dbl_value_2");
	      asm("cvdl _index2");
	      asm("nop");
	      if( (index2 >= -99) && (index2 <= 99) ) {	
		   if( index2 ) {
			sgl_value_5 = 0;	/* set a dummy index */
			adr_dpipe_ops[sgl_value_5].m = 0;
			adr_dpipe_ops[sgl_value_5].l = 0xabadface;
		   } else {
			sgl_value_5 = 6;	/* set a dummy index */
			adr_dpipe_ops[sgl_value_5].m = 0xabadbabe;
			adr_dpipe_ops[sgl_value_5].l = 0xabadface;
		   }
		   asm("movl _index2,r0");	/* save the index */
		   asm("std _dpipe_ops[r0]");	/* save the Acc's value */
		   asm("std _dbl_value_3");	/* save this value */
/*
 *  This is the start of the LOOP ON ERROR section
*/
	           asm("_pipe18_1_lp:");
		   asm("movl _sgl_value_5,r0");	/* save the bum index */
	           asm("ldd _dbl_value_1");	
	           asm("muld _dbl_value_2");
	           asm("cvdl r0");		/* set up the index to use */
	           asm("subd _dpipe_ops[r0]");	/* subtract saved value */
	           asm("std _dbl_st_acc");
		   asm("movl r0,_sgl_value_6");	/* save the index used */
	           if( force_loop ) 
	                asm("brb _pipe18_1_lp");;	/* loop on the error */
/*
 *   Verify the results (the accumulator should be = 0) 
*/
	           if( (dbl_st_acc.m) || (dbl_st_acc.l) ) {
	                 errcnt++;		/* bump the error count    */
	                 if ( prt_error ) 
			     pipe18_print();	/* print the error mesage  */
	                 if ( halt_flg )
	                     pipe18_halt( 1 );	/* halt on the error       */
	                 if ( loop_on_err )  {
			     force_loop = TRUE;
	                     asm("jmp _pipe18_1_lp");;   
	           	 }
	           }
	      }
	} 
	asm("jmp *return");		/* return to the test monitor       */
}




/*
 **************************************************************************
 *
 *		print an error message of the form
 *
 * cycle: xx  Test xx, Error with subtract data based on CVDL value, index = xx
 * test sequence = LDD(op1), MULD(op2), CVDL r0, SUBD operand[r0], STD
 *operand 1 = xxxxxxx xxxxxxx,    final Acc = xxxxxxx xxxxxxx,  index = xxxxxxx
 *operand 2 = xxxxxxx xxxxxxx, expected Acc = xxxxxxx xxxxxxx
 *operand 3 = xxxxxxx xxxxxxx,  CVDL result = xxxxxxx
 *                             int expected = xxxxxxx
 **************************************************************************
*/
pipe18_print()
{
	 writes(" \n");		/* start a new print line   */
	 writes("cycle: ");
	 writed( cycle );
	 writes("  Test ");
	 writed( test_no );
	 writes("  (Pipe 18),  error\n");
	 writes(" LDD(op1), MULD(op2), CVDL(r0), SUBD(op3), STD\n");
	 writes("operand 1 = ");
	 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("\noperand 2 = ");
	 write32h( dbl_value_2.m );
	 writec(' ');
	 write32h( dbl_value_2.l );
	 writes(", expected Acc = ");
	 write32h( dbl_expected.m );
	 writec(' ');
	 write32h( dbl_expected.l );
	 writes("\noperand 3 = ");
	 write32h( dbl_value_3.m );
	 writec(' ');
	 write32h( dbl_value_3.l );
	 writes(",  CVDL result = ");
	 write32h( sgl_value_6 );
	 writec('\n');
	 writes("                               int expected = ");
	 write32h( index2 );
	 writec('\n');
}



/*
 **************************************************************************
 *
 *		HALT ON AN ERROR
 *
 **************************************************************************
*/
pipe18_halt()
{
	 sgl_value_1 = dbl_value_1.m;
	 sgl_value_2 = dbl_value_1.l;
	 sgl_value_3 = dbl_value_2.m;
	 sgl_value_4 = dbl_value_2.l;
	 asm("movl _test_no,r0");	/* r0  = test number           */
	 asm("movl $1,r1");		/* r1  = subtest number        */
	 asm("movl $1,r2");		/* r2  = error code            */
	 asm("movl _cycle,r3");		/* r3  = cycle count           */
	 asm("movl _sgl_value_1,r4");	/* r4  = MS of dbl operand #1  */
	 asm("movl _sgl_value_2,r5");	/* r5  = LS of dbl operand #1  */
	 asm("movl _sgl_value_3,r6");	/* r6  = MS of dbl operand #2  */
	 asm("movl _sgl_value_4,r7");	/* r7  = LS of dbl operand #2  */
	 sgl_value_1 = dbl_st_acc.m;
	 sgl_value_2 = dbl_st_acc.l;
	 sgl_value_3 = dbl_expected.m;
	 sgl_value_4 = dbl_expected.l;
	 sgl_value_5 = dbl_value_3.m;
	 sgl_value_6 = dbl_value_3.l;
	 asm("movl _sgl_value_5,r8");	/* r8  = MS of dbl operand #3  */
	 asm("movl _sgl_value_6,r9");	/* r9  = LS of dbl operand #3  */
	 asm("movl _sgl_value_1,r10");	/* r10 = MS of final result    */
	 asm("movl _sgl_value_2,r11");	/* r11 = LS of final result    */
	 asm("movl _sgl_value_3,r12");	/* r12 = MS of expected result */
	 asm("movl _sgl_value_4,r13");	/* r13 = LS of expected result */
	 asm("movl _index,r14");	/* r14 = 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.