Simulation Commands - HACKT PRSIM Manual
Description: HACKT PRSIM Manual

Next: Channel Commands, Previous: General Commands, Up: Commands

### 3.3 `simulation` Commands

— Command: initialize

> Resets the variable state of the simulation (to unknown), while preserving other settings such as mode and breakpoints. The random number generator seed is untouched by this command.

— Command: reset

> Similar to initialize, but also resets all modes to their default values. This command can be used to quickly bring the simulator to the initial startup state, without having to exit and relaunch. This also resets the random number generator seed used with seed48.

Running the simulation.

— Command: step [n]

> Advances the simulation by n time steps. Without n, takes only a single step. Time steps may cover multiple events if they are at the exact same time. To step by events count, use step-event.

— Command: step-event [n]

> Advances the simulation by n events. Without n, takes only a single event. A single event is not necessarily guaranteed to advance the time, if multiple events are enqueued at the same time.

— Command: advance delay

> Advances the simulation delay units of time.

— Command: cycle

> Execute steps until the event queue is exhausted (if ever). Can be interrupted by `Ctrl-C` or a `SIGINT` signal.

Coercively setting values.

— Command: set node val [delay]

> Set node to val. If delay is omitted, the set event is inserted `now' at the current time, at the head of the event queue. If delay is given with a `+` prefix, time is added relative to `now', otherwise it is scheduled at an absolute time delay.

— Command: setr node val

> Same as the set command, but using a random delay into the future.

— Command: setf node val [delay]

> Set forcefully. Same as the set command, but this overrides any pending events on node.

— Command: setrf node val

> Same as setf and setr combined; forcefully set node to val at random time in future, overriding any pending events.

— Command: unset node

> Cancel any pending set commands on node. This effectively causes a node to be re-evaluated based on the state of its fanin. If the evaluation results in a change of value, a firing is scheduled in the event queue. This command may be useful in releasing nodes from a stuck state caused by a coercive set.

— Command: unsetall

> Clears all coercive set commands, and re-evaluates all nodes in terms of their fanins.

Breakpoints.

— Command: breakpt node

> Set a breakpoint on node. When node changes value, interrupt the simulation (during cycle, advance, or step), and return control back to the interpreter.

— Command: breaks

> Show all breakpoints (nodes).

— Command: nobreakpt node
— Command: unbreak node

> Removes breakpoint on node.

— Command: nobreakptall
— Command: unbreakall

> Removes all breakpoints.

Rescheduling events.

— Command: reschedule node time
— Command: reschedule-from-now node time
— Command: reschedule-relative node time
— Command: reschedule-now node

> If there is a pending event on node in the event queue, reschedule it as follows: reschedule interprets time as an absolute time. reschedule-from-now interprets time relative to the current time. reschedule-relative interprets time relative to the pending event's presently scheduled time. The resulting rescheduled time cannot be in the past; it must be greater than or equal to the current time. Tie-breakers: given a group of events with the same time, a newly rescheduled event at that time will be *last* among them. reschedule-now, however, will guarantee that the rescheduled event occurs next at the current time. Return with error status if there is no pending event on node.

— Command: execute node

> Reschedules a pending event to the current time and executes it immediately. Equivalent to reschedule-now node, followed by step-event.