Skip to main content

SignalAccess

Trait SignalAccess 

Source
pub trait SignalAccess {
    // Required methods
    fn read(&self, cell: StateCellId) -> FourStateValue;
    fn write(&mut self, cell: StateCellId, value: FourStateValue) -> bool;
    fn subscribe(
        &mut self,
        cell: StateCellId,
        role: ListenerRole,
        sink: Box<dyn ValueChangeSink + Send>,
    );

    // Provided methods
    fn read_row(&self, cell: StateCellId, row: u64) -> FourStateValue { ... }
    fn write_row(
        &mut self,
        cell: StateCellId,
        row: u64,
        value: FourStateValue,
    ) -> bool { ... }
    fn read_wide_window(
        &self,
        cell: StateCellId,
        lo_word: usize,
        words: usize,
    ) -> (Vec<u64>, Vec<u64>) { ... }
    fn write_wide_window(
        &mut self,
        cell: StateCellId,
        lo_word: usize,
        aval: &[u64],
        bval: &[u64],
    ) -> bool { ... }
    fn take_alias_changes(&mut self) -> Vec<AliasChange> { ... }
}
Expand description

STATE owns the one canonical signal read/write/subscribe primitive (ARCHITECTURE §2); RUNTIME’s VPI/FST/$display/debugger hosts are pure consumers of this trait, never a second implementation of signal access (vj-runtime::signal_consumer demonstrates this by depending on it).

Required Methods§

Source

fn read(&self, cell: StateCellId) -> FourStateValue

Source

fn write(&mut self, cell: StateCellId, value: FourStateValue) -> bool

Returns true iff the write actually changed the stored value (the old-vs-new compare state.md §3 requires before any VC record is emitted).

Source

fn subscribe( &mut self, cell: StateCellId, role: ListenerRole, sink: Box<dyn ValueChangeSink + Send>, )

Provided Methods§

Source

fn read_row(&self, cell: StateCellId, row: u64) -> FourStateValue

One row of a memory cell (SlotClass::Memory). Only implemented by the real StateEngine; a test double that never stages a memory NBA never reaches this.

Source

fn write_row( &mut self, cell: StateCellId, row: u64, value: FourStateValue, ) -> bool

Writes one row of a memory cell; true iff the row changed.

Source

fn read_wide_window( &self, cell: StateCellId, lo_word: usize, words: usize, ) -> (Vec<u64>, Vec<u64>)

The plane words [lo_word, lo_word + words) of a wide cell, as (aval, bval). The default reads the whole value; StateEngine reads just the window (a nonblocking write to a few bits of a huge vector must not cost O(N)).

Source

fn write_wide_window( &mut self, cell: StateCellId, lo_word: usize, aval: &[u64], bval: &[u64], ) -> bool

Stores the plane words aval/bval at lo_word.. of a wide cell; true iff the value changed. The default patches the whole value; StateEngine stores just the window.

Source

fn take_alias_changes(&mut self) -> Vec<AliasChange>

Changes of other names for storage the last write touched (a window alias of a ref port, state::alias), drained by the scheduler after each commit so it can notify their waiters. Empty for every engine that has no window alias.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§