st.c
2.15 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/****************************************************************
WHAT: RSP SCALAR UNIT TEST GENERATOR FOR LOAD BYTE
SCCS: @(#)st.c 1.1 03 Aug 1994
FILE: st.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_ST_TCS
#define GenCase() \
fprintf(outp,Templ,CurTcNo,ip->name,rR,HHW(Reg[rR]), \
LHW(Reg[rR]),LHW(Imm),LHW(Imm)&~3,rA,rB, \
HHW(OpA),LHW(OpA),HHW(OpB),LHW(OpB), \
HHW(Res),LHW(Res),rT)
PRIVATE char *Templ =
/* ChkSt( n,Op, rR, RValH, RValL, Imm,ImmAlgn, rA, rB, OpAH, OpBL, OpBH, OpBL, ResH, ResL, rT)*/
"\tChkSt(%2d,%s,r%-2d,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,r%-2d,r%-2d,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,0x%4.4X,r%-2d)\n";
int StGen(outp, ip)
FILE *outp;
I_TABLE *ip;
{
int datasize = 0;
u32 data = 0;
switch (ip->vec) {
case STB_VEC: datasize = 1; data = 0x000000FF; break;
case STH_VEC: datasize = 2; data = 0x0000FF00; break;
case STW_VEC: datasize = 4; data = 0xFF000000; break;
default: fprintf(stderr,"Unrecognized vector type: ST\n"); break;
}
OpB = DMEM_BASE;
for (Imm=0; Imm<datasize*8; Imm+=datasize, CurTcNo++) {
OpA = 0x1001 << (Imm/datasize);
FILE_SPLIT {
Res = ip->proc(OpA,OpB,Imm);
GenCase();
UpdRegTABR();
}
UpdRegID();
}
for (Imm=datasize*8; Imm<datasize*16; Imm+=datasize, CurTcNo++) {
OpA = data << ((Imm/datasize)-8);
FILE_SPLIT {
Res = ip->proc(OpA,OpB,Imm);
GenCase();
UpdRegTABR();
}
UpdRegID();
}
OpB = DMEM_BASE + datasize*16;
for (Imm=-datasize; Imm>-datasize*9; Imm-=datasize, CurTcNo++) {
OpA = 0x1001 << ((-Imm/datasize)-1);
FILE_SPLIT {
Res = ip->proc(OpA,OpB,Imm);
GenCase();
UpdRegTABR();
}
UpdRegID();
}
for (Imm=-datasize*9; Imm>-datasize*17; Imm-=datasize, CurTcNo++) {
OpA = data << ((-Imm/datasize)-9);
FILE_SPLIT {
Res = ip->proc(OpA,OpB,Imm);
GenCase();
UpdRegTABR();
}
UpdRegID();
}
return CurTcNo = 0;
} /* StGen */