summaryrefslogtreecommitdiff
path: root/src/instructions.rs
diff options
context:
space:
mode:
authortaitep <taitep@taitep.se>2025-12-21 19:36:25 +0100
committertaitep <taitep@taitep.se>2025-12-21 19:36:25 +0100
commit6c39a5eef270e160f9954dc8eac99ce53e8423c9 (patch)
tree37a48d9899b4a6284cd99e6a4510bc3f429ba114 /src/instructions.rs
parent944ed573c6f69e34c56179f98efd71b05e2bb02b (diff)
Implement JALR, fix JAL, change how some stuff in instructions.rs is expressed
Diffstat (limited to 'src/instructions.rs')
-rw-r--r--src/instructions.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/instructions.rs b/src/instructions.rs
index bf942ee..e72dfb5 100644
--- a/src/instructions.rs
+++ b/src/instructions.rs
@@ -16,11 +16,7 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Option<Instr
0b00100 => match instr.funct3() {
// OP_IMM
0b000 => Some(rvi::addi(core, instr)),
- 0b001 => match instr.funct6() {
- // left-shift immediate
- 0b000000 => Some(rvi::slli(core, instr)),
- _ => None,
- },
+ 0b001 => (instr.funct6() == 0).then(|| rvi::slli(core, instr)),
0b111 => Some(rvi::andi(core, instr)),
_ => None,
},
@@ -47,8 +43,9 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Option<Instr
_ => None,
},
0b01101 => Some(rvi::lui(core, instr)),
- 0b11011 => Some(rvi::jal(core, instr)),
0b00101 => Some(rvi::auipc(core, instr)),
+ 0b11011 => Some(rvi::jal(core, instr)),
+ 0b11001 => (instr.funct3() == 0).then(|| rvi::jalr(core, instr)),
_ => None,
}
}