14
Running a Simulation
This chapter discusses the following topics:
- Running Spectre in 64-Bit
- Starting Simulations
- Checking Simulation Status
- Interrupting a Simulation
- Recovering from Transient Analysis Terminations
- Controlling Command Line Defaults
Running Spectre in 64-Bit
You can run 64-bit software using any of the following two methods:
- Using the -64 Command Line Option
-
Using the CDS_AUTO_64BIT Environment VariableBefore you run 64-bit software, verify that all required patches are installed by running the System Configuration Checking Tool script,
checkSysConf. This script is in your local installation of Cadence software, at the following location:your_install_dir/bin/checkSysConf MMSIM19.1MMSIM19.1is a parameter expected by the script.
The System Configuration Checking Tool is also available on the Cadence Online Support system. All required patches must be installed for the 64-bit executables to work correctly.
Using the -64 Command Line Option
For example, run Spectre using the following command:
your_install_dir/bin/spectre -64 mem.scs
Using the CDS_AUTO_64BIT Environment Variable
-
Set the environment variable
CDS_AUTO_64BIT {ALL|NONE|"list"|INCLUDE: "list"|EXCLUDE:"list"}to select 64-bit executables.
Examples:setenv CDS_AUTO_64BIT spectre
setenv CDS_AUTO_64BIT EXCLUDE:"si"
-
Run Spectre using the following command:
your_install_dir/bin/spectre
Starting Simulations
To start a simulation, you type the spectre command at the command line with the following syntax:
spectre +spiceoptionsinputfile
The spectre command starts a simulation of inputfile. The simulation includes any options you request. For a given simulation, the spectre command options override any settings in default environment variables or options statement specifications.
The +spice option ensures that Spectre is invoked with the SPICE-compatible parser. In addition, it also
- sets tnom and temp to 25C
- sets parameter inheritance to global rather than the Spectre default of local. This means that global parameter definitions override local ones.
- sets flags on all device models to be SPICE compatible.
-
enforces .IC statements and initial conditions on elements for DC and OP analyses. By default, Spectre only forces initial conditions if the DC analysis
forceoption is set.
The following example starts a simulation of the input file test1.
spectre +spice test1
Specifying Simulation Options
Many simulation runs require more complicated instructions than the previous example. Spectre® circuit-simulator-run options can be specified in two ways. Which method you use depends on the run option.
-
You specify some Spectre options by typing a minus (
-) in front of the option. The (-V) in the following example specifies that version information be printed for the simulation of circuittest1.spectre -V test1
-
You activate some Spectre options by typing a plus (
+) before the option. You deactivate these options by typing a minus (-) before the option. For example, the followingspectrecommand starts a simulation run for circuittest1. In this simulation, the Spectre simulator sets checkpoints but does not print error messages:spectre +checkpoint -error test1
Some Spectre options have abbreviations. You can find these abbreviations in
spectre +cp -error test1
Specific spectre command options are discussed throughout this guide. For a complete list of options and formats, see
Using License Queuing
You can turn on license queuing by using the lqtimeout command line option:
spectre +lqtimeout time
If a license is not available when you begin a simulation job, the Spectre circuit simulator waits in queue for a license for the specified time. If you specify the value 0 for this option, the Spectre circuit simulator waits indefinitely for a license. The lqtimeout option ha s no default value for the standalone Spectre circuit simulator. If you invoke Spectre through the Analog Design Environment, the default value for lqtimeout is 900 seconds.
You can use the lqsleep option to specify the interval (in seconds) at which the Spectre circuit simulator should check for license availability. The default value for lqsleep is 30 seconds.
spectre +lqsleep interval
For more information on any of the above options, see spectre -h.
Suspending a Simulation Automatically When Disk Space is Low
You can use the +disk_check command-line option to suspend a simulation when the disk space is lower than the specified threshold. When Spectre finds the available disk space to be less than the specified threshold value, it immediately suspends the simulation and generates a warning message. You can free up the disk space and type kill -s CONT <pid> at the command line to resume the simulation. However, if you set the option disk_check_autoresume=yes in the options statement, the simulation is resumed automatically once you free up the disk space.
The threshold value can also be set using the disk_check_thresh option in the options statement, as follows:
Opts options disk_check_thresh=1E9
The above statement sets the disk space threshold value to 1 gigabytes. The default value for the option disk_check_thresh is 1M.
Suspending and Resuming Licenses
You can direct Spectre to release licenses when suspending a simulation job. This feature is aimed for users of simulation farms, where the licenses in use by a group of lower priority jobs may be needed for a group of higher priority jobs. To enable this feature, simply start Spectre with the +lsuspend command line option. Press ctrl+z to suspend the simulation run and release the Spectre license. All licenses are checked in. To resume simulation, press fg. These keystrokes may not work if you have changed the default key bindings.
You can also use the kill command to suspend and resume the simulation. You can suspend a simulation with kill -s TSTP <pid>. To resume the simulation, type kill -s CONT <pid>.
In Virtuoso® Analog Design Environment, the lqtimeout and lqsleep options are controlled by the following options:
spectre.envOpts lsuspend boolean t
spectre.envOpts licQueueTimeOut string "900"
spectre.envOpts licQueueSleep string "30"
Determining Whether a Simulation Was Successful
When the Spectre simulator finishes a simulation, it sets the shell status variable to one of the following values:
Checking Simulation Status
If you want to check the status of a simulation during a run, type the following UNIX command:
% kill -USR1 PID
PID is the Spectre process identification number, which you can find by activating the UNIX ps utility.
The Spectre simulator displays the status information on the screen or sends it to standard output if it cannot write to the screen. If you check the status from a remote terminal, the Spectre simulator also writes the status to the SpectreStatus file in the directory from which the Spectre simulator was called. The Spectre simulator deletes this file at termination of the run.
sweep and steps options for the annotate parameter. You can set the annotate parameter for most Spectre analyses.Interrupting a Simulation
If you want to stop the Spectre simulator while a simulation is running, do one of the following:
-
Send an INT signal with your interrupt character.
The interrupt character is usuallyControl-c. You can get information about the interrupt character for your system with the UNIXsttyutility. -
Send the INT signal with a
kill(1)command.
When you use either of these commands, the Spectre simulator prepares the incomplete output data file for reading by the postprocessor and then stops the simulation.
Recovering from Transient Analysis Terminations
If a transient analysis ends before a successful conclusion, you can recover the work that is completed and restart the analysis. The Spectre simulator needs saved state or checkpoint files to perform this recovery. State files save the current state of the simulation whereas checkpoint files save only the circuit operating point and simulation time at the specified point during the simulation. When re-starting an aborted simulation with a saved state file, convergence issues, glitches, and potential inaccuracies associated with the checkpoint mechanism are prevented.
You can change the netlist parameters (global, subcircuit, instance), temperature, simulation tolerances, and stop time between savestate and restart. You cannot change the topology and the platform you are running the simulation on.
This section tells you how to create saved state and checkpoint files. It also tells you how to restart a simulation after a transient analysis termination.
Creating Saved State Files
You can save the current state of the system periodically during a simulation, so that if the simulation is interrupted, you can re-run the simulation from the last saved point. You can also use the save state feature to run a simulation up to a point, and then re-run the last portion of the simulation several times to investigate how the circuit responds to different stimuli. You can try various accuracy settings for different time periods to get the best performance for your simulation.
-
Enable save state by typing
+savestateas a command line argument to thespectrecommand that starts the simulation. Savestate is enabled by default. -
Specify the time points and file to save the state to:
analysisName tran stop=
wherestoptime[ [saveperiod=time] | [savetime=[time1time2…]] | [saveclock=clock_time] ] [savefile=filename.srf]
If more than one time point parameter is specified, the Spectre circuit simulator utilizes the parameters in the order as given in the table above – i.e., saveperiod, savetime, and then saveclock.
By default, the Spectre simulator creates checkpoint files every 30 minutes during a transient analysis. In the case of Spectre APS, the saveclock period is set to infinity due to which, checkpoint files are not created unless saveclock is specifically set to a smaller value. The Spectre simulator deletes the savestate files when the simulation ends successfully.
The Spectre simulator attempts to save the state file after QUIT, TERM, INT, or HUP interrupts. After other interrupt signals, the Spectre simulator might be unable to save the state file.
Creating checkpoint Files
This section talks about the following ways to create checkpoint files:
-
Automatically, with defaults and
optionsstatement settings - From the command line during a simulation
- For specific analyses with netlist instructions
This section also tells you how to restart a simulation after a transient analysis termination.
Reactivating Automatic Recovery for a Single Simulation
If you have deactivated the default setting (by putting the -checkpoint setting in an environment variable), you can reactivate the default value for a given simulation run with the following procedure:
Determining How Often the Spectre Simulator Creates Recovery Files
If you want to change how often the Spectre simulator creates checkpoint files for a particular simulation, or if you want your checkpoint files saved after a successful completion, you should set the ckptclock parameter of the options statement. For more information about the options statement, consult the parameter listings in the Spectre online help (spectre -h).
The following options statement tells the Spectre simulator to create checkpoint files every 3 1/2 minutes for all transient analyses in a simulation. (You indicate parameters for ckptclock in seconds.)
SetCkptInterval options ckptclock=210
Creating Recovery Files from the Command Line
You can create a checkpoint file when a transient analysis is running with a UNIX interrupt signal from the command line.
-
To create a checkpoint file from the command line, send a
USR2signal with a UNIXkillcommand.kill -USR2
(You find the necessary process identification number by running the UNIXPIDpsutility.)
The Spectre simulator also attempts to write a checkpoint file after QUIT, TERM, INT, or HUP interrupts. After other interrupt signals, the Spectre simulator might be unable to write a checkpoint file.
Setting Recovery File Specifications for a Single Analysis
When you specify a transient analysis, you can also create periodic checkpoint files for that analysis.
-
To create periodic checkpoint files for a transient analysis, set the
ckptperiodparameter in the transient analysis statement.
The following example creates a checkpoint every 20 seconds during the transient analysis SineResponse:
SineResponse tran stop=150u ckptperiod=20
Restarting a Transient Analysis
You can restart a transient analysis from the last saved state file or checkpoint file.
To restart a transient analysis from the last saved state file, do one of the following,
-
Add the
+recover=[filename] argument to thespectrecommand line -
Add the
recoverargument to thetranstatement as follows:analysisName tran recover=
filename
To restart a transient analysis from the last checkpoint file,
Output Directory after Recovery
A new raw directory is created when recovering a saved state. The raw directory name is the same as the run directory name with an index number added, such as *.raw# where # is 0, 1, 2,...
For example, if the raw directory in the first run is input.raw, the recovered raw directory is input.raw0. The next recovered raw directory is named input.raw1 and so on.
Controlling Command Line Defaults
There are many run options you can specify with either the spectre command or the options statement. The Spectre simulator provides defaults for many of these options, so you can avoid the inconvenience of specifying many options for each simulation. Spectre defaults are satisfactory for most situations, but, if you have specialized needs, you can also set your own defaults. Spectre command line defaults control the following general areas:
- Messages from the Spectre simulator
- Destination and format of results
- Default values for the C preprocessor
- Default values for percent codes
- Creating checkpoints and initiating recoveries
- Screen display
- Name of the simulator
-
Simulation environment (such as
opus,edge, and so on)
Examining the Spectre Simulator Defaults
You can identify the various Spectre defaults by consulting the detailed description of spectre command options in the Spectre Circuit Simulator Reference manual.
Setting Your Own Defaults
You can set your own defaults by setting the UNIX environment variables %S_DEFAULTS or SPECTRE_DEFAULTS. In %S_DEFAULTS, %S is replaced by the name of the simulator, so this variable is typically SPECTRE_DEFAULTS. However, the name created by the %S substitution is different if you move the executable to a file with a different name or if you call the program with a symbolic or hard link with a different name. Consequently, you can create multiple sets of defaults, which you identify with different %S substitutions. Initially, the Spectre simulator looks for defaults settings in %S_DEFAULTS. If this variable does not exist, it looks for default settings in SPECTRE_DEFAULTS.
To set these environment variables, use the following procedure.
-
In an appropriate file, such as
.cshrcor.login, use the appropriate UNIX command to create settings for the environment variables%S_DEFAULTSorSPECTRE_DEFAULTS. Format the new default settings likespectrecommand line arguments and place them in quotation marks.
The following example changes the default output format from psfbin to psfxl. It also sets an option that is normally deactivated. It sends all messages from the Spectre simulator to a %C:r.log file.
setenv SPECTRE_DEFAULTS "-format psfxl +log %C:r.log "
SPECTRE_DEFAULTS=" -format psfxl +log %C:r.log "
EXPORT SPECTRE_DEFAULTS
This second example, a typical use of the SPECTRE_DEFAULTS environment variable, tells the Spectre simulator to do the following:
-
Write a log file named cktfile
.out, where cktfile is the name of the input file minus any dot extension. -
Use the parameter soft limits file in the Cadence® software hierarchy.
setenv SPECTRE_DEFAULTS "+log %C:r.out +param /cds/etc/spectre/range.lmts"
You can use the default settings to specify alternative conditions for running the Spectre simulator. Suppose you create the following environment variables:
setenv SPECTRE_DEFAULTS "+param range.lmts +log %C:r.o -E"
setenv SPECSIM_DEFAULTS "+param corner.lmts =log %C:r.log \ -f psfbin"
If spectre and specsim are both links to the Spectre executable, and you run the executable as spectre, the Spectre simulator does the following:
-
Reads the file
range.lmtsfor the parameter limits -
Directs all messages to the screen and to a log file named after the circuit file with
.oappended (see Chapter 13, “Managing Files,” for more information about specifying filenames) - Runs the C preprocessor
Running the executable as specsim causes the Spectre simulator to select a different set of defaults and to do the following:
-
Read the range limits from the file
corner.lmts -
Direct log messages to a file named after the circuit file with
.logappended (the=logspecification suppresses the log output to the screen) - Format output files in binary parameter storage format (PSF)
References for Additional Information about Specific Defaults
In some cases, you need to consult other sections of this book before you can set defaults.
- If you want to set default limits for warning messages about parameter values, consult Chapter 21, “Identifying Problems and Troubleshooting,” to find information about installing Cadence defaults or creating your own range limits file if you need to customize defaults.
- You can find additional information about percent code defaults in Description of Spectre Predefined Percent Codes.
Overriding Defaults
You can override defaults in the UNIX environment variables for a given simulation with either spectre command-line arguments or options statement specifications. The spectre command-line arguments also override options statement specifications.
Return to top