
29 September 1997 – Subject To Change
Serial Icache Load Predecode Values
C–5
build_vector(instr, outvector, &instatus, &instr_count); /* build the vector */
}
if (instr_count > MAX_INSTR){
printf("\nev5fmt Warning: input file too long.\n");
printf("\tThere are %d instructions in the input file\n", instr_count);
printf("\tTruncated after %d instructions\n\n", instr_count, MAX_INSTR);
}
}
fprintf(hexfile,":15%04X00",offset);
chksum = (offset & 0xff) + (offset >> 8) + 0x15;
for (j=0; j < 17; j++) /* special case, last record */
{
fprintf(hexfile,"%02X", (0x00));
= *charptr;
}
for (j=0; j < 4; j++) /* Put 4 bytes of FF at the end... */
{
fprintf(hexfile, "%02X", 0xff);
= 0xff;
}
fprintf(hexfile,"%02X\n", (-chksum) & 0xff);
fprintf(hexfile,":00000001FF\n"); /* end-of-file record */
printf("Total intructions processed = %d\t(%d free)\n",
instr_count, MAX_INSTR - instr_count);
fclose(infile);
fclose(outfile);
fclose(hexfile);
exit(0);
}
void build_vector(int instr[], int outvector[], int *instatus, int *instr_count)
{
int j, k, t;
int status;
for (j=0;j<4;j++) instr[j] = 0;
for (j=0;j<DATA_BYTES_PER_REC/4;j++) outvector[j]=0;
if (*instatus == 0) /* read until the file’s done */
{
/* read-in 4 instructions */
if (16 > (status = fread(&instr[0],1,16,infile)))
*instatus = 1; /* we’re done now */
*instr= status/4;
}
predecodes=0;
owparity = 0;
for (j=0;j<4;j++)
{
predecodes |= (4 ^ instrpredecode(instr[j])) << (j*5);