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
tools:actsim [2023/04/14 15:22]
rajit [Configuration file]
tools:actsim [2024/08/15 14:05] (current)
rajit [Timing]
Line 80: Line 80:
 ==== Timing ==== ==== Timing ====
  
-<code>random [<min> <max>]</code>+<code>random [-u] [<min> <max>]</code>
 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 ''-u'' is used, then randomization is only applied to unspecified delays.
  
 <code>random_seed <seed></code> <code>random_seed <seed></code>
Line 90: Line 91:
  
 <code>random_choice on|off</code> <code>random_choice on|off</code>
-turn on/off random exclhi/lo firings +Turn on/off random exclhi/lo firings. ACT uses ''mk_exclhi'' (''mk_excllo'') [[language:langs:spec#exclusive_directives|directives]] to force signals to be exclusive-high (exclusive low).  
- +This is typically used to model arbiters. If the ''mk_exclhi'' (''mk_excllo'') directive is used between a set of signals, and more than one signal is driven high (low) at the same simulation time, then turning on random choice randomizes the selection of the signal that is allowed to go high (low).
  
 ==== Running Simulation ==== ==== Running Simulation ====
Line 268: Line 268:
 { {
     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,5,2}  // the data values+                    {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::sink<true, // log output +    sim::sink<32 // 32-bit 
-              32  // 32-bit+                     0, // sink ID for logging 
 +                     true // log values
               > sx(a.C);               > sx(a.C);
  }  }
Line 291: Line 294:
 { {
     adder a;     adder a;
-    // The first parameter is the file ID (default name is _infile_.0).  +    // The first parameter is the bitwidth 
-    // The second parameter is whether the file should be looped. +    // The second parameter is the file ID (default name is _infile_.0).  
-    // The third parameter is the bit-width. +    // The third parameter is whether the file should be looped. 
-    sim::file_source<0, false, 32> s1(a.A);+    // The fourth parameter is the source ID for logging 
 +    // The fifth parameter specifies if the source should log its output 
 +    sim::source_file<32, 0, false, 0, false> s1(a.A);
          
     // 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::sink<true, // log output +    sim::sink<32 // 32-bit 
-              32  // 32-bit+                     0, // sink ID for logging 
 +                     true // log values
               > sx(a.C);               > sx(a.C);
  }  }
 </file> </file>
 +
 +This example will also need a file ''_infile_.0'' that contains the [[sim:start|list of values]].
 ===== Mixed-signal simulations ===== ===== Mixed-signal simulations =====
  
Line 314: Line 322:
  
 ===== Configuration file ===== ===== Configuration file =====
 +
 +An ACT configuration file can be read into ''actsim'' to control its behavior. The following summarizes configuration options that affect the behavior of the simulator (beyond the default ACT configurations that affect all tools). The simulator loads in the default ''actsim.conf'' file, but any of those parameters can be augmented/over-ridden using the ''-cnf'' [[stdoptions:start|command-line option]].
 +
  
 ==== CHP configuration options ==== ==== CHP configuration options ====
  
-The standard simulation library (in the sim namespace) uses a few configuration file settings to pick the names +<code> 
-of the files for I/O+begin sim 
 +  begin chp 
 +    int inf_loop_opt 0 
 +  end 
 +end 
 +</code> 
 +''actsim'' can detect an infinite loop where no state changes occur, and delete the process from the simulation environment if this flag is turned on (by being set to 1).
  
 <code> <code>
-string sim.file.prefix "_infile_"+begin sim 
 +  begin chp 
 +    int default_delay 0 
 +    real default_leakage 0 
 +    int default_area 0 
 +  end 
 +end
 </code> </code>
-Change this parameter to modify the default file names used by the file I/O library used by the standard simulation namespace.+These set default simulation parameters for CHP processes. The default delay sets the value for each non-skip basic statement (send, receive, assignment) in a CHP program. The default leakage per process can be secified (in nW), as can the default area (in square microns).
  
-Alternatively, a file name table can be specified whose entries are the names of the files to be used for each file ID (0 = first entry, 1 = second entry, etc.) 
 <code> <code>
-string_table sim.file.name_table "file1.in" "file2.in"+begin sim 
 +  begin chp 
 +    int debug_metrics 0 
 +  end 
 +end
 </code> </code>
-If this parameter is specified, then the prefix parameter is ignored.+If this is set to 1, then debugging messages are printed out showing the metrics that ''actsim'' was looking for in the configuration file, and what metrics were in fact found.
  
-Other simulation parameters are:+==== Mixed-signal simulation ====
  
 +The mixed-signal simulation parameters are used to configure the interface to Xyce, and are contained in a sim.device block.
 <code> <code>
-int sim.chp.inf_loop_opt 0+begin sim 
 +  begin device 
 +    # put mixed-signal parameters here   
 +  end 
 +end
 </code> </code>
-''actsim'' can detect an infinite loop where no state changes occur, and delete the process from the simulation environment if this flag is turned on (by being set to 1).+The parameters are 
 +<code> 
 +real timescale 1e-12   
 +</code> 
 +This is used for the time resolution of the Xyce output trace files, if any.
  
 <code> <code>
-int sim.chp.default_delay 10+real analog_window 0.05
 </code> </code>
-This is the default delay for each non-skip basic statement (sendreceiveassignment) in CHP program.+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 supplythis would be 0.95 for a digital 1 thresholdand 0.05 for digital 0 threshold.
  
 <code> <code>
-int sim.chp.default_leakage 0+int case_for_sim 1
 </code> </code>
-This is the default leakage associated with process (in nW)+SPICE is case-insensitive, and the internals of the analog simulator usually have either lowercase or uppercase name for all the signals. Set this to 1 (the default, and correct value for Xyceif it is uppercase, 0 for lowercase.
  
 <code> <code>
-int sim.chp.default_area 0+real settling_time 1e-12
 </code> </code>
-This is the default area associated with a CHP process (square microns).+This is the settling time parameter for the built-in ADC device used to convert between the digital and analog signals.
  
 <code> <code>
-int sim.chp.debug_metrics 0+int dump_all 1
 </code> </code>
-If this is set to 1then debugging messages are printed out showing the metrics that ''actsim'' was looking for in the configuration file, and what metrics were in fact found.+If this is true, all voltage signals should be saved to the output trace file. Otherwiseonly the interface signals are saved to the trace file. 
 + 
 +<code> 
 +string output_format "prn:lxt2:alint:vcd" 
 +</code> 
 +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. 
 + 
 +<code> 
 +int waveform_steps 10 
 +real waveform_time 10e-12 
 +</code> 
 +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. 
 + 
 +<code> 
 +string model_files "path.sp" 
 +</code> 
 +By default, the simulation will look for the file ''models.sp'' in the ACT configuration directory. This string can be used to override this default and pick a different SPICE file that includes all the needed models. 
 + 
 +<code> 
 +string outfile "xyce_out" 
 +</code> 
 +This is the name of the trace file output that is generated. 
 + 
 +<code> 
 +real stop_time 100e-12 
 +</code> 
 +This is the time at which the trace file output should stop. 
 + 
 +==== 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.  
 + 
 +<code> 
 +begin sim 
 +  begin file 
 +    string prefix "_infile_" 
 +  end 
 +end 
 +</code> 
 +Change this parameter to modify the default file names used by the file I/O library used by the standard simulation namespace. 
 + 
 +Alternativelya file name table can be specified whose entries are the names of the files to be used for each file ID (0 = first entry, 1 = second entry, etc.) 
 +<code> 
 +begin sim 
 +  begin file 
 +    string_table name_table "file1.in" "file2.in" 
 +  end 
 +end 
 +</code> 
 +If this parameter is specified, then the prefix parameter is ignored. 
 +