br_ww.c 1.98 KB
/****************************************************************
  WHAT:	RSP TEST GENERATOR
  SCCS: @(#)br_ww.c	1.1 03 Aug 1994
  FILE:	br_ww.c
   WHO: Project Reality - Evan Y. Wang
   (C): 1994 Silicon Graphics, Inc.
 ****************************************************************/
#include <stdio.h>
#include "software.h"
#include "gen.h"
#include "suregre.h"

#define	MAX_TCS	MAX_BR_WW_TCS

#define GenCase(tmpl)						\
    fprintf(outp,tmpl,CurTcNo,ip->name,rA,rB,			\
	    HHW(OpA),LHW(OpA),HHW(OpB),LHW(OpB),rT);

PRIVATE	char *TemplT =
    /* ChkBrWWT(  n,Op,   rA,   rB,   OpAH,   OpAL,   OpBH,   OpBL,   rT); */
    "\tChkBrWWT(%2d,%s,r%-2d,r%-2d,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,r%-2d)\n";

PRIVATE	char *TemplF =
    /* ChkBrWWF(  n,Op,   rA,   rB,   OpAH,   OpAL,   OpBH,   OpBL,   rT); */
    "\tChkBrWWF(%2d,%s,r%-2d,r%-2d,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,r%-2d)\n";

int BrWWGen(outp, ip)
    FILE *outp;
    I_TABLE *ip;
{
    int i = 0;

    FILE_SPLIT {	/* default case - both operands zero */
	if (ip->proc(OpA,OpB))	{ GenCase(TemplT); }
	else			{ GenCase(TemplF); }
    }
    CurTcNo++;

    OpA = 2;
    OpB = 2;
    do {
	FILE_SPLIT {
	    if (ip->proc(OpA,OpB))	{ GenCase(TemplT); }
	    else			{ GenCase(TemplF); }
	}

	switch (i++&3) {
	  case 0: OpA <<= 2;	break;
	  case 1: OpB <<= 2;	break;
	  case 2: OpB <<= 2;	break;
	  case 3: OpA <<= 2;	break;
	}

	UpdRegID();

    } while (CurTcNo++, OpA <= 0x40000000 && OpB <= 0x40000000);

    i = 0;
    OpA = 3;
    OpB = 3;
    do {
	FILE_SPLIT {
	    if (ip->proc(OpA,OpB))	{ GenCase(TemplT); }
	    else			{ GenCase(TemplF); }
	}

	switch (i++&3) {
	  case 0: OpA <<= 2; OpA |= 0x80000003;	break;
	  case 1: OpB <<= 2; OpB |= 0x80000003;	break;
	  case 2: OpB <<= 2; OpB |= 0x80000003;	break;
	  case 3: OpA <<= 2; OpA |= 0x80000003;	break;
	}

	UpdRegID();

    } while (CurTcNo++, (OpA & OpB) != 0xFFFFFFFF);

    FILE_SPLIT {
	if (ip->proc(OpA,OpB))	{ GenCase(TemplT); }
	else			{ GenCase(TemplF); }
    }

    return CurTcNo = 0;

}   /* BrWWGen */