openvm_circuit::arch

Trait VmCoreChip

Source
pub trait VmCoreChip<F, I: VmAdapterInterface<F>> {
    type Record: Send;
    type Air: BaseAirWithPublicValues<F> + Clone;

    // Required methods
    fn execute_instruction(
        &self,
        instruction: &Instruction<F>,
        from_pc: u32,
        reads: I::Reads,
    ) -> Result<(AdapterRuntimeContext<F, I>, Self::Record)>;
    fn get_opcode_name(&self, opcode: usize) -> String;
    fn generate_trace_row(&self, row_slice: &mut [F], record: Self::Record);
    fn air(&self) -> &Self::Air;

    // Provided methods
    fn generate_public_values(&self) -> Vec<F> { ... }
    fn finalize(&self, _trace: &mut RowMajorMatrix<F>, _num_records: usize) { ... }
}
Expand description

Trait to be implemented on primitive chip to integrate with the machine.

Required Associated Types§

Source

type Record: Send

Minimum data that must be recorded to be able to generate trace for one row of PrimitiveAir.

Source

type Air: BaseAirWithPublicValues<F> + Clone

The primitive AIR with main constraints that do not depend on memory and other architecture-specifics.

Required Methods§

Source

fn execute_instruction( &self, instruction: &Instruction<F>, from_pc: u32, reads: I::Reads, ) -> Result<(AdapterRuntimeContext<F, I>, Self::Record)>

Source

fn get_opcode_name(&self, opcode: usize) -> String

Source

fn generate_trace_row(&self, row_slice: &mut [F], record: Self::Record)

Populates row_slice with values corresponding to record. The provided row_slice will have length equal to self.air().width(). This function will be called for each row in the trace which is being used, and all other rows in the trace will be filled with zeroes.

Source

fn air(&self) -> &Self::Air

Provided Methods§

Source

fn generate_public_values(&self) -> Vec<F>

Returns a list of public values to publish.

Source

fn finalize(&self, _trace: &mut RowMajorMatrix<F>, _num_records: usize)

Finalize the trace, especially the padded rows if the all-zero rows don’t satisfy the constraints. This is done after records are consumed and the trace matrix is generated. Most implementations should just leave the default implementation if padding with rows of all 0s satisfies the constraints.

Implementors§