summaryrefslogtreecommitdiff
path: root/src/instructions
diff options
context:
space:
mode:
authortaitep <taitep@taitep.se>2025-12-21 19:01:02 +0100
committertaitep <taitep@taitep.se>2025-12-21 19:01:02 +0100
commit2e1c0a7dce7b5ce225b7ac56897eff2c65acdaa7 (patch)
tree3255caae1a1fae5bf054236472bd4d900b53c2e2 /src/instructions
parent5c132b55e9d197df0eca9e82db556f0dfb65a627 (diff)
Implement AUIPC
Diffstat (limited to 'src/instructions')
-rw-r--r--src/instructions/rvi.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/instructions/rvi.rs b/src/instructions/rvi.rs
index 3aadc10..5c06b62 100644
--- a/src/instructions/rvi.rs
+++ b/src/instructions/rvi.rs
@@ -123,6 +123,12 @@ pub fn jal(core: &mut Core, instr: Instruction) -> InstructionResult {
InstructionResult::Normal
}
+pub fn auipc(core: &mut Core, instr: Instruction) -> InstructionResult {
+ core.reg_write(instr.rd(), core.pc.wrapping_add(instr.imm_u()));
+ core.advance_pc();
+ InstructionResult::Normal
+}
+
pub fn beq(core: &mut Core, instr: Instruction) -> InstructionResult {
if core.reg_read(instr.rs1()) == core.reg_read(instr.rs2()) {
core.pc = core.pc.wrapping_add(instr.imm_b());