ld.c
1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/****************************************************************
WHAT: RSP SCALAR UNIT TEST GENERATOR FOR LOAD BYTE
SCCS: @(#)ld.c 1.1 03 Aug 1994
FILE: ld.c
WHO: Project Reality - Evan Y. Wang
(C): Silicon Graphics, Inc.
****************************************************************/
#include <stdio.h>
#include "software.h"
#include "gen.h"
#include "suregre.h"
#define MAX_TCS MAX_LD_TCS
#define GenCase() \
fprintf(outp,Templ,CurTcNo,ip->name,rR,HHW(Reg[rR]), \
LHW(Reg[rR]),LHW(Imm),rB,HHW(OpB),LHW(OpB), \
HHW(Res),LHW(Res),rT)
PRIVATE char *Templ =
/* ChkLd( n,Op, rR, RValH, RValL, Imm, rB, OpBH, OpBL, ResH, ResL, rT)*/
"\tChkLd(%2d,%s,r%-2d,0x%4.4X,0x%4.4X,0x%4.4X,r%-2d,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,r%-2d)\n";
int LdGen(outp, ip)
FILE *outp;
I_TABLE *ip;
{
int datasize = 0;
switch (ip->vec) {
case LDB_VEC: datasize = 1; break;
case LDH_VEC: datasize = 2; break;
case LDW_VEC: datasize = 4; break;
default: fprintf(stderr,"Unrecognized vector type: LD\n"); break;
}
/************************************************************
Generate Test Cases
************************************************************/
OpB = DMEM_BASE;
for (Imm=0; Imm<datasize*0x14; Imm+=datasize, CurTcNo++) {
FILE_SPLIT {
Res = ip->proc(OpB,Imm);
GenCase();
UpdRegTBR();
}
UpdRegID();
}
OpB = DMEM_BASE + datasize*0x14;
for (Imm=-datasize; Imm>-datasize*0x15; Imm-=datasize, CurTcNo++) {
FILE_SPLIT {
Res = ip->proc(OpB,Imm);
GenCase();
UpdRegTBR();
}
UpdRegID();
}
return CurTcNo = 0;
} /* LdGen */