Skip to main content

SimBackend

Trait SimBackend 

Source
pub trait SimBackend {
    type Event: EventHandle;

Show 30 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 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§

Source

type Event: EventHandle

The event handle type produced by this backend.

Required Methods§

Source

fn eval_comb(&mut self) -> Result<(), SimulatorErrorCode>

Source

fn eval_apply_ff_at( &mut self, event: Self::Event, ) -> Result<(), SimulatorErrorCode>

Evaluate and apply a flip-flop domain for the given event.

Source

fn eval_only_ff_at( &mut self, event: Self::Event, ) -> Result<(), SimulatorErrorCode>

Evaluate FF domain without applying (for cascaded clocks).

Source

fn apply_ff_at(&mut self, event: Self::Event) -> Result<(), SimulatorErrorCode>

Apply (commit) an already-evaluated FF domain.

Source

fn resolve_signal(&self, addr: &AbsoluteAddr) -> SignalRef

Source

fn resolve_event(&self, addr: &AbsoluteAddr) -> Self::Event

Source

fn resolve_event_opt(&self, addr: &AbsoluteAddr) -> Option<Self::Event>

Source

fn resolve_eval_only_event(&self, addr: &AbsoluteAddr) -> Option<Self::Event>

Source

fn resolve_apply_event(&self, addr: &AbsoluteAddr) -> Option<Self::Event>

Source

fn set<T: Copy>(&mut self, signal: SignalRef, val: T)

Source

fn set_wide(&mut self, signal: SignalRef, val: BigUint)

Source

fn set_four_state(&mut self, signal: SignalRef, val: BigUint, mask: BigUint)

Source

fn get(&self, signal: SignalRef) -> BigUint

Source

fn get_as<T: Default + Copy>(&self, signal: SignalRef) -> T

Source

fn get_four_state(&self, signal: SignalRef) -> (BigUint, BigUint)

Source

fn memory_as_ptr(&self) -> (*const u8, usize)

Source

fn memory_as_mut_ptr(&mut self) -> (*mut u8, usize)

Source

fn runtime_event_buffer_as_ptr(&self) -> (*const u8, usize)

Source

fn stable_region_size(&self) -> usize

Source

fn layout(&self) -> &MemoryLayout

Source

fn id_to_addr_slice(&self) -> &[AbsoluteAddr]

Source

fn id_to_event_slice(&self) -> &[Self::Event]

Source

fn num_events(&self) -> usize

Source

fn clear_triggered_bits(&mut self)

Source

fn mark_triggered_bit(&mut self, id: usize)

Source

fn get_triggered_bits(&self) -> BitSet

Provided Methods§

Source

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.

Source

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.

Source

fn runtime_event_buffer(&self) -> Option<Arc<RuntimeEventBuffer>>

Source

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".

Implementors§