Monte Carlo Analysis (montecarlo)
Description
The montecarlo analysis is a swept analysis with associated child analyses similar to the sweep analysis (see spectre -h sweep.) The Monte Carlo analysis refers to "statistics blocks" where statistical distributions and correlations of netlist parameters are specified (detailed information about statistics blocks is given below). For each iteration of the Monte Carlo analysis, new pseudo-random values are generated for the specified netlist parameters (according to their specified distributions) and the list of child analyses are then executed.
Expressions are associated with the child analyses. These expressions, which you constructed as scalar calculator expressions during Monte Carlo analysis setup, can be used to measure circuit metrics, such as the slew-rate of an op-amp. For each iteration during a Monte Carlo analysis, the expression results vary with the netlist parameters. Therefore, Monte Carlo analysis allows you to examine and predict circuit performance variations, which affect yield.
The statistics blocks allow you to specify batch-to-batch (process) and per-instance (mismatch) variations for netlist parameters. These statistically-varying netlist parameters can be referenced by models or instances in the main netlist and may represent IC manufacturing process variation or component variations for board-level designs. The following description gives a simplified example of the Monte Carlo analysis flow:
perform nominal run if requested
if any errors in nominal run then stop
foreach Monte Carlo iteration {
if process variations specified then
apply process variation to parameters
if mismatch variations specified then
apply mismatch variation to parameters
Syntax
Name montecarlo parameter=value ...
Parameters
|
Degree of annotation. Possible values are no, title, sweep and status. |
||
Fast Monte Carlo parameters (for all FMC methods)
Fast Monte Carlo parameters (only for Worst Sample method)
Fast Monte Carlo parameters (only for Yield Estimation method)
|
Specify the FMC yield estimation target width of confidence interval (in terms of sigma).. |
Detailed Description and Examples:
Determines the sampling behavior. This parameter can be set to standard, the default value, or lhs. lhs invokes latin-hypercube (LHS) method, while standard defaults to the existing standard sampling behavior.
Controls the number of subdivisions used in the LHS method.
If numbins is not specified, the number of subdivisions of the sampling space in LHS will be numruns + firstrun - 1. This parameter is active only when sampling is lhs. If numbins is set to a non-zero integer, the number of subdivisions will be assigned to the greater of the two values numbins or numruns + firstrun -1.
Specifies the number of Monte Carlo iterations to perform. The simulator performs a loop, running the specified child analyses, and evaluating any expressions numruns times.
Specifies the iteration indices to be simulated. Two types of settings are accepted: integers, and ranges. For example, runpoints=[10 range(15, 18) 20] is an acceptable setting, which is translated to perform the simulation of 10th, 15th, 16th, 17th, 18th, and 20th iterations.
Specifies the seed for the random number generator. By always specifying the same seed, you can reproduce a previous experiment. If you do not specify a seed, each time you run the analysis, you will get different results, that is, a different stream of pseudo-random numbers is generated.
Allows you to specify an ASCII file in which scalar data (results of expressions that resolve to scalar values) is written. The data from this file can be read and plotted in histograms by ADE. For each iteration of each Monte Carlo child analyses, Spectre (through Artil) writes a line to this ASCII file, which contains scalar data (one scalar expression per column, for example, slewrate or bandwidth). The default name for this file is of the form name.mcdata, where name is the name of the Monte Carlo analysis instance. This file contains only the matrix of numeric values. If you are an ADE Monte Carlo user, you will be more familiar with the term mcdata file for the scalar file. Additionally, when the ADE Monte Carlo tool is used to generate the Spectre netlist file, Spectre merges the values of the statistically varying process parameters into this file that contains the scalar data (results of expressions). This means that ADE can later read the data and create scatter plots of the statistically varying process parameters against each other, or against the results of the expressions. In this way, you can see correlations between process parameter variations and circuit performance variations. This data merging occurs whenever the scalarfile and processscalarfile are written in the same directory.
Contains the titles, sweep variable values, and the full expression for each of the columns in the scalarfile. If you are an ADE Monte Carlo user, you will be more familiar with the term mcparam file for the paramfile. This file is created in the psf directory by default, unless you specify an alternative path with the file name.
If saveprocessparams is set to yes, the process (batch-to-batch) values of all statistically varying parameters are saved to this scalar data file. You can use saveprocessvec to filter out a subset of parameters in which case Spectre will save only the parameters specified in saveprocessvec to the processscalarfile). The processscalarfile is equivalent to scalarfile, except that the data in the scalarfile contains the values of the scalar expressions, whereas the data in processscalarfile contains the corresponding process parameter values. The default name for this file is of the form instname.process.mcdata, where instname is the name of the Monte Carlo analysis instance. This file is created in the psf directory by default, unless you specify an alternative path in the filename. You can load processscalarfile and processparamfile into the ADE statistical post-processing environment to plot/verify the process parameter distributions. If you later merge the processparamfile with the data in the scalarfile, you can then plot scalar expressions values against the corresponding process parameters by loading this merged file into the ADE statistical postprocessing environment.
Contains the titles and sweep variable values for each of the columns in processscalarfile. These titles are the names of the process parameters.
processparamfile is equivalent to the paramfile, except that paramfile contains the name of the expressions, whereas processparamfile contains the names of the process parameters. The default name for this file is of the form instname.process.mcparam, where instname is the name of the Monte Carlo analysis instance. This file is created in the psf directory by default, unless you specify an alternative location with filename.
Specifies the index of the first iteration. If the first iteration is specified as some number n greater than one, then the beginning n-1 iterations are skipped, that is, the Monte Carlo analysis behaves as if the first n-1 iterations were run, but without actually performing the child analyses for these iterations. The subsequent stream of random numbers generated for the remaining iterations will be the same as if the first n-1 iterations were actually run. By specifying the first iteration number and the same value for seed, you can reproduce a particular run or sequence of runs from a previous experiment (for example, to examine an outlier case in more detail).
variations={process,mismatch,all} (defaults to process).
Determines whether to apply only process (batch-to-batch) variations, or only mismatch (per-instance) variations, or both. This parameter assumes that you have specified appropriate statistical distributions in the statistics block. You cannot request that mismatch variations be applied unless you have specified mismatch statistics in the statistics block. You cannot request that process variations be applied unless you have specified process statistics in the statistics block.
saveprocessvec=[rshsp TOX ...]
If saveprocessparams is set to yes, this parameter saves the process (batch-to-batch) values of only those parameters that are listed in saveprocessvec to the processparamfile. This acts as a filter so that you do not save all process parameters to the file. If you do not want to filter the list of process parameters, do not specify this parameter.
donominal={yes,no}(defaults to yes).
Controls whether Spectre should perform a nominal run before starting the main Monte Carlo loop of iterations. If any errors are encountered during the nominal run (for example, convergence problems, incorrect expressions, and so on) then Spectre issues an appropriate error message and immediately abandons the Monte Carlo analysis.
If set to no, Spectre runs only the Monte Carlo iteration, and does not perform nominal analysis. If any errors are encountered during the Monte Carlo iterations, Spectre issues a warning and continues with the next iteration of the Monte Carlo loop.
addnominalresults={yes,no} (defaults to no).
Controls whether Spectre should append a nominal run results after the Monte Carlo run results in the data files.
paramdumpmode={yes,no}(defaults to no).
Controls whether Spectre should dump out each process/mismatch parameter distribution type, mean value, s.t.d. value, and correlation information into additional parameter files. The names for these files are instname.process_full.param, instname.mismatch_full.param, instname.process.correlate.param and instname.mismatch.correlate.param, where instname is the name of the Monte Carlo analysis instance.
dumpseed={yes,no} (defaults to no).
Controls whether Spectre should dump out seed parameter and iteration number into instname.seed file, where instname is the name of the Monte Carlo analysis instance.
nullmfactorcorrelation={yes,no} (defaults to no).
Controls whether Spectre should emulate a 0% correlation for mismatch devices with m-factor.
appendsd={yes,no}(defaults to no).
Specifies whether to append scalar data to an existing scalarfile, or to overwrite the existing scalarfile. This flag applies to both the scalar file and the processscalarfile.
If set to yes, a data file (for example, psf) is saved for each analysis for each Monte Carlo iteration, in addition to the expressions scalar results that are saved to the ASCII scalar data file at the end of each iteration. Saving the full data files between runs enables the cloud plotting feature (overlaid waveforms) in ADE. It also enables you to define/evaluate new calculator measurements after the simulation has been run using the ViVA XL calculator. This feature could result in a huge amount of data being stored to disk, and it is advised that you use this feature with care. If you do decide to use this feature, it is advisable to keep the saved data to a minimum. If this parameter is set to no, data files are overwritten by each Monte Carlo iteration.
savedatainseparatedir={yes,no}.
If set to yes, a data file (for example, psf) is saved for each analysis for each Monte Carlo iteration in a separate directory, in addition to the expressions scalar results that are saved to the ASCII scalar data file at the end of each iteration. This feature can result in a huge amount of data being stored to the disk. Therefore, it is recommended that you use this feature with care and keep the saved data to a minimum. If this parameter is set to no, data files are overwritten by each Monte Carlo iteration.
annotate={no,title,sweep,status}
Specifies the degree of annotation. Use the maximum value of status to print a summary of the runs that did not converge, had problems evaluating expressions, and so on.
To get better run performance on small-sized designs, it is recommended to use the following settings:
1) Set the global option "narrate=compact" to reduce the annotation messages
2) Reduce the number of saved signals, or use the "save=nooutput" option
3) Use just the measure statement to measure the simulation results
Examples
// do a Monte Carlo analysis, with process variations only
// useful for looking at absolute performance spreads
mc1 montecarlo variations=process seed=1234 numruns=200 {
dcop1 dc // a child analysis
tran1 tran start=0 stop=1u // another child analysis
// expression calculations are sent to the scalardata file
export slewrate=oceanEval("slewRate(v("vout"),10n,t,30n,t,10,90 )")
}
// do a Monte Carlo analysis, with mismatch variations only
// useful for detecting spreads in differential circuit
// applications, etc. Do not perform a nominal run.
mc2 montecarlo donominal=no variations=mismatch seed=1234 numruns=200 {
dcop2 dc
tran2 tran start=0 stop=1u
export slewrate=oceanEval("slewRate(v("vout"),10n,t,30n,t,10,90 )")
}
// do both together...
mc3 montecarlo saveprocessparams=yes variations=all numruns=200 {
dcop3 dc
tran3 tran start=0 stop=1u
export slewrate=oceanEval("slewRate(v("vout"),10n,t,30n,t,10,90 )")
}
Specifying Parameter Distributions Using Statistics Blocks
The statistics blocks are used to specify the input statistical variations for a Monte Carlo analysis. A statistics block may contain one or more process blocks (which represent batch-to-batch type variations) and/or one or more mismatch blocks (which represents on-chip or device mismatch variations), in which the distributions for parameters are specified. Statistics blocks may also contain one or more correlation statements to specify the correlations between specified process parameters, and/or to specify correlated device instances (for example matched pairs). Statistics blocks may also contain a truncate statement that may be used for generating truncated distributions. The distributions specified in the process block are sampled once per Monte Carlo iteration and are typically used to represent batch-to-batch or process variations, whereas the distributions specified in the mismatch block are sampled on a per subcircuit instance basis and are typically used to represent device-to-device mismatch for devices on the same chip. In the case where the same parameter is subject to both process and mismatch variations, the sampled process value becomes the mean for the mismatch random number generator for that particular parameter.
Statistics blocks can be specified using combinations of the Spectre keywords statistics, process, mismatch, vary, truncate, and correlate. Braces {} are used to delimit blocks.
The following example shows statistics blocks, which are discussed below along with syntax requirements.
// define some netlist parameters to represent process parameters
// such as sheet resistance and mismatch factors
parameters rshsp=200 rshpi=5k rshpi_std=0.4K xisn=1 xisp=1 xxx=20000 uuu=200
// define statistical variations, to be used
// with a MonteCarlo analysis.
process { // process: generate random number once per MC run
vary rshsp dist=gauss std=12 percent=yes
vary rshpi dist=gauss std=rshpi_std // rshpi_std is a parameter
vary uuu dist=unif N=10 percent=yes
truncate tr=2.0 // +/- 2 sigma
mismatch { // mismatch: generate a random number per instance
truncate tr=7.0 // +/- 7 sigma
// some process parameters are correlated
correlate param=[rshsp rshpi] cc=0.6
// specify a global distribution truncation factor
truncate tr=6.0 // +/- 6 sigma
// a separate statistics block to specify correlated (i.e. matched) components
// where m1 and m2 are subckt instances.
correlate dev=[m1 m2] param=[xisn xisp] cc=0.8
// a separate statistics block to specify correlation with wildcard, where
// I*.M3 matches multiple subckt instances, for examples, I1.M3, I2.M3, I3.M3, etc..
// Only the asterisk (*) is recognized as a valid wildcard symbol.
correlate dev=[ I*.M3 ] param=[misx mixy] cc=0.8
Parameter variations are specified using the following syntax:
vary PAR_NAME dist=<type> {std=<value> | N=<value>} {percent=yes|no}
The following types of parameter distributions are available: gaussian, lognormal, uniform, set-uniform, and gamma, corresponding to the keywords gauss, lnorm, unif, 'sunif', and 'gamma' respectively. For the gauss, the lnorm and the 'gamma' distributions, you specify a standard deviation using the std keyword.
For the gaussian distribution, the mean value is taken as the current value of the parameter being varied, giving a distribution denoted by Normal (mean,std). Using the example above, parameter rshpi is varied with a distribution of Normal (5k,0.4k)
The lognormal distribution is denoted by:
log(x) = Normal( log(mean), std )
where, x is the parameter being specified as having a lognormal distribution.
log(xxx) = Normal( log(20000), 12 )
The uniform distribution for parameter x is generated according to:
The mean value is the nominal value of the parameter x, and the parameter is varied about the mean with a range of +/- N. The standard deviation is not specified for the uniform distribution, but its value can be calculated by using the formula: std=N/sqrt(3).
Set-uniform, or discrete uniform, distribution is specified by a finite set of values values=[val1 val2 ... valN] that are equally likely to be observed. Values can be provided one by one, or using range(<min>, <max>, <step>), or using expression <min>:<step>:<max>.
Similar to Gauss distribution, the mean value for gamma distribution is the current value of the parameter being varied, giving a distribution denoted by Gamma(mean,std). The correponding shape parameter 'alpha' and scale parameter 'beta' are:
Notice: truncation factor is not available for gamma distribution, and it will always be complete gamma distribution for any set value of truncation factor.
The percent flag indicates whether the standard deviation std or uniform range N are specified in absolute terms (percent=no) or as a percentage of the mean value (percent=yes). For parameter uuu in the example above, the mean value is 200, and the variation is 200 +/- 10%*(200) i.e. 200 +/- 20. For parameter rshsp, the process variation is given by Normal (200, 12%*(200)), that is, Normal (200, 24). It is recommended that you do not use percent=yes with the lognormal distribution.
Process and Mismatch Variations
The statistics specified in a process block are applied at global scope, and the distributions are sampled once per Monte Carlo iteration. The statistics specified in a mismatch block are applied on a per-subcircuit instance basis, and are sampled once per subcircuit instance. If you place model cards and/or device instances in subcircuits, and add a mismatch block to your statistics block you can effectively model device-to-device mismatch for these devices/models.
There are two types of correlation statements that you can use: process parameter correlation statements and instance correlation statements.
The syntax of the process parameter correlation statement is:
correlate param=[list of parameters] cc=<value>
This allows you to specify a correlation coefficient between multiple process parameters. You can specify multiple process parameter correlation statements in a statistics block to build a matrix of process parameter correlations. During a Monte Carlo analysis, process parameter values are randomly generated according to the specified distributions and correlations.
Mismatch Correlation (Matched Devices)
The syntax of the instance or mismatch correlation statements are:
correlate dev=[list of subcircuit instances] {param=[list of parameters]} cc=<value>
correlate dev=[<wildcard expr>] {param=[list of parameters]} cc=<value>
where, the device or subcircuit instances to be matched are listed in the list of subcircuit instances or regular expressions with asterisk (*), and the list of parameters specifies exactly which parameters with mismatch variations are to be correlated.
The instance mismatch correlation statement is used to specify correlations for particular subcircuit instances. If a subcircuit contains a device, you can effectively use the instance correlation statements to specify that certain devices are correlated (that is, matched) and give the correlation coefficient. You can optionally specify exactly which parameters are to be correlated by giving a list of parameters (each of which must have had distributions specified for it in a mismatch block), or specify no parameter list, in which case all parameters with mismatch statistics specified are correlated with the given correlation coefficient. The correlation coefficients are specified in the <value> field and must be between +/- 1.0.
std and N when specifying distributions.
The default truncation factor for gaussian distributions (and for the gaussian distribution underlying the lognormal distribution) is 4.0 sigma. Randomly generated values that are outside the range of mean +/- 4.0 sigma are automatically rejected and regenerated until they fall inside the range. You can change the truncation factor using the truncate statement. The syntax is:
The following conditions should be considered while setting the truncate factor: The value of the truncation factor can be a constant or an expression.
Parameter correlations can be affected by using small truncation factors.
There are different truncate for process and mismatch blocks. If a truncate for process or mismatch block is not given, it will be set to the value of truncate in statistic block.
Notice: truncation factor is not available for gamma distribution, and it will always be complete gamma distribution for any set value of truncation factor.
Return to top