Trait sp1_core::air::MemoryAirBuilder

source ·
pub trait MemoryAirBuilder: BaseAirBuilder {
    // Provided methods
    fn eval_memory_access<E: Into<Self::Expr> + Clone>(
        &mut self,
        shard: impl Into<Self::Expr>,
        channel: impl Into<Self::Expr>,
        clk: impl Into<Self::Expr>,
        addr: impl Into<Self::Expr>,
        memory_access: &impl MemoryCols<E>,
        do_check: impl Into<Self::Expr>,
    ) { ... }
    fn eval_memory_access_slice<E: Into<Self::Expr> + Copy>(
        &mut self,
        shard: impl Into<Self::Expr> + Copy,
        channel: impl Into<Self::Expr> + Clone,
        clk: impl Into<Self::Expr> + Clone,
        initial_addr: impl Into<Self::Expr> + Clone,
        memory_access_slice: &[impl MemoryCols<E>],
        verify_memory_access: impl Into<Self::Expr> + Copy,
    ) { ... }
    fn eval_memory_access_timestamp(
        &mut self,
        mem_access: &MemoryAccessCols<impl Into<Self::Expr> + Clone>,
        do_check: impl Into<Self::Expr>,
        shard: impl Into<Self::Expr> + Clone,
        channel: impl Into<Self::Expr> + Clone,
        clk: impl Into<Self::Expr>,
    ) { ... }
    fn eval_range_check_24bits(
        &mut self,
        value: impl Into<Self::Expr>,
        limb_16: impl Into<Self::Expr> + Clone,
        limb_8: impl Into<Self::Expr> + Clone,
        shard: impl Into<Self::Expr> + Clone,
        channel: impl Into<Self::Expr> + Clone,
        do_check: impl Into<Self::Expr> + Clone,
    ) { ... }
}
Expand description

A trait which contains methods related to memory interactions in an AIR.

Provided Methods§

source

fn eval_memory_access<E: Into<Self::Expr> + Clone>( &mut self, shard: impl Into<Self::Expr>, channel: impl Into<Self::Expr>, clk: impl Into<Self::Expr>, addr: impl Into<Self::Expr>, memory_access: &impl MemoryCols<E>, do_check: impl Into<Self::Expr>, )

Constrain a memory read or write.

This method verifies that a memory access timestamp (shard, clk) is greater than the previous access’s timestamp. It will also add to the memory argument.

source

fn eval_memory_access_slice<E: Into<Self::Expr> + Copy>( &mut self, shard: impl Into<Self::Expr> + Copy, channel: impl Into<Self::Expr> + Clone, clk: impl Into<Self::Expr> + Clone, initial_addr: impl Into<Self::Expr> + Clone, memory_access_slice: &[impl MemoryCols<E>], verify_memory_access: impl Into<Self::Expr> + Copy, )

Constraints a memory read or write to a slice of MemoryAccessCols.

source

fn eval_memory_access_timestamp( &mut self, mem_access: &MemoryAccessCols<impl Into<Self::Expr> + Clone>, do_check: impl Into<Self::Expr>, shard: impl Into<Self::Expr> + Clone, channel: impl Into<Self::Expr> + Clone, clk: impl Into<Self::Expr>, )

Verifies the memory access timestamp.

This method verifies that the current memory access happened after the previous one’s. Specifically it will ensure that if the current and previous access are in the same shard, then the current’s clk val is greater than the previous’s. If they are not in the same shard, then it will ensure that the current’s shard val is greater than the previous’s.

source

fn eval_range_check_24bits( &mut self, value: impl Into<Self::Expr>, limb_16: impl Into<Self::Expr> + Clone, limb_8: impl Into<Self::Expr> + Clone, shard: impl Into<Self::Expr> + Clone, channel: impl Into<Self::Expr> + Clone, do_check: impl Into<Self::Expr> + Clone, )

Verifies the inputted value is within 24 bits.

This method verifies that the inputted is less than 2^24 by doing a 16 bit and 8 bit range check on it’s limbs. It will also verify that the limbs are correct. This method is needed since the memory access timestamp check (see [Self::verify_mem_access_ts]) needs to assume the clk is within 24 bits.

Object Safety§

This trait is not object safe.

Implementors§