19
Time-Saving Techniques
In this chapter, you will learn about different methods to reduce simulation time. This chapter discusses the following topics:
- Specifying Efficient Starting Points
- Reducing the Number of Simulation Runs
- Adjusting Speed and Accuracy
- Saving Time by Starting Analyses from Previous Solutions
- Saving Time by Specifying State Information
- Saving Time by Modifying Parameters during a Simulation
- Saving Time by Selecting a Continuation Method
Specifying Efficient Starting Points
The Spectre® circuit simulator arrives at a solution for a simulation by calculating successively more accurate estimates of the final result. You can increase simulation speed by providing information that the Spectre simulator uses to increase the accuracy of the initial solution estimate. There are three ways to provide a good starting point for a simulation:
- Start analyses from previous solutions
- Specify initial conditions for components and nodes
- Specify solution estimates with nodesets
Reducing the Number of Simulation Runs
With the Spectre simulator, you can run many analyses (including analyses of the same type) in a single simulation. With other SPICE-like simulators, you might require multiple simulations to complete the same tasks. In a single simulation run, you can run a set of Spectre analyses; modify the component, temperature, or options parameters; and then run additional analyses with the new parameters.
Adjusting Speed and Accuracy
You can use the errpreset parameter to increase the speed of transient analyses, but this speed increase requires some sacrifice of accuracy.
Saving Time by Starting Analyses from Previous Solutions
A solution for one analysis can be an appropriate starting point for the next analysis. For example, if a DC analysis precedes a transient analysis, you can use the DC solution as the first guess for the initial point in the transient analysis solution. There are two Spectre analysis parameters that let you start analyses from previous solutions. They are available for most Spectre analyses.
-
The
restartparameter
If you set this parameter torestart=noin an analysis statement, the Spectre simulator uses the DC solution of the previous analysis as an initial guess for the following analysis. -
The
prevoppointparameter
If you set this parameter toprevoppoint=yesin an analysis statement, the Spectre simulator does not compute or recompute the operating point. Instead, it uses the operating point computed by the previous analysis.
Saving Time by Specifying State Information
The Spectre simulator lets you provide state information (the current or last-known status or condition of a process, transaction, or setting) to the DC and transient analyses. You can specify two kinds of state information:
-
Initial conditions
Theicstatement lets you specify values for the starting point of a transient analysis. The values you can specify are voltages on nodes and capacitors, and currents on inductors. -
Nodesets
Nodesets are estimates of the solution you provide for the DC or transient analyses. Nodesets usually act only as aids in speeding convergence, but if a circuit has more than one solution, as with a latch, nodesets can bias the solution to the one closest to the nodeset values.
Setting Initial Conditions for All Transient Analyses
You can specify initial conditions that apply to all transient analyses in a simulation or to a single transient analysis. The ic statement and the ic parameter described in this section set initial conditions for all transient analyses in the netlist. In general, you use the ic parameter of individual components to specify initial conditions for those components, and you use the ic statement to specify initial conditions for nodes. You can specify initial conditions for inductors with either method. Specifying cmin for a transient analysis does not satisfy the condition that a node has a capacitive path to ground.
ic parameter for individual components with the ic parameter of the transient analysis. The latter lets you select from among different initial conditions specifications for a given transient analysis.Specifying Initial Conditions for Components
You can specify initial conditions in the instance statements of capacitors, inductors, and windings for magnetic cores. The ic parameter specifies initial voltage values for capacitors and current values for inductors and windings. In the following example, the initial condition voltage on capacitor Cap13 is set to two volts:
Cap13 11 9 capacitor c=10n ic=2
Specifying Initial Conditions for Nodes
You use the ic statement to specify initial conditions for nodes or initial currents for inductors. The nodes can be inside a subcircuit or internal nodes to a component.
The following is the format for the ic statement:
icsignalName=value…
The format for specifying signals with the ic statement is similar to that used by the save statement. This method is described in detail in
ic Voff=0 X3.7=2.5 M1:int_d=3.5 L1:1=1u
This example sets the following initial conditions:
-
The voltage of node
Voffis set to 0. - Node 7 of subcircuit X3 is set to 2.5 V.
- The internal drain node of component M1 is set to 3.5 V. (See the following table for more information about specifying internal nodes.)
-
The current for inductor
L1is set to 1μ.
Specifying initial node voltages requires some additional discussion. The following table tells you the internal voltages you can specify with different components.
| Component | Internal Node Specifications |
|---|---|
Supplying Solution Estimates to Increase Speed
You use the nodeset statement to supply estimates of solutions that aid convergence or bias the simulation towards a given solution. You can use nodesets for all DC and initial transient analysis solutions in the netlist. The nodeset statement has the following format:
nodesetsignalName=value…
Values you can supply with the nodeset statement include voltages on topological nodes, including internal nodes, and currents through voltage sources, inductors, switches, transformers, N-ports, and transmission lines.
The format for specifying signals with the nodeset statement is similar to that used by the save statement. This method is described in detail in
nodeset Voff=0 X3.7=2.5 M1:int_d=3.5 L1:1=1u
This example sets the following solution estimates:
-
The voltage of node
Voffis set to 0. - Node 7 of subcircuit X3 is set to 2.5 V.
- The internal drain node of component M1 is set to 3.5 V. (See the table in the ic statements section of this chapter for more information about specifying internal nodes.)
-
The current for inductor
L1is set to 1μ.
Specifying State Information for Individual Analyses
You can specify state information for individual analyses in two ways:
-
You can use the
icparameter of the transient analysis to choose which previous specifications are used. - You can create a state file that is read by an individual analysis.
Choosing Which Initial Conditions Specifications Are Used for a Transient Analysis
The ic parameter in the transient analysis lets you select among several options for which initial conditions to use. You can choose the following settings:
Specifying State Information with State Files
You can also specify initial conditions and estimate solutions by creating a state file that is read by the appropriate analysis. You can create a state file in two ways:
- You can instruct the Spectre simulator to create a state file in a previous analysis for future use.
- You can create a state file manually in a text editor.
Telling the Spectre Simulator to Create a State File
You can instruct the Spectre simulator to create a state file from either the initial point or the final point in an analysis. To write a state file from the initial point in an analysis, use the write parameter. To write a state file from the final point, use the writefinal parameter. Each of the following two examples writes a state file named ua741.dc. The first example writes the state file from the initial point in the DC sweep, and the second example writes the state file from the final point in the DC sweep.
Drift dc param=temp start=0 stop=50.0 step=1 readns="ua741.dc" write="ua741.dc"
Drift dc param=temp start=0 stop=50.0 step=1 readns="ua741.dc" writefinal="ua741.dc"
Creating a State File Manually
The syntax for creating a state file in a text editor is simple. Each line contains a signal name and a signal value. Anything after a pound sign (#) is ignored as a comment. The following is an example of a simple state file:
# State file generated by Spectre from circuit file 'wilson'
# during 'stepresponse' at 5:39:38 PM, jan 21, 1992.
1 .588793510612534
2 1.17406247989272
3 14.9900516233357
pwr 15
vcc:p -9.9483766642647e-06
Reading State Files
To read a state file as an initial condition, use the readic transient analysis parameter. To read a state file as a nodeset, use the readns parameter. This example reads the file intCond as initial conditions:
DoTran_z12 tran start=0 stop=0.003 \
step=0.00015 maxstep=6e-06 readic="intCond"
This second example reads the file soluEst as a nodeset.
DoTran_z12 tran start=0 stop=0.003 \
step=0.00015 maxstep=6e-06 readns="soluEst"
Special Uses for State Files
State files can be useful for the following reasons:
- You can save state files and use them in later simulations. For example, you can save the solution at the final point of a transient analysis and then continue the analysis in a later simulation by using the state file as the starting point for another transient analysis.
- You can use state files to create automatic updates of initial conditions and nodesets.
The following example demonstrates the usefulness of state files:
altTemp alter param=temp value=0
Drift dc param=temp start=0 stop=50.0 step=1 readns=”ua741.dc0” write=”ua741.dc
XferVsTemp xf param=temp start=0 stop=50 step=1 probe=Rload freq=1kHz \ readns=”ua741.dc0”
The first analysis computes the DC solution at T=0C, saves it to a file called ua741.dc0, and then sweeps the temperature to T=50C. The transfer function analysis (xf) resets the temperature to zero. Because of the temperature change, the DC solution must be recomputed. Without the use of state files, this computation might slow the simulation because the only available estimate of the DC solution would be that computed at T=50C, the final point in the DC sweep. However, by using a state file to preserve the initial DC solution at T=0C, you can enable the Spectre simulator to compute the new DC solution quickly. The computation is fast because the Spectre simulator can use the DC solution computed at T=0C to estimate the new solution. You can also make future simulations of this circuit start quickly by using the state file to estimate the DC solution. Even if you have altered a circuit, it is usually faster to start the DC analysis from a previous solution than to start from the beginning.
Saving Time by Modifying Parameters during a Simulation
The Spectre simulator lets you place specifications in the netlist to modify parameters and then resimulate. This lets you accomplish tasks with a single Spectre run that might require multiple runs with another simulator. To change parameter settings during a run, you use the following Spectre control statements:
-
The
alterstatement
You use this statement to change the parameters of circuits, subcircuits, and individual models or components. You also use it to change the followingoptionsstatement temperature parameters and scaling factors:
You can use thealtergroupstatement to specify device, model, and netlist parameter statements that you want to change the values of with analyses. -
The
setstatement
Except for temperature parameters and scaling factors, you use thesetstatement to modify anyoptionsstatement parameters you set at the beginning of the netlist. The new settings apply to all analyses that follow thesetstatement in the netlist.
The alter and set statements are queued up with analysis statements and are processed in order.
Changing Circuit or Component Parameter Values
You modify parameters for devices, models, circuit, and subcircuit parameters during a simulation with the alter statement. The modifications apply to all analyses that follow the alter statement in your netlist until you request another parameter modification.
Changing Parameter Values for Components
To change a parameter value for a component device or model, you specify the device or model name, the parameter name, and the new parameter value in the alter statement. You can modify only one parameter with each alter statement, but you can put any number of alter statements in a netlist. The following example demonstrates alter statement syntax:
SetMag alter dev=Vt1 param=mag value=1
-
SetMagis the unique netlist name for thisalterstatement. (Like many Spectre statements, eachalterstatement must have a unique name.) -
The keyword
alteris the primitive name for thealterstatement. -
dev=Vt1identifiesVt1as the netlist name for the component statement you want to modify. You identify an instance statement withdevand amodelstatement withmod. When you use thealterstatement to modify a circuit parameter, you leave bothdevandmodunspecified. -
param=magidentifiesmagas the parameter you are modifying. If you omit this parameter, the Spectre simulator uses the first parameter listed for each component in the Spectre online help as the default. -
value=1identifies1as the new value for themagparameter. If you leavevalueunspecified, it is set to the default for the parameter.
Changing Parameter Values for Models
To change a parameter value for model files with the altergroup statement, you list the device, model, and circuit parameter statements as you do in the main netlist. Within an alter group, each model is first defaulted and then the model parameters are updated. You cannot nest alter groups. You cannot change from a model to a model group and vice versa. The following example demonstrates altergroup statement syntax:
ag1 altergroup {
parameters p1=1
model myres resistor r1=1e3 af=p1
model mybsim bsim3v3 lmax=p1 lmin=3.5e-7
}
Further Examples of Changing Component Parameter Values
This example changes the is parameter of a model named SH3 to the value 1e-15:
modify2 alter mod=SH3 param=is value=1e-15
The following examples show how to use the param default in an alter statement. The first parameter listed for resistors in the Spectre online help (spectre -h) is the default. For resistors, this is the resistance parameter r.
Consequently, if R1 is a resistor, the following two alter statements are equivalent:
change1 alter dev=R1 param=r value=50
change1 alter dev=R1 value=50
Changing Parameter Values for Circuits
When you change a circuit parameter, you use the same syntax as when you change a device or model parameter except that you do not enter a dev or a mod parameter.
This example changes the ambient temperature to 0°C:
change2 alter param=temp value=0
The following table describes the circuit parameters you can change with the alter statement:
| Parameter | Description |
|---|---|
temp or tnom using an alter statement, all expressions with temp or tnom are reevaluated.Modifying Initial Settings of the State of the Simulator
You can change the initial settings for the state of the simulator by placing a set statement in the netlist. The set statement is similar to the options statement that sets the state of the simulator, but it is queued with the analysis statements in the order you place them in the netlist.
You use the set statement to change previous options or set statement specifications. The modifications apply to all analyses that follow the set statement in the netlist until you request another parameter modification. The set and options statements have many identical parameters, but the set statement cannot modify all options statement parameters. The parameter listings in the Spectre online help (spectre -h) tell you which parameters you can reset with the set statement.
Formatting the set Statement
The following example demonstrates the set statement syntax. This example turns off several annotation parameters.
Quiet set narrate=no error=no info=no
-
Quietis the unique name you give to thesetstatement. -
The keyword
setis the primitive name for thesetstatement. -
narrate,error, andinfoare the parameters you are changing.
Saving Time by Selecting a Continuation Method
The Spectre simulator normally starts with an initial estimate and then tries to find the solution for a circuit using the Newton-Raphson method. If this attempt fails, the Spectre simulator automatically tries several continuation methods to find a solution and tells you which method was successful. Continuation methods modify the circuit so that the solution is easy to compute and then gradually change the circuit back to its original form. Continuation methods are robust, but they are slower than the Newton-Raphson method.
If you need to modify and resimulate a circuit that was solved with a continuation method, you probably want to save simulation time by directly selecting the continuation method you know was previously successful.
You select the continuation method with the homotopy parameter of the set or options statements. In addition to the default setting, all, other settings are possible for this parameter: gmin stepping (gmin), source stepping (source), the pseudotransient method (ptran), and damped pseudotransient method (dptran), . You can also prevent the use of continuation methods by setting the homotopy parameter to none.
Return to top