summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaitep <taitep@taitep.se>2026-01-12 17:25:02 +0100
committertaitep <taitep@taitep.se>2026-01-12 17:25:02 +0100
commitd3e8af85a601cc5b831f02beff4ac415c21f1e8d (patch)
treeb1752f6fb4cf1817e7d045535482c51c53cf4dc7
parent3451a8227cee4a087f3836f63bd95650e3571ce9 (diff)
Add the files and decode logic for RVA
-rw-r--r--src/decode.rs9
-rw-r--r--src/instructions.rs2
-rw-r--r--src/instructions/rva.rs14
3 files changed, 23 insertions, 2 deletions
diff --git a/src/decode.rs b/src/decode.rs
index 7f58516..480fdff 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -51,7 +51,12 @@ impl Instruction {
#[inline]
pub fn funct7(self) -> u8 {
- (self.0 >> 25 & 0x7f) as u8
+ (self.0 >> 25) as u8
+ }
+
+ #[inline]
+ pub fn funct5(self) -> u8 {
+ (self.0 >> 27) as u8
}
#[inline]
@@ -95,7 +100,7 @@ impl Instruction {
/// 32bit ones use funct7 in this way
#[inline]
pub fn funct6(self) -> u8 {
- (self.0 >> 26 & 0x3f) as u8
+ (self.0 >> 26) as u8
}
/// Mostly/only used for the SYSTEM opcode
diff --git a/src/instructions.rs b/src/instructions.rs
index d820f35..476ae6d 100644
--- a/src/instructions.rs
+++ b/src/instructions.rs
@@ -7,6 +7,7 @@
#[macro_use]
mod macros;
+mod rva;
mod rvi;
mod rvm;
@@ -166,6 +167,7 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Result<(), E
Ok(())
}
},
+ 0b01011 => rva::find_and_exec(instr, core),
_ => illegal(instr),
}
}
diff --git a/src/instructions/rva.rs b/src/instructions/rva.rs
new file mode 100644
index 0000000..fd57056
--- /dev/null
+++ b/src/instructions/rva.rs
@@ -0,0 +1,14 @@
+// Copyright (c) 2026 taitep
+// SPDX-License-Identifier: BSD-2-Clause
+//
+// This file is part of TRVE (https://gitea.taitep.se/taitep/trve)
+// See LICENSE file in the project root for full license text.
+
+use super::illegal;
+use crate::{core::Core, decode::Instruction, exceptions::Exception};
+
+pub(super) fn find_and_exec(instr: Instruction, core: &mut Core) -> Result<(), Exception> {
+ match (instr.funct3(), instr.funct5()) {
+ _ => illegal(instr),
+ }
+}