====== 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'', and that both ''Vdd'' and ''GND'' are defined as globals for the power supplies. 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 read in a script file and execute the commands within ==== Timing ==== random [ ] Set the random timing mode and optionally specify the default random timing bounds for all nodes. random_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 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 set current running mode. ^ Mode ^ Effect ^ | ''reset'' | ''reset'' turns off weak interference warnings (node still becomes X). During chip initialization, there can be weak interference since the simulator assumes all nodes are initially X. Setting the mode to ''reset'' during the reset phase prevents these warnings from being printed to the screen. | | ''run'' | Warnings of weak interference are enabled. This should be the standard mode after the reset phase has completed. | initialize initialize the simulation, setting all nodes to ''X''. step [] simulate transitions (default is 1) advance [] simulate for units of simulation time (default is 1) cycle [] simulate until the next transition on (default is forever) break set a breakpoint on 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 set the node, bus, or vector to specified get get value of a node, bus, or vector assert assert that the node, bus, or vector is uget get value of node but report its canonical name set_principal select as the canonical name for a node watch add watchpoint for unwatch delete watchpoint for watchall watch all nodes ==== Debug ==== status 0|1|X [[^]str] list all nodes with specified value, optional prefix/string match pending print the prsim pending event queue alias list all of the name aliases for fanin print the production rules that drive fanin-get print the production rules that drive with the values of each expression and node in the guards evaluated. fanout print the set of nodes for which appears in the guard of a driving production rule chk-save save a simulation checkpoint to chk-restore restore simulation state from a checkpoint ==== Tracing ==== dumptc dump transition counts for nodes to pairtc turns on pair transition counts trace Create atrace file for