Skip to main content

ab_riscv_interpreter_compliance_tests/
rv64.rs

1#[cfg(any(miri, not(all(target_arch = "riscv64", target_feature = "zbc"))))]
2use ab_riscv_interpreter::rv64::b::zbc::clmul_internal;
3use ab_riscv_interpreter::rv64::{Rv64InterpreterState, Rv64SystemInstructionHandler};
4use ab_riscv_interpreter::{ExecutableInstruction, ExecutionError, ProgramCounter, VirtualMemory};
5use ab_riscv_macros::{instruction, instruction_execution};
6use ab_riscv_primitives::instruction::Instruction;
7use ab_riscv_primitives::instruction::rv64::b::zba::Rv64ZbaInstruction;
8use ab_riscv_primitives::instruction::rv64::b::zbb::Rv64ZbbInstruction;
9use ab_riscv_primitives::instruction::rv64::b::zbc::Rv64ZbcInstruction;
10use ab_riscv_primitives::instruction::rv64::b::zbs::Rv64ZbsInstruction;
11use ab_riscv_primitives::registers::Register;
12use core::fmt;
13use core::ops::ControlFlow;
14
15/// B(Zba+Zbb+Zbs)+Zbc
16#[instruction(inherit = [Rv64BInstruction, Rv64ZbcInstruction])]
17#[derive(Debug, Clone, Copy, PartialEq, Eq)]
18pub enum FullRv64BInstruction<Reg> {}
19
20#[instruction]
21impl<Reg> const Instruction for FullRv64BInstruction<Reg>
22where
23    Reg: [const] Register<Type = u64>,
24{
25    type Reg = Reg;
26
27    #[inline(always)]
28    fn try_decode(instruction: u32) -> Option<Self> {
29        None
30    }
31
32    #[inline(always)]
33    fn alignment() -> u8 {
34        size_of::<u32>() as u8
35    }
36
37    #[inline(always)]
38    fn size(&self) -> u8 {
39        size_of::<u32>() as u8
40    }
41}
42
43#[instruction]
44impl<Reg> fmt::Display for FullRv64BInstruction<Reg>
45where
46    Reg: fmt::Display + Copy,
47{
48    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
49        match self {}
50    }
51}
52
53#[instruction_execution]
54impl<Reg, Memory, PC, InstructionHandler, CustomError>
55    ExecutableInstruction<
56        Rv64InterpreterState<Reg, Memory, PC, InstructionHandler, CustomError>,
57        CustomError,
58    > for FullRv64BInstruction<Reg>
59where
60    Reg: Register<Type = u64>,
61    [(); Reg::N]:,
62    Memory: VirtualMemory,
63    PC: ProgramCounter<Reg::Type, Memory, CustomError>,
64    InstructionHandler: Rv64SystemInstructionHandler<Reg, Memory, PC, CustomError>,
65{
66    fn execute(
67        self,
68        state: &mut Rv64InterpreterState<Reg, Memory, PC, InstructionHandler, CustomError>,
69    ) -> Result<ControlFlow<()>, ExecutionError<Reg::Type, Self, CustomError>> {
70        Ok(ControlFlow::Continue(()))
71    }
72}