dmainstr.c 4.56 KB
/************************************************************************
  WHAT: RSP SCALAR UNIT DMA VERIFICATION TEST GENERATOR
  SCCS: %W% %G%
  PTLS:	$Id: dmainstr.c,v 1.1.1.1 2002/05/02 03:29:13 blythe Exp $
  ENGR:	Evan Y. Wang
  PROJ:	Project Reality
  (CR):	1994 Silicon Graphics, Inc.
 ************************************************************************/
#include <stdio.h>
#include <string.h>
#include "software.h"
#include "dmagen.h"

/************************************************************************
  INSTRUCTION MACROS
 ************************************************************************/
void Label(l)
    char *l;
{
    fprintf(fhTFile,"%s:",l);
}   /* Label */

void LdReg(r,v,c)
    int  r;
    u32  v;
    char *c;
{
    fprintf(fhTFile,"\tlui\t$%d,\t0x%4.4X\t\t\t%s\n",r,v>>16,c);
    fprintf(fhTFile,"\tori\t$%d,\t$%d,\t0x%4.4X\n",r,r,v&0xFFFF);
    Ip+=8;
}   /* LdReg */

void TestHeader(fno,tno)
    int fno;
    u32 tno;
{
    fprintf(fhTFile,"\t/********************************");
    fprintf(fhTFile,"********************************\n");
    fprintf(fhTFile,"\t                           DMA TEST #%d.%d\n",fno,tno);
    fprintf(fhTFile,"\t ********************************");
    fprintf(fhTFile,"********************************/\n");
}   /* TestHeader */

/************************************************************************
  INSTRUCTIONS
 ************************************************************************/
void Add(rt,r1,r2,c)
    int  rt;
    int  r1;
    int  r2;
    char *c;
{
    fprintf(fhTFile,"\tadd\t$%d,\t$%d,\t$%d\t\t%s\n",rt,r1,r2,c);
    Ip+=4;
}   /* Add */

void Addi(rt,r1,im,c)
    int  rt;
    int  r1;
    u16  im;
    char *c;
{
    fprintf(fhTFile,"\taddi\t$%d,\t$%d,\t0x%4.4X\t\t%s\n",rt,r1,im,c);
    Ip+=4;
}   /* Addi */

void Andi(rt,r1,im,c)
    int  rt;
    int  r1;
    u16  im;
    char *c;
{
    fprintf(fhTFile,"\tandi\t$%d,\t$%d,\t0x%4.4X\t\t%s\n",rt,r1,im,c);
    Ip+=4;
}   /* Andi */

void Beq(r1,r2,target,c)
    int  r1;
    int  r2;
    char *target;
    char *c;
{
    fprintf(fhTFile,"\tbeq\t$%d,\t$%d,\t%s\t\t%s\n",r1,r2,target,c);
    Ip+=4;
}   /* Bne */

void Bne(r1,r2,target,c)
    int  r1;
    int  r2;
    char *target;
    char *c;
{
    fprintf(fhTFile,"\tbne\t$%d,\t$%d,\t%s\t\t%s\n",r1,r2,target,c);
    Ip+=4;
}   /* Bne */

void Break()
{
    fprintf(fhTFile,"\tbreak\n");
    Ip+=4;
}   /* Nop */

void J(l,c)
    char *l;
    char *c;
{
    fprintf(fhTFile,"\tj\t%s\t\t\t\t%s\n",l,c);
    Ip+=4;
}   /* J */

void Jal(l,c)
    char *l;
    char *c;
{
    fprintf(fhTFile,"\tjal\t%s\t\t\t\t%s\n",l,c);
    Ip+=4;
}   /* Jal */

void Jalr(rt,rd,c)
    int  rt;
    int  rd;
    char *c;
{
    fprintf(fhTFile,"\tjalr\t$%d,\t$%d\t\t\t%s\n",rt,rd,c);
    Ip+=4;
}   /* Jalr */

void Jr(r,c)
    int  r;
    char *c;
{
    fprintf(fhTFile,"\tjr\t$%d\t\t\t\t%s\n",r,c);
    Ip+=4;
}   /* Jr */

void Lw(rt,offs,ra,c)
    int  rt;
    u16  offs;
    int  ra;
    char *c;
{
    fprintf(fhTFile,"\tlw\t$%d,\t0x%4.4X ($%d)\t\t%s\n",rt,offs,ra,c);
    Ip+=4;
}   /* Lw */

void Mfc0(r,cpu,c)
    int  r;
    int  cpu;
    char *c;
{
    fprintf(fhTFile,"\tmfc0\t$%d,\t$%d\t\t\t%s\n",r,cpu,c);
    Ip+=4;
}   /* Mfc0 */

void Mtc0(r,cpu,c)
    int  r;
    int  cpu;
    char *c;
{
    fprintf(fhTFile,"\tmtc0\t$%d,\t$%d\t\t\t%s\n",r,cpu,c);
    Ip+=4;
}   /* Mtc0 */

void Nop(c)
    char *c;
{
    fprintf(fhTFile,"\tnop\t\t\t\t\t%s\n",c);
    Ip+=4;
}   /* Nop */

void Or(rt,r1,r2,c)
    int  rt;
    int  r1;
    int  r2;
    char *c;
{
    fprintf(fhTFile,"\tor\t$%d,\t$%d,\t$%d\t\t%s\n",rt,r1,r2,c);
    Ip+=4;
}   /* Or */

void Ori(rt,rd,v,c)
    int  rt;
    int  rd;
    u32  v;
    char *c;
{
    fprintf(fhTFile,"\tori\t$%d,\t$%d,\t0x%4.4X\t\t%s\n",rt,rd,v&0xFFFF,c);
    Ip+=4;
}   /* Ori */

void Sll(rt,rd,v,c)
    int  rt;
    int  rd;
    u32  v;
    char *c;
{
    fprintf(fhTFile,"\tsll\t$%d,\t$%d,\t0x%4.4X\t\t%s\n",rt,rd,v&0xFFFF,c);
    Ip+=4;
}   /* Sll */

void Srl(rt,rd,v,c)
    int  rt;
    int  rd;
    u32  v;
    char *c;
{
    fprintf(fhTFile,"\tsrl\t$%d,\t$%d,\t0x%4.4X\t\t%s\n",rt,rd,v&0xFFFF,c);
    Ip+=4;
}   /* Sll */

void Sub(rt,r1,r2,c)
    int  rt;
    int  r1;
    int  r2;
    char *c;
{
    fprintf(fhTFile,"\tsub\t$%d,\t$%d,\t$%d\t\t%s\n",rt,r1,r2,c);
    Ip+=4;
}   /* Sub */

void Sw(rt,offs,ra,c)
    int  rt;
    u16  offs;
    int  ra;
    char *c;
{
    fprintf(fhTFile,"\tsw\t$%d,\t0x%4.4X ($%d)\t\t%s\n",rt,offs,ra,c);
    Ip+=4;
}   /* Sw */

void Xor(rt,r1,r2,c)
    int  rt;
    int  r1;
    int  r2;
    char *c;
{
    fprintf(fhTFile,"\txor\t$%d,\t$%d,\t$%d\t\t%s\n",rt,r1,r2,c);
    Ip+=4;
}   /* Xor */