Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:basicprs [2019/04/18 18:47] – rajit | tutorial:basicprs [2022/05/30 14:16] (current) – removed rajit | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Basic gate-level simulation ====== | ||
- | |||
- | Gates in the ACT language are specified using production rules, which can specify the Boolean logic for the pull-up and pull-down switching networks for a gate. | ||
- | Since production rules are general enough to | ||
- | specify arbitrary pull-up and pull-down networks, ACT can be used to describe both synchronous and asynchronous circuits. The ACT language contains many constructs that can be used to create design hierarchy, simplifying the description of the circuit. Components can be arrayed, grouped together, or connected to each other using simple constructs. | ||
- | |||
- | The following ACT file describes a process that corresponds to one inverter: | ||
- | |||
- | < | ||
- | defproc inv (bool? in; bool! out) | ||
- | { | ||
- | prs { | ||
- | in -> out- | ||
- | ~in -> out+ | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | The parameters in parentheses are the ports for the process (i.e. what you can connect to externally), | ||
- | |||
- | < | ||
- | import " | ||
- | inv i; | ||
- | </ | ||
- | |||
- | This program imports the previously defined ACT file, and then creates an /instance/ of an inverter called '' | ||
- | |||
- | ===== Simulating with prsim ===== | ||
- | |||
- | If the file above is called '' | ||
- | |||
- | < | ||
- | % aflat test_inv.act > test_inv.prs | ||
- | </ | ||
- | |||
- | The output file is the following: | ||
- | |||
- | < | ||
- | " | ||
- | ~" | ||
- | </ | ||
- | |||
- | Note that ACT uses '' | ||
- | |||
- | If the file is saved as '' | ||
- | |||
- | < | ||
- | % prsim inv.prs | ||
- | |||
- | (Prsim) initialize | ||
- | (Prsim) watch i.in | ||
- | (Prsim) watch i.out | ||
- | (Prsim) status X | ||
- | (Prsim) set i.in 0 | ||
- | (Prsim) cycle | ||
- | (Prsim) set i.in 1 | ||
- | (Prsim) cycle | ||
- | </ | ||
- | |||
- | '' | ||
- | |||
- | One of the useful features of '' | ||
- | |||
- | < | ||
- | (Prsim) random | ||
- | </ | ||
- | |||
- | After this command, all delays are randomized. This is a useful test to see if your production rules are stable and non-interfering. If '' | ||
- | |||
- | Local variables can be defined in ACT in the usual way. | ||
- | |||
- | < | ||
- | defproc sigbuf (bool in, out) | ||
- | { | ||
- | bool mid; | ||
- | prs { | ||
- | in -> mid- | ||
- | ~in -> mid+ | ||
- | |||
- | mid -> out- | ||
- | ~mid -> out+ | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | In this example, '' | ||
- | |||
- | < | ||
- | defproc invarray (bool in[8], out[8]) | ||
- | { | ||
- | |||
- | inv x[8]; | ||
- | |||
- | (; i : 8 : x[i].in = in[i]; x[i].out = out[i]; ) | ||
- | } | ||
- | </ | ||
- | |||
- | This process creates an array of 8 inverters. The second statement is a loop construct. The loop index is '' | ||
- | |||
- | |||