1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// Copyright (c) 2025 taitep
// SPDX-License-Identifier: MIT
//
// This file is part of TRVE (https://gitea.taitep.se/taitep/trve)
// See LICENSE file in the project root for full license text.
mod rvi;
use crate::{
core::{Core, InstructionResult},
decode::Instruction,
};
pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Option<InstructionResult> {
match instr.opcode_noncompressed() {
0b00100 => match instr.funct3() {
// OP_IMM
0b000 => Some(rvi::addi(core, instr)),
_ => None,
},
0b00110 => match instr.funct3() {
// OP_IMM_32
0b000 => Some(rvi::addiw(core, instr)),
_ => None,
},
0b01000 => match instr.funct3() {
// STORE
0b011 => Some(rvi::sd(core, instr)),
_ => None,
},
0b01101 => Some(rvi::lui(core, instr)),
_ => None,
}
}
|