ilgen.h 3.35 KB
/************************************************************************
  WHAT:	RSP SCALAR UNIT BYPASS VERIFICATION TEST PROGRAM GENERATOR
  SCCS:	%W% %G%
  PTLS:	$Id: ilgen.h,v 1.1.1.1 2002/05/02 03:29:14 blythe Exp $
  FILE:	table.c
  ENGR:	Evan Y. Wang
  PROJ:	Project Reality
  (CR):	1994 Silicon Graphics, Inc.
 ************************************************************************/
#ifndef _table_h_
#define _table_h_

#define IMEM_BASE	0
#define IMEM_SIZE	0x1000			/* 4KB of IMEM	*/

#define DMEM_BASE	0x10000000
#define DMEM_SIZE	0x1000			/* 4KB of DMEM	*/

/************************************************************************
  UTILITY MACRO FUNCTIONS:
    HHW		- Extract high half-word.
    LHW		- Extract low  half-word.
 ************************************************************************/
#define	HHW(op)		(((op) >> 16) & 0xFFFF)
#define	LHW(op)		((op) & 0xFFFF)

/************************************************************************
  INSTRUCTION TABLE USED FOR GENERATING SCALAR UNIT BYPASS TESTS.
 ************************************************************************/
typedef struct {

    char *instr;		/* instruction string		*/
    int  op;			/* instruction type		*/
    int  atype;			/* intermediate value type	*/
    int  min_nop;
    int  grpmsk;		/* eliminate incongruent pairs	*/

} ITABLE;

#define ARG_VVV		0
#define ARG_VR		1
#define ARG_RV		2
#define ARG_R		3

#define OP_VADD		0
#define OP_LQV		(OP_VADD+1)
#define OP_MTC2		(OP_LQV+1)
#define OP_CTC2		(OP_MTC2+1)
#define OP_LTV		(OP_CTC2+1)
#define OP_SQV		(OP_LTV+1)
#define OP_MFC2		(OP_SQV+1)
#define OP_CFC2		(OP_MFC2+1)
#define OP_STV		(OP_CFC2+1)

/************************************************************************
  GLOBAL VARIABLES USED IN TEST GENERATION.
 ************************************************************************/
extern int Space;
extern ITABLE I1Table[];
extern ITABLE I2Table[];
extern int I1TableSize;
extern int I2TableSize;

/************************************************************************
  GLOBAL BARIABLES USED IN MODELING RSP.
 ************************************************************************/
extern u32  Vco;
extern u32  Reg[];
extern UD32 VReg[32][4];
extern UD32 DMem[];

/************************************************************************
  INSTRUCTION MACROS TO INCREASE READABILITY
 ************************************************************************/
#define ADDI(rd,rs,i)	fprintf(outp,"\taddi\t$%d,\t$%d,\t0x%4.4X\n",rd,rs,i)
#define BNE(r1,r2)	fprintf(outp,"\tbne\t$%d,\t$%d,\tFail\n",r1,r2)
#define CFC2(r,v)	fprintf(outp,"\tcfc2\t$%d,\t$v%d\n",r,v)
#define CTC2(r,v)	fprintf(outp,"\tctc2\t$%d,\t$v%d\n",r,v)
#define LI(rid,val)							\
{									\
    fprintf(outp,"\tlui\t$%d,\t0x%4.4X\n",rid,val>>16);			\
    fprintf(outp,"\tori\t$%d,\t0x%4.4X\n",rid,val&0xFFFF);		\
}
#define LQV(v,r)	fprintf(outp,"\tlqv\t$v%d,\t0($%d)\n",v,r)
#define LTV(v,r)	fprintf(outp,"\tltv\t$v%d[0],\t0($%d)\n",v,r)
#define NEWLINE()	fprintf(outp,"\n")
#define NOP()		fprintf(outp,"\tnop\n")
#define OR(rd,rs,rt)	fprintf(outp,"\tor\t$%d,\t$%d,\t$%d\n",rd,rs,rt)
#define STV(v,r)	fprintf(outp,"\tstv\t$v%d[0],\t0($%d)\n",v,r)
#define VADD(vd,v1,v2)	fprintf(outp,"\tvadd\t$v%d,\t$v%d,\t$v%d\n",vd,v1,v2)
#define VEQ(vd,v1,v2)	fprintf(outp,"\tveq\t$v%d,\t$v%d,\t$v%d\n",vd,v1,v2)
#define VNXOR(vd,v1,v2)	fprintf(outp,"\tvnxor\t$v%d,\t$v%d,\t$v%d\n",vd,v1,v2)

#endif