Add the files and decode logic for RVA
This commit is contained in:
@@ -51,7 +51,12 @@ impl Instruction {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn funct7(self) -> u8 {
|
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]
|
#[inline]
|
||||||
@@ -95,7 +100,7 @@ impl Instruction {
|
|||||||
/// 32bit ones use funct7 in this way
|
/// 32bit ones use funct7 in this way
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn funct6(self) -> u8 {
|
pub fn funct6(self) -> u8 {
|
||||||
(self.0 >> 26 & 0x3f) as u8
|
(self.0 >> 26) as u8
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mostly/only used for the SYSTEM opcode
|
/// Mostly/only used for the SYSTEM opcode
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
|
mod rva;
|
||||||
mod rvi;
|
mod rvi;
|
||||||
mod rvm;
|
mod rvm;
|
||||||
|
|
||||||
@@ -166,6 +167,7 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Result<(), E
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
0b01011 => rva::find_and_exec(instr, core),
|
||||||
_ => illegal(instr),
|
_ => illegal(instr),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/instructions/rva.rs
Normal file
14
src/instructions/rva.rs
Normal file
@@ -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),
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user