pro_epi.c 2.17 KB
#include <stdio.h>
#include "vudefs.h"

prolog(fp)
FILE *fp;
  {
    int i;

    fprintf(fp,"/*******************************\n");
    fprintf(fp," *prog name:   %s        \n",prog_name);
    fprintf(fp," *******************************/\n");
    fprintf(fp,"                         \n");
/*
   fprintf(fp,"#include \"/hosts/yogi/usr/people/kishor/mdevroot/PR/rspsim/vuregre/src/include/VU_AVP.h\"      \n");
*/
    fprintf(fp,"#include \"VU_AVP.h\"    \n");
    fprintf(fp,"                         \n");
    fprintf(fp,"	.text	        \n");
    fprintf(fp,"	lui $26, 0x0000 \n");
    fprintf(fp,"	ori $26, 0x0040 \n");
    fprintf(fp,"	lui $27, 0x0000 \n");
    fprintf(fp,"	ori $27, 0x0fe0 \n");
    fprintf(fp,"                        \n");

    for (i=0; i<8; i++) data[data_pntr++] = 0x4000;
    for (i=0; i<8; i++) data[data_pntr++] = 0x0001;
    for (i=0; i<8; i++) data[data_pntr++] = 0x0000;
    for (i=0; i<8; i++) data[data_pntr++] = 0x0000;
  }

epilog(fp)
FILE *fp;
  {
    fprintf(fp,"                         \n");
    fprintf(fp,"	lui   $31,0xfeed \n");
    fprintf(fp,"	ori   $31,0x0000 \n");
    fprintf(fp,"	sw    $31, 0($0) \n");
    fprintf(fp,"	nop              \n");
    fprintf(fp,"	break	         \n");
    fprintf(fp,"	nop              \n");
    fprintf(fp,"	nop              \n");
    fprintf(fp,"	nop              \n");
    fprintf(fp,"	nop              \n");
    fprintf(fp,"Fail:                    \n"); 
    fprintf(fp,"	lui   $31,0xdead \n");
    fprintf(fp,"	ori   $31,0xbeef \n");
    fprintf(fp,"	sw    $31, 0($0) \n");
    fprintf(fp,"	nop              \n");
    fprintf(fp,"	break	         \n");
    fprintf(fp,"	nop              \n");
    fprintf(fp,"	nop              \n");
  }

dump_data(fp)
FILE *fp;
  {
   int i;
    fprintf(fp,"	                \n");
    fprintf(fp,"/**************************************/\n"); 
    fprintf(fp,"	                \n");
    fprintf(fp,".data                   \n");
    fprintf(fp,"	                \n");
   if (data_pntr>=2048){
    fprintf(fp,"******ERROR*****Data Segment exceeds 4K \n");
    printf("******ERROR*****Data Segment exceeds 4K \n");
    }
   else
    for (i=0; i<data_pntr; i++) fprintf(fp,"   .half 0x%4.4X  \n",data[i]);
  }