aboutsummaryrefslogtreecommitdiff
path: root/src/simulator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulator.rs')
-rw-r--r--src/simulator.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/simulator.rs b/src/simulator.rs
index a7140fe..607a3b5 100644
--- a/src/simulator.rs
+++ b/src/simulator.rs
@@ -105,9 +105,16 @@ impl Simulator {
// ret
core.running = false;
}
+ else {
+ let target = ((pc as i32) + inst.i_imm()) as usize;
+ core.registers.write_word(inst.rd(), pc + 4);
+ core.pc = target;
+ }
},
isa::opcodes::JAL => {
-
+ let target = ((pc as i32) + inst.uj_imm()) as usize;
+ core.registers.write_word(inst.rd(), pc + 4);
+ core.pc = target;
}
isa::opcodes::BRANCH => {