Skip to main content

ab_riscv_interpreter/rv32/zk/
zkn.rs

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