pub trait ProcessState {
    // Required methods
    fn clk(&self) -> u32;
    fn ctx(&self) -> u32;
    fn get_stack_item(&self, pos: usize) -> Felt;
    fn get_stack_word(&self, word_idx: usize) -> Word;
    fn get_stack_state(&self) -> Vec<Felt>;
    fn get_mem_value(&self, ctx: u32, addr: u32) -> Option<Word>;
}
Expand description

A trait that defines a set of methods which allow access to the state of the process.

Required Methods§

source

fn clk(&self) -> u32

Returns the current clock cycle of a process.

source

fn ctx(&self) -> u32

Returns the current execution context ID.

source

fn get_stack_item(&self, pos: usize) -> Felt

Returns the value located at the specified position on the stack at the current clock cycle.

source

fn get_stack_word(&self, word_idx: usize) -> Word

Returns a word located at the specified word index on the stack.

Specifically, word 0 is defined by the first 4 elements of the stack, word 1 is defined by the next 4 elements etc. Since the top of the stack contains 4 word, the highest valid word index is 3.

The words are created in reverse order. For example, for word 0 the top element of the stack will be at the last position in the word.

Creating a word does not change the state of the stack.

source

fn get_stack_state(&self) -> Vec<Felt>

Returns stack state at the current clock cycle. This includes the top 16 items of the stack + overflow entries.

source

fn get_mem_value(&self, ctx: u32, addr: u32) -> Option<Word>

Returns a word located at the specified context/address, or None if the address hasn’t been accessed previously.

Implementors§