diff options
| author | taitep <taitep@taitep.se> | 2025-12-30 20:53:57 +0100 |
|---|---|---|
| committer | taitep <taitep@taitep.se> | 2025-12-30 20:53:57 +0100 |
| commit | 0f0e844223a17452835aed88adb3af976d2e1eae (patch) | |
| tree | 2d993912a48ef5277c70035bb02c160e53a0f733 /src/instructions.rs | |
| parent | 5a383956c9ee27d50452aa237a9f34b7f75e8f7c (diff) | |
Finish RV64M
Diffstat (limited to 'src/instructions.rs')
| -rw-r--r-- | src/instructions.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/instructions.rs b/src/instructions.rs index 2a224b3..d820f35 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -32,7 +32,6 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Result<(), E // OP (0b000, 0b0000000) => rvi::add(core, instr), (0b000, 0b0100000) => rvi::sub(core, instr), - (0b000, 0b0000001) => rvm::mul(core, instr), (0b010, 0b0000000) => rvi::slt(core, instr), (0b011, 0b0000000) => rvi::sltu(core, instr), (0b001, 0b0000000) => rvi::sll(core, instr), @@ -40,8 +39,16 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Result<(), E (0b101, 0b0100000) => rvi::sra(core, instr), (0b111, 0b0000000) => rvi::and(core, instr), (0b100, 0b0000000) => rvi::xor(core, instr), - (0b100, 0b0000001) => rvm::div(core, instr), (0b110, 0b0000000) => rvi::or(core, instr), + // rvm + (0b000, 0b0000001) => rvm::mul(core, instr), + (0b001, 0b0000001) => rvm::mulh(core, instr), + (0b010, 0b0000001) => rvm::mulhsu(core, instr), + (0b011, 0b0000001) => rvm::mulhu(core, instr), + (0b100, 0b0000001) => rvm::div(core, instr), + (0b101, 0b0000001) => rvm::divu(core, instr), + (0b110, 0b0000001) => rvm::rem(core, instr), + (0b111, 0b0000001) => rvm::remu(core, instr), _ => illegal(instr), }, 0b01110 => match (instr.funct3(), instr.funct7()) { @@ -51,6 +58,12 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Result<(), E (0b001, 0b0000000) => rvi::sllw(core, instr), (0b101, 0b0000000) => rvi::srlw(core, instr), (0b101, 0b0100000) => rvi::sraw(core, instr), + // rvm + (0b000, 0b0000001) => rvm::mulw(core, instr), + (0b100, 0b0000001) => rvm::divw(core, instr), + (0b101, 0b0000001) => rvm::divuw(core, instr), + (0b110, 0b0000001) => rvm::remw(core, instr), + (0b111, 0b0000001) => rvm::remuw(core, instr), _ => illegal(instr), }, 0b00100 => match instr.funct3() { |
