File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / fpevent / div_by_0_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 DIVIDE BY ZERO EVENT TEST
 *
 *  26-Mar-85  JJM: written
 *
 ********************************************************************
*/
div_by_0_test()
{
	event_msg = "Divide By ZERO";
	test_event = ARITH_CODE;	/* expect an arithmetic fault */
	exp_code = FLT_0_DIV_CODE;	/*  -specificly divide by 0   */
	disable_mask = 0;		/* don't disable any events   */
	evt_disabled = FALSE;		/* expected event is enabled  */
	if( evt_inst )			/* was the op-code specified? */
	{
	      if( evt_inst == DIVF_OP_CODE ) 
		   run_divf();		/* test the DIVF instruction */
	      else if( evt_inst == DIVD_OP_CODE ) 
		   run_divd();		/* test the DIVD instruction */
	      else if( (prt_hdrs) && (cycle == 1) ) 
	      {
	           writes("There are no DIVIDE BY ZERO faults with op-code ");
		   writeh( evt_inst );	/* print the ersatz op-code  */
		   writec('\n');
		   error = TRUE;	/* needed for line feed control */
	      }
	} 
	 else	/* test both DIVF and DIVD */
	{
	     run_divf();		/* test the DIVF instruction */
	     run_divd();		/* test the DIVD instruction */
	}
}
 



/*
 **********************************************************************
 *
 *	SET UP TO TEST DIVIDE BY ZERO WITH THE DIVF INSTRUCTION
 *
 **********************************************************************
*/
run_divf()
{
	op_code     = DIVF_OP_CODE;	/* set the inst's op_code */
	op_name     = "DIVF ";		/* set the inst's name */
	precision   = SGL;
	acc_ld_size = SGL;		/* load a single precision Acc. */
	sgl_op      = TRUE;
	valid_test  = TRUE;		/* we're running a test */
	data_ptr    = zero_divide_data;	/* set the data ptr */
	max_index   = zero_divide_cnt; 	/* set the max index */
	if( (prt_hdrs) && (cycle == 1) ) 
	     writes( op_name );
	test_inst();
}



/*
 **********************************************************************
 *
 *	SET UP TO TEST DIVIDE BY ZERO WITH THE DIVD INSTRUCTION
 *
 **********************************************************************
*/
run_divd()
{
	op_code     = DIVD_OP_CODE;	/* set the inst's op_code */
	op_name     = "DIVD ";		/* set the inst's name */
	precision   = DBL;
	acc_ld_size = DBL;		/* load a double precision Acc. */
	sgl_op      = FALSE;
	valid_test  = TRUE;		/* we're running a test */
	data_ptr    = zero_divide_data;	/* set the data ptr */
	max_index   = zero_divide_cnt; 	/* set the max index */
	if( (prt_hdrs) && (cycle == 1) ) 
	     writes( op_name );
	test_inst();
}

unix.superglobalmegacorp.com

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