91 const int A[8] = { 22, 5, -9, 3, -17, 38, 0, 11 };
92 const int outData[8] = { -17, -9, 0, 3, 5, 11, 22, 38 };
94 #define IADDR(x) (((x)&0x000000ff)>>2) 95 #define DADDR(x) (((x)&0x000000ff)>>2) 126 for (i = 0; i < 32; i++)
130 reg[29] = 0x7fffeffc;
132 for (i = 0; i < 8; i++)
150 shamt = (ins >> 6) & 0x1f;
151 rd = (ins >> 11) & 0x1f;
152 rt = (ins >> 16) & 0x1f;
153 rs = (ins >> 21) & 0x1f;
159 reg[rd] = reg[rs] + reg[rt];
162 reg[rd] = reg[rs] - reg[rt];
166 hilo = (
long long) reg[rs] * (
long long) reg[rt];
167 Lo = hilo & 0x00000000ffffffffULL;
168 Hi = ((int) (hilo >> 32)) & 0xffffffffUL;
172 (
unsigned long long) ((
unsigned int) (reg[rs])) *
173 (
unsigned long long) ((
unsigned int) (reg[rt]));
174 Lo = hilo & 0x00000000ffffffffULL;
175 Hi = ((int) (hilo >> 32)) & 0xffffffffUL;
186 reg[rd] = reg[rs] & reg[rt];
189 reg[rd] = reg[rs] | reg[rt];
192 reg[rd] = reg[rs] ^ reg[rt];
195 reg[rd] = reg[rt] << shamt;
198 reg[rd] = reg[rt] >> shamt;
201 reg[rd] = reg[rt] << reg[rs];
204 reg[rd] = reg[rt] >> reg[rs];
208 reg[rd] = reg[rs] < reg[rt];
211 reg[rd] = (
unsigned int) reg[rs] < (
unsigned int) reg[rt];
224 tgtadr = ins & 0x3ffffff;
228 tgtadr = ins & 0x3ffffff;
235 address = ins & 0xffff;
236 rt = (ins >> 16) & 0x1f;
237 rs = (ins >> 21) & 0x1f;
241 reg[rt] = reg[rs] + address;
245 reg[rt] = reg[rs] & (
unsigned short) address;
248 reg[rt] = reg[rs] | (
unsigned short) address;
251 reg[rt] = reg[rs] ^ (
unsigned short) address;
255 reg[rt] = dmem[
DADDR (reg[rs] + address)];
258 dmem[
DADDR (reg[rs] + address)] = reg[rt];
262 reg[rt] = address << 16;
266 if (reg[rs] == reg[rt])
267 pc = pc - 4 + (address << 2);
270 if (reg[rs] != reg[rt])
271 pc = pc - 4 + (address << 2);
275 pc = pc - 4 + (address << 2);
279 reg[rt] = reg[rs] < address;
283 reg[rt] = (
unsigned int) reg[rs] < (
unsigned short) address;
298 for (j = 0; j < 8; j++)
const unsigned long imem[44]