Skip to main content

ab_riscv_interpreter/rv64/
b.rs

1//! RV64 B extension
2
3pub mod zba;
4pub mod zbb;
5pub mod zbc;
6pub mod zbs;
7
8use crate::rv64::b::zbb::rv64_zbb_helpers;
9use crate::{
10    ExecutableInstruction, ExecutableInstructionCsr, ExecutableInstructionOperands, ExecutionError,
11    RegisterFile, Rs1Rs2OperandValues, Rs1Rs2Operands,
12};
13use ab_riscv_macros::instruction_execution;
14use ab_riscv_primitives::prelude::*;
15use core::ops::ControlFlow;
16
17#[instruction_execution]
18impl<Reg> ExecutableInstructionOperands for Rv64BInstruction<Reg> where Reg: Register<Type = u64> {}
19
20#[instruction_execution]
21impl<Reg, ExtState, CustomError> ExecutableInstructionCsr<ExtState, CustomError>
22    for Rv64BInstruction<Reg>
23where
24    Reg: Register<Type = u64>,
25{
26}
27
28#[instruction_execution]
29impl<Reg, Regs, ExtState, Memory, PC, InstructionHandler, CustomError>
30    ExecutableInstruction<Regs, ExtState, Memory, PC, InstructionHandler, CustomError>
31    for Rv64BInstruction<Reg>
32where
33    Reg: Register<Type = u64>,
34{
35    #[inline(always)]
36    fn execute(
37        self,
38        Rs1Rs2OperandValues {
39            rs1_value,
40            rs2_value,
41        }: Rs1Rs2OperandValues<<Self::Reg as Register>::Type>,
42        _regs: &mut Regs,
43        _ext_state: &mut ExtState,
44        _memory: &mut Memory,
45        _program_counter: &mut PC,
46        _system_instruction_handler: &mut InstructionHandler,
47    ) -> Result<
48        ControlFlow<(), (Self::Reg, <Self::Reg as Register>::Type)>,
49        ExecutionError<Reg::Type, CustomError>,
50    > {
51        Ok(ControlFlow::Continue(Default::default()))
52    }
53}