previousValue property

  1. @override
LogicValue? previousValue
override

The value of this signal before the most recent Simulator.tick had completed. It will be null before the first tick after this signal is created.

If this is called mid-tick, it will be the value from before the tick started. If this is called post-tick, it will be the value from before that last tick started.

This is useful for querying the value of a signal in a testbench before some change event occurred, for example sampling a signal before a clock edge for code that was triggered on that edge.

Note that if a signal is connected to another signal, the listener may be reset.

Implementation

@override
LogicValue? get previousValue =>
    elements.map((e) => e.value).toList(growable: false).rswizzle();