inp007.c 1.86 KB
#include <bstring.h>
#include <stdio.h>

#include "inp.h"

static void passThrough(void);
static void varyAlpha(void);

int
main(int argc, char *argv[])
{
	printHeader();
	passThrough();
	varyAlpha();
	printTrailingCycles();
}

/*
 * passThrough	choose an alpha such that numerator (and denominator)
 *		of multiply is non-zero and step through all coverage values.
 */
static void
passThrough(void)
{
	cc_t cc;
	cc_t *ccp = &cc;
	int i;

	bzero(ccp, sizeof(cc));

	ccp->ncyc = 0;		/* one cycle mode */

	/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,0) */

	ccp->cc_x_sel_1_r = CC_SUBA_ZERO;
	ccp->cc_y_sel_1_r = CC_SUBB_ZERO;
	ccp->cc_a_sel_1_r = CC_MULT_ZERO;
	ccp->cc_c_sel_1_r = CC_ADD_ONE;

	ccp->cc_x_sel_1_a = CC_SUBA_ZERO_ALPHA;
	ccp->cc_y_sel_1_a = CC_SUBB_ZERO_ALPHA;
	ccp->cc_a_sel_1_a = CC_MULT_ZERO_ALPHA;
	ccp->cc_c_sel_1_a = CC_ADD_ONE_ALPHA;

	ccp->alpha_cvg_select = 1;

	printf("# Coverage value pass through test\n");

	for (i = 0; i <= 8; i++) {
		ccp->cvg =  i;
		printf("#  cvg 0x%x\n", ccp->cvg);
		printVector(ccp, 1);
	}
}

/*
 * varyAlpha	hold coverage value constant and vary alpha values
 *		and verify that coverage does not vary
 */
static void
varyAlpha(void)
{
	cc_t cc;
	cc_t *ccp = &cc;
	int i;

	bzero(ccp, sizeof(cc));

	ccp->ncyc = 0;		/* one cycle mode */

	/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,0) */

	ccp->cc_x_sel_1_r = CC_SUBA_ZERO;
	ccp->cc_y_sel_1_r = CC_SUBB_ZERO;
	ccp->cc_a_sel_1_r = CC_MULT_ZERO;
	ccp->cc_c_sel_1_r = CC_ADD_ONE;

	ccp->cc_x_sel_1_a = CC_SUBA_ZERO_ALPHA;
	ccp->cc_y_sel_1_a = CC_SUBB_ZERO_ALPHA;
	ccp->cc_a_sel_1_a = CC_MULT_ZERO_ALPHA;
	ccp->cc_c_sel_1_a = CC_ADD_PRIM_ALPHA;


	ccp->alpha_cvg_select = 1;
	ccp->cvg = 0x2;

	printf("# Vary alpha while holding coverage constant\n");

	for (i = 1; i < 32; i++) {
		ccp->prim_a = i<<3;
		printf("#  alpha 0x%x\n", ccp->prim_a);
		printVector(ccp, 1);
	}
}