Product Documentation
Spectre Classic Simulator, Spectre APS, Spectre X, Spectre XPS, Spectre FMC Analysis, and Legato Reliability Solution User Guide
Product Version 23.1, September 2023

14


Running a Simulation

This chapter discusses the following topics:

Running Spectre in 64-Bit

You can run 64-bit software using any of the following two methods:

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

Do the following:

  1. Set the environment variable CDS_AUTO_64BIT {ALL|NONE|"list"|INCLUDE: "list"|EXCLUDE:"list"}to select 64-bit executables.

    ALL

    Runs all applications as 64-bit, where available. The list of applications available is in:
    your_install_dir/bin/64bit

    NONE

    Runs all applications as 32-bit.

    "list"

    Runs only the executables included in the list, where available, as 64-bit. list is a list of case-sensitive executable names delimited by comma(,), semi-colon(;), or colon(:).

    INCLUDE:"list"

    Runs all applications in the list as 64-bit, where available.

    EXCLUDE:"list"

    Runs all applications as 64-bit, where available, except the applications in the list.


    Examples:
    setenv CDS_AUTO_64BIT spectre 
    setenv CDS_AUTO_64BIT EXCLUDE:"si" 
  2. 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 +spice options inputfile 

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

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.

Some Spectre options have abbreviations. You can find these abbreviations in Chapter 2, “Spectre Command Options,” of the Spectre Circuit Simulator Reference manual. For example, you can type the previous command as follows:

spectre +cp -error test1

Specific spectre command options are discussed throughout this guide. For a complete list of options and formats, see Chapter 2, “Spectre Command Options,” of the Spectre Circuit Simulator Reference manual.

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:

0

If the Spectre simulator completed the simulation normally

1

If the Spectre simulator stopped any analysis because of an error

2

If the Spectre simulator stopped the simulation early because of a Spectre error condition

3

If a Spectre simulation was stopped by you or by the operating system

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.

You can also give Spectre netlist instructions to display some status information. For more information, consult the Spectre online help about the 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:

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.

Do not stop the Spectre simulator with a kill -9 command. This command stops the simulation before the Spectre simulator can prepare the output files for reading by the postprocessor.

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.

To create a saved state file,

  1. Enable save state by typing +savestate as a command line argument to the spectre command that starts the simulation. Savestate is enabled by default.
  2. Specify the time points and file to save the state to:
    analysisName tran stop=stoptime [ [saveperiod=time] | [savetime=[time1 time2…]] | [saveclock=clock_time] ] [savefile=filename.srf] 
    where
    If you specify Spectre

    saveperiod=time

    generates a saved state file at the specified transient simulation time interval. Only the last generated saved state file is kept.

    savetime=[time1 time2]

    generates a saved state file at each specified time point and suffixes ascending numbers to the file name (filename.srf#) where #=0, 1, 2…

    saveclock=clock_time

    generates a saved state file at the specified real time interval. Default value is 30 minutes for Spectre. Spectre APS does not have any time limit for the saveclock period.

    savefile=filename.srf

    saves the state to the specified file. Default name is %C.%A.srf where %C is the input circuit file name and %A is the analysis name.

    savefile=filename

    saves the state to file filename@time1, filename@time2 and so on.

    Default name is %C.%A.srf_@time1, %C.%A.srf_@time2... where %C is the input circuit file name and %A is the analysis name.

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:

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.

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.

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,

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:

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.

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.

For csh:

setenv SPECTRE_DEFAULTS "-format psfxl +log %C:r.log "

For sh or ksh:

SPECTRE_DEFAULTS=" -format psfxl +log %C:r.log "
EXPORT SPECTRE_DEFAULTS
To view a demonstration on controlling the Spectre output, see Controlling Spectre Outputs Using the Environment Variable Setting video.
Access to this video will depend on the availability of a web browser and a Cadence Online Support account.

This second example, a typical use of the SPECTRE_DEFAULTS environment variable, tells the Spectre simulator to do the following:

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:

Running the executable as specsim causes the Spectre simulator to select a different set of defaults and to do the following:

References for Additional Information about Specific Defaults

In some cases, you need to consult other sections of this book before you can set defaults.

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.

To view the demonstration on overriding the defaults, see Controlling Spectre Outputs during Run Time video.
Access to this video will depend on the availability of a web browser and a Cadence Online Support account.

Return to top
 ⠀
X