diff --git a/ceno_zkvm/src/instructions/riscv/jump.rs b/ceno_zkvm/src/instructions/riscv/jump.rs index 72a72ff87..2ef521e67 100644 --- a/ceno_zkvm/src/instructions/riscv/jump.rs +++ b/ceno_zkvm/src/instructions/riscv/jump.rs @@ -1,6 +1,7 @@ mod jal; use super::RIVInstruction; +use jal::JalCircuit; use ceno_emul::InsnKind; #[cfg(test)] @@ -10,3 +11,4 @@ pub struct JalOp; impl RIVInstruction for JalOp { const INST_KIND: InsnKind = InsnKind::JAL; } +pub type JalInstruction = JalCircuit; diff --git a/ceno_zkvm/src/instructions/riscv/jump/jal.rs b/ceno_zkvm/src/instructions/riscv/jump/jal.rs index d6b905514..5ea897e17 100644 --- a/ceno_zkvm/src/instructions/riscv/jump/jal.rs +++ b/ceno_zkvm/src/instructions/riscv/jump/jal.rs @@ -15,27 +15,27 @@ use crate::{ }; use ceno_emul::PC_STEP_SIZE; -pub struct JalInstruction(PhantomData<(E, I)>); - -pub struct InstructionConfig { +pub struct JalConfig { pub j_insn: JInstructionConfig, pub rd_written: UInt, } +pub struct JalCircuit(PhantomData<(E, I)>); + /// JAL instruction circuit /// NOTE: does not validate that next_pc is aligned by 4-byte increments, which /// should be verified by lookup argument of the next execution step against /// the program table -impl Instruction for JalInstruction { +impl Instruction for JalCircuit { + type InstructionConfig = JalConfig; + fn name() -> String { format!("{:?}", I::INST_KIND) } - type InstructionConfig = InstructionConfig; - fn construct_circuit( circuit_builder: &mut CircuitBuilder, - ) -> Result, ZKVMError> { + ) -> Result, ZKVMError> { let rd_written = UInt::new_unchecked(|| "rd_limbs", circuit_builder)?; let j_insn = JInstructionConfig::construct_circuit( @@ -55,7 +55,7 @@ impl Instruction for JalInstruction