Implement BLTU
This commit is contained in:
@@ -52,6 +52,7 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Option<Instr
|
||||
// BRANCH
|
||||
0b000 => Some(rvi::beq(core, instr)),
|
||||
0b001 => Some(rvi::bne(core, instr)),
|
||||
0b110 => Some(rvi::bltu(core, instr)),
|
||||
0b111 => Some(rvi::bgeu(core, instr)),
|
||||
_ => None,
|
||||
},
|
||||
|
||||
@@ -132,3 +132,13 @@ pub fn bgeu(core: &mut Core, instr: Instruction) -> InstructionResult {
|
||||
|
||||
InstructionResult::Normal
|
||||
}
|
||||
|
||||
pub fn bltu(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());
|
||||
} else {
|
||||
core.advance_pc();
|
||||
}
|
||||
|
||||
InstructionResult::Normal
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user