Skip to main content

ab_riscv_interpreter/rv64/zk/
zkn.rs

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