Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
cb1e8cc
Add shrink-cpu buses, decode layout, EQ chip
jotabulacios May 27, 2026
e5f7b2e
Add BYTEWISE ALU chip
jotabulacios May 27, 2026
7aaff8f
Add BYTEWISE, STORE and CPU32 chips
jotabulacios May 27, 2026
d3fb018
Add CPU32 buses; fix EQ ALU output width
jotabulacios May 27, 2026
8a7df1c
Register EQ/BYTEWISE/STORE/CPU32 as empty tables
jotabulacios May 27, 2026
0e38025
Migrate CPU + ALU/memory chips to unified ALU bus
jotabulacios May 27, 2026
dabff74
Delegate word instructions to the CPU32 table
jotabulacios May 27, 2026
68e49d7
Re-enable and rewrite CPU/decode/constraint tests for the shrink-cpu …
jotabulacios May 27, 2026
44ae067
remove unnecesary files
jotabulacios May 28, 2026
816917a
Unify LT/MUL/memw/dvrm onto the ALU bus
jotabulacios May 28, 2026
e9d93c5
Pin JALR rvd to pc+len
jotabulacios May 28, 2026
a35222c
Align SHIFT shift-amount layout with the spec
jotabulacios May 29, 2026
c8ef5f7
reconcile prover with shrink-cpu spec
jotabulacios May 29, 2026
aa73c31
Add spec assumption range checks
jotabulacios May 29, 2026
cd637dc
Add explicit IS_BYTE[shift[0]] range check
jotabulacios May 29, 2026
71319a5
Sync CPU with merged shrink-cpu spec
jotabulacios Jun 2, 2026
00ec7a0
solve conflicts
jotabulacios Jun 2, 2026
56adb56
remove old comments
jotabulacios Jun 2, 2026
5e90da2
use constants
jotabulacios Jun 2, 2026
0d95579
solve conflicts
jotabulacios Jun 3, 2026
949a847
Propagate carry in branch rvd constraint
jotabulacios Jun 3, 2026
0a10f13
prevent register side effects in CPU32 padding
jotabulacios Jun 3, 2026
025185b
Use unreachable for validated carry arms
jotabulacios Jun 8, 2026
6e4d83e
Force signed to zero on CPU32 padding rows
jotabulacios Jun 8, 2026
8fe9d9e
Force res_sign to zero on CPU32 padding rows
jotabulacios Jun 8, 2026
e898e41
Merge branch 'main' into feat/shrink-cpu-byte-alu
diegokingston Jun 9, 2026
6eb329b
Merge main into feat/shrink-cpu-byte-alu
MauroToscano Jun 11, 2026
64b2c1b
Gate CPU32 sign lookups by signed
jotabulacios Jun 11, 2026
9dfdf5f
Merge main into feat/shrink-cpu-byte-alu (resolve #652 conflicts)
MauroToscano Jun 11, 2026
732f5bb
Merge pull request #665 from yetanotherco/merge/main-into-shrink-cpu
MauroToscano Jun 11, 2026
55f85f5
close LT/SHIFT/LOAD underconstrained gaps
jotabulacios Jun 11, 2026
57bd2b0
Remove dead LT carry helper and fix stale comments
jotabulacios Jun 11, 2026
da8d63e
Remove legacy byte-op buses
MauroToscano Jun 12, 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,128 changes: 339 additions & 789 deletions prover/src/constraints/cpu.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion prover/src/constraints/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ impl AddConstraint {
let carry = match self.carry_idx {
0 => self.compute_carry_0(step),
1 => self.compute_carry_1(step),
_ => panic!("Invalid carry index"),
_ => unreachable!("carry_idx validated <= 1 at construction"),
};

if self.cond_cols.is_empty() {
Expand Down
69 changes: 64 additions & 5 deletions prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ use crate::tables::trace_builder::Traces;
use crate::tables::trace_builder::count_table_lengths;
use crate::tables::types::BusId;
use crate::test_utils::{
E, F, VmAir, create_bitwise_air, create_branch_air, create_commit_air, create_cpu_air,
create_decode_air, create_dvrm_air, create_halt_air, create_keccak_air, create_keccak_rc_air,
create_keccak_rnd_air, create_load_air, create_lt_air, create_memw_air,
create_memw_aligned_air, create_memw_register_air, create_mul_air, create_page_air,
create_register_air, create_shift_air,
E, F, VmAir, create_bitwise_air, create_branch_air, create_bytewise_air, create_commit_air,
create_cpu_air, create_cpu32_air, create_decode_air, create_dvrm_air, create_eq_air,
create_halt_air, create_keccak_air, create_keccak_rc_air, create_keccak_rnd_air,
create_load_air, create_lt_air, create_memw_air, create_memw_aligned_air,
create_memw_register_air, create_mul_air, create_page_air, create_register_air,
create_shift_air, create_store_air,
};

use stark::proof::options::{GoldilocksCubicProofOptions, ProofOptions};
Expand Down Expand Up @@ -84,6 +85,11 @@ pub struct TableCounts {
pub shift: usize,
pub branch: usize,
pub memw_register: usize,
// Auxiliary ALU / memory / CPU32 dispatch chips
pub eq: usize,
pub bytewise: usize,
pub store: usize,
pub cpu32: usize,
}

impl TableCounts {
Expand All @@ -99,6 +105,10 @@ impl TableCounts {
+ self.shift
+ self.branch
+ self.memw_register
+ self.eq
+ self.bytewise
+ self.store
+ self.cpu32
}

/// Validate that all required tables have at least one chunk.
Expand All @@ -117,6 +127,10 @@ impl TableCounts {
("shift", self.shift),
("branch", self.branch),
("memw_register", self.memw_register),
("eq", self.eq),
("bytewise", self.bytewise),
("store", self.store),
("cpu32", self.cpu32),
];
for (name, count) in checks {
if count == 0 {
Expand Down Expand Up @@ -212,6 +226,11 @@ pub(crate) struct VmAirs {
pub register: VmAir,
pub pages: Vec<VmAir>,
pub memw_registers: Vec<VmAir>,
// Auxiliary ALU / memory / CPU32 dispatch chips
pub eqs: Vec<VmAir>,
pub bytewises: Vec<VmAir>,
pub stores: Vec<VmAir>,
pub cpu32s: Vec<VmAir>,
}

impl VmAirs {
Expand Down Expand Up @@ -269,6 +288,18 @@ impl VmAirs {
{
pairs.push((air, trace, &()));
}
for (air, trace) in self.eqs.iter().zip(traces.eqs.iter_mut()) {
pairs.push((air, trace, &()));
}
for (air, trace) in self.bytewises.iter().zip(traces.bytewises.iter_mut()) {
pairs.push((air, trace, &()));
}
for (air, trace) in self.stores.iter().zip(traces.stores.iter_mut()) {
pairs.push((air, trace, &()));
}
for (air, trace) in self.cpu32s.iter().zip(traces.cpu32s.iter_mut()) {
pairs.push((air, trace, &()));
}

pairs
}
Expand Down Expand Up @@ -319,6 +350,18 @@ impl VmAirs {
for air in &self.memw_registers {
refs.push(air);
}
for air in &self.eqs {
refs.push(air);
}
for air in &self.bytewises {
refs.push(air);
}
for air in &self.stores {
refs.push(air);
}
for air in &self.cpu32s {
refs.push(air);
}

refs
}
Expand Down Expand Up @@ -454,6 +497,18 @@ impl VmAirs {
let memw_registers: Vec<_> = (0..table_counts.memw_register)
.map(|i| create_memw_register_air(proof_options).with_name(&format!("MEMW_R[{}]", i)))
.collect();
let eqs: Vec<_> = (0..table_counts.eq)
.map(|i| create_eq_air(proof_options).with_name(&format!("EQ[{}]", i)))
.collect();
let bytewises: Vec<_> = (0..table_counts.bytewise)
.map(|i| create_bytewise_air(proof_options).with_name(&format!("BYTEWISE[{}]", i)))
.collect();
let stores: Vec<_> = (0..table_counts.store)
.map(|i| create_store_air(proof_options).with_name(&format!("STORE[{}]", i)))
.collect();
let cpu32s: Vec<_> = (0..table_counts.cpu32)
.map(|i| create_cpu32_air(proof_options).with_name(&format!("CPU32[{}]", i)))
.collect();

#[cfg(feature = "debug-checks")]
debug_report::print_bus_legend();
Expand All @@ -478,6 +533,10 @@ impl VmAirs {
register,
pages,
memw_registers,
eqs,
bytewises,
stores,
cpu32s,
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion prover/src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::test_utils::E;
use crate::{RuntimePageRange, TableCounts};

/// Domain-separation tag. Bump the suffix (`_V2`, ...) on any encoding change.
const DOMAIN_TAG: &[u8] = b"LAMBDAVM_STARK_STATEMENT_V1";
const DOMAIN_TAG: &[u8] = b"LAMBDAVM_STARK_STATEMENT_V2";

fn elf_digest(elf: &[u8]) -> [u8; 32] {
let mut h = Keccak256::new();
Expand Down Expand Up @@ -55,6 +55,10 @@ pub(crate) fn absorb_statement(
shift,
branch,
memw_register,
eq,
bytewise,
store,
cpu32,
} = table_counts;
for count in [
cpu,
Expand All @@ -67,6 +71,10 @@ pub(crate) fn absorb_statement(
shift,
branch,
memw_register,
eq,
bytewise,
store,
cpu32,
] {
t.append_bytes(&(count as u64).to_le_bytes());
}
Expand Down
Loading
Loading