Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tools:actsim [2023/04/14 14:42] rajit [Example with a test environment] |
tools:actsim [2023/04/14 15:26] rajit [Standard sim namespace helper functions] |
||
---|---|---|---|
Line 215: | Line 215: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ==== Direct environment in ACT ==== | ||
A simple test environment would look like this: | A simple test environment would look like this: | ||
Line 253: | Line 255: | ||
Running '' | Running '' | ||
- | Since this is a commonly-used approach, the [[stdlib: | + | Since this is a commonly-used approach, the [[stdlib: |
+ | ==== Using pre-defined sources and sinks with data in the ACT file ==== | ||
+ | |||
+ | The same example can be written using the helper processes provided as follows: | ||
+ | |||
+ | <file act testadd2.act> | ||
+ | import " | ||
+ | import sim; // import simulation namespace | ||
+ | |||
+ | defproc test() | ||
+ | { | ||
+ | adder a; | ||
+ | sim:: | ||
+ | false, // don't repeat the sequence of values | ||
+ | 3, // three data values | ||
+ | {3, | ||
+ | > s1(a.A); | ||
+ | sim:: | ||
+ | sim:: | ||
+ | 32 // 32-bit | ||
+ | > sx(a.C); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Using files for test data ==== | ||
+ | |||
+ | Instead of providing the data values in the ACT test environment, | ||
+ | |||
+ | <file act testadd3.act> | ||
+ | import " | ||
+ | import sim; // import simulation namespace | ||
+ | |||
+ | defproc test() | ||
+ | { | ||
+ | adder a; | ||
+ | // The first parameter is the file ID (default name is _infile_.0). | ||
+ | // The second parameter is whether the file should be looped. | ||
+ | // The third parameter is the bit-width. | ||
+ | sim:: | ||
+ | | ||
+ | // This could also use a file source | ||
+ | sim:: | ||
+ | sim:: | ||
+ | 32 // 32-bit | ||
+ | > sx(a.C); | ||
+ | } | ||
+ | </ | ||
===== Mixed-signal simulations ===== | ===== Mixed-signal simulations ===== | ||
Line 267: | Line 315: | ||
===== Configuration file ===== | ===== Configuration file ===== | ||
+ | An ACT configuration file can be read into '' | ||
+ | |||
+ | |||
+ | ==== CHP configuration options ==== | ||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | int sim.chp.inf_loop_opt 0 | ||
+ | </ | ||
+ | '' | ||
+ | |||
+ | < | ||
+ | int sim.chp.default_delay 10 | ||
+ | </ | ||
+ | This is the default delay for each non-skip basic statement (send, receive, assignment) in a CHP program. | ||
+ | |||
+ | < | ||
+ | int sim.chp.default_leakage 0 | ||
+ | </ | ||
+ | This is the default leakage associated with a process (in nW) | ||
+ | |||
+ | < | ||
+ | int sim.chp.default_area 0 | ||
+ | </ | ||
+ | This is the default area associated with a CHP process (square microns). | ||
+ | |||
+ | < | ||
+ | int sim.chp.debug_metrics 0 | ||
+ | </ | ||
+ | If this is set to 1, then debugging messages are printed out showing the metrics that '' | ||
+ | |||
+ | ==== Standard sim namespace helper functions ==== | ||
+ | |||
+ | The standard simulation library (in the sim namespace) uses a few configuration file settings to pick the names | ||
+ | of the files for I/O. | ||
+ | |||
+ | < | ||
+ | begin sim | ||
+ | begin file | ||
+ | string prefix " | ||
+ | end | ||
+ | end | ||
+ | </ | ||
+ | Change this parameter to modify the default file names used by the file I/O library used by the standard simulation namespace. | ||
+ | |||
+ | Alternatively, | ||
+ | < | ||
+ | begin sim | ||
+ | begin file | ||
+ | string_table name_table " | ||
+ | end | ||
+ | end | ||
+ | </ | ||
+ | If this parameter is specified, then the prefix parameter is ignored. | ||
+ | |||
+ | ==== Mixed-signal simulation ==== | ||
+ | |||
+ | sim.device.timescale | ||
+ | sim.device.analog_window | ||
+ | sim.device.case_for_sim | ||
+ | sim.device.settling_time | ||
+ | sim.device.dump_all | ||
+ | sim.device.output_format | ||
+ | sim.device.waveform_steps | ||
+ | sim.device.waveform_time | ||
+ | sim.device.model_files | ||
+ | sim.device.outfile | ||
+ | sim.device.stop_time | ||