cc2.c 1.65 KB
/****************************************************************
  WHAT:	RSP SCALAR UNIT TEST GENERATOR FOR CC2 FORMAT
  SCCS: %W% %G%
  PTLS:	$Id: cc2.c,v 1.1.1.1 2002/10/29 08:07:09 blythe Exp $
  FILE:	cc2 - To and from control register of coprocessor 2
  ENGR:	Evan Y. Wang
  PROJ:	Project Reality
  (CR):	1994 Silicon Graphics, Inc.
 ****************************************************************/
#include <stdio.h>
#include "software.h"
#include "gen.h"
#include "suregre.h"

#define MAX_TCS	MAX_CC2_TCS

#define GenCase()						\
    fprintf(outp,Templ,CurTcNo,ip->name,			\
	    rA, rB, rR, rT, vT,					\
	    HHW(OpA), LHW(OpA), HHW(OpB), LHW(OpB),		\
	    HHW(Res), LHW(Res), HHW(Imm), LHW(Imm))

PRIVATE	char *Templ =
    /* ChkCc2(  n,Op,   rA,   rB,   rR,   rT, vT,     AH,     AL,     BH,     BL,     RH,     RL,     TH,     TL); */
    "\tChkCc2(%2d,%s,r%-2d,r%-2d,r%-2d,r%-2d,v%d,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X)\n";

int Cc2Gen(outp, ip)
    FILE *outp;			/* output file handle		*/
    I_TABLE *ip;		/* instruction table entry ptr	*/
{
    int i;

    /* Test VCO */
    vT = 0;
    for (i=0; i<32; i++) {
	OpA = (4<<i) | (2<<(i&0xF)) | (1<<(i&7));
	OpB = (0x80000000>>i) | (0x10000>>(i&0xF)) | (0x80>>(i&7));
	FILE_SPLIT {
	    Res = ip->proc(OpA,OpB,vT);
	    GenCase();
	    UpdRegTABR();
	}

	CurTcNo++;
	UpdRegID();
    }

    /* Test VCC */
    vT = 1;
    for (i=0; i<32; i++) {
	OpA = (4<<i) | (2<<(i&0xF)) | (1<<(i&7));
	OpB = (0x80000000>>i) | (0x10000>>(i&0xF)) | (0x80>>(i&7));
	FILE_SPLIT {
	    Res = ip->proc(OpA,OpB,vT);
	    GenCase();
	    UpdRegTABR();
	}

	CurTcNo++;
	UpdRegID();
    }

    return 0;

}   /* Cc2Gen */