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    ExecutionResult, FetchInstructionResult, InstructionFetcher, OpaqueThreadedExecutionResult,
16    RegisterFile, Rs1Rs2OperandValues, Rs1Rs2Operands, ThreadedExecutableInstruction,
17    ThreadedExecutionResult,
18};
19use ab_riscv_macros::instruction_execution;
20use ab_riscv_primitives::prelude::*;
21
22#[instruction_execution]
23const impl<Reg, Hart> ExecutableInstructionOperands for Rv32ZknInstruction<Hart>
24where
25    Reg: Register<Type = u32>,
26    Hart: HartConfig<Reg = Reg>,
27{
28}
29
30#[instruction_execution]
31const impl<Reg, Hart, Env> ExecutableInstructionCsr<Env> for Rv32ZknInstruction<Hart>
32where
33    Reg: Register<Type = u32>,
34    Hart: HartConfig<Reg = Reg>,
35{
36}
37
38#[instruction_execution]
39const impl<Reg, Hart, Regs, Env, Memory, PC> ExecutableInstruction<Regs, Env, Memory, PC>
40    for Rv32ZknInstruction<Hart>
41where
42    Reg: [const] Register<Type = u32>,
43    Hart: HartConfig<Reg = Reg>,
44{
45    #[inline(always)]
46    #[cfg_attr(feature = "no-panic", no_panic_const::no_panic(const))]
47    fn execute(
48        self,
49        Rs1Rs2OperandValues {
50            rs1_value,
51            rs2_value,
52        }: Rs1Rs2OperandValues<Reg::Type>,
53        _regs: &mut Regs,
54        _env: &mut Env,
55        _memory: &mut Memory,
56        _program_counter: &PC,
57    ) -> ExecutionResult<Reg> {
58        ExecutionResult::ContinueNoWrite
59    }
60}