This is an old revision of the document!


prsim: Production rule simulation

Before using prsim to simulate a set of production rules, they must first be flattened using aflat. Assuming your production rules are in a file called circuit.act, you would run:

aflat circuit.act > circuit.prs
prsim circuit.prs

This will give you an interactive (Prsim) prompt. Type help to get a list of simulation commands.

Standard Test Script

When running prsim, it is good practice to use a test .act file that looks something like this:

import "circuit.act";
...
... // your test setup

bool Reset;

prs {
   Reset -> Vdd+
   Reset -> GND-
   Reset => _Reset-
}

In this example, I've assumed that the circuit reset signals are the global variables Reset and _Reset. You should use the appropriate signals for your circuit there. The nice thing about this setup is that you can have a prsim script file that looks something like this:

random
set Reset 1
cycle
status U
... // watch various things
set Reset 0
cycle

Commands

General

help

display a list of commands with short descriptions

exit

terminate

source <file>

read in a script file and execute the commands within

array <variable> <range> <command>

execute multiple of one command. Variable is a string that is replaced with the current iteration. Since it is just blind string replacement, you'll probably want to name it something like $i to prevent conflicts within the repeated command. Range should be of the format start:end[:step] (the brackets mean step is optional).

save <file>

save a simulation checkpoint to the specified file

restore <file>

restore simulation from a checkpoint

Timing

random [<min> <max>]

Set the random timing mode and optionally specify the default random timing bounds for all nodes.

random_seed <seed>

set the seed for the random timing mode.

norandom

Set the deterministic timing mode.

random_excl on|off

turn on/off random exclhi/lo firings

after <n> <minu> <maxu> <mind> <maxd>

For the random timing mode, set the random timing bounds for the up and down transitions for a specified node.

Running Simulation

mode reset|run|unstab|nounstab

set current running mode.

Mode Effect
reset/run reset turns off weak interference warnings (node still becomes X) and run turns them on
unstab/nounstab unstab marks all nodes as possibly unstable, turning of the instability warnings (node still becomes X), nounstab turns them on
initialize

initialize the simulation, setting all nodes to X.

step [<steps>]

simulate <steps> transitions (default is 1)

advance [<duration>]

simulate for <duration> units of simulation time (default is 1)

cycle [<node>]

simulate until the next transition on <node> (default is forever)

break <node>

set a breakpoint on <node>

break-on-warn

toggles the break-on-warn flag which stops/doesn't stop simulation on instability or interference

exit-on-warn

like break-on-warn, but exits prsim

Setting/Getting Node Values

set <variable> <value>

set the node, bus, or vector <variable> to specified <value>

get <variable>

get value of a node, bus, or vector <variable>

assert <variable> <value>

assert that the node, bus, or vector <variable> is <value>

seu <node> 0|1|X <start-delay> <dur>

Delayed SEU event on node lasting for <dur> units

uget <n>

get value of node <n> but report its canonical name

watch <n>

add watchpoint for <n>

unwatch <n>

delete watchpoint for <n>

watchall

watch all nodes