Skip to main content

ab_riscv_interpreter/rv32/zk/
zbkc.rs

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