miden_air/trace/stack/mod.rs
1use core::ops::Range;
2
3use miden_core::{program::MIN_STACK_DEPTH, utils::range};
4
5// CONSTANTS
6// ================================================================================================
7
8/// Index at which stack item columns start in the stack trace.
9pub const STACK_TOP_OFFSET: usize = 0;
10
11/// Location of stack top items in the stack trace.
12pub const STACK_TOP_RANGE: Range<usize> = range(STACK_TOP_OFFSET, MIN_STACK_DEPTH);
13
14/// Number of bookkeeping and helper columns in the stack trace.
15pub const NUM_STACK_HELPER_COLS: usize = 3;
16
17/// Index of the b0 helper column in the stack trace. This column holds the current stack depth.
18pub const B0_COL_IDX: usize = STACK_TOP_RANGE.end;
19
20/// Index of the b1 helper column in the stack trace. This column holds the address of the top
21/// item in the stack overflow table.
22pub const B1_COL_IDX: usize = STACK_TOP_RANGE.end + 1;
23
24/// Index of the h0 helper column in the stack trace. This column contains 1 / (b0 - 16) when
25/// b0 != 16, and ZERO otherwise.
26pub const H0_COL_IDX: usize = STACK_TOP_RANGE.end + 2;