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

/*
 ********************************************************************
 *
 *	MONITOR FOR THE FPP OVERFLOW EVENT TEST
 *
 *  25-Mar-85  JJM: written
 *
 ********************************************************************
*/
ovfl_test()
{
	event_msg = "Overflow";
	test_event = ARITH_CODE;	/* expect an arithmetic fault */
	exp_code = FLT_OVFL_CODE;	/*  -specificly floating overflow */
	disable_mask = 0;		/* don't disable any events   */
	evt_disabled = FALSE;
	if( evt_inst )			/* was the op-code specified? */
	{
	      inst_index = get_ovfl_index( evt_inst );
	      if( inst_index < 0 ) 	/* valid instruction for OVFL? */
	      {
	           if( (prt_hdrs) && (cycle == 1) )  /* not a valid instr */
		   {
			writes(
		       "There are no floating OVERFLOW faults with op-code ");
		        writeh( evt_inst );
		        writec('\n');
			error = TRUE;	/* needed for line feed control */
		   }
	      } else 
		   test_ovfl_inst();	/* test the instruction */
	} else				/* the op-code wasn't specfied */
	      for(inst_index=0; inst_index < size_ovfl_tbl; inst_index++)
		   test_ovfl_inst();	/* test each ovfl instruction */
}


/*
 ********************************************************************
 *
 *	test the floating overflow event on an instruction
 *
 ********************************************************************
*/
test_ovfl_inst()
{
	valid_test = TRUE;		/* a test is being run */
	op_code    =  ovfl_tbl[ inst_index ].inst_code;
	op_name    =  ovfl_tbl[ inst_index ].name;
	no_ops     =  ovfl_tbl[ inst_index ].no_operands;
	precision  =  ovfl_tbl[ inst_index ].precision;
	data_ptr   =  ovfl_tbl[ inst_index ].ovfl_data;
	max_index  = *ovfl_tbl[ inst_index ].ovfl_cnt;
	if( precision == SGL ) {
	     sgl_op = TRUE;
	     acc_ld_size = SGL;		/* use a sgl precision Acc. */
	} else {
	     sgl_op = FALSE;
	     acc_ld_size = DBL;		/* use a dbl precision Acc. */
	}
	if( (prt_hdrs) && (cycle == 1) ) 
	     writes( op_name );
	test_inst();
}




/*
 ***************************************************************************
 *
 *   GET THE OVERFLOW / UNDERFLOW INSTRUCTION TABLE INDEX FOR AN OP-CODE
 *
 *  Given the op_code of an instruction, return the instruction's index in
 *  the overflow / underflow instruction table. Return a negative number 
 *  if the op-code isn't in the table.
 *
 **************************************************************************
*/
get_ovfl_index( op_code )
{
int x;
	x = 0;
	while( (ovfl_tbl[x].inst_code != op_code) && (x < size_ovfl_tbl) )
	     x++;
	if( x == size_ovfl_tbl )
	     x = -1;
	return( x );
}



unix.superglobalmegacorp.com

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