Commit b6100120 authored by George Hotz's avatar George Hotz

blez/bgtz

parent ef8504e9
...@@ -121,6 +121,11 @@ contract MIPS { ...@@ -121,6 +121,11 @@ contract MIPS {
val = pc + (SE(insn&0xFFFF, 16)<<2); val = pc + (SE(insn&0xFFFF, 16)<<2);
storeAddr = REG_PC; storeAddr = REG_PC;
} }
} else if (opcode == 6 || opcode == 7) { // blez/bgtz
if ((int32(rs) > 0 && opcode == 7) || (int32(rs) <= 0 && opcode == 6)) {
val = pc + (SE(insn&0xFFFF, 16)<<2);
storeAddr = REG_PC;
}
} else { } else {
// ALU // ALU
val = execute(insn, rs, rt, mem); val = execute(insn, rs, rt, mem);
...@@ -128,7 +133,7 @@ contract MIPS { ...@@ -128,7 +133,7 @@ contract MIPS {
// write back // write back
if (storeAddr != 0xFFFFFFFF) { if (storeAddr != 0xFFFFFFFF) {
// does this ever not happen? // does this ever not happen? yes, on untaken beq/bne
stateHash = m.WriteMemory(stateHash, storeAddr, val); stateHash = m.WriteMemory(stateHash, storeAddr, val);
} }
if (storeAddr != REG_PC) { if (storeAddr != REG_PC) {
......
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