pub struct Program {
pub instructions: Vec<Instruction>,
pub pc_start: u32,
pub pc_base: u32,
pub memory_image: HashMap<u32, u32>,
pub preprocessed_shape: Option<CoreShape>,
}
Expand description
A program that can be executed by the SP1 zkVM.
Contains a series of instructions along with the initial memory image. It also contains the start address and base address of the program.
Fields§
§instructions: Vec<Instruction>
The instructions of the program.
pc_start: u32
The start address of the program.
pc_base: u32
The base address of the program.
memory_image: HashMap<u32, u32>
The initial memory image, useful for global constants.
preprocessed_shape: Option<CoreShape>
The shape for the preprocessed tables.
Implementations§
source§impl Program
impl Program
sourcepub fn new(instructions: Vec<Instruction>, pc_start: u32, pc_base: u32) -> Self
pub fn new(instructions: Vec<Instruction>, pc_start: u32, pc_base: u32) -> Self
Create a new Program.
sourcepub fn from(input: &[u8]) -> Result<Self>
pub fn from(input: &[u8]) -> Result<Self>
Disassemble a RV32IM ELF to a program that be executed by the VM.
§Errors
This function may return an error if the ELF is not valid.
sourcepub fn from_elf(path: &str) -> Result<Self>
pub fn from_elf(path: &str) -> Result<Self>
Disassemble a RV32IM ELF to a program that be executed by the VM from a file path.
§Errors
This function will return an error if the file cannot be opened or read.
sourcepub fn fixed_log2_rows<F: Field, A: MachineAir<F>>(
&self,
air: &A,
) -> Option<usize>
pub fn fixed_log2_rows<F: Field, A: MachineAir<F>>( &self, air: &A, ) -> Option<usize>
Custom logic for padding the trace to a power of two according to the proof shape.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Program
impl<'de> Deserialize<'de> for Program
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<F: Field> MachineProgram<F> for Program
impl<F: Field> MachineProgram<F> for Program
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more