Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
intro_example:inverter [2020/04/29 14:37]
rajit
intro_example:inverter [2020/12/02 01:00]
127.0.0.1 external edit
Line 51: Line 51:
 </code> </code>
  
 +Next, we can simulate the inverter using a production-rule simulator. We have provided ''[[tools:prsim|prsim]]'' for production rule simulation as part of the ACT tools.
 +
 +===== Simulating with prsim =====
 +
 +The complete example is:
 +
 +<code>
 +defproc inverter (bool? i; bool! o)
 +
 +  prs {
 +    i => o-
 +  }
 +
 +
 +inverter inv;
 +</code>
 +
 +
 +If the file above is called ''test_inv.act'', a production rule file can be created from the ACT file by:
 +
 +<code>
 +% aflat test_inv.act > test_inv.prs
 +</code>
 +
 +The output file is the following:
 +
 +<code>
 +"inv.i"->"inv.out"-
 +~"inv.i"->"inv.out"+
 +</code>
 +
 +Note that ACT uses ''.'' (like standard programming languages) as a separator between the name of the instance and internal nodes within it. (Note that magic, irsim use ''/'' as a separator; Xyce uses colon).
 +
 +If the file is saved as ''test_inv.prs'', it can be simulated using the production rule simulator called ''[[tools:prsim|prsim]]''
 +
 +<code>
 +% prsim test_inv.prs    
 +
 +(Prsim) initialize 
 +(Prsim) watch inv.i
 +(Prsim) watch inv.o
 +(Prsim) status X
 +(Prsim) set inv.i 0
 +(Prsim) cycle
 +(Prsim) set inv.i 1
 +(Prsim) cycle
 +</code>
 +
 +''prsim'' will check if the production rules being run are stable (i.e. hazard/glitch-free) and non-interfering (i.e. that pull-up and pull-down networks are not on simultaneously). It doesn't check all possible delay configurations, but just reports errors if it observes unstable or interfering production rules while the simulation is running. Try ''help'' as a ''prsim'' command to see the range of commands supported by ''prsim.''
 +
 +One of the useful features of ''prsim'' is that it can automatically randomize the delays of production rule firings. To do this, use
 +
 +<code>
 +(Prsim) random
 +</code>
 +
 +After this command, all delays are randomized. This is a useful test to see if your production rules are stable and non-interfering. If ''prsim'' finds that a production rule is unstable, it sets its output to ''X'' (for undefined). These ''X''s can propagate through the circuit.