Simulator class abstract
A functional event-based static simulator for logic behavior.
Each tick of the simulator steps through the following events and phases:
- preTick (event): Occurs at the very start of a tick, before anything else occurs. This is useful for flop sampling.
- SimulatorPhase.beforeTick (phase)
- startTick (event): The beginning of the "meat" of the tick.
- SimulatorPhase.mainTick (phase): Most events happen here, lots of glitches.
- clkStable (event): All glitchiness has completed, clocks should be stable now.
- SimulatorPhase.clkStable (phase)
- postTick (event): The tick has completed, all values should be settled.
- SimulatorPhase.outOfTick (phase): Not during an active simulator tick.
Functional behavior modelling subscribes to Simulator events and/or queries the SimulatorPhase.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
clkStable
→ Stream<
void> -
Emits an event when most events are complete, and clocks are stable.
no setter
- logger → Logger
-
A global logger object for the Simulator.
final
- phase → SimulatorPhase
-
Gets the current SimulatorPhase of the Simulator.
no setter
-
postTick
→ Stream<
void> -
Emits an event after all events are completed.
no setter
-
preTick
→ Stream<
void> -
Emits an event before any other actions take place on the tick.
no setter
-
resetRequested
→ Future<
void> -
Completes when reset is called after the Simulator has completed any
actions it needs to perform to prepare for the next simulation.
no setter
-
simulationEnded
→ Future<
void> -
Completes when the simulation has completed.
no setter
- simulationHasEnded → bool
-
Returns true iff the simulation has completed.
no setter
-
startTick
→ Stream<
void> -
Emits an event at the start of actions within a tick.
no setter
- time → int
-
The current time in the Simulator.
no setter
Static Methods
-
cancelAction(
int timestamp, dynamic action()) → bool -
Cancels an
action
previously scheduled fortimestamp
. -
endSimulation(
) → Future< void> - Halts the simulation. Allows the current tick to finish, if there is one.
-
hasStepsRemaining(
) → bool - Returns true iff there are more steps for the Simulator to tick through.
-
injectAction(
dynamic action()) → void -
Adds an arbitrary
action
to be executed as soon as possible, during the current simulation tick if possible. -
registerAction(
int timestamp, dynamic action()) → void -
Registers an abritrary
action
to be executed attimestamp
time. -
registerEndOfSimulationAction(
dynamic action()) → void -
Registers an arbitrary
action
to be executed at the end of the simulation. -
reset(
) → Future< void> - Resets the entire Simulator back to its initial state.
-
run(
) → Future< void> - Starts the simulation, executing all pending actions in time-order until it finishes or is stopped.
-
setMaxSimTime(
int newMaxSimTime) → void - Sets a time, after which, the Simulator will halt processing of new actions.
-
throwException(
Exception exception, StackTrace stackTrace) → void -
Collects an
exception
and associatedstackTrace
triggered asynchronously during simulation to be thrown synchronously by run. -
tick(
) → Future< void> - A single simulation tick.