utils.c 1.81 KB
/************************************************************************
  WHAT: RSP DUAL-ISSUE VERIFICATION TEST PROGRAM GENERATOR
  SCCS: @(#)utils.c	1.2 21 Sep 1994
  PTLS: $Id: utils.c,v 1.1.1.1 2002/05/02 03:29:13 blythe Exp $
  ENGR:	Project Reality - Evan Y. Wang
  (CR):	1994 Silicon Graphics, Inc.
 ************************************************************************/
#include <stdio.h>
#include "software.h"
#include "digen.h"

void fpCOMMENT(of,str)
    FILE *of;
    char *str;
{
    static char *stars = "************************************************";

    fprintf(of,"\n\t/%s\n\t  %s\n\t %s/\n\n", stars, str, stars);
}


void fpVADD(of,vd,v1,v2)
    FILE *of;
    int vd, v1, v2;
{
    int i;
    fprintf(of,"\tvadd\t$v%d, $v%d, $v%d\n",vd,v1,v2);
    for (i=0; i<8; i++) {
	*(&VReg[vd][0].u.h.hw+i) = *(&VReg[v1][0].u.h.hw+i)
	    + *(&VReg[v2][0].u.h.hw+i) + ((VCR[VCO]>>i)&1);
	if (*(&VReg[vd][0].u.h.hw+i) > 0x7FFF)
	    *(&VReg[vd][0].u.h.hw+i) = 0x7FFF;
    }
    VCR[VCO] = 0;
    IP++;
} /* fpvadd */

void fpVADDC(of,vd,v1,v2)
    FILE *of;
    int vd, v1, v2;
{
    int i;
    u32 tmp;

    fprintf(of,"\tvaddc\t$v%d, $v%d, $v%d\n",vd,v1,v2);
    VCR[VCO] = 0;
    for (i=0; i<8; i++) {
	tmp = *(&VReg[v1][0].u.h.hw+i) + *(&VReg[v2][0].u.h.hw+i);
	*(&VReg[vd][0].u.h.hw+i) = tmp & 0xFFFF;
	VCR[VCO] |= (tmp&0x10000) >> (16-i); 
    }
    IP++;
} /* fpvadd */

void fpVEQ(of,vd,v1,v2)
    FILE *of;
    int  vd, v1, v2;
{
    int i, cond;

    fprintf(of,"\tveq\t$v%d, $v%d, $v%d\n",vd,v1,v2);
    for (i=0; i<8; i++) {
	VCR[VCC] |= ((*(&VReg[v1][0].u.h.hw+i) == *(&VReg[v2][0].u.h.hw+i))
		     && !((VCR[VCO]>>(8+i))&1)) << i;
    }
    VReg[vd][0].w = VReg[v2][0].w;
    VReg[vd][1].w = VReg[v2][1].w;
    VReg[vd][2].w = VReg[v2][2].w;
    VReg[vd][3].w = VReg[v2][3].w;
    VCR[VCO] = 0;
    IP++;
} /* fpVEQ */