next up previous contents
Next: Netlist filtering Up: Simulation Previous: Monte-Carlo-Simulation

Using the pre-processor cpp, Netlist filtering

Beginning with SPICECAD version 1.3, a Monte Carlo Simulation can be performed on almost any parameter, for example MOS or bipolar model parameters. To avoid writing a lot of additional code, the C preprocessor 'cpp' had been chosen to help SPICECAD to do what you, the user of SPICECAD wants to do.

So, running a Monte Carlo Simulation over a MOS model works like this:

First, place a Monte Carlo Simulation box and fill in the properties :

NUMPOINT : Number of simulations
model/parametric : parametric
optimize yes/no: no
goalfile: (none)
weighting lin/log : lin (not used)
std deviation : {stddev}
parameter1 : WHATEVER
model1 : (none) or flat/{stddev1}
parameter2 : DONTKNOW
model2 : (none) or flat/{stddev2}
.
.
.
modeln : DOITSO
parametern: (none) or flat/{stddevn}
modeln+1 : (none)
parametern+1 : (none)

stddev , stddev1 ... stddevn are the values for the standard deviation, WHATEVER, DONTKNOW ... DOITSO are strings. These strings have to re-appear in the MOS model file like this:

.MODEL scnanjss NMOS LEVEL=3
+ UO=3.842E+02
+ VTO= WHATEVER
+ GAMMA=7.930E-01
+ PHI= DONTKNOW
+ NSUB=7.000E+17
+ ETA=0.000E+00
+ DELTA=0.000E+00
+ THETA=6.218E-02
+ VMAX=1.773E+05
+ KAPPA=3.629E-01
+ LD=1.000E-07
+ TOX= LATERNE
+ NFS=2.620E+11
+ CGSO=3.3E-10 CGDO= DOITSO PB=0.6 FC=0.5
+ CJ=0.54E-3 MJ=0.31 CJSW=3.3E-10 MJSW=0.33 KF=7.7E-28
+ AF=0.96

WHATEVER, DONTKNOW, LATERNE and DOITSO also have to appear in the parameter box. You need to type in these names and their values by hand, because they are not detected during an 'updateparams' process.

Now, we are ready to run the simulation.

Before doing this, you have to pop up the parametric menu and push 'use cpp (model sweep)'. Now, push 'run monte carlo'.

What will happen , now, is that SPICECAD netlists the ciruit as follows:

*default_ueberschrift Wed Sep 11 22:39:39 1996 parametric  0.00  0.00 
#define WHATEVER 6.781304e-01 
#define DONTKNOW 6.391833e-02
#define LATERNE 8.648665e-09 
#define DOITSO 2.095932e-10 
*
*
*

M0 4 4 0 0 scnanjss l=2.000000e-06 w=8.482375e-06 as=3.600000e-11 
+  ad=3.600000e-11  ps=2.400000e-05  pd=2.400000e-05 
V0 3 0 PULSE ( 1.65  3.3  0 .1n .1n 10n 20n )
V1 1 0 DC 3.3 
M1 2 3 1 1 scnapjss l=2.000000e-06 w=4.500000e-05 as=2.700000e-10  
+ ad=2.700000e-10  ps=1.020000e-04  pd=1.020000e-04 
M2 2 3 4 0 scnanjss l=2.000000e-06 w=6.000000e-06 as=3.600000e-11  
+ ad=3.600000e-11  ps=2.400000e-05  pd=2.400000e-05 

.MODEL scnanjss NMOS LEVEL=3
+ UO=3.842E+02
+ VTO= WHATEVER
+ GAMMA=7.930E-01
+ PHI= DONTKNOW
+ NSUB=7.000E+17
+ ETA=0.000E+00
+ DELTA=0.000E+00
+ THETA=6.218E-02
+ VMAX=1.773E+05
+ KAPPA=3.629E-01
+ LD=1.000E-07
+ TOX= LATERNE
+ NFS=2.620E+11
+ CGSO=3.3E-10 CGDO= DOITSO PB=0.6 FC=0.5
+ CJ=0.54E-3 MJ=0.31 CJSW=3.3E-10 MJSW=0.33 KF=7.7E-28
+ AF=0.96

.
.
.

You can find this file under '/tmp/orig ' . You should have access to this path, otherwise, funny things will happen. Next, SPICECAD generates a shell script which runs 'cpp' and 'sed'. The name of the shell-script is '/tmp/convert_spice3_file.sh'.

After executing this shell-script, which overwrites the original file, the file which will be read in into SPICE3 looks as it should.

make sure that you do not use parameter names which equal SPICE3 or MOS model keywords. So it is mandatory to use words which do not appear elsewhere inside the SPICE3 netlist ..


next up previous contents
Next: Netlist filtering Up: Simulation Previous: Monte-Carlo-Simulation
Martin Maschmann
1999-10-10