Commit ef8504e9 authored by George Hotz's avatar George Hotz

beq and bne

parent bc7c1f01
......@@ -114,8 +114,17 @@ contract MIPS {
storeAddr = REG_PC;
}
// execute
uint32 val = execute(insn, rs, rt, mem);
uint32 val;
if (opcode == 4 || opcode == 5) { // beq/bne
rt = m.ReadMemory(stateHash, REG_OFFSET + ((insn >> 14) & 0x7C));
if ((rs == rt && opcode == 4) || (rs != rt && opcode == 5)) {
val = pc + (SE(insn&0xFFFF, 16)<<2);
storeAddr = REG_PC;
}
} else {
// ALU
val = execute(insn, rs, rt, mem);
}
// write back
if (storeAddr != 0xFFFFFFFF) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment