pub struct Dispatch { /* private fields */ }Expand description
The fixed 3-role VC listener dispatch table (ST-073, ST-074). See this module’s doc comment for why this is 3 named fields, not a collection.
Implementations§
Source§impl Dispatch
impl Dispatch
pub fn new() -> Self
Sourcepub fn register(
&mut self,
role: ListenerRole,
sink: Box<dyn ValueChangeSink + Send>,
)
pub fn register( &mut self, role: ListenerRole, sink: Box<dyn ValueChangeSink + Send>, )
Registers sink for role, replacing any previously-registered sink
for that same role (last write wins — this task does not introduce a
multi-listener-per-role fan-out; each of the 3 roles holds at most one
sink, matching Dispatch’s own field shape). The match is exhaustive
with no wildcard arm: ListenerRole has exactly 3 variants (frozen in
state::mod’s Task-0 contract stub), so this is the concrete
enforcement ST-073’s “attempting a fourth/unknown role is a
compile-time… invalid call” asks for — a 4th variant added to
ListenerRole anywhere in this crate breaks this match at compile
time (ARCHITECTURE §7 item 9’s exhaustive-match discipline).
Sourcepub fn dispatch(
&mut self,
cell: StateCellId,
edge: EdgeKind,
at: SimTime,
region: Region,
)
pub fn dispatch( &mut self, cell: StateCellId, edge: EdgeKind, at: SimTime, region: Region, )
Fans notify_change out to every registered sink, in the fixed
Scheduler, Waveform, Vpi order (ST-073), via 3 unrolled if let Some(..) checks — never a loop over a collection, so this method’s
cost is the same 3 branches regardless of how many times it has been
called before (ST-074).
Sourcepub fn notify_scheduler(
&mut self,
cell: StateCellId,
edge: EdgeKind,
at: SimTime,
region: Region,
)
pub fn notify_scheduler( &mut self, cell: StateCellId, edge: EdgeKind, at: SimTime, region: Region, )
Task 12 (ST-075): the only fan-out write::commit_write (state::write)
ever calls — fires the Scheduler slot alone, unconditionally, on
every real change, immediately (never GVT-gated: v1’s conservative
LOOKAHEAD_CYCLES = 0 engine has no outstanding speculation, so
“speculative” and “committed” coincide at every event). Never touches
waveform/vpi — those observe exclusively through
StateEngine::drain_committed_changes (state::gvt), never through
this method.
Sourcepub fn notify_waveform_and_vpi(
&mut self,
cell: StateCellId,
edge: EdgeKind,
at: SimTime,
region: Region,
)
pub fn notify_waveform_and_vpi( &mut self, cell: StateCellId, edge: EdgeKind, at: SimTime, region: Region, )
Task 12 (ST-078): the Scheduler-less analogue of dispatch — fires
waveform then vpi, in that fixed order, each only if registered,
never scheduler. Not called eagerly from commit_write (see that
method’s own doc comment): Waveform/VPI/$display-style consumers
observe committed changes through StateEngine::drain_committed_changes’s
returned VcRecords instead; this method exists for a future caller
(e.g. RUNTIME) that already has EdgeKind/Region context to push an
eager per-write callback on top of that commit-stream.