Struct miden_processor::ProgramOutputs
source · pub struct ProgramOutputs { /* private fields */ }
Expand description
Output container for Miden VM programs.
Miden program outputs contain the full state of the stack at the end of execution as well as the addresses in the overflow table which are required to reconstruct the table (when combined with the overflow values from the stack state).
stack
is expected to be ordered as if they elements were popped off the stack one by one.
Thus, the value at the top of the stack is expected to be in the first position, and the order
of the rest of the output elements will also match the order on the stack.
overflow_addrs
is expected to start with the prev
address value from the first row in the
overflow table (the row representing the deepest element in the stack) and then be followed by
the address (clk
value) of each row in the table starting from the deepest element in the
stack and finishing with the row which was added to the table last.
Implementations
sourceimpl ProgramOutputs
impl ProgramOutputs
pub fn new(
stack: Vec<u64, Global>,
overflow_addrs: Vec<u64, Global>
) -> ProgramOutputs
pub fn from_elements(
stack: Vec<BaseElement, Global>,
overflow_addrs: Vec<BaseElement, Global>
) -> ProgramOutputs
sourcepub fn stack(&self) -> &[u64]
pub fn stack(&self) -> &[u64]
Returns the stack outputs, which is state of the stack at the end of execution converted to integers.
sourcepub fn stack_outputs(&self, num_outputs: usize) -> &[u64]
pub fn stack_outputs(&self, num_outputs: usize) -> &[u64]
Returns the number of requested stack outputs or returns the full stack if fewer than the requested number of stack values exist.
sourcepub fn stack_top(&self) -> [BaseElement; 16]
pub fn stack_top(&self) -> [BaseElement; 16]
Returns the state of the top of the stack at the end of execution.
sourcepub fn overflow_addrs(&self) -> &[u64]
pub fn overflow_addrs(&self) -> &[u64]
Returns the overflow address outputs, which are the addresses required to reconstruct the overflow table (when combined with the stack overflow values) converted to integers.
sourcepub fn has_overflow(&self) -> bool
pub fn has_overflow(&self) -> bool
Returns true if the overflow table outputs are non-empty.
sourcepub fn overflow_prev(&self) -> BaseElement
pub fn overflow_prev(&self) -> BaseElement
Returns the previous address prev
for the first row in the stack overflow table
sourcepub fn stack_overflow(&self) -> Vec<(BaseElement, BaseElement), Global>
pub fn stack_overflow(&self) -> Vec<(BaseElement, BaseElement), Global>
Returns (address, value) for all rows which were on the overflow table at the end of execution in the order in which they were added to the table (deepest stack item first).
Trait Implementations
sourceimpl Clone for ProgramOutputs
impl Clone for ProgramOutputs
sourcefn clone(&self) -> ProgramOutputs
fn clone(&self) -> ProgramOutputs
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more