Implement AUIPC

This commit is contained in:
2025-12-21 19:01:02 +01:00
parent 5c132b55e9
commit 2e1c0a7dce
2 changed files with 7 additions and 0 deletions

View File

@@ -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());