Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
44daccd
fix: missing assert_bool for is_nor flag in BitwiseChip (#448)
eeemmmmmm Feb 24, 2026
96a64f0
fix: remove duplicate assert_bool constraints in ShiftRightChip (#451)
eeemmmmmm Feb 24, 2026
2073cbe
feat: add keeper (#443)
eigmax Feb 25, 2026
81391b6
feat: update shape files
eigmax Feb 25, 2026
8834491
feat: release vk for v1.2.5
eigmax Feb 26, 2026
96c2275
feat: update vk for v1.2.5
eigmax Mar 3, 2026
6664dff
Merge branch 'main' into pre-release-v1.2.5
eigmax Mar 3, 2026
26743e1
initial picus backend for Ziren
shankarapailoor Sep 25, 2025
f51e0a4
adding comment describing PicusInfo for AddSub
shankarapailoor Sep 25, 2025
c04256b
adding readme
shankarapailoor Sep 25, 2025
3d1257a
adding macro to derive PicusInfo
shankarapailoor Oct 3, 2025
4354a77
removing outdated comment
shankarapailoor Oct 3, 2025
73e6556
determining inputs/outputs through interactions
shankarapailoor Oct 3, 2025
448eff9
misc picus support changes
shankarapailoor Feb 5, 2026
5be5d16
rebased
shankarapailoor Feb 5, 2026
9b6e4d1
adding symbolic and concrete pending tasks
shankarapailoor Feb 9, 2026
88c8cb2
fixing unused import and formatting issues
shankarapailoor Feb 9, 2026
4d70a4e
clippy fixes
shankarapailoor Feb 9, 2026
e666580
removing picus out files
shankarapailoor Feb 9, 2026
83fc16f
format fix
shankarapailoor Feb 9, 2026
3bd174f
format fix
shankarapailoor Feb 9, 2026
bf0f855
clippy fixes
shankarapailoor Feb 9, 2026
f9b856d
fixing clippy warning
shankarapailoor Feb 9, 2026
17f4588
adding back selector post-conditions and checking one hot constraints…
shankarapailoor Mar 2, 2026
516429f
fixing fmt and clippy warnings
shankarapailoor Mar 2, 2026
e2c478d
refactor picus backend
shankarapailoor Mar 3, 2026
434b6a8
adding readme
shankarapailoor Mar 3, 2026
d62f0c1
fixing clippy warnings
shankarapailoor Mar 3, 2026
dec7cdf
updating dependency in Cargo lock
shankarapailoor Mar 3, 2026
9088e32
removing is_real from a selector in Sll
shankarapailoor Mar 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,032 changes: 641 additions & 391 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace.package]
version = "1.2.4"
version = "1.2.5"
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.80"
Expand All @@ -16,6 +16,7 @@ members = [
"crates/cuda",
"crates/curves",
"crates/derive",
"crates/picus",
"crates/primitives",
"crates/prover",
"crates/recursion/circuit",
Expand Down Expand Up @@ -115,6 +116,7 @@ zkm-build = { path = "crates/build" }
zkm-sdk = { path = "crates/sdk" }
zkm-cuda = { path = "crates/cuda" }
zkm-verifier = { path = "crates/verifier" }
zkm-picus = {path = "crates/picus"}

zkm-lib = { path = "crates/zkvm/lib", default-features = false }
zkm-zkvm = { path = "crates/zkvm/entrypoint", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ Learn more about Ziren at [docs.zkm.io](https://docs.zkm.io).
## Acknowledgements
Ziren draws inspiration from the following projects, which represents the cutting-edge zero-knowledge proof systems.
- [Plonky3](https://github.com/Plonky3/Plonky3): Ziren proving backend is based on Plonky3.
- [SP1](https://github.com/succinctlabs/sp1): Ziren circuit builder, recursion compiler, and precompiles originate from SP1.
- [SP1](https://github.com/succinctlabs/sp1): Ziren circuit builder, recursion compiler, and precompiles originate from SP1.
3 changes: 3 additions & 0 deletions crates/core/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ vec_map = { version = "0.8.2", features = ["serde"] }
enum-map = { version = "2.7.3", features = ["serde"] }
sha2 = { workspace = true }
anyhow = { workspace = true }
tracing-subscriber = "0.3.19"
env_logger = "0.11.6"
num_enum = "0.7.5"

[dev-dependencies]
test-artifacts = { path = "../../test-artifacts" }
Expand Down
14 changes: 13 additions & 1 deletion crates/core/executor/src/opcode.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
//! Opcodes for ZKM.

use enum_map::Enum;
use num_enum::TryFromPrimitive;
use p3_field::Field;
use serde::{Deserialize, Serialize};
use std::fmt::Display;

/// An opcode (short for "operation code") specifies the operation to be performed by the processor.
#[allow(non_camel_case_types)]
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord, Enum,
TryFromPrimitive,
Debug,
Clone,
Copy,
PartialEq,
Eq,
Hash,
Serialize,
Deserialize,
PartialOrd,
Ord,
Enum,
)]
#[repr(u8)]
pub enum Opcode {
Expand Down
1 change: 1 addition & 0 deletions crates/core/machine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ zkm-primitives = { workspace = true }
zkm-core-executor = { workspace = true, default-features = true }
zkm-curves = { workspace = true }

crossbeam-channel = "0.5.12"
rayon = "1.10.0"
rayon-scan = "0.1.1"

Expand Down
11 changes: 8 additions & 3 deletions crates/core/machine/src/alu/add_sub/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use zkm_core_executor::{
events::{AluEvent, ByteLookupEvent, ByteRecord},
ExecutionRecord, Opcode, Program,
};
use zkm_derive::AlignedBorrow;
use zkm_derive::{AlignedBorrow, PicusAnnotations};
use zkm_stark::{
air::{MachineAir, ZKMAirBuilder},
air::{MachineAir, PicusInfo, ZKMAirBuilder},
Word,
};

Expand All @@ -38,7 +38,7 @@ pub const NUM_ADD_SUB_COLS: usize = size_of::<AddSubCols<u8>>();
pub struct AddSubChip;

/// The column layout for the chip.
#[derive(AlignedBorrow, Default, Clone, Copy)]
#[derive(AlignedBorrow, PicusAnnotations, Default, Clone, Copy)]
#[repr(C)]
pub struct AddSubCols<T> {
/// The current/next pc, used for instruction lookup table.
Expand All @@ -56,9 +56,11 @@ pub struct AddSubCols<T> {
pub operand_2: Word<T>,

/// Flag indicating whether the opcode is `ADD`.
#[picus(selector)]
pub is_add: T,

/// Flag indicating whether the opcode is `SUB`.
#[picus(selector)]
pub is_sub: T,
}

Expand All @@ -78,6 +80,9 @@ impl<F: PrimeField32> MachineAir<F> for AddSubChip {
next_power_of_two(input.add_sub_events.len(), input.fixed_log2_rows::<F, _>(self));
Some(nb_rows)
}
fn picus_info(&self) -> PicusInfo {
AddSubCols::<u8>::picus_info()
}

fn generate_trace(
&self,
Expand Down
16 changes: 12 additions & 4 deletions crates/core/machine/src/alu/bitwise/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use zkm_core_executor::{
events::{AluEvent, ByteLookupEvent, ByteRecord},
ByteOpcode, ExecutionRecord, Opcode, Program,
};
use zkm_derive::AlignedBorrow;
use zkm_derive::{AlignedBorrow, PicusAnnotations};
use zkm_stark::{
air::{MachineAir, ZKMAirBuilder},
air::{MachineAir, PicusInfo, ZKMAirBuilder},
Word,
};

Expand All @@ -29,7 +29,7 @@ pub const NUM_BITWISE_COLS: usize = size_of::<BitwiseCols<u8>>();
pub struct BitwiseChip;

/// The column layout for the chip.
#[derive(AlignedBorrow, Default, Clone, Copy)]
#[derive(AlignedBorrow, PicusAnnotations, Default, Clone, Copy)]
#[repr(C)]
pub struct BitwiseCols<T> {
/// The current/next pc, used for instruction lookup table.
Expand All @@ -46,15 +46,19 @@ pub struct BitwiseCols<T> {
pub c: Word<T>,

/// If the opcode is NOR.
#[picus(selector)]
pub is_nor: T,

/// If the opcode is XOR.
#[picus(selector)]
pub is_xor: T,

// If the opcode is OR.
#[picus(selector)]
pub is_or: T,

/// If the opcode is AND.
#[picus(selector)]
pub is_and: T,
}

Expand All @@ -69,6 +73,10 @@ impl<F: PrimeField32> MachineAir<F> for BitwiseChip {
"Bitwise".to_string()
}

fn picus_info(&self) -> PicusInfo {
BitwiseCols::<u8>::picus_info()
}

fn generate_trace(
&self,
input: &ExecutionRecord,
Expand Down Expand Up @@ -229,7 +237,7 @@ where
builder.assert_bool(local.is_xor);
builder.assert_bool(local.is_or);
builder.assert_bool(local.is_and);
builder.assert_bool(local.is_xor);
builder.assert_bool(local.is_nor);
builder.assert_bool(is_real);
}
}
Expand Down
12 changes: 9 additions & 3 deletions crates/core/machine/src/alu/clo_clz/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use zkm_core_executor::{
events::{ByteLookupEvent, ByteRecord},
ByteOpcode, ExecutionRecord, Opcode, Program,
};
use zkm_derive::AlignedBorrow;
use zkm_stark::{air::MachineAir, Word};
use zkm_derive::{AlignedBorrow, PicusAnnotations};
use zkm_stark::{air::MachineAir, PicusInfo, Word};

use crate::{air::ZKMCoreAirBuilder, utils::pad_rows_fixed, CoreChipError};

Expand All @@ -39,7 +39,7 @@ const BYTE_SIZE: usize = 8;
pub struct CloClzChip;

/// The column layout for the chip.
#[derive(AlignedBorrow, Default, Debug, Clone, Copy)]
#[derive(AlignedBorrow, PicusAnnotations, Default, Debug, Clone, Copy)]
#[repr(C)]
pub struct CloClzCols<T> {
/// The current/next pc, used for instruction lookup table.
Expand All @@ -63,9 +63,11 @@ pub struct CloClzCols<T> {
pub sr1: Word<T>,

/// Flag to indicate whether the opcode is CLZ.
#[picus(selector)]
pub is_clz: T,

/// Flag to indicate whether the opcode is CLO.
#[picus(selector)]
pub is_clo: T,

/// Selector to know whether this row is enabled.
Expand All @@ -83,6 +85,10 @@ impl<F: PrimeField32> MachineAir<F> for CloClzChip {
"CloClz".to_string()
}

fn picus_info(&self) -> PicusInfo {
CloClzCols::<u8>::picus_info()
}

fn generate_trace(
&self,
input: &ExecutionRecord,
Expand Down
13 changes: 10 additions & 3 deletions crates/core/machine/src/alu/divrem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ use zkm_core_executor::{
};

use crate::{memory::MemoryReadWriteCols, CoreChipError};
use zkm_derive::AlignedBorrow;
use zkm_derive::{AlignedBorrow, PicusAnnotations};
use zkm_primitives::consts::WORD_SIZE;
use zkm_stark::{air::MachineAir, Word};
use zkm_stark::{
air::{MachineAir, PicusInfo},
Word,
};

use crate::{
air::{WordAirBuilder, ZKMCoreAirBuilder},
Expand All @@ -101,7 +104,7 @@ const LONG_WORD_SIZE: usize = 2 * WORD_SIZE;
pub struct DivRemChip;

/// The column layout for the chip.
#[derive(AlignedBorrow, Default, Debug, Clone, Copy)]
#[derive(AlignedBorrow, PicusAnnotations, Default, Debug, Clone, Copy)]
#[repr(C)]
pub struct DivRemCols<T> {
/// The current/next pc, used for instruction lookup table.
Expand Down Expand Up @@ -139,15 +142,19 @@ pub struct DivRemCols<T> {
pub is_c_0: IsZeroWordOperation<T>,

/// Flag to indicate whether the opcode is DIV.
#[picus(selector)]
pub is_div: T,

/// Flag to indicate whether the opcode is DIVU.
#[picus(selector)]
pub is_divu: T,

/// Flag to indicate whether the opcode is MOD.
#[picus(selector)]
pub is_mod: T,

/// Flag to indicate whether the opcode is MODU.
#[picus(selector)]
pub is_modu: T,

/// Flag to indicate whether the division operation overflows.
Expand Down
12 changes: 9 additions & 3 deletions crates/core/machine/src/alu/lt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use zkm_core_executor::{
events::{AluEvent, ByteLookupEvent, ByteRecord},
ByteOpcode, ExecutionRecord, Opcode, Program,
};
use zkm_derive::AlignedBorrow;
use zkm_derive::{AlignedBorrow, PicusAnnotations};
use zkm_stark::{
air::{BaseAirBuilder, MachineAir, ZKMAirBuilder},
Word,
PicusInfo, Word,
};

use crate::{
Expand All @@ -32,17 +32,19 @@ pub const NUM_LT_COLS: usize = size_of::<LtCols<u8>>();
pub struct LtChip;

/// The column layout for the chip.
#[derive(AlignedBorrow, Default, Clone, Copy)]
#[derive(AlignedBorrow, PicusAnnotations, Default, Clone, Copy)]
#[repr(C)]
pub struct LtCols<T> {
/// The current/next pc, used for instruction lookup table.
pub pc: T,
pub next_pc: T,

/// If the opcode is SLT.
#[picus(selector)]
pub is_slt: T,

/// If the opcode is SLTU.
#[picus(selector)]
pub is_sltu: T,

/// The output operand.
Expand Down Expand Up @@ -104,6 +106,10 @@ impl<F: PrimeField32> MachineAir<F> for LtChip {
"Lt".to_string()
}

fn picus_info(&self) -> PicusInfo {
LtCols::<u8>::picus_info()
}

fn generate_trace(
&self,
input: &ExecutionRecord,
Expand Down
21 changes: 14 additions & 7 deletions crates/core/machine/src/alu/mul/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ use zkm_core_executor::{
events::{ByteLookupEvent, ByteRecord, CompAluEvent, MemoryAccessPosition, MemoryRecordEnum},
ByteOpcode, ExecutionRecord, Opcode, Program,
};
use zkm_derive::AlignedBorrow;
use zkm_derive::{AlignedBorrow, PicusAnnotations};
use zkm_primitives::consts::WORD_SIZE;
use zkm_stark::{air::MachineAir, Word};
use zkm_stark::{air::MachineAir, PicusInfo, Word};

use crate::{
air::{WordAirBuilder, ZKMCoreAirBuilder},
Expand Down Expand Up @@ -74,10 +74,11 @@ const BYTE_MASK: u8 = 0xff;
pub struct MulChip;

/// The column layout for the chip.
#[derive(AlignedBorrow, Default, Debug, Clone, Copy)]
#[derive(AlignedBorrow, PicusAnnotations, Default, Debug, Clone, Copy)]
#[repr(C)]
pub struct MulCols<T> {
/// The current/next pc, used for instruction lookup table.
#[picus(input)]
pub pc: T,
pub next_pc: T,

Expand Down Expand Up @@ -112,15 +113,17 @@ pub struct MulCols<T> {
pub c_sign_extend: T,

/// Flag indicating whether the opcode is `MUL`.
#[picus(selector)]
pub is_mul: T,

/// Flag indicating whether the opcode is `MULT`.
#[picus(selector)]
pub is_mult: T,

/// Flag indicating whether the opcode is `MULTU`.
#[picus(selector)]
pub is_multu: T,

/// Selector to know whether this row is enabled.
pub is_real: T,

/// Access to hi register
Expand All @@ -146,6 +149,10 @@ impl<F: PrimeField32> MachineAir<F> for MulChip {
"Mul".to_string()
}

fn picus_info(&self) -> PicusInfo {
MulCols::<u8>::picus_info()
}

fn generate_trace(
&self,
input: &ExecutionRecord,
Expand Down Expand Up @@ -395,11 +402,11 @@ where
let product = {
for i in 0..PRODUCT_SIZE {
if i == 0 {
builder.assert_eq(local.product[i], m[i].clone() - local.carry[i] * base);
builder.assert_eq(m[i].clone(), local.carry[i] * base + local.product[i]);
} else {
builder.assert_eq(
local.product[i],
m[i].clone() + local.carry[i - 1] - local.carry[i] * base,
local.product[i] + local.carry[i] * base - local.carry[i - 1],
m[i].clone(),
);
}
}
Expand Down
Loading