You are on page 1of 19

Introduction to Statistical Simulation

Analyze yield by observing the effects of


q q

Element parameter variation Model parameter variation

n n n

.MEASURE .ALTER Statistical Methods


q q q

Simple Sweeps Worst Case Monte Carlo

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
1

MEASURE
n

.MEASURE
q
q

(Vol. 1, p. 3-13+)

Prints user-defined electrical specifications of a circuit


.MEASURE is a post processor

q q

Used extensively for optimization and curve fitting Seven fundamental measurement modes:

Rise, Fall, Delay Average, RMS, Min, Max, and Peak-to-Peak Find-When Equation Evaluation Derivative Evaluation Integral Evaluation Relative Error

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
2

MEASURE: Rise/Fall Syntax


.MEASURE <DC | TRAN | AC> result TRIG TARG <optimization options>
q

result - name given the measured value in the HSPICE output. TRIG trig_var VAL=trig_val <TD=timedelay> <CROSS=#of> <RISE=#of> + <FALL=#of> TRIG AT=value TARG targ_var VAL=targ_val <TD=timedelay> <CROSS=#of | LAST><RISE=#of | LAST> + <FALLS=#of | LAST>

Example
+ TARG V(2) VAL=2.5

(Vol. 1, pg 3-14)
Delay 10ns TDLAY

.MEAS TRAN TDELAY TRIG V(1) VAL=2.5 TD=10ns RISE=2 FALL=2


V(1) 2.5v

...

V(2)

...

2.5v

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
3

MEASURE: Avg, RMS,...Syntax


.MEASURE <DC | TRAN | AC> result func out_var <FROM=val> <TO=val> + <optimization options>
q q q

func: AVG, RMS, MIN, MAX, PP result: name given the measured value in the HSPICE output out_var: name of the output variable to be measured.

Examples
q

.MEAS TRAN avgval AVG V(10) From=10ns To=55ns

Print out average nodal voltage of node 10 during tran time 10 to 55ns. Print as avgval.

.MEAS TRAN maxval MAX V(1,2) From=15ns To=100ns

Find the maximum voltage difference between nodes 1 and 2 from time 15ns to 100ns. Print as maxval.

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
4

MEASURE: FIND-WHEN Syntax


n

FIND-WHEN
q

(Vol. 1, p. 3-18)

Allows any independent variables (time, freq, parameter), by using WHEN syntax, or any dependent variables (voltage, current, etc), by using FIND-WHEN syntax, to be measured when some specific event occurs.

.MEASURE <DC | TRAN | AC> result WHEN out_var=val <TD=val> + <RISE=#of> | LAST> <FALL=#of | LAST> <CROSS=#of | LAST> <optimization options>

result - name given the measured value in the HSPICE output file.
n

Example - WHEN
.MEAS TRAN fifth WHEN V(osc_out)=2.5v RISE=5
measure the time of the 5th rise of node osc_out at 2.5v. Report as fifth in listing.

Example - FIND-WHEN
.MEAS TRAN result FIND v(out) WHEN v(in)=40m
measure v(out) when v(in)=40m - store in variable result

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
5

MEASURE: Equation Evaluation Syntax


n

Equation Evaluation
q

(Vol. 1, p. 3-19)

Use this statement to evaluate an equation that can be a function of the results of previous .MEASURE statements. The equation MUST NOT be a function of node voltages or branch currents.

.MEASURE <DC | TRAN | AC> result PARAM=equation <optimization options>


result - name given the measured value in the HSPICE output file.

Example
.MEAS TRAN Tmid PARAM=(T_from+T_to)/2

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
6

MEASURE: Derivative Function


n

Derivative Function
q

(Vol. 1, p. 3-19)

Provides the derivative of an output variable at a given time or frequency or for any sweep variable. Also provides the derivative of a specified output variable when some specific event occurs. .MEASURE <DC | TRAN | AC> result DERIVATIVE out_var WHEN +var2=val <TD=val> <RISE=#of> | LAST> <FALL=#of | LAST> +<CROSS=#of | LAST> <optimization options>
result - name given the measured value in the HSPICE output file.

Example
.MEAS TRAN slewrate DERIV v(1) WHEN V(osc_out)=2.5v RISE=5

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
7

MEASURE: Integral Function


n

Integral Function
q

(Vol. 1, p. 3-21)

Provides the integral of an output variable over a specified period.

.MEASURE <DC | TRAN | AC> result INTEGRAL out_var <FROM=val1> + <TO=val2> <optimization options>
result - name given the measured value in the HSPICE output file.
n

Example
.MEAS TRAN charge INTEG I(cload) FROM=10ns TO=100ns

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
8

LAB 6

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
9

.ALTER: Description
n

.ALTER
q

(Vol. 1, pp. 2-22)

Rerun a simulation several times with different


Circuit topology Models Library components Elements Parameter values Options Source stimulus Analysis variables Print/plot commands (must be parameterized)
.ALTER

Sequence for Worst Case Corner Analysis Removes previous library selection Add new library case

.DELETE LIB .LIB

q q q

1st Run - Star-Hspice reads input netlist file up to the first .ALTER Subsequent - Reads input netlist to next .ALTER, etc

.option alt9999 - Can use up to 9999 alters in one run. With .ALTER statement only, default is 36. D3, Session 2: Intro to Statistical Simulation
Star-Hspice Basic Training 2000
10

.ALTER: Limitations
n

Limitations:
Main Program q

$Alternative Main Program 1 ... ... .END Main Program 2 ... ... .END etc

CAN include

... ... .ALTER

Element Statements (except source) .DATA, .LIB, .DEL LIB, .INCLUDE, .MODEL statements .IC, .NODESET statements .OP, .OPTIONS, .PARAM, .TEMP, .TF, .TRAN, .DC, .AC

... .ALTER ... .END

CANNOT include

.PRINT, .PLOT, .GRAPH, or any other i/o statements (CAN parameterize)

AVOID adding analysis statements under each .ALTER block. ( Will cause huge penalty in simulation time and confusion in result outputting!)

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
11

.ALTER: Example
(Vol. 1, pp 2-23)
ALTER Test - CMOS Inverter .OPTIONS ACCT LIST .OP .DC VIN 0 5 0.1 .PRINT DC v(3) v(2) .PRINT tran v(3) .PARAM VDD=5 .LIB MOS.LIB NORMAL VDD 1 0 VDD VIN 2 0 M1 3 2 1 1 P 6U 15U M2 3 2 0 0 N 6U 15U .ALTER Change Supply .PARAM VDD=10 .ALTER Fast Process .DEL LIB MOS.LIB NORMAL .LIB MOS.LIB FAST .ALTER Add Transient .TRAN .1 2 .END

.OP DC Sweep

... change VDD to 10v .OP DC Sweep ... alter change to fast library (MUST delete first) (VDD=10v still in effect) .OP DC Sweep ... alter to add transient (VDD=10v still in effect) (.lib mos.lib FAST still in effect) .OP DC Sweep Transient

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
12

.ALTER: Example
n

Example - Parameterizing Source Statements


.PARAM A=4ns B=5ns V1 VA GND PULSE (0v 5v 0ns A B 46.5ns 100ns) V2 VB GND PULSE (0v 5v 0ns A B 96ns 200ns) V3 VC GND PULSE (0v 5v 0ns A B 196.5ns 400ns) .ALTER .PARAM A=5ns B=6ns .ALTER .PARAM A=6ns B=7ns .END

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
13

Statistical Methods
n

Analyze yield by observing the effects of:


q q

element parameter variation model parameter variation

Perform multiple analyses to modify DC operating points, sweeps, AC, and transient analyses. Types of Analysis
q

Simple sweep analysis

(Vol. 1, p. 9-19)

Automated over a fixed set of values. (Vol. 1, p. 9-21)

Worst case corners analysis

Component value limits are known, measured, and implemented as skew parameters. (Vol. 1, p. 9-25)

Monte Carlo Analysis


Statistical standard deviations of component values are known. Automated over a random range of values.

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
14

Statistical Methods - Worst Case


n

Simple Worst Case Analysis


q q

(Vol. 1, P. 9-19)

Switch to different process corner libraries and repeat simulation. .ALTER, .DEL LIB, .LIB (you MUST delete a lib before calling a new lib)
.LIB CMOS.lib SLOW .Tran ... .ALTER Run Fast Corner Library .DEL LIB CMOS.lib SLOW

Worst Case Sweep Analysis


q

.LIB CMOS.lib FAST

HSPICE models can include physically measurable model skew parameters.


e.g. poly CD, active CD, tox, diffusion resistivity, threshold voltage variation, etc. Incorporated into models as skew variables.
.PARAM sigma=0 toxcd=200 tox=toxcd - sigma * 10 .TRAN 20p 1n SWEEP sigma -3 3 .5 ... .model ... tox=tox ...

e.g. +/- 3 sigma variation to TOX.

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
15

Statistical Methods - Monte Carlo


n

Statistical deviations for element and model parameters are known.


q

Random number generation creates variations within:


Gaussian distribution. Uniform distribution. Limit distribution. (Vol. 1, 9-26)

Setup
q q q

.PARAM statement. (Set element/model parameter to function distribution). Set .DC, .AC, .TRAN to MONTE .MEASURE to calculate mean, variance, sigma, std. deviation.
.PARAM tox = agauss ( 200 , 10 , 1 ) .TRAN 20p 1n sweep MONTE=20 ... .model ... tox=tox ...

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
16

Statistical Methods - Monte Carlo


n

Setting up Monte Carlo


q

(Vol. 1, P. 9-27)

Use a .PARAM to set an element or model parameter to:

GAUSSIAN .PARAM ver=gauss(nom_val,rel_variation,sigma, mult) .PARAM ver=agauss(nom_val,abs_variation,sigma, mult)

UNIFORM PARAM ver=unif(nom_val,rel_variation, mult) .PARAM ver=aunif(nom_val,abs_variation, mult)

LIMIT PARAM ver=limit(nom_val,abs_variation)

WARNING - if you misspell GAUSS (or uniform or limit) there is no warning, but no distribution will occur.

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
17

Statistical Methods - Monte Carlo


n

Setting up Monte Carlo


q

Analysis must be .AC, .DC or .TRAN to enable MONTE

.DC vin 1 5 .25 sweep monte=val (val=# of randomizations)

.AC dec 10 100 10meg sweep monte=val .TRAN 1n 10n sweep monte=val

A .MEASURE statement can be used to calculate the mean, variance, and sigma of any output desired.

R1 1 0 Res R2 2 0 Res 2 .tran 2 ns 100ns sweep monte=30 .param Res=gauss(10k, 1k, 1) + Res2=gauss (Res+1, 1k, 1) .measure tran name find v(3) at 50ns

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
18

LAB 7

D3, Session 2: Intro to Statistical Simulation


Star-Hspice Basic Training 2000
19

You might also like