brl_w.c 1.19 KB
/****************************************************************
  WHAT: RSP TEST GENERATOR
  SCCS: @(#)brl_w.c	1.1 03 Aug 1994
  FILE: brl_w.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_BRL_W_TCS

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

/* Macro for condition true */
PRIVATE	char *TemplT =
    /* ChkBrlWT(  n,Op,   rA,   OpAH,   OpAL,   rT); */
    "\tChkBrlWT(%2d,%s,r%-2d,0x%4.4X,0x%4.4X,r%-2d)\n";

/* Macro for condition false */
PRIVATE	char *TemplF =
    /* ChkBrlWF(  n,Op,   rA,   OpAH,   OpAL,   rT); */
    "\tChkBrlWF(%2d,%s,r%-2d,0x%4.4X,0x%4.4X,r%-2d)\n";

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

    while (1) {

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

	if (OpA == 0xFFFFFFFF)		break;
	else if (OpA & 0x80000000)	{ OpA = (OpA<<1) | 0x80000001;	}
	else				{ OpA = 1 << i;			}

	UpdRegID(); i++; CurTcNo++;
    }
    return CurTcNo = 0;

}   /* BrlWGen */