int a = (inst >> 8) & 0xf;
unsigned av = cpu.asregs.regs[a];
unsigned v = (inst & 0xff);
+
TRACE("inc");
cpu.asregs.regs[a] = av + v;
}
int a = (inst >> 8) & 0xf;
unsigned av = cpu.asregs.regs[a];
unsigned v = (inst & 0xff);
+
TRACE("dec");
cpu.asregs.regs[a] = av - v;
}
{
int a = (inst >> 8) & 0xf;
unsigned v = (inst & 0xff);
+
TRACE("gsr");
cpu.asregs.regs[a] = cpu.asregs.sregs[v];
}
{
int a = (inst >> 8) & 0xf;
unsigned v = (inst & 0xff);
+
TRACE("ssr");
cpu.asregs.sregs[v] = cpu.asregs.regs[a];
}
case 0x01: /* ldi.l (immediate) */
{
int reg = (inst >> 4) & 0xf;
+
TRACE("ldi.l");
unsigned int val = EXTRACT_WORD(pc+2);
cpu.asregs.regs[reg] = val;
{
int dest = (inst >> 4) & 0xf;
int src = (inst ) & 0xf;
+
TRACE("mov");
cpu.asregs.regs[dest] = cpu.asregs.regs[src];
}
{
unsigned int fn = EXTRACT_WORD(pc+2);
unsigned int sp = cpu.asregs.regs[1];
+
TRACE("jsra");
/* Save a slot for the static chain. */
sp -= 4;
int b = inst & 0xf;
unsigned av = cpu.asregs.regs[a];
unsigned bv = cpu.asregs.regs[b];
+
TRACE("add.l");
cpu.asregs.regs[a] = av + bv;
}
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
int sp = cpu.asregs.regs[a] - 4;
+
TRACE("push");
wlat (scpu, opc, sp, cpu.asregs.regs[b]);
cpu.asregs.regs[a] = sp;
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
int sp = cpu.asregs.regs[a];
+
TRACE("pop");
cpu.asregs.regs[b] = rlat (scpu, opc, sp);
cpu.asregs.regs[a] = sp + 4;
{
int reg = (inst >> 4) & 0xf;
unsigned int addr = EXTRACT_WORD(pc+2);
+
TRACE("lda.l");
cpu.asregs.regs[reg] = rlat (scpu, opc, addr);
pc += 4;
{
int reg = (inst >> 4) & 0xf;
unsigned int addr = EXTRACT_WORD(pc+2);
+
TRACE("sta.l");
wlat (scpu, opc, addr, cpu.asregs.regs[reg]);
pc += 4;
int src = inst & 0xf;
int dest = (inst >> 4) & 0xf;
int xv;
+
TRACE("ld.l");
xv = cpu.asregs.regs[src];
cpu.asregs.regs[dest] = rlat (scpu, opc, xv);
{
int dest = (inst >> 4) & 0xf;
int val = inst & 0xf;
+
TRACE("st.l");
wlat (scpu, opc, cpu.asregs.regs[dest], cpu.asregs.regs[val]);
}
unsigned int addr = EXTRACT_WORD(pc+2);
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
+
TRACE("ldo.l");
addr += cpu.asregs.regs[b];
cpu.asregs.regs[a] = rlat (scpu, opc, addr);
unsigned int addr = EXTRACT_WORD(pc+2);
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
+
TRACE("sto.l");
addr += cpu.asregs.regs[a];
wlat (scpu, opc, addr, cpu.asregs.regs[b]);
int vb = cpu.asregs.regs[b];
TRACE("cmp");
-
if (va == vb)
cc = CC_EQ;
else
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
signed char bv = cpu.asregs.regs[b];
+
TRACE("sex.b");
cpu.asregs.regs[a] = (int) bv;
}
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
signed short bv = cpu.asregs.regs[b];
+
TRACE("sex.s");
cpu.asregs.regs[a] = (int) bv;
}
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
signed char bv = cpu.asregs.regs[b];
+
TRACE("zex.b");
cpu.asregs.regs[a] = (int) bv & 0xff;
}
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
signed short bv = cpu.asregs.regs[b];
+
TRACE("zex.s");
cpu.asregs.regs[a] = (int) bv & 0xffff;
}
int b = inst & 0xf;
unsigned av = cpu.asregs.regs[a];
unsigned bv = cpu.asregs.regs[b];
- TRACE("mul.x");
signed long long r =
(signed long long) av * (signed long long) bv;
+
+ TRACE("mul.x");
cpu.asregs.regs[a] = r >> 32;
}
break;
int b = inst & 0xf;
unsigned av = cpu.asregs.regs[a];
unsigned bv = cpu.asregs.regs[b];
- TRACE("umul.x");
unsigned long long r =
(unsigned long long) av * (unsigned long long) bv;
+
+ TRACE("umul.x");
cpu.asregs.regs[a] = r >> 32;
}
break;
case 0x1a: /* jmpa */
{
unsigned int tgt = EXTRACT_WORD(pc+2);
+
TRACE("jmpa");
pc = tgt - 2;
}
case 0x1b: /* ldi.b (immediate) */
{
int reg = (inst >> 4) & 0xf;
-
unsigned int val = EXTRACT_WORD(pc+2);
+
TRACE("ldi.b");
cpu.asregs.regs[reg] = val;
pc += 4;
int src = inst & 0xf;
int dest = (inst >> 4) & 0xf;
int xv;
+
TRACE("ld.b");
xv = cpu.asregs.regs[src];
cpu.asregs.regs[dest] = rbat (scpu, opc, xv);
{
int reg = (inst >> 4) & 0xf;
unsigned int addr = EXTRACT_WORD(pc+2);
+
TRACE("lda.b");
cpu.asregs.regs[reg] = rbat (scpu, opc, addr);
pc += 4;
{
int dest = (inst >> 4) & 0xf;
int val = inst & 0xf;
+
TRACE("st.b");
wbat (scpu, opc, cpu.asregs.regs[dest], cpu.asregs.regs[val]);
}
{
int reg = (inst >> 4) & 0xf;
unsigned int addr = EXTRACT_WORD(pc+2);
+
TRACE("sta.b");
wbat (scpu, opc, addr, cpu.asregs.regs[reg]);
pc += 4;
int reg = (inst >> 4) & 0xf;
unsigned int val = EXTRACT_WORD(pc+2);
+
TRACE("ldi.s");
cpu.asregs.regs[reg] = val;
pc += 4;
int src = inst & 0xf;
int dest = (inst >> 4) & 0xf;
int xv;
+
TRACE("ld.s");
xv = cpu.asregs.regs[src];
cpu.asregs.regs[dest] = rsat (scpu, opc, xv);
{
int reg = (inst >> 4) & 0xf;
unsigned int addr = EXTRACT_WORD(pc+2);
+
TRACE("lda.s");
cpu.asregs.regs[reg] = rsat (scpu, opc, addr);
pc += 4;
{
int dest = (inst >> 4) & 0xf;
int val = inst & 0xf;
+
TRACE("st.s");
wsat (scpu, opc, cpu.asregs.regs[dest], cpu.asregs.regs[val]);
}
{
int reg = (inst >> 4) & 0xf;
unsigned int addr = EXTRACT_WORD(pc+2);
+
TRACE("sta.s");
wsat (scpu, opc, addr, cpu.asregs.regs[reg]);
pc += 4;
case 0x25: /* jmp */
{
int reg = (inst >> 4) & 0xf;
+
TRACE("jmp");
pc = cpu.asregs.regs[reg] - 2;
}
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
int av, bv;
+
TRACE("and");
av = cpu.asregs.regs[a];
bv = cpu.asregs.regs[b];
int b = inst & 0xf;
int av = cpu.asregs.regs[a];
int bv = cpu.asregs.regs[b];
+
TRACE("lshr");
cpu.asregs.regs[a] = (unsigned) ((unsigned) av >> bv);
}
int b = inst & 0xf;
int av = cpu.asregs.regs[a];
int bv = cpu.asregs.regs[b];
+
TRACE("ashl");
cpu.asregs.regs[a] = av << bv;
}
int b = inst & 0xf;
unsigned av = cpu.asregs.regs[a];
unsigned bv = cpu.asregs.regs[b];
+
TRACE("sub.l");
cpu.asregs.regs[a] = av - bv;
}
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
int bv = cpu.asregs.regs[b];
+
TRACE("neg");
cpu.asregs.regs[a] = - bv;
}
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
int av, bv;
+
TRACE("or");
av = cpu.asregs.regs[a];
bv = cpu.asregs.regs[b];
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
int bv = cpu.asregs.regs[b];
+
TRACE("not");
cpu.asregs.regs[a] = 0xffffffff ^ bv;
}
int b = inst & 0xf;
int av = cpu.asregs.regs[a];
int bv = cpu.asregs.regs[b];
+
TRACE("ashr");
cpu.asregs.regs[a] = av >> bv;
}
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
int av, bv;
+
TRACE("xor");
av = cpu.asregs.regs[a];
bv = cpu.asregs.regs[b];
int b = inst & 0xf;
unsigned av = cpu.asregs.regs[a];
unsigned bv = cpu.asregs.regs[b];
+
TRACE("mul.l");
cpu.asregs.regs[a] = av * bv;
}
case 0x30: /* swi */
{
unsigned int inum = EXTRACT_WORD(pc+2);
+
TRACE("swi");
/* Set the special registers appropriately. */
cpu.asregs.sregs[2] = 3; /* MOXIE_EX_SWI */
int b = inst & 0xf;
int av = cpu.asregs.regs[a];
int bv = cpu.asregs.regs[b];
+
TRACE("div.l");
cpu.asregs.regs[a] = av / bv;
}
int b = inst & 0xf;
unsigned int av = cpu.asregs.regs[a];
unsigned int bv = cpu.asregs.regs[b];
+
TRACE("udiv.l");
cpu.asregs.regs[a] = (av / bv);
}
int b = inst & 0xf;
int av = cpu.asregs.regs[a];
int bv = cpu.asregs.regs[b];
+
TRACE("mod.l");
cpu.asregs.regs[a] = av % bv;
}
int b = inst & 0xf;
unsigned int av = cpu.asregs.regs[a];
unsigned int bv = cpu.asregs.regs[b];
+
TRACE("umod.l");
cpu.asregs.regs[a] = (av % bv);
}
unsigned int addr = EXTRACT_WORD(pc+2);
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
+
TRACE("ldo.b");
addr += cpu.asregs.regs[b];
cpu.asregs.regs[a] = rbat (scpu, opc, addr);
unsigned int addr = EXTRACT_WORD(pc+2);
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
+
TRACE("sto.b");
addr += cpu.asregs.regs[a];
wbat (scpu, opc, addr, cpu.asregs.regs[b]);
unsigned int addr = EXTRACT_WORD(pc+2);
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
+
TRACE("ldo.s");
addr += cpu.asregs.regs[b];
cpu.asregs.regs[a] = rsat (scpu, opc, addr);
unsigned int addr = EXTRACT_WORD(pc+2);
int a = (inst >> 4) & 0xf;
int b = inst & 0xf;
+
TRACE("sto.s");
addr += cpu.asregs.regs[a];
wsat (scpu, opc, addr, cpu.asregs.regs[b]);