Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify stack overflow auxiliary column build #1174

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
281 changes: 0 additions & 281 deletions processor/src/chiplets/aux_trace/bus.rs

This file was deleted.

38 changes: 24 additions & 14 deletions processor/src/chiplets/aux_trace/main_trace.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use core::ops::Range;

use super::{ColMatrix, Felt};

use core::ops::Range;
use miden_air::trace::{
chiplets::{
hasher::STATE_WIDTH, BITWISE_A_COL_IDX, BITWISE_B_COL_IDX, BITWISE_OUTPUT_COL_IDX,
Expand All @@ -11,11 +9,17 @@ use miden_air::trace::{
decoder::{HASHER_STATE_OFFSET, NUM_HASHER_COLUMNS, USER_OP_HELPERS_OFFSET},
CHIPLETS_OFFSET, CLK_COL_IDX, CTX_COL_IDX, DECODER_TRACE_OFFSET, STACK_TRACE_OFFSET,
};

use vm_core::{utils::range, ONE, ZERO};

// CONSTANTS
// ================================================================================================

const DECODER_HASHER_RANGE: Range<usize> =
range(DECODER_TRACE_OFFSET + HASHER_STATE_OFFSET, NUM_HASHER_COLUMNS);

// HELPER STRUCT AND METHODS
// ================================================================================================

pub struct MainTrace<'a> {
columns: &'a ColMatrix<Felt>,
}
Expand All @@ -27,7 +31,8 @@ impl<'a> MainTrace<'a> {
}
}

// System columns
// SYSTEM COLUMNS
// --------------------------------------------------------------------------------------------

pub fn clk(&self, i: usize) -> Felt {
self.columns.get_column(CLK_COL_IDX)[i]
Expand All @@ -37,12 +42,18 @@ impl<'a> MainTrace<'a> {
self.columns.get_column(CTX_COL_IDX)[i]
}

// Decoder columns
// DECODER COLUMNS
// --------------------------------------------------------------------------------------------

pub fn addr(&self, i: usize) -> Felt {
self.columns.get_column(DECODER_TRACE_OFFSET)[i]
}

// Helper method to detect change of address.
pub fn is_addr_change(&self, i: usize) -> bool {
self.addr(i) != self.addr(i + 1)
}

pub fn helper_0(&self, i: usize) -> Felt {
self.columns.get_column(DECODER_TRACE_OFFSET + USER_OP_HELPERS_OFFSET)[i]
}
Expand Down Expand Up @@ -82,7 +93,8 @@ impl<'a> MainTrace<'a> {
+ b6.mul_small(64)
}

// Stack columns
// STACK COLUMNS
// --------------------------------------------------------------------------------------------

pub fn s0(&self, i: usize) -> Felt {
self.columns.get_column(STACK_TRACE_OFFSET)[i]
Expand Down Expand Up @@ -140,7 +152,8 @@ impl<'a> MainTrace<'a> {
self.columns.get_column(STACK_TRACE_OFFSET + 13)[i]
}

// Chiplets columns
// CHIPLETS COLUMNS
// --------------------------------------------------------------------------------------------

pub fn chiplet_selector_0(&self, i: usize) -> Felt {
self.columns.get_column(CHIPLETS_OFFSET)[i]
Expand Down Expand Up @@ -230,7 +243,9 @@ impl<'a> MainTrace<'a> {
pub fn chiplet_kernel_root_3(&self, i: usize) -> Felt {
self.columns.get_column(CHIPLETS_OFFSET + 9)[i]
}
// Merkle path hashing selectors

// MERKLE PATH HASHING SELECTORS
// --------------------------------------------------------------------------------------------

pub fn f_mv(&self, i: usize) -> bool {
(i % 8 == 0)
Expand Down Expand Up @@ -271,9 +286,4 @@ impl<'a> MainTrace<'a> {
&& self.chiplet_selector_2(i) == ONE
&& self.chiplet_selector_3(i) == ZERO
}

// Helper method to detect change of address in the kernel ROM chiplet.
pub fn is_addr_change(&self, i: usize) -> bool {
self.addr(i) != self.addr(i + 1)
}
}
Loading
Loading