Skip to main content

InterpMachine

Trait InterpMachine 

Source
pub trait InterpMachine<A> {
Show 13 methods // Required methods fn load( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, ) -> Result<SIRValue, InterpError>; fn store( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, value: &SIRValue, ) -> Result<(), InterpError>; fn commit( &mut self, src: &A, dst: &A, access: ResolvedAccess<'_>, bits: usize, ) -> Result<(), InterpError>; fn notify_triggers( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, triggers: &[TriggerIdWithKind], ) -> Result<(), InterpError>; fn notify_trigger_only_store( &mut self, addr: &A, triggers: &[TriggerIdWithKind], ) -> Result<(), InterpError>; fn capture_store_range( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, ) -> Result<StoreSnapshot, InterpError>; fn enable_comb_captures( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, before: &StoreSnapshot, sites: &[u32], ) -> Result<(), InterpError>; fn emit_runtime_event( &mut self, site_id: u32, args: &[SIRValue], ) -> Result<(), InterpError>; fn emit_comb_capture_event( &mut self, site_id: u32, args: &[SIRValue], fatal_error_code: Option<i64>, consume_enabled: bool, ) -> Result<(), InterpError>; fn enable_comb_capture_if_changed( &mut self, old: &SIRValue, new: &SIRValue, sites: &[u32], ) -> Result<(), InterpError>; // Provided methods fn load_u64( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, ) -> Result<u64, InterpError> { ... } fn store_u64( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, value: u64, ) -> Result<(), InterpError> { ... } fn prepare_store( &mut self, _addr: &A, _access: ResolvedAccess<'_>, _bits: usize, ) -> Result<(), InterpError> { ... }
}
Expand description

Storage and side-effect interface driven by the interpreter.

The production implementation wraps the simulator’s live memory image and event plumbing; tests use an in-memory fake. The address type A matches the executed SIR (for example RegionedAbsoluteAddr).

Required Methods§

Source

fn load( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, ) -> Result<SIRValue, InterpError>

Source

fn store( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, value: &SIRValue, ) -> Result<(), InterpError>

Source

fn commit( &mut self, src: &A, dst: &A, access: ResolvedAccess<'_>, bits: usize, ) -> Result<(), InterpError>

Commit: copy bits at access from src to dst.

Source

fn notify_triggers( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, triggers: &[TriggerIdWithKind], ) -> Result<(), InterpError>

Edge/level triggers attached to a Store or Commit.

The resolved access and width let the machine compare the stored range against its group-entry snapshot for per-kind edge detection.

Source

fn notify_trigger_only_store( &mut self, addr: &A, triggers: &[TriggerIdWithKind], ) -> Result<(), InterpError>

Trigger-only aliased store (bits == 0): no memory write happens and the source register is intentionally undefined; the machine detects a change on the aliased signal and marks its triggers.

Source

fn capture_store_range( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, ) -> Result<StoreSnapshot, InterpError>

Snapshot the stored range before a Store with comb capture sites so the post-store comparison can detect actual changes.

Source

fn enable_comb_captures( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, before: &StoreSnapshot, sites: &[u32], ) -> Result<(), InterpError>

Enable comb capture sites when the stored range differs from the pre-store snapshot.

Source

fn emit_runtime_event( &mut self, site_id: u32, args: &[SIRValue], ) -> Result<(), InterpError>

Source

fn emit_comb_capture_event( &mut self, site_id: u32, args: &[SIRValue], fatal_error_code: Option<i64>, consume_enabled: bool, ) -> Result<(), InterpError>

Emit a comb capture event. Returns Err(InterpError::Fatal) when the event carries a fatal code and its site was enabled, mirroring the compiled unit’s early return.

Source

fn enable_comb_capture_if_changed( &mut self, old: &SIRValue, new: &SIRValue, sites: &[u32], ) -> Result<(), InterpError>

Provided Methods§

Source

fn load_u64( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, ) -> Result<u64, InterpError>

Load a fully-known value no wider than 64 bits.

The default keeps custom interpreter machines source-compatible. The production backend overrides this to avoid constructing a BigUint.

Source

fn store_u64( &mut self, addr: &A, access: ResolvedAccess<'_>, bits: usize, value: u64, ) -> Result<(), InterpError>

Store a fully-known value no wider than 64 bits.

Production storage overrides this with an allocation-free path.

Source

fn prepare_store( &mut self, _addr: &A, _access: ResolvedAccess<'_>, _bits: usize, ) -> Result<(), InterpError>

Prepare storage for an upcoming store. Invoked before any pre-store snapshot so the machine can make the destination readable (for example sparse copy-on-write chunk initialization).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§