diff options
Diffstat (limited to 'src/simulator.rs')
-rw-r--r-- | src/simulator.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/simulator.rs b/src/simulator.rs index 3ca11d9..7e7051c 100644 --- a/src/simulator.rs +++ b/src/simulator.rs @@ -107,15 +107,15 @@ impl Simulator { core.running = false; } else { - let target = (((pc as i32) + inst.i_imm()) & 0xFFFFFFFE) as usize; - core.registers.write_word(inst.rd(), pc + 4); + let target = (((pc as i32) + inst.i_imm()) as usize) & 0xFFFFFFFE; + core.registers.write_word(inst.rd(), (pc + 4) as u32); core.pc = target; return; } }, isa::opcodes::JAL => { let target = ((pc as i32) + inst.uj_imm()) as usize; - core.registers.write_word(inst.rd(), pc + 4); + core.registers.write_word(inst.rd(), (pc + 4) as u32); core.pc = target; return; } |