Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tools:actsim [2023/04/14 19:29] – [Mixed-signal simulation] rajit | tools:actsim [2026/05/03 17:00] (current) – [Manipulating internal variables] rajit | ||
|---|---|---|---|
| Line 80: | Line 80: | ||
| ==== Timing ==== | ==== Timing ==== | ||
| - | < | + | < |
| Set the random timing mode and optionally specify the default random timing bounds for all nodes. | Set the random timing mode and optionally specify the default random timing bounds for all nodes. | ||
| + | If '' | ||
| < | < | ||
| Line 90: | Line 91: | ||
| < | < | ||
| - | turn on/off random exclhi/lo firings | + | Turn on/off random exclhi/lo firings. ACT uses '' |
| - | + | This is typically used to model arbiters. If the '' | |
| ==== Running Simulation ==== | ==== Running Simulation ==== | ||
| Line 169: | Line 169: | ||
| (Work in progress; try running '' | (Work in progress; try running '' | ||
| + | ==== Manipulating internal variables ==== | ||
| + | |||
| + | The internal state of a process cannot be accessed in ACT, unless it is explicitly exposed via the port list. Consider the following CHP fragment | ||
| + | <code act> | ||
| + | defproc funnyproc (chan?(int) X; chan!(int) Y) | ||
| + | { | ||
| + | bool myvar; | ||
| + | ... | ||
| + | chp { | ||
| + | ... | ||
| + | [ myvar -> X!0 ]; | ||
| + | ... | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | If '' | ||
| + | the environment cannot access '' | ||
| + | if they are deadlocked. In that case, the following message will appear in the simulation log: | ||
| + | < | ||
| + | [ XXX] < | ||
| + | </ | ||
| + | where '' | ||
| + | |||
| + | During simulation, one can '' | ||
| + | In particular, the variable '' | ||
| + | < | ||
| + | actsim> gc-retry inst | ||
| + | </ | ||
| + | This asks the simulator to re-evaluate the guards that led to the deadlock for the instance name '' | ||
| ==== User-defined commands ==== | ==== User-defined commands ==== | ||
| Line 268: | Line 298: | ||
| { | { | ||
| adder a; | adder a; | ||
| - | sim::source_seq<32, // 32-bit data | + | sim::source_sequence<32, // 32-bit data |
| - | false, // don't repeat the sequence of values | + | |
| 3, // three data values | 3, // three data values | ||
| - | {3, | + | {3,5,2}, // the data values |
| + | false, // don't repeat the sequence of values | ||
| + | 0, // source ID is zero for logging | ||
| + | false // don't log any information in the source | ||
| > s1(a.A); | > s1(a.A); | ||
| - | sim::source_seq<32, false, 3, {7,9,3}> s2(a.B); | + | sim::source_sequence<32, 3, {7,9,3}, false, 1, false> s2(a.B); |
| - | sim:: | + | sim:: |
| - | | + | 0, // sink ID for logging |
| + | true // log values | ||
| > sx(a.C); | > sx(a.C); | ||
| } | } | ||
| Line 291: | Line 324: | ||
| { | { | ||
| adder a; | adder a; | ||
| - | // The first parameter is the file ID (default name is _infile_.0). | + | // The first parameter is the bitwidth |
| - | // The second | + | // The second |
| - | // The third parameter is the bit-width. | + | // The third parameter is whether the file should be looped. |
| - | sim::file_source<0, false, | + | // The fourth |
| + | // The fifth parameter specifies if the source should log its output | ||
| + | sim::source_file<32, 0, false, | ||
| | | ||
| // This could also use a file source | // This could also use a file source | ||
| - | sim::source_seq<32, false, 3, {7,9,3}> s2(a.B); | + | sim::source_sequence<32, 3, {7,9,3}, false, 1, false> s2(a.B); |
| - | sim:: | + | sim:: |
| - | | + | 0, // sink ID for logging |
| + | true // log values | ||
| > sx(a.C); | > sx(a.C); | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | This example will also need a file '' | ||
| + | ===== Mixed level simulations ===== | ||
| + | |||
| + | '' | ||
| + | |||
| + | For mixed level simulations to operate correctly, '' | ||
| + | |||
| + | When running CHP level simulations, | ||
| + | |||
| + | To support this functionality, | ||
| + | <code act> | ||
| + | Initialize { | ||
| + | | ||
| + | | ||
| + | } | ||
| + | </ | ||
| + | When '' | ||
| + | * The circuit execution mode is set to '' | ||
| + | * For channels that cross the CHP to HSE/PRS boundary, the appropriate reset block in the channel definition is scheduled for execution. | ||
| + | * The actions in the first '' | ||
| + | * Once there are no simulation events remaining, the second sequence of actions is executed. In this case, because the second sequence of actions is the //last// block, the '' | ||
| + | |||
| + | There can be any number of '' | ||
| + | |||
| ===== Mixed-signal simulations ===== | ===== Mixed-signal simulations ===== | ||
| - | Mixed analog-digital simulations can be done in '' | + | Mixed analog-digital simulations can be done in '' |
| There are two ways to specify an analog simulation: | There are two ways to specify an analog simulation: | ||
| * Specify prs for a process and simulate it at the device level using spice models. This can be done by specifying the device level using an ACT [[config: | * Specify prs for a process and simulate it at the device level using spice models. This can be done by specifying the device level using an ACT [[config: | ||
| Line 312: | Line 373: | ||
| The method to specify a blackbox process is described [[https:// | The method to specify a blackbox process is described [[https:// | ||
| + | ==== Resetting the circuit ==== | ||
| + | The reset phase of the analog part of the design needs special care, depending on how your circuit is supposed to operate. Here we describe a few scenarios: | ||
| + | * The normal operation of the digital circuit simulation initializes the analog part of the design. In this case, nothing special is required. | ||
| + | * The reset protocol for the digital circuit should also include the analog electronics. This happens, for example, if you are running analog simulations of some production rules with a digital environment. In this case, you may need to run the analog simulation for more than the default time to initialize the circuit. | ||
| + | * The digital circuit resets from input provided by the analog circuit. | ||
| + | |||
| + | In the latter two cases, you may need to force the reset protocol to last a minimum duration that may be longer than the default. This can be accomplished by a //digital// delay as follows: | ||
| + | <code act> | ||
| + | import globals; // contains Reset | ||
| + | |||
| + | defproc reset_delay(bool? | ||
| + | { | ||
| + | bool _i; | ||
| + | prs { | ||
| + | i => _i- | ||
| + | [after=5000] _i => o- // explicit delay introduced | ||
| + | } | ||
| + | } | ||
| + | |||
| + | bool Rtmp; | ||
| + | reset_delay r(Reset, | ||
| + | |||
| + | Initialize { | ||
| + | actions | ||
| + | actions { [Rtmp]; Reset- } | ||
| + | } | ||
| + | </ | ||
| + | This will delay the reset phase by a minimum amount of time determined by the '' | ||
| ===== Configuration file ===== | ===== Configuration file ===== | ||
| An ACT configuration file can be read into '' | An ACT configuration file can be read into '' | ||
| + | ==== General options ==== | ||
| + | When '' | ||
| + | < | ||
| + | begin sim | ||
| + | int reset_rounds 100 | ||
| + | end | ||
| + | </ | ||
| + | |||
| + | '' | ||
| + | < | ||
| + | begin sim | ||
| + | string sdf_file " | ||
| + | int sdf_mangled_names 1 | ||
| + | end | ||
| + | </ | ||
| + | The parameter '' | ||
| ==== CHP configuration options ==== | ==== CHP configuration options ==== | ||
| Line 349: | Line 454: | ||
| If this is set to 1, then debugging messages are printed out showing the metrics that '' | If this is set to 1, then debugging messages are printed out showing the metrics that '' | ||
| + | Metrics for energy, delay, leakage power, and area can be specified in a configuration file. These metrics are specified for each process type. (A better version is in the works...) | ||
| + | |||
| + | < | ||
| + | begin sim | ||
| + | begin chp | ||
| + | begin mytype<> | ||
| + | begin varname | ||
| + | int D 42 | ||
| + | int E 84 | ||
| + | end | ||
| + | real leakage 1e-8 | ||
| + | int area 23 | ||
| + | end | ||
| + | end | ||
| + | end | ||
| + | </ | ||
| + | This configuration file provides annotations for energy and delay for a '' | ||
| ==== Mixed-signal simulation ==== | ==== Mixed-signal simulation ==== | ||
| + | |||
| + | The mixed-signal simulation parameters are used to configure the interface to Xyce, and are contained in a sim.device block. | ||
| + | < | ||
| + | begin sim | ||
| + | begin device | ||
| + | # put mixed-signal parameters here | ||
| + | end | ||
| + | end | ||
| + | </ | ||
| + | The parameters are | ||
| + | < | ||
| + | real timescale 1e-12 | ||
| + | </ | ||
| + | This is used for the time resolution of the Xyce output trace files, if any. | ||
| + | |||
| + | < | ||
| + | real analog_window 0.05 | ||
| + | </ | ||
| + | This specifies when an analog signal output should be treated as a digital 0 or digital 1. The value 0.05 means within 5% of the rail-to-rail voltage. So for a 1V power supply, this would be 0.95 for a digital 1 threshold, and 0.05 for a digital 0 threshold. | ||
| + | |||
| + | < | ||
| + | int case_for_sim 1 | ||
| + | </ | ||
| + | SPICE is case-insensitive, | ||
| + | |||
| + | < | ||
| + | real settling_time 1e-12 | ||
| + | </ | ||
| + | This is the settling time parameter for the built-in ADC device used to convert between the digital and analog signals. | ||
| + | |||
| + | < | ||
| + | int dump_all 1 | ||
| + | </ | ||
| + | If this is true, all voltage signals should be saved to the output trace file. Otherwise, only the interface signals are saved to the trace file. | ||
| + | |||
| + | < | ||
| + | string output_format " | ||
| + | </ | ||
| + | This specifies which output trace file formats should be generated from the underlying analog simulation engine. Any number of colon-separated formats are supported, but only one of the built-in formats (raw, prn, etc) can be used. | ||
| + | |||
| + | < | ||
| + | int waveform_steps 10 | ||
| + | real waveform_time 10e-12 | ||
| + | </ | ||
| + | The digital input is converted to a ramp before being fed to the analog simulation. This specifies the duration and number of steps used for the conversion. | ||
| + | |||
| + | < | ||
| + | string model_files " | ||
| + | </ | ||
| + | By default, the simulation will look for the file '' | ||
| + | |||
| + | < | ||
| + | string outfile " | ||
| + | </ | ||
| + | This is the name of the trace file output that is generated. | ||
| + | |||
| + | < | ||
| + | real stop_time 100e-12 | ||
| + | </ | ||
| + | This is the time at which the trace file output should stop. | ||
| + | |||
| + | < | ||
| + | string_table measure_statements " | ||
| + | </ | ||
| + | defines additional spice lines added to each generated spice file used for the device_level simulations, | ||
| ==== Standard sim namespace helper functions ==== | ==== Standard sim namespace helper functions ==== | ||