pub trait SimBackend {
type Event: EventHandle;
Show 31 methods
// Required methods
fn eval_comb(&mut self) -> Result<(), SimulatorErrorCode>;
fn eval_apply_ff_at(
&mut self,
event: Self::Event,
) -> Result<(), SimulatorErrorCode>;
fn eval_only_ff_at(
&mut self,
event: Self::Event,
) -> Result<(), SimulatorErrorCode>;
fn apply_ff_at(
&mut self,
event: Self::Event,
) -> Result<(), SimulatorErrorCode>;
fn resolve_signal(&self, addr: &AbsoluteAddr) -> SignalRef;
fn resolve_event(&self, addr: &AbsoluteAddr) -> Self::Event;
fn resolve_event_opt(&self, addr: &AbsoluteAddr) -> Option<Self::Event>;
fn resolve_eval_only_event(
&self,
addr: &AbsoluteAddr,
) -> Option<Self::Event>;
fn resolve_apply_event(&self, addr: &AbsoluteAddr) -> Option<Self::Event>;
fn set<T: Copy>(&mut self, signal: SignalRef, val: T);
fn set_wide(&mut self, signal: SignalRef, val: BigUint);
fn set_four_state(&mut self, signal: SignalRef, val: BigUint, mask: BigUint);
fn get(&self, signal: SignalRef) -> BigUint;
fn get_as<T: Default + Copy>(&self, signal: SignalRef) -> T;
fn get_four_state(&self, signal: SignalRef) -> (BigUint, BigUint);
fn memory_as_ptr(&self) -> (*const u8, usize);
fn memory_as_mut_ptr(&mut self) -> (*mut u8, usize);
fn runtime_event_buffer_as_ptr(&self) -> (*const u8, usize);
fn stable_region_size(&self) -> usize;
fn layout(&self) -> &MemoryLayout;
fn id_to_addr_slice(&self) -> &[AbsoluteAddr] ⓘ;
fn id_to_event_slice(&self) -> &[Self::Event];
fn num_events(&self) -> usize;
fn clear_triggered_bits(&mut self);
fn mark_triggered_bit(&mut self, id: usize);
fn get_triggered_bits(&self) -> BitSet;
// Provided methods
fn eval_comb_apply_ff_at(
&mut self,
event: Self::Event,
) -> Result<(), SimulatorErrorCode> { ... }
fn eval_comb_apply_ff_many_at(
&mut self,
event: Self::Event,
count: u64,
) -> (u64, Result<(), SimulatorErrorCode>) { ... }
fn memory_owner(&self) -> Option<Arc<dyn Any + Send + Sync>> { ... }
fn runtime_event_buffer(&self) -> Option<Arc<RuntimeEventBuffer>> { ... }
fn set_comb_capture_event_enabled(&mut self, _active_sites: &[bool]) { ... }
}Expand description
Abstraction over different simulation backends (JIT, WASM, etc.).
Simulator<B> is generic over this trait so that the same high-level
API works with any backend. JitBackend is the default.
Required Associated Types§
Sourcetype Event: EventHandle
type Event: EventHandle
The event handle type produced by this backend.
Required Methods§
fn eval_comb(&mut self) -> Result<(), SimulatorErrorCode>
Sourcefn eval_apply_ff_at(
&mut self,
event: Self::Event,
) -> Result<(), SimulatorErrorCode>
fn eval_apply_ff_at( &mut self, event: Self::Event, ) -> Result<(), SimulatorErrorCode>
Evaluate and apply a flip-flop domain for the given event.
Sourcefn eval_only_ff_at(
&mut self,
event: Self::Event,
) -> Result<(), SimulatorErrorCode>
fn eval_only_ff_at( &mut self, event: Self::Event, ) -> Result<(), SimulatorErrorCode>
Evaluate FF domain without applying (for cascaded clocks).
Sourcefn apply_ff_at(&mut self, event: Self::Event) -> Result<(), SimulatorErrorCode>
fn apply_ff_at(&mut self, event: Self::Event) -> Result<(), SimulatorErrorCode>
Apply (commit) an already-evaluated FF domain.
fn resolve_signal(&self, addr: &AbsoluteAddr) -> SignalRef
fn resolve_event(&self, addr: &AbsoluteAddr) -> Self::Event
fn resolve_event_opt(&self, addr: &AbsoluteAddr) -> Option<Self::Event>
fn resolve_eval_only_event(&self, addr: &AbsoluteAddr) -> Option<Self::Event>
fn resolve_apply_event(&self, addr: &AbsoluteAddr) -> Option<Self::Event>
fn set<T: Copy>(&mut self, signal: SignalRef, val: T)
fn set_wide(&mut self, signal: SignalRef, val: BigUint)
fn set_four_state(&mut self, signal: SignalRef, val: BigUint, mask: BigUint)
fn get(&self, signal: SignalRef) -> BigUint
fn get_as<T: Default + Copy>(&self, signal: SignalRef) -> T
fn get_four_state(&self, signal: SignalRef) -> (BigUint, BigUint)
fn memory_as_ptr(&self) -> (*const u8, usize)
fn memory_as_mut_ptr(&mut self) -> (*mut u8, usize)
fn runtime_event_buffer_as_ptr(&self) -> (*const u8, usize)
fn stable_region_size(&self) -> usize
fn layout(&self) -> &MemoryLayout
fn id_to_addr_slice(&self) -> &[AbsoluteAddr] ⓘ
fn id_to_event_slice(&self) -> &[Self::Event]
fn num_events(&self) -> usize
fn clear_triggered_bits(&mut self)
fn mark_triggered_bit(&mut self, id: usize)
fn get_triggered_bits(&self) -> BitSet
Provided Methods§
Sourcefn eval_comb_apply_ff_at(
&mut self,
event: Self::Event,
) -> Result<(), SimulatorErrorCode>
fn eval_comb_apply_ff_at( &mut self, event: Self::Event, ) -> Result<(), SimulatorErrorCode>
Evaluate combinational logic and then evaluate/apply one flip-flop domain. Backends may override this to compile the two phases as one function; the default preserves the same ordering with two calls.
Sourcefn eval_comb_apply_ff_many_at(
&mut self,
event: Self::Event,
count: u64,
) -> (u64, Result<(), SimulatorErrorCode>)
fn eval_comb_apply_ff_many_at( &mut self, event: Self::Event, count: u64, ) -> (u64, Result<(), SimulatorErrorCode>)
Execute up to count identical fused ticks. The returned count is the
number of iterations completed before a runtime event or error forced a
return to the host. Backends without an in-function loop execute one
iteration so the caller can preserve per-tick observation semantics.
Sourcefn memory_owner(&self) -> Option<Arc<dyn Any + Send + Sync>>
fn memory_owner(&self) -> Option<Arc<dyn Any + Send + Sync>>
Return an opaque owner that keeps the memory allocation alive.
Host integrations that expose the raw memory outside Rust can retain
this value until their external view is finalized. Backends without a
separately owned stable allocation may keep the default None.
When returning Some, the allocation and address reported by
Self::memory_as_ptr and Self::memory_as_mut_ptr must remain valid
until every clone of the owner has been dropped.
fn runtime_event_buffer(&self) -> Option<Arc<RuntimeEventBuffer>>
fn set_comb_capture_event_enabled(&mut self, _active_sites: &[bool])
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".