Skip to content

Commit deba8c7

Browse files
author
Gilad Chase
committed
Add types module, move PackedCasmState there
1 parent f0a68be commit deba8c7

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

crates/prover/src/components/add_mul_opcode/prover.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,14 @@ use crate::components::memory;
1818
use crate::input::instructions::VmState;
1919
use crate::relations::{MemoryRelation, StateRelation, N_MEMORY_ELEMS, STATE_SIZE};
2020
use crate::utils::prover::decode_opcode;
21+
use crate::utils::types::PackedCasmState;
2122
use crate::utils::{Selector, SelectorTrait};
2223

2324
const N_MEMORY_LOOKUPS: usize = 4;
2425
const N_STATE_LOOKUPS: usize = 2;
2526

26-
// TODO(Ohad): take from prover_types and remove.
27-
pub struct PackedVmState {
28-
pub pc: PackedM31,
29-
pub ap: PackedM31,
30-
pub fp: PackedM31,
31-
}
32-
3327
pub struct ClaimGenerator {
34-
pub inputs: Vec<PackedVmState>,
28+
pub inputs: Vec<PackedCasmState>,
3529
}
3630
impl ClaimGenerator {
3731
pub fn new(mut inputs: Vec<VmState>) -> Self {
@@ -44,7 +38,7 @@ impl ClaimGenerator {
4438
let inputs = inputs
4539
.into_iter()
4640
.array_chunks::<N_LANES>()
47-
.map(|chunk| PackedVmState {
41+
.map(|chunk| PackedCasmState {
4842
pc: PackedM31::from_array(std::array::from_fn(|i| {
4943
M31::from_u32_unchecked(chunk[i].pc)
5044
})),
@@ -157,7 +151,7 @@ impl InteractionClaimGenerator {
157151
}
158152

159153
fn write_trace_simd(
160-
inputs: &[PackedVmState],
154+
inputs: &[PackedCasmState],
161155
memory_trace_generator: &memory::ClaimGenerator,
162156
) -> (
163157
Vec<CircleEvaluation<SimdBackend, M31, BitReversedOrder>>,
@@ -199,7 +193,7 @@ fn write_trace_simd(
199193
// | State (3) | flags (5) | offsets (3) | addrs (3) | values (3 * 4) |
200194
fn write_trace_row(
201195
trace: &mut [Col<SimdBackend, M31>],
202-
input: &PackedVmState,
196+
input: &PackedCasmState,
203197
row_index: usize,
204198
interaction_claim_generator: &mut InteractionClaimGenerator,
205199
memory_trace_generator: &memory::ClaimGenerator,

crates/prover/src/components/ret_opcode/prover.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,10 @@ use crate::components::memory;
1818
use crate::components::ret_opcode::component::RET_N_TRACE_CELLS;
1919
use crate::input::instructions::VmState;
2020
use crate::relations::MemoryRelation;
21+
use crate::utils::types::PackedCasmState;
2122

2223
const N_MEMORY_CALLS: usize = 3;
2324

24-
// TODO(Ohad): take from prover_types and remove.
25-
#[derive(Debug)]
26-
pub struct PackedCasmState {
27-
pub pc: PackedM31,
28-
pub ap: PackedM31,
29-
pub fp: PackedM31,
30-
}
31-
3225
#[derive(Debug)]
3326
pub struct ClaimGenerator {
3427
pub inputs: Vec<PackedCasmState>,

crates/prover/src/utils/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pub mod component;
22
pub mod prover;
3+
pub mod types;
34

45
use std::ops::{Add, Mul, Sub};
56

crates/prover/src/utils/types.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
use stwo_prover::core::backend::simd::m31::PackedM31;
2+
3+
#[derive(Debug, Clone)]
4+
pub struct PackedCasmState {
5+
pub pc: PackedM31,
6+
pub ap: PackedM31,
7+
pub fp: PackedM31,
8+
}

0 commit comments

Comments
 (0)