From 57f8eed5db6e1a39d7232dd51d6cb766d985d6ec Mon Sep 17 00:00:00 2001 From: pnenzi Date: Mon, 11 Aug 2003 19:53:13 +0000 Subject: [PATCH] bsim 3v0 model. Import. --- src/spicelib/devices/bsim3v0/Makefile.am | 33 + src/spicelib/devices/bsim3v0/b3v0.c | 429 +++++ src/spicelib/devices/bsim3v0/b3v0acld.c | 185 ++ src/spicelib/devices/bsim3v0/b3v0ask.c | 221 +++ src/spicelib/devices/bsim3v0/b3v0cvtest.c | 90 + src/spicelib/devices/bsim3v0/b3v0del.c | 38 + src/spicelib/devices/bsim3v0/b3v0dest.c | 36 + src/spicelib/devices/bsim3v0/b3v0getic.c | 44 + src/spicelib/devices/bsim3v0/b3v0ld.c | 1935 ++++++++++++++++++++ src/spicelib/devices/bsim3v0/b3v0mask.c | 1090 +++++++++++ src/spicelib/devices/bsim3v0/b3v0mdel.c | 42 + src/spicelib/devices/bsim3v0/b3v0mpar.c | 1482 +++++++++++++++ src/spicelib/devices/bsim3v0/b3v0noi.c | 356 ++++ src/spicelib/devices/bsim3v0/b3v0par.c | 96 + src/spicelib/devices/bsim3v0/b3v0pzld.c | 150 ++ src/spicelib/devices/bsim3v0/b3v0set.c | 926 ++++++++++ src/spicelib/devices/bsim3v0/b3v0temp.c | 631 +++++++ src/spicelib/devices/bsim3v0/b3v0trunc.c | 50 + src/spicelib/devices/bsim3v0/bsim3v0def.h | 1580 ++++++++++++++++ src/spicelib/devices/bsim3v0/bsim3v0ext.h | 30 + src/spicelib/devices/bsim3v0/bsim3v0init.c | 82 + src/spicelib/devices/bsim3v0/bsim3v0init.h | 13 + src/spicelib/devices/bsim3v0/bsim3v0itf.h | 12 + 23 files changed, 9551 insertions(+) create mode 100644 src/spicelib/devices/bsim3v0/Makefile.am create mode 100644 src/spicelib/devices/bsim3v0/b3v0.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0acld.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0ask.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0cvtest.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0del.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0dest.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0getic.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0ld.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0mask.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0mdel.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0mpar.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0noi.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0par.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0pzld.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0set.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0temp.c create mode 100644 src/spicelib/devices/bsim3v0/b3v0trunc.c create mode 100644 src/spicelib/devices/bsim3v0/bsim3v0def.h create mode 100644 src/spicelib/devices/bsim3v0/bsim3v0ext.h create mode 100644 src/spicelib/devices/bsim3v0/bsim3v0init.c create mode 100644 src/spicelib/devices/bsim3v0/bsim3v0init.h create mode 100644 src/spicelib/devices/bsim3v0/bsim3v0itf.h diff --git a/src/spicelib/devices/bsim3v0/Makefile.am b/src/spicelib/devices/bsim3v0/Makefile.am new file mode 100644 index 000000000..b1933693d --- /dev/null +++ b/src/spicelib/devices/bsim3v0/Makefile.am @@ -0,0 +1,33 @@ +## Process this file with automake to produce Makefile.in + +noinst_LIBRARIES = libbsim3v0.a + +libbsim3v0_a_SOURCES = \ + b3v0.c \ + b3v0acld.c \ + b3v0ask.c \ + b3v0cvtest.c \ + b3v0del.c \ + b3v0dest.c \ + b3v0getic.c \ + b3v0ld.c \ + b3v0mask.c \ + b3v0mdel.c \ + b3v0mpar.c \ + b3v0noi.c \ + b3v0par.c \ + b3v0pzld.c \ + b3v0set.c \ + b3v0temp.c \ + b3v0trunc.c \ + bsim3v0def.h \ + bsim3v0ext.h \ + bsim3v0init.c \ + bsim3v0init.h \ + bsim3v0itf.h + + + +INCLUDES = -I$(top_srcdir)/src/include + +MAINTAINERCLEANFILES = Makefile.in diff --git a/src/spicelib/devices/bsim3v0/b3v0.c b/src/spicelib/devices/bsim3v0/b3v0.c new file mode 100644 index 000000000..971df905f --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0.c @@ -0,0 +1,429 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0.c +**********/ + +#include "ngspice.h" +#include "devdefs.h" +#include "bsim3v0def.h" +#include "suffix.h" + +IFparm BSIM3v0pTable[] = { /* parameters */ +IOP( "l", BSIM3v0_L, IF_REAL , "Length"), +IOP( "w", BSIM3v0_W, IF_REAL , "Width"), +IOP( "m", BSIM3v0_M, IF_REAL , "Parallel multiplier"), +IOP( "ad", BSIM3v0_AD, IF_REAL , "Drain area"), +IOP( "as", BSIM3v0_AS, IF_REAL , "Source area"), +IOP( "pd", BSIM3v0_PD, IF_REAL , "Drain perimeter"), +IOP( "ps", BSIM3v0_PS, IF_REAL , "Source perimeter"), +IOP( "nrd", BSIM3v0_NRD, IF_REAL , "Number of squares in drain"), +IOP( "nrs", BSIM3v0_NRS, IF_REAL , "Number of squares in source"), +IOP( "off", BSIM3v0_OFF, IF_FLAG , "Device is initially off"), +IOP( "nqsmod", BSIM3v0_NQSMOD, IF_INTEGER, "Non-quasi-static model selector"), +IP( "ic", BSIM3v0_IC, IF_REALVEC , "Vector of DS,GS,BS initial voltages"), +OP( "gmbs", BSIM3v0_GMBS, IF_REAL, "Gmb"), +OP( "gm", BSIM3v0_GM, IF_REAL, "Gm"), +OP( "gds", BSIM3v0_GDS, IF_REAL, "Gds"), +OP( "vdsat", BSIM3v0_VDSAT, IF_REAL, "Vdsat"), +OP( "vth", BSIM3v0_VON, IF_REAL, "Vth"), +OP( "id", BSIM3v0_CD, IF_REAL, "Ids"), +OP( "vbs", BSIM3v0_VBS, IF_REAL, "Vbs"), +OP( "vgs", BSIM3v0_VGS, IF_REAL, "Vgs"), +OP( "vds", BSIM3v0_VDS, IF_REAL, "Vds"), +}; + +IFparm BSIM3v0mPTable[] = { /* model parameters */ +IOP( "capmod", BSIM3v0_MOD_CAPMOD, IF_INTEGER, "Capacitance model selector"), +IOP( "nqsmod", BSIM3v0_MOD_NQSMOD, IF_INTEGER, "Non-quasi-static model selector"), +IOP( "mobmod", BSIM3v0_MOD_MOBMOD, IF_INTEGER, "Mobility model selector"), +IOP( "noimod", BSIM3v0_MOD_NOIMOD, IF_INTEGER, "Noise model selector"), +IOP( "binunit", BSIM3v0_MOD_BINUNIT, IF_INTEGER, "Bin unit selector"), +IOP( "tox", BSIM3v0_MOD_TOX, IF_REAL, "Gate oxide thickness in meters"), + +IOP( "cdsc", BSIM3v0_MOD_CDSC, IF_REAL, "Drain/Source and channel coupling capacitance"), +IOP( "cdscb", BSIM3v0_MOD_CDSCB, IF_REAL, "Body-bias dependence of cdsc"), +IOP( "cdscd", BSIM3v0_MOD_CDSCD, IF_REAL, "Drain-bias dependence of cdsc"), +IOP( "cit", BSIM3v0_MOD_CIT, IF_REAL, "Interface state capacitance"), +IOP( "nfactor", BSIM3v0_MOD_NFACTOR, IF_REAL, "Subthreshold swing Coefficient"), +IOP( "xj", BSIM3v0_MOD_XJ, IF_REAL, "Junction depth in meters"), +IOP( "vsat", BSIM3v0_MOD_VSAT, IF_REAL, "Saturation velocity at tnom"), +IOP( "at", BSIM3v0_MOD_AT, IF_REAL, "Temperature coefficient of vsat"), +IOP( "a0", BSIM3v0_MOD_A0, IF_REAL, "Non-uniform depletion width effect coefficient."), +IOP( "ags", BSIM3v0_MOD_AGS, IF_REAL, "Gate bias coefficient of Abulk."), +IOP( "a1", BSIM3v0_MOD_A1, IF_REAL, "Non-saturation effect coefficient"), +IOP( "a2", BSIM3v0_MOD_A2, IF_REAL, "Non-saturation effect coefficient"), +IOP( "keta", BSIM3v0_MOD_KETA, IF_REAL, "Body-bias coefficient of non-uniform depletion width effect."), +IOP( "nsub", BSIM3v0_MOD_NSUB, IF_REAL, "Substrate doping concentration"), +IOP( "nch", BSIM3v0_MOD_NPEAK, IF_REAL, "Channel doping concentration"), +IOP( "ngate", BSIM3v0_MOD_NGATE, IF_REAL, "Poly-gate doping concentration"), +IOP( "gamma1", BSIM3v0_MOD_GAMMA1, IF_REAL, "Vth body coefficient"), +IOP( "gamma2", BSIM3v0_MOD_GAMMA2, IF_REAL, "Vth body coefficient"), +IOP( "vbx", BSIM3v0_MOD_VBX, IF_REAL, "Vth transition body Voltage"), +IOP( "vbm", BSIM3v0_MOD_VBM, IF_REAL, "Maximum body voltage"), + +IOP( "xt", BSIM3v0_MOD_XT, IF_REAL, "Doping depth"), +IOP( "k1", BSIM3v0_MOD_K1, IF_REAL, "Bulk effect coefficient 1"), +IOP( "kt1", BSIM3v0_MOD_KT1, IF_REAL, "Temperature coefficient of Vth"), +IOP( "kt1l", BSIM3v0_MOD_KT1L, IF_REAL, "Temperature coefficient of Vth"), +IOP( "kt2", BSIM3v0_MOD_KT2, IF_REAL, "Body-coefficient of kt1"), +IOP( "k2", BSIM3v0_MOD_K2, IF_REAL, "Bulk effect coefficient 2"), +IOP( "k3", BSIM3v0_MOD_K3, IF_REAL, "Narrow width effect coefficient"), +IOP( "k3b", BSIM3v0_MOD_K3B, IF_REAL, "Body effect coefficient of k3"), +IOP( "w0", BSIM3v0_MOD_W0, IF_REAL, "Narrow width effect parameter"), +IOP( "nlx", BSIM3v0_MOD_NLX, IF_REAL, "Lateral non-uniform doping effect"), +IOP( "dvt0", BSIM3v0_MOD_DVT0, IF_REAL, "Short channel effect coeff. 0"), +IOP( "dvt1", BSIM3v0_MOD_DVT1, IF_REAL, "Short channel effect coeff. 1"), +IOP( "dvt2", BSIM3v0_MOD_DVT2, IF_REAL, "Short channel effect coeff. 2"), +IOP( "dvt0w", BSIM3v0_MOD_DVT0W, IF_REAL, "Narrow Width coeff. 0"), +IOP( "dvt1w", BSIM3v0_MOD_DVT1W, IF_REAL, "Narrow Width effect coeff. 1"), +IOP( "dvt2w", BSIM3v0_MOD_DVT2W, IF_REAL, "Narrow Width effect coeff. 2"), +IOP( "drout", BSIM3v0_MOD_DROUT, IF_REAL, "DIBL coefficient of output resistance"), +IOP( "dsub", BSIM3v0_MOD_DSUB, IF_REAL, "DIBL coefficient in the subthreshold region"), +IOP( "vth0", BSIM3v0_MOD_VTH0, IF_REAL,"Threshold voltage"), +IOP( "vtho", BSIM3v0_MOD_VTH0, IF_REAL,"Threshold voltage"), +IOP( "ua", BSIM3v0_MOD_UA, IF_REAL, "Linear gate dependence of mobility"), +IOP( "ua1", BSIM3v0_MOD_UA1, IF_REAL, "Temperature coefficient of ua"), +IOP( "ub", BSIM3v0_MOD_UB, IF_REAL, "Quadratic gate dependence of mobility"), +IOP( "ub1", BSIM3v0_MOD_UB1, IF_REAL, "Temperature coefficient of ub"), +IOP( "uc", BSIM3v0_MOD_UC, IF_REAL, "Body-bias dependence of mobility"), +IOP( "uc1", BSIM3v0_MOD_UC1, IF_REAL, "Temperature coefficient of uc"), +IOP( "u0", BSIM3v0_MOD_U0, IF_REAL, "Low-field mobility at Tnom"), +IOP( "ute", BSIM3v0_MOD_UTE, IF_REAL, "Temperature coefficient of mobility"), +IOP( "voff", BSIM3v0_MOD_VOFF, IF_REAL, "Threshold voltage offset"), +IOP( "tnom", BSIM3v0_MOD_TNOM, IF_REAL, "Parameter measurement temperature"), +IOP( "cgso", BSIM3v0_MOD_CGSO, IF_REAL, "Gate-source overlap capacitance per width"), +IOP( "cgdo", BSIM3v0_MOD_CGDO, IF_REAL, "Gate-drain overlap capacitance per width"), +IOP( "cgbo", BSIM3v0_MOD_CGBO, IF_REAL, "Gate-bulk overlap capacitance per length"), +IOP( "xpart", BSIM3v0_MOD_XPART, IF_REAL, "Channel charge partitioning"), +IOP( "elm", BSIM3v0_MOD_ELM, IF_REAL, "Non-quasi-static Elmore Constant Parameter"), +IOP( "delta", BSIM3v0_MOD_DELTA, IF_REAL, "Effective Vds parameter"), +IOP( "rsh", BSIM3v0_MOD_RSH, IF_REAL, "Source-drain sheet resistance"), +IOP( "rdsw", BSIM3v0_MOD_RDSW, IF_REAL, "Source-drain resistance per width"), + +IOP( "prwg", BSIM3v0_MOD_PRWG, IF_REAL, "Gate-bias effect on parasitic resistance "), +IOP( "prwb", BSIM3v0_MOD_PRWB, IF_REAL, "Body-effect on parasitic resistance "), + +IOP( "prt", BSIM3v0_MOD_PRT, IF_REAL, "Temperature coefficient of parasitic resistance "), +IOP( "eta0", BSIM3v0_MOD_ETA0, IF_REAL, "Subthreshold region DIBL coefficient"), +IOP( "etab", BSIM3v0_MOD_ETAB, IF_REAL, "Subthreshold region DIBL coefficient"), +IOP( "pclm", BSIM3v0_MOD_PCLM, IF_REAL, "Channel length modulation Coefficient"), +IOP( "pdiblc1", BSIM3v0_MOD_PDIBL1, IF_REAL, "Drain-induced barrier lowering coefficient"), +IOP( "pdiblc2", BSIM3v0_MOD_PDIBL2, IF_REAL, "Drain-induced barrier lowering coefficient"), +IOP( "pdiblcb", BSIM3v0_MOD_PDIBLB, IF_REAL, "Body-effect on drain-induced barrier lowering"), +IOP( "pscbe1", BSIM3v0_MOD_PSCBE1, IF_REAL, "Substrate current body-effect coefficient"), +IOP( "pscbe2", BSIM3v0_MOD_PSCBE2, IF_REAL, "Substrate current body-effect coefficient"), +IOP( "pvag", BSIM3v0_MOD_PVAG, IF_REAL, "Gate dependence of output resistance parameter"), +IOP( "js", BSIM3v0_MOD_JS, IF_REAL, "Source/drain junction reverse saturation current density"), +IOP( "pb", BSIM3v0_MOD_PB, IF_REAL, "Source/drain junction built-in potential"), +IOP( "mj", BSIM3v0_MOD_MJ, IF_REAL, "Source/drain bottom junction capacitance grading coefficient"), +IOP( "pbsw", BSIM3v0_MOD_PBSW, IF_REAL, "Source/drain sidewall junction capacitance built in potential"), +IOP( "mjsw", BSIM3v0_MOD_MJSW, IF_REAL, "Source/drain sidewall junction capacitance grading coefficient"), +IOP( "cj", BSIM3v0_MOD_CJ, IF_REAL, "Source/drain bottom junction capacitance per unit area"), +IOP( "cjsw", BSIM3v0_MOD_CJSW, IF_REAL, "Source/drain sidewall junction capacitance per unit area"), + +IOP( "lint", BSIM3v0_MOD_LINT, IF_REAL, "Length reduction parameter"), +IOP( "ll", BSIM3v0_MOD_LL, IF_REAL, "Length reduction parameter"), +IOP( "lln", BSIM3v0_MOD_LLN, IF_REAL, "Length reduction parameter"), +IOP( "lw", BSIM3v0_MOD_LW, IF_REAL, "Length reduction parameter"), +IOP( "lwn", BSIM3v0_MOD_LWN, IF_REAL, "Length reduction parameter"), +IOP( "lwl", BSIM3v0_MOD_LWL, IF_REAL, "Length reduction parameter"), +IOP( "lmin", BSIM3v0_MOD_LMIN, IF_REAL, "Minimum length for the model"), +IOP( "lmax", BSIM3v0_MOD_LMAX, IF_REAL, "Maximum length for the model"), + +IOP( "wr", BSIM3v0_MOD_WR, IF_REAL, "Width dependence of rds"), +IOP( "wint", BSIM3v0_MOD_WINT, IF_REAL, "Width reduction parameter"), +IOP( "dwg", BSIM3v0_MOD_DWG, IF_REAL, "Width reduction parameter"), +IOP( "dwb", BSIM3v0_MOD_DWB, IF_REAL, "Width reduction parameter"), + +IOP( "wl", BSIM3v0_MOD_WL, IF_REAL, "Width reduction parameter"), +IOP( "wln", BSIM3v0_MOD_WLN, IF_REAL, "Width reduction parameter"), +IOP( "ww", BSIM3v0_MOD_WW, IF_REAL, "Width reduction parameter"), +IOP( "wwn", BSIM3v0_MOD_WWN, IF_REAL, "Width reduction parameter"), +IOP( "wwl", BSIM3v0_MOD_WWL, IF_REAL, "Width reduction parameter"), +IOP( "wmin", BSIM3v0_MOD_WMIN, IF_REAL, "Minimum width for the model"), +IOP( "wmax", BSIM3v0_MOD_WMAX, IF_REAL, "Maximum width for the model"), + +IOP( "b0", BSIM3v0_MOD_B0, IF_REAL, "Abulk narrow width parameter"), +IOP( "b1", BSIM3v0_MOD_B1, IF_REAL, "Abulk narrow width parameter"), + +IOP( "cgsl", BSIM3v0_MOD_CGSL, IF_REAL, "New C-V model parameter"), +IOP( "cgdl", BSIM3v0_MOD_CGDL, IF_REAL, "New C-V model parameter"), +IOP( "ckappa", BSIM3v0_MOD_CKAPPA, IF_REAL, "New C-V model parameter"), +IOP( "cf", BSIM3v0_MOD_CF, IF_REAL, "Fringe capacitance parameter"), +IOP( "clc", BSIM3v0_MOD_CLC, IF_REAL, "Vdsat parameter for C-V model"), +IOP( "cle", BSIM3v0_MOD_CLE, IF_REAL, "Vdsat parameter for C-V model"), +IOP( "dwc", BSIM3v0_MOD_DWC, IF_REAL, "Delta W for C-V model"), +IOP( "dlc", BSIM3v0_MOD_DLC, IF_REAL, "Delta L for C-V model"), + +IOP( "alpha0", BSIM3v0_MOD_ALPHA0, IF_REAL, "substrate current model parameter"), +IOP( "beta0", BSIM3v0_MOD_BETA0, IF_REAL, "substrate current model parameter"), + +IOP( "lcdsc", BSIM3v0_MOD_LCDSC, IF_REAL, "Length dependence of cdsc"), +IOP( "lcdscb", BSIM3v0_MOD_LCDSCB, IF_REAL, "Length dependence of cdscb"), +IOP( "lcdscd", BSIM3v0_MOD_LCDSCD, IF_REAL, "Length dependence of cdscd"), +IOP( "lcit", BSIM3v0_MOD_LCIT, IF_REAL, "Length dependence of cit"), +IOP( "lnfactor", BSIM3v0_MOD_LNFACTOR, IF_REAL, "Length dependence of nfactor"), +IOP( "lxj", BSIM3v0_MOD_LXJ, IF_REAL, "Length dependence of xj"), +IOP( "lvsat", BSIM3v0_MOD_LVSAT, IF_REAL, "Length dependence of vsat"), +IOP( "lat", BSIM3v0_MOD_LAT, IF_REAL, "Length dependence of at"), +IOP( "la0", BSIM3v0_MOD_LA0, IF_REAL, "Length dependence of a0"), +IOP( "lags", BSIM3v0_MOD_LAGS, IF_REAL, "Length dependence of ags"), +IOP( "la1", BSIM3v0_MOD_LA1, IF_REAL, "Length dependence of a1"), +IOP( "la2", BSIM3v0_MOD_LA2, IF_REAL, "Length dependence of a2"), +IOP( "lketa", BSIM3v0_MOD_LKETA, IF_REAL, "Length dependence of keta"), +IOP( "lnsub", BSIM3v0_MOD_LNSUB, IF_REAL, "Length dependence of nsub"), +IOP( "lnch", BSIM3v0_MOD_LNPEAK, IF_REAL, "Length dependence of nch"), +IOP( "lngate", BSIM3v0_MOD_LNGATE, IF_REAL, "Length dependence of ngate"), +IOP( "lgamma1", BSIM3v0_MOD_LGAMMA1, IF_REAL, "Length dependence of gamma1"), +IOP( "lgamma2", BSIM3v0_MOD_LGAMMA2, IF_REAL, "Length dependence of gamma2"), +IOP( "lvbx", BSIM3v0_MOD_LVBX, IF_REAL, "Length dependence of vbx"), +IOP( "lvbm", BSIM3v0_MOD_LVBM, IF_REAL, "Length dependence of vbm"), +IOP( "lxt", BSIM3v0_MOD_LXT, IF_REAL, "Length dependence of xt"), +IOP( "lk1", BSIM3v0_MOD_LK1, IF_REAL, "Length dependence of k1"), +IOP( "lkt1", BSIM3v0_MOD_LKT1, IF_REAL, "Length dependence of kt1"), +IOP( "lkt1l", BSIM3v0_MOD_LKT1L, IF_REAL, "Length dependence of kt1l"), +IOP( "lkt2", BSIM3v0_MOD_LKT2, IF_REAL, "Length dependence of kt2"), +IOP( "lk2", BSIM3v0_MOD_LK2, IF_REAL, "Length dependence of k2"), +IOP( "lk3", BSIM3v0_MOD_LK3, IF_REAL, "Length dependence of k3"), +IOP( "lk3b", BSIM3v0_MOD_LK3B, IF_REAL, "Length dependence of k3b"), +IOP( "lw0", BSIM3v0_MOD_LW0, IF_REAL, "Length dependence of w0"), +IOP( "lnlx", BSIM3v0_MOD_LNLX, IF_REAL, "Length dependence of nlx"), +IOP( "ldvt0", BSIM3v0_MOD_LDVT0, IF_REAL, "Length dependence of dvt0"), +IOP( "ldvt1", BSIM3v0_MOD_LDVT1, IF_REAL, "Length dependence of dvt1"), +IOP( "ldvt2", BSIM3v0_MOD_LDVT2, IF_REAL, "Length dependence of dvt2"), +IOP( "ldvt0w", BSIM3v0_MOD_LDVT0W, IF_REAL, "Length dependence of dvt0w"), +IOP( "ldvt1w", BSIM3v0_MOD_LDVT1W, IF_REAL, "Length dependence of dvt1w"), +IOP( "ldvt2w", BSIM3v0_MOD_LDVT2W, IF_REAL, "Length dependence of dvt2w"), +IOP( "ldrout", BSIM3v0_MOD_LDROUT, IF_REAL, "Length dependence of drout"), +IOP( "ldsub", BSIM3v0_MOD_LDSUB, IF_REAL, "Length dependence of dsub"), +IOP( "lvth0", BSIM3v0_MOD_LVTH0, IF_REAL,"Length dependence of vto"), +IOP( "lvtho", BSIM3v0_MOD_LVTH0, IF_REAL,"Length dependence of vto"), +IOP( "lua", BSIM3v0_MOD_LUA, IF_REAL, "Length dependence of ua"), +IOP( "lua1", BSIM3v0_MOD_LUA1, IF_REAL, "Length dependence of ua1"), +IOP( "lub", BSIM3v0_MOD_LUB, IF_REAL, "Length dependence of ub"), +IOP( "lub1", BSIM3v0_MOD_LUB1, IF_REAL, "Length dependence of ub1"), +IOP( "luc", BSIM3v0_MOD_LUC, IF_REAL, "Length dependence of uc"), +IOP( "luc1", BSIM3v0_MOD_LUC1, IF_REAL, "Length dependence of uc1"), +IOP( "lu0", BSIM3v0_MOD_LU0, IF_REAL, "Length dependence of u0"), +IOP( "lute", BSIM3v0_MOD_LUTE, IF_REAL, "Length dependence of ute"), +IOP( "lvoff", BSIM3v0_MOD_LVOFF, IF_REAL, "Length dependence of voff"), +IOP( "lelm", BSIM3v0_MOD_LELM, IF_REAL, "Length dependence of elm"), +IOP( "ldelta", BSIM3v0_MOD_LDELTA, IF_REAL, "Length dependence of delta"), +IOP( "lrdsw", BSIM3v0_MOD_LRDSW, IF_REAL, "Length dependence of rdsw "), + +IOP( "lprwg", BSIM3v0_MOD_LPRWG, IF_REAL, "Length dependence of prwg "), +IOP( "lprwb", BSIM3v0_MOD_LPRWB, IF_REAL, "Length dependence of prwb "), + +IOP( "lprt", BSIM3v0_MOD_LPRT, IF_REAL, "Length dependence of prt "), +IOP( "leta0", BSIM3v0_MOD_LETA0, IF_REAL, "Length dependence of eta0"), +IOP( "letab", BSIM3v0_MOD_LETAB, IF_REAL, "Length dependence of etab"), +IOP( "lpclm", BSIM3v0_MOD_LPCLM, IF_REAL, "Length dependence of pclm"), +IOP( "lpdiblc1", BSIM3v0_MOD_LPDIBL1, IF_REAL, "Length dependence of pdiblc1"), +IOP( "lpdiblc2", BSIM3v0_MOD_LPDIBL2, IF_REAL, "Length dependence of pdiblc2"), +IOP( "lpdiblcb", BSIM3v0_MOD_LPDIBLB, IF_REAL, "Length dependence of pdiblcb"), +IOP( "lpscbe1", BSIM3v0_MOD_LPSCBE1, IF_REAL, "Length dependence of pscbe1"), +IOP( "lpscbe2", BSIM3v0_MOD_LPSCBE2, IF_REAL, "Length dependence of pscbe2"), +IOP( "lpvag", BSIM3v0_MOD_LPVAG, IF_REAL, "Length dependence of pvag"), +IOP( "lwr", BSIM3v0_MOD_LWR, IF_REAL, "Length dependence of wr"), +IOP( "ldwg", BSIM3v0_MOD_LDWG, IF_REAL, "Length dependence of dwg"), +IOP( "ldwb", BSIM3v0_MOD_LDWB, IF_REAL, "Length dependence of dwb"), +IOP( "lb0", BSIM3v0_MOD_LB0, IF_REAL, "Length dependence of b0"), +IOP( "lb1", BSIM3v0_MOD_LB1, IF_REAL, "Length dependence of b1"), +IOP( "lcgsl", BSIM3v0_MOD_LCGSL, IF_REAL, "Length dependence of cgsl"), +IOP( "lcgdl", BSIM3v0_MOD_LCGDL, IF_REAL, "Length dependence of cgdl"), +IOP( "lckappa", BSIM3v0_MOD_LCKAPPA, IF_REAL, "Length dependence of ckappa"), +IOP( "lcf", BSIM3v0_MOD_LCF, IF_REAL, "Length dependence of cf"), +IOP( "lclc", BSIM3v0_MOD_LCLC, IF_REAL, "Length dependence of clc"), +IOP( "lcle", BSIM3v0_MOD_LCLE, IF_REAL, "Length dependence of cle"), +IOP( "lalpha0", BSIM3v0_MOD_LALPHA0, IF_REAL, "Length dependence of alpha0"), +IOP( "lbeta0", BSIM3v0_MOD_LBETA0, IF_REAL, "Length dependence of beta0"), + +IOP( "wcdsc", BSIM3v0_MOD_WCDSC, IF_REAL, "Width dependence of cdsc"), +IOP( "wcdscb", BSIM3v0_MOD_WCDSCB, IF_REAL, "Width dependence of cdscb"), +IOP( "wcdscd", BSIM3v0_MOD_WCDSCD, IF_REAL, "Width dependence of cdscd"), +IOP( "wcit", BSIM3v0_MOD_WCIT, IF_REAL, "Width dependence of cit"), +IOP( "wnfactor", BSIM3v0_MOD_WNFACTOR, IF_REAL, "Width dependence of nfactor"), +IOP( "wxj", BSIM3v0_MOD_WXJ, IF_REAL, "Width dependence of xj"), +IOP( "wvsat", BSIM3v0_MOD_WVSAT, IF_REAL, "Width dependence of vsat"), +IOP( "wat", BSIM3v0_MOD_WAT, IF_REAL, "Width dependence of at"), +IOP( "wa0", BSIM3v0_MOD_WA0, IF_REAL, "Width dependence of a0"), +IOP( "wags", BSIM3v0_MOD_WAGS, IF_REAL, "Width dependence of ags"), +IOP( "wa1", BSIM3v0_MOD_WA1, IF_REAL, "Width dependence of a1"), +IOP( "wa2", BSIM3v0_MOD_WA2, IF_REAL, "Width dependence of a2"), +IOP( "wketa", BSIM3v0_MOD_WKETA, IF_REAL, "Width dependence of keta"), +IOP( "wnsub", BSIM3v0_MOD_WNSUB, IF_REAL, "Width dependence of nsub"), +IOP( "wnch", BSIM3v0_MOD_WNPEAK, IF_REAL, "Width dependence of nch"), +IOP( "wngate", BSIM3v0_MOD_WNGATE, IF_REAL, "Width dependence of ngate"), +IOP( "wgamma1", BSIM3v0_MOD_WGAMMA1, IF_REAL, "Width dependence of gamma1"), +IOP( "wgamma2", BSIM3v0_MOD_WGAMMA2, IF_REAL, "Width dependence of gamma2"), +IOP( "wvbx", BSIM3v0_MOD_WVBX, IF_REAL, "Width dependence of vbx"), +IOP( "wvbm", BSIM3v0_MOD_WVBM, IF_REAL, "Width dependence of vbm"), +IOP( "wxt", BSIM3v0_MOD_WXT, IF_REAL, "Width dependence of xt"), +IOP( "wk1", BSIM3v0_MOD_WK1, IF_REAL, "Width dependence of k1"), +IOP( "wkt1", BSIM3v0_MOD_WKT1, IF_REAL, "Width dependence of kt1"), +IOP( "wkt1l", BSIM3v0_MOD_WKT1L, IF_REAL, "Width dependence of kt1l"), +IOP( "wkt2", BSIM3v0_MOD_WKT2, IF_REAL, "Width dependence of kt2"), +IOP( "wk2", BSIM3v0_MOD_WK2, IF_REAL, "Width dependence of k2"), +IOP( "wk3", BSIM3v0_MOD_WK3, IF_REAL, "Width dependence of k3"), +IOP( "wk3b", BSIM3v0_MOD_WK3B, IF_REAL, "Width dependence of k3b"), +IOP( "ww0", BSIM3v0_MOD_WW0, IF_REAL, "Width dependence of w0"), +IOP( "wnlx", BSIM3v0_MOD_WNLX, IF_REAL, "Width dependence of nlx"), +IOP( "wdvt0", BSIM3v0_MOD_WDVT0, IF_REAL, "Width dependence of dvt0"), +IOP( "wdvt1", BSIM3v0_MOD_WDVT1, IF_REAL, "Width dependence of dvt1"), +IOP( "wdvt2", BSIM3v0_MOD_WDVT2, IF_REAL, "Width dependence of dvt2"), +IOP( "wdvt0w", BSIM3v0_MOD_WDVT0W, IF_REAL, "Width dependence of dvt0w"), +IOP( "wdvt1w", BSIM3v0_MOD_WDVT1W, IF_REAL, "Width dependence of dvt1w"), +IOP( "wdvt2w", BSIM3v0_MOD_WDVT2W, IF_REAL, "Width dependence of dvt2w"), +IOP( "wdrout", BSIM3v0_MOD_WDROUT, IF_REAL, "Width dependence of drout"), +IOP( "wdsub", BSIM3v0_MOD_WDSUB, IF_REAL, "Width dependence of dsub"), +IOP( "wvth0", BSIM3v0_MOD_WVTH0, IF_REAL,"Width dependence of vto"), +IOP( "wvtho", BSIM3v0_MOD_WVTH0, IF_REAL,"Width dependence of vto"), +IOP( "wua", BSIM3v0_MOD_WUA, IF_REAL, "Width dependence of ua"), +IOP( "wua1", BSIM3v0_MOD_WUA1, IF_REAL, "Width dependence of ua1"), +IOP( "wub", BSIM3v0_MOD_WUB, IF_REAL, "Width dependence of ub"), +IOP( "wub1", BSIM3v0_MOD_WUB1, IF_REAL, "Width dependence of ub1"), +IOP( "wuc", BSIM3v0_MOD_WUC, IF_REAL, "Width dependence of uc"), +IOP( "wuc1", BSIM3v0_MOD_WUC1, IF_REAL, "Width dependence of uc1"), +IOP( "wu0", BSIM3v0_MOD_WU0, IF_REAL, "Width dependence of u0"), +IOP( "wute", BSIM3v0_MOD_WUTE, IF_REAL, "Width dependence of ute"), +IOP( "wvoff", BSIM3v0_MOD_WVOFF, IF_REAL, "Width dependence of voff"), +IOP( "welm", BSIM3v0_MOD_WELM, IF_REAL, "Width dependence of elm"), +IOP( "wdelta", BSIM3v0_MOD_WDELTA, IF_REAL, "Width dependence of delta"), +IOP( "wrdsw", BSIM3v0_MOD_WRDSW, IF_REAL, "Width dependence of rdsw "), + +IOP( "wprwg", BSIM3v0_MOD_WPRWG, IF_REAL, "Width dependence of prwg "), +IOP( "wprwb", BSIM3v0_MOD_WPRWB, IF_REAL, "Width dependence of prwb "), + +IOP( "wprt", BSIM3v0_MOD_WPRT, IF_REAL, "Width dependence of prt"), +IOP( "weta0", BSIM3v0_MOD_WETA0, IF_REAL, "Width dependence of eta0"), +IOP( "wetab", BSIM3v0_MOD_WETAB, IF_REAL, "Width dependence of etab"), +IOP( "wpclm", BSIM3v0_MOD_WPCLM, IF_REAL, "Width dependence of pclm"), +IOP( "wpdiblc1", BSIM3v0_MOD_WPDIBL1, IF_REAL, "Width dependence of pdiblc1"), +IOP( "wpdiblc2", BSIM3v0_MOD_WPDIBL2, IF_REAL, "Width dependence of pdiblc2"), +IOP( "wpdiblcb", BSIM3v0_MOD_WPDIBLB, IF_REAL, "Width dependence of pdiblcb"), +IOP( "wpscbe1", BSIM3v0_MOD_WPSCBE1, IF_REAL, "Width dependence of pscbe1"), +IOP( "wpscbe2", BSIM3v0_MOD_WPSCBE2, IF_REAL, "Width dependence of pscbe2"), +IOP( "wpvag", BSIM3v0_MOD_WPVAG, IF_REAL, "Width dependence of pvag"), +IOP( "wwr", BSIM3v0_MOD_WWR, IF_REAL, "Width dependence of wr"), +IOP( "wdwg", BSIM3v0_MOD_WDWG, IF_REAL, "Width dependence of dwg"), +IOP( "wdwb", BSIM3v0_MOD_WDWB, IF_REAL, "Width dependence of dwb"), +IOP( "wb0", BSIM3v0_MOD_WB0, IF_REAL, "Width dependence of b0"), +IOP( "wb1", BSIM3v0_MOD_WB1, IF_REAL, "Width dependence of b1"), +IOP( "wcgsl", BSIM3v0_MOD_WCGSL, IF_REAL, "Width dependence of cgsl"), +IOP( "wcgdl", BSIM3v0_MOD_WCGDL, IF_REAL, "Width dependence of cgdl"), +IOP( "wckappa", BSIM3v0_MOD_WCKAPPA, IF_REAL, "Width dependence of ckappa"), +IOP( "wcf", BSIM3v0_MOD_WCF, IF_REAL, "Width dependence of cf"), +IOP( "wclc", BSIM3v0_MOD_WCLC, IF_REAL, "Width dependence of clc"), +IOP( "wcle", BSIM3v0_MOD_WCLE, IF_REAL, "Width dependence of cle"), +IOP( "walpha0", BSIM3v0_MOD_WALPHA0, IF_REAL, "Width dependence of alpha0"), +IOP( "wbeta0", BSIM3v0_MOD_WBETA0, IF_REAL, "Width dependence of beta0"), + +IOP( "pcdsc", BSIM3v0_MOD_PCDSC, IF_REAL, "Cross-term dependence of cdsc"), +IOP( "pcdscb", BSIM3v0_MOD_PCDSCB, IF_REAL, "Cross-term dependence of cdscb"), +IOP( "pcdscd", BSIM3v0_MOD_PCDSCD, IF_REAL, "Cross-term dependence of cdscd"), +IOP( "pcit", BSIM3v0_MOD_PCIT, IF_REAL, "Cross-term dependence of cit"), +IOP( "pnfactor", BSIM3v0_MOD_PNFACTOR, IF_REAL, "Cross-term dependence of nfactor"), +IOP( "pxj", BSIM3v0_MOD_PXJ, IF_REAL, "Cross-term dependence of xj"), +IOP( "pvsat", BSIM3v0_MOD_PVSAT, IF_REAL, "Cross-term dependence of vsat"), +IOP( "pat", BSIM3v0_MOD_PAT, IF_REAL, "Cross-term dependence of at"), +IOP( "pa0", BSIM3v0_MOD_PA0, IF_REAL, "Cross-term dependence of a0"), +IOP( "pags", BSIM3v0_MOD_PAGS, IF_REAL, "Cross-term dependence of ags"), +IOP( "pa1", BSIM3v0_MOD_PA1, IF_REAL, "Cross-term dependence of a1"), +IOP( "pa2", BSIM3v0_MOD_PA2, IF_REAL, "Cross-term dependence of a2"), +IOP( "pketa", BSIM3v0_MOD_PKETA, IF_REAL, "Cross-term dependence of keta"), +IOP( "pnsub", BSIM3v0_MOD_PNSUB, IF_REAL, "Cross-term dependence of nsub"), +IOP( "pnch", BSIM3v0_MOD_PNPEAK, IF_REAL, "Cross-term dependence of nch"), +IOP( "pngate", BSIM3v0_MOD_PNGATE, IF_REAL, "Cross-term dependence of ngate"), +IOP( "pgamma1", BSIM3v0_MOD_PGAMMA1, IF_REAL, "Cross-term dependence of gamma1"), +IOP( "pgamma2", BSIM3v0_MOD_PGAMMA2, IF_REAL, "Cross-term dependence of gamma2"), +IOP( "pvbx", BSIM3v0_MOD_PVBX, IF_REAL, "Cross-term dependence of vbx"), +IOP( "pvbm", BSIM3v0_MOD_PVBM, IF_REAL, "Cross-term dependence of vbm"), +IOP( "pxt", BSIM3v0_MOD_PXT, IF_REAL, "Cross-term dependence of xt"), +IOP( "pk1", BSIM3v0_MOD_PK1, IF_REAL, "Cross-term dependence of k1"), +IOP( "pkt1", BSIM3v0_MOD_PKT1, IF_REAL, "Cross-term dependence of kt1"), +IOP( "pkt1l", BSIM3v0_MOD_PKT1L, IF_REAL, "Cross-term dependence of kt1l"), +IOP( "pkt2", BSIM3v0_MOD_PKT2, IF_REAL, "Cross-term dependence of kt2"), +IOP( "pk2", BSIM3v0_MOD_PK2, IF_REAL, "Cross-term dependence of k2"), +IOP( "pk3", BSIM3v0_MOD_PK3, IF_REAL, "Cross-term dependence of k3"), +IOP( "pk3b", BSIM3v0_MOD_PK3B, IF_REAL, "Cross-term dependence of k3b"), +IOP( "pw0", BSIM3v0_MOD_PW0, IF_REAL, "Cross-term dependence of w0"), +IOP( "pnlx", BSIM3v0_MOD_PNLX, IF_REAL, "Cross-term dependence of nlx"), +IOP( "pdvt0", BSIM3v0_MOD_PDVT0, IF_REAL, "Cross-term dependence of dvt0"), +IOP( "pdvt1", BSIM3v0_MOD_PDVT1, IF_REAL, "Cross-term dependence of dvt1"), +IOP( "pdvt2", BSIM3v0_MOD_PDVT2, IF_REAL, "Cross-term dependence of dvt2"), +IOP( "pdvt0w", BSIM3v0_MOD_PDVT0W, IF_REAL, "Cross-term dependence of dvt0w"), +IOP( "pdvt1w", BSIM3v0_MOD_PDVT1W, IF_REAL, "Cross-term dependence of dvt1w"), +IOP( "pdvt2w", BSIM3v0_MOD_PDVT2W, IF_REAL, "Cross-term dependence of dvt2w"), +IOP( "pdrout", BSIM3v0_MOD_PDROUT, IF_REAL, "Cross-term dependence of drout"), +IOP( "pdsub", BSIM3v0_MOD_PDSUB, IF_REAL, "Cross-term dependence of dsub"), +IOP( "pvth0", BSIM3v0_MOD_PVTH0, IF_REAL,"Cross-term dependence of vto"), +IOP( "pvtho", BSIM3v0_MOD_PVTH0, IF_REAL,"Cross-term dependence of vto"), +IOP( "pua", BSIM3v0_MOD_PUA, IF_REAL, "Cross-term dependence of ua"), +IOP( "pua1", BSIM3v0_MOD_PUA1, IF_REAL, "Cross-term dependence of ua1"), +IOP( "pub", BSIM3v0_MOD_PUB, IF_REAL, "Cross-term dependence of ub"), +IOP( "pub1", BSIM3v0_MOD_PUB1, IF_REAL, "Cross-term dependence of ub1"), +IOP( "puc", BSIM3v0_MOD_PUC, IF_REAL, "Cross-term dependence of uc"), +IOP( "puc1", BSIM3v0_MOD_PUC1, IF_REAL, "Cross-term dependence of uc1"), +IOP( "pu0", BSIM3v0_MOD_PU0, IF_REAL, "Cross-term dependence of u0"), +IOP( "pute", BSIM3v0_MOD_PUTE, IF_REAL, "Cross-term dependence of ute"), +IOP( "pvoff", BSIM3v0_MOD_PVOFF, IF_REAL, "Cross-term dependence of voff"), +IOP( "pelm", BSIM3v0_MOD_PELM, IF_REAL, "Cross-term dependence of elm"), +IOP( "pdelta", BSIM3v0_MOD_PDELTA, IF_REAL, "Cross-term dependence of delta"), +IOP( "prdsw", BSIM3v0_MOD_PRDSW, IF_REAL, "Cross-term dependence of rdsw "), + +IOP( "pprwg", BSIM3v0_MOD_PPRWG, IF_REAL, "Cross-term dependence of prwg "), +IOP( "pprwb", BSIM3v0_MOD_PPRWB, IF_REAL, "Cross-term dependence of prwb "), + +IOP( "pprt", BSIM3v0_MOD_PPRT, IF_REAL, "Cross-term dependence of prt "), +IOP( "peta0", BSIM3v0_MOD_PETA0, IF_REAL, "Cross-term dependence of eta0"), +IOP( "petab", BSIM3v0_MOD_PETAB, IF_REAL, "Cross-term dependence of etab"), +IOP( "ppclm", BSIM3v0_MOD_PPCLM, IF_REAL, "Cross-term dependence of pclm"), +IOP( "ppdiblc1", BSIM3v0_MOD_PPDIBL1, IF_REAL, "Cross-term dependence of pdiblc1"), +IOP( "ppdiblc2", BSIM3v0_MOD_PPDIBL2, IF_REAL, "Cross-term dependence of pdiblc2"), +IOP( "ppdiblcb", BSIM3v0_MOD_PPDIBLB, IF_REAL, "Cross-term dependence of pdiblcb"), +IOP( "ppscbe1", BSIM3v0_MOD_PPSCBE1, IF_REAL, "Cross-term dependence of pscbe1"), +IOP( "ppscbe2", BSIM3v0_MOD_PPSCBE2, IF_REAL, "Cross-term dependence of pscbe2"), +IOP( "ppvag", BSIM3v0_MOD_PPVAG, IF_REAL, "Cross-term dependence of pvag"), +IOP( "pwr", BSIM3v0_MOD_PWR, IF_REAL, "Cross-term dependence of wr"), +IOP( "pdwg", BSIM3v0_MOD_PDWG, IF_REAL, "Cross-term dependence of dwg"), +IOP( "pdwb", BSIM3v0_MOD_PDWB, IF_REAL, "Cross-term dependence of dwb"), +IOP( "pb0", BSIM3v0_MOD_PB0, IF_REAL, "Cross-term dependence of b0"), +IOP( "pb1", BSIM3v0_MOD_PB1, IF_REAL, "Cross-term dependence of b1"), +IOP( "pcgsl", BSIM3v0_MOD_PCGSL, IF_REAL, "Cross-term dependence of cgsl"), +IOP( "pcgdl", BSIM3v0_MOD_PCGDL, IF_REAL, "Cross-term dependence of cgdl"), +IOP( "pckappa", BSIM3v0_MOD_PCKAPPA, IF_REAL, "Cross-term dependence of ckappa"), +IOP( "pcf", BSIM3v0_MOD_PCF, IF_REAL, "Cross-term dependence of cf"), +IOP( "pclc", BSIM3v0_MOD_PCLC, IF_REAL, "Cross-term dependence of clc"), +IOP( "pcle", BSIM3v0_MOD_PCLE, IF_REAL, "Cross-term dependence of cle"), +IOP( "palpha0", BSIM3v0_MOD_PALPHA0, IF_REAL, "Cross-term dependence of alpha0"), +IOP( "pbeta0", BSIM3v0_MOD_PBETA0, IF_REAL, "Cross-term dependence of beta0"), + +IOP( "noia", BSIM3v0_MOD_NOIA, IF_REAL, "Flicker noise parameter"), +IOP( "noib", BSIM3v0_MOD_NOIB, IF_REAL, "Flicker noise parameter"), +IOP( "noic", BSIM3v0_MOD_NOIC, IF_REAL, "Flicker noise parameter"), +IOP( "em", BSIM3v0_MOD_EM, IF_REAL, "Flicker noise parameter"), +IOP( "ef", BSIM3v0_MOD_EF, IF_REAL, "Flicker noise frequency exponent"), +IOP( "af", BSIM3v0_MOD_AF, IF_REAL, "Flicker noise exponent"), +IOP( "kf", BSIM3v0_MOD_KF, IF_REAL, "Flicker noise coefficient"), + +IP( "nmos", BSIM3v0_MOD_NMOS, IF_FLAG, "Flag to indicate NMOS"), +IP( "pmos", BSIM3v0_MOD_PMOS, IF_FLAG, "Flag to indicate PMOS"), +}; + +char *BSIM3v0names[] = { + "Drain", + "Gate", + "Source", + "Bulk", + "Charge" +}; + +int BSIM3v0nSize = NUMELEMS(BSIM3v0names); +int BSIM3v0pTSize = NUMELEMS(BSIM3v0pTable); +int BSIM3v0mPTSize = NUMELEMS(BSIM3v0mPTable); +int BSIM3v0iSize = sizeof(BSIM3v0instance); +int BSIM3v0mSize = sizeof(BSIM3v0model); + + + diff --git a/src/spicelib/devices/bsim3v0/b3v0acld.c b/src/spicelib/devices/bsim3v0/b3v0acld.c new file mode 100644 index 000000000..26f91c80e --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0acld.c @@ -0,0 +1,185 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0acld.c +**********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim3v0def.h" +#include "sperror.h" +#include "suffix.h" + + +int +BSIM3v0acLoad(GENmodel *inModel, CKTcircuit *ckt) +{ +BSIM3v0model *model = (BSIM3v0model*)inModel; +BSIM3v0instance *here; +double xcggb, xcgdb, xcgsb, xcbgb, xcbdb, xcbsb, xcddb, xcssb, xcdgb; +double gdpr, gspr, gds, gbd, gbs, capbd, capbs, xcsgb, xcdsb, xcsdb; +double cggb, cgdb, cgsb, cbgb, cbdb, cbsb, cddb, cdgb, cdsb, omega; +double GSoverlapCap, GDoverlapCap, GBoverlapCap, FwdSum, RevSum, Gm, Gmbs; + +double dxpart, sxpart, cqgb, cqdb, cqsb, cqbb, xcqgb, xcqdb, xcqsb, xcqbb; + +double m; + + omega = ckt->CKTomega; + for (; model != NULL; model = model->BSIM3v0nextModel) + { + + + for (here = model->BSIM3v0instances; here!= NULL; + here = here->BSIM3v0nextInstance) + { + + if (here->BSIM3v0owner != ARCHme) + continue; + + + if (here->BSIM3v0mode >= 0) + { Gm = here->BSIM3v0gm; + Gmbs = here->BSIM3v0gmbs; + FwdSum = Gm + Gmbs; + RevSum = 0.0; + cggb = here->BSIM3v0cggb; + cgsb = here->BSIM3v0cgsb; + cgdb = here->BSIM3v0cgdb; + + cbgb = here->BSIM3v0cbgb; + cbsb = here->BSIM3v0cbsb; + cbdb = here->BSIM3v0cbdb; + + cdgb = here->BSIM3v0cdgb; + cdsb = here->BSIM3v0cdsb; + cddb = here->BSIM3v0cddb; + + cqgb = here->BSIM3v0cqgb; + cqdb = here->BSIM3v0cqdb; + cqsb = here->BSIM3v0cqsb; + cqbb = here->BSIM3v0cqbb; + sxpart = 0.6; + dxpart = 0.4; + + } + else + { Gm = -here->BSIM3v0gm; + Gmbs = -here->BSIM3v0gmbs; + FwdSum = 0.0; + RevSum = -Gm - Gmbs; + cggb = here->BSIM3v0cggb; + cgsb = here->BSIM3v0cgdb; + cgdb = here->BSIM3v0cgsb; + + cbgb = here->BSIM3v0cbgb; + cbsb = here->BSIM3v0cbdb; + cbdb = here->BSIM3v0cbsb; + + cdgb = -(here->BSIM3v0cdgb + cggb + cbgb); + cdsb = -(here->BSIM3v0cddb + cgsb + cbsb); + cddb = -(here->BSIM3v0cdsb + cgdb + cbdb); + + cqgb = here->BSIM3v0cqgb; + cqdb = here->BSIM3v0cqsb; + cqsb = here->BSIM3v0cqdb; + cqbb = here->BSIM3v0cqbb; + sxpart = 0.4; + dxpart = 0.6; + } + + gdpr=here->BSIM3v0drainConductance; + gspr=here->BSIM3v0sourceConductance; + gds= here->BSIM3v0gds; + gbd= here->BSIM3v0gbd; + gbs= here->BSIM3v0gbs; + capbd= here->BSIM3v0capbd; + capbs= here->BSIM3v0capbs; + + GSoverlapCap = here->BSIM3v0cgso; + GDoverlapCap = here->BSIM3v0cgdo; + GBoverlapCap = here->pParam->BSIM3v0cgbo; + + xcdgb = (cdgb - GDoverlapCap) * omega; + xcddb = (cddb + capbd + GDoverlapCap) * omega; + xcdsb = cdsb * omega; + xcsgb = -(cggb + cbgb + cdgb + GSoverlapCap) * omega; + xcsdb = -(cgdb + cbdb + cddb) * omega; + xcssb = (capbs + GSoverlapCap - (cgsb + cbsb + cdsb)) * omega; + xcggb = (cggb + GDoverlapCap + GSoverlapCap + GBoverlapCap) + * omega; + xcgdb = (cgdb - GDoverlapCap ) * omega; + xcgsb = (cgsb - GSoverlapCap) * omega; + xcbgb = (cbgb - GBoverlapCap) * omega; + xcbdb = (cbdb - capbd ) * omega; + xcbsb = (cbsb - capbs ) * omega; + xcqgb = cqgb * omega; + xcqdb = cqdb * omega; + xcqsb = cqsb * omega; + xcqbb = cqbb * omega; + + m = here->BSIM3v0m; + + *(here->BSIM3v0GgPtr +1) += m * xcggb; + *(here->BSIM3v0BbPtr +1) -= m * (xcbgb + xcbdb + xcbsb); + *(here->BSIM3v0DPdpPtr +1) += m * xcddb; + *(here->BSIM3v0SPspPtr +1) += m * xcssb; + *(here->BSIM3v0GbPtr +1) -= m * (xcggb + xcgdb + xcgsb); + *(here->BSIM3v0GdpPtr +1) += m * xcgdb; + *(here->BSIM3v0GspPtr +1) += m * xcgsb; + *(here->BSIM3v0BgPtr +1) += m * xcbgb; + *(here->BSIM3v0BdpPtr +1) += m * xcbdb; + *(here->BSIM3v0BspPtr +1) += m * xcbsb; + *(here->BSIM3v0DPgPtr +1) += m * xcdgb; + *(here->BSIM3v0DPbPtr +1) -= m * (xcdgb + xcddb + xcdsb); + *(here->BSIM3v0DPspPtr +1) += m * xcdsb; + *(here->BSIM3v0SPgPtr +1) += m * xcsgb; + *(here->BSIM3v0SPbPtr +1) -= m * (xcsgb + xcsdb + xcssb); + *(here->BSIM3v0SPdpPtr +1) += m * xcsdb; + + *(here->BSIM3v0QqPtr +1) += m * omega; + + *(here->BSIM3v0QgPtr +1) -= m * xcqgb; + *(here->BSIM3v0QdpPtr +1) -= m * xcqdb; + *(here->BSIM3v0QspPtr +1) -= m * xcqsb; + *(here->BSIM3v0QbPtr +1) -= m * xcqbb; + + + *(here->BSIM3v0DdPtr) += m * gdpr; + *(here->BSIM3v0SsPtr) += m * gspr; + *(here->BSIM3v0BbPtr) += m * (gbd + gbs); + *(here->BSIM3v0DPdpPtr) += m * (gdpr + gds + gbd + RevSum + dxpart*here->BSIM3v0gtd); + *(here->BSIM3v0SPspPtr) += m * (gspr + gds + gbs + FwdSum + sxpart*here->BSIM3v0gts); + *(here->BSIM3v0DdpPtr) -= m * gdpr; + *(here->BSIM3v0SspPtr) -= m * gspr; + *(here->BSIM3v0BdpPtr) -= m * gbd; + *(here->BSIM3v0BspPtr) -= m * gbs; + *(here->BSIM3v0DPdPtr) -= m * gdpr; + *(here->BSIM3v0DPgPtr) += m * (Gm + dxpart * here->BSIM3v0gtg); + *(here->BSIM3v0DPbPtr) -= m * (gbd - Gmbs - dxpart * here->BSIM3v0gtb); + *(here->BSIM3v0DPspPtr) -= m * (gds + FwdSum - dxpart * here->BSIM3v0gts); + *(here->BSIM3v0SPgPtr) -= m * (Gm - sxpart * here->BSIM3v0gtg); + *(here->BSIM3v0SPsPtr) -= m * gspr; + *(here->BSIM3v0SPbPtr) -= m * (gbs + Gmbs - sxpart * here->BSIM3v0gtg); + *(here->BSIM3v0SPdpPtr) -= m * (gds + RevSum - sxpart * here->BSIM3v0gtd); + *(here->BSIM3v0GgPtr) -= m * here->BSIM3v0gtg; + *(here->BSIM3v0GbPtr) -= m * here->BSIM3v0gtb; + *(here->BSIM3v0GdpPtr) -= m * here->BSIM3v0gtd; + *(here->BSIM3v0GspPtr) -= m * here->BSIM3v0gts; + + *(here->BSIM3v0QqPtr) += m * here->BSIM3v0gtau; + + *(here->BSIM3v0DPqPtr) += m * (dxpart * here->BSIM3v0gtau); + *(here->BSIM3v0SPqPtr) += m * (sxpart * here->BSIM3v0gtau); + *(here->BSIM3v0GqPtr) -= m * here->BSIM3v0gtau; + + *(here->BSIM3v0QgPtr) += m * here->BSIM3v0gtg; + *(here->BSIM3v0QdpPtr) += m * here->BSIM3v0gtd; + *(here->BSIM3v0QspPtr) += m * here->BSIM3v0gts; + *(here->BSIM3v0QbPtr) += m * here->BSIM3v0gtb; + + } + } + return(OK); +} + diff --git a/src/spicelib/devices/bsim3v0/b3v0ask.c b/src/spicelib/devices/bsim3v0/b3v0ask.c new file mode 100644 index 000000000..51401bdbb --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0ask.c @@ -0,0 +1,221 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0ask.c +**********/ + +#include "ngspice.h" +#include "ifsim.h" +#include "cktdefs.h" +#include "devdefs.h" +#include "bsim3v0def.h" +#include "sperror.h" +#include "suffix.h" + +int +BSIM3v0ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, + IFvalue *select) +{ +BSIM3v0instance *here = (BSIM3v0instance*)inst; + + switch(which) + { case BSIM3v0_L: + value->rValue = here->BSIM3v0l; + return(OK); + case BSIM3v0_W: + value->rValue = here->BSIM3v0w; + return(OK); + case BSIM3v0_M: + value->rValue = here->BSIM3v0m; + return(OK); + case BSIM3v0_AS: + value->rValue = here->BSIM3v0sourceArea; + return(OK); + case BSIM3v0_AD: + value->rValue = here->BSIM3v0drainArea; + return(OK); + case BSIM3v0_PS: + value->rValue = here->BSIM3v0sourcePerimeter; + return(OK); + case BSIM3v0_PD: + value->rValue = here->BSIM3v0drainPerimeter; + return(OK); + case BSIM3v0_NRS: + value->rValue = here->BSIM3v0sourceSquares; + return(OK); + case BSIM3v0_NRD: + value->rValue = here->BSIM3v0drainSquares; + return(OK); + case BSIM3v0_OFF: + value->rValue = here->BSIM3v0off; + return(OK); + case BSIM3v0_NQSMOD: + value->iValue = here->BSIM3v0nqsMod; + return(OK); + case BSIM3v0_IC_VBS: + value->rValue = here->BSIM3v0icVBS; + return(OK); + case BSIM3v0_IC_VDS: + value->rValue = here->BSIM3v0icVDS; + return(OK); + case BSIM3v0_IC_VGS: + value->rValue = here->BSIM3v0icVGS; + return(OK); + case BSIM3v0_DNODE: + value->iValue = here->BSIM3v0dNode; + return(OK); + case BSIM3v0_GNODE: + value->iValue = here->BSIM3v0gNode; + return(OK); + case BSIM3v0_SNODE: + value->iValue = here->BSIM3v0sNode; + return(OK); + case BSIM3v0_BNODE: + value->iValue = here->BSIM3v0bNode; + return(OK); + case BSIM3v0_DNODEPRIME: + value->iValue = here->BSIM3v0dNodePrime; + return(OK); + case BSIM3v0_SNODEPRIME: + value->iValue = here->BSIM3v0sNodePrime; + return(OK); + case BSIM3v0_SOURCECONDUCT: + value->rValue = here->BSIM3v0sourceConductance; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_DRAINCONDUCT: + value->rValue = here->BSIM3v0drainConductance; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_VBD: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0vbd); + return(OK); + case BSIM3v0_VBS: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0vbs); + return(OK); + case BSIM3v0_VGS: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0vgs); + return(OK); + case BSIM3v0_VDS: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0vds); + return(OK); + case BSIM3v0_CD: + value->rValue = here->BSIM3v0cd; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CBS: + value->rValue = here->BSIM3v0cbs; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CBD: + value->rValue = here->BSIM3v0cbd; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_GM: + value->rValue = here->BSIM3v0gm; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_GDS: + value->rValue = here->BSIM3v0gds; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_GMBS: + value->rValue = here->BSIM3v0gmbs; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_GBD: + value->rValue = here->BSIM3v0gbd; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_GBS: + value->rValue = here->BSIM3v0gbs; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_QB: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0qb); + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CQB: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0cqb); + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_QG: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0qg); + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CQG: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0cqg); + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_QD: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0qd); + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CQD: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0cqd); + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CGG: + value->rValue = here->BSIM3v0cggb; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CGD: + value->rValue = here->BSIM3v0cgdb; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CGS: + value->rValue = here->BSIM3v0cgsb; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CDG: + value->rValue = here->BSIM3v0cdgb; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CDD: + value->rValue = here->BSIM3v0cddb; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CDS: + value->rValue = here->BSIM3v0cdsb; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CBG: + value->rValue = here->BSIM3v0cbgb; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CBDB: + value->rValue = here->BSIM3v0cbdb; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CBSB: + value->rValue = here->BSIM3v0cbsb; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CAPBD: + value->rValue = here->BSIM3v0capbd; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_CAPBS: + value->rValue = here->BSIM3v0capbs; + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_VON: + value->rValue = here->BSIM3v0von; + return(OK); + case BSIM3v0_VDSAT: + value->rValue = here->BSIM3v0vdsat; + return(OK); + case BSIM3v0_QBS: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0qbs); + value->rValue *= here->BSIM3v0m; + return(OK); + case BSIM3v0_QBD: + value->rValue = *(ckt->CKTstate0 + here->BSIM3v0qbd); + value->rValue *= here->BSIM3v0m; + return(OK); + default: + return(E_BADPARM); + } + /* NOTREACHED */ +} + diff --git a/src/spicelib/devices/bsim3v0/b3v0cvtest.c b/src/spicelib/devices/bsim3v0/b3v0cvtest.c new file mode 100644 index 000000000..1bde1ca69 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0cvtest.c @@ -0,0 +1,90 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0cvtest.c +**********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim3v0def.h" +#include "trandefs.h" +#include "const.h" +#include "devdefs.h" +#include "sperror.h" +#include "suffix.h" + + +int +BSIM3v0convTest(GENmodel *inModel, CKTcircuit *ckt) +{ +BSIM3v0model *model = (BSIM3v0model*)inModel; +BSIM3v0instance *here; +double delvbd, delvbs, delvds, delvgd, delvgs, vbd, vbs, vds; +double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; + + /* loop through all the BSIM3v0 device models */ + for (; model != NULL; model = model->BSIM3v0nextModel) + { /* loop through all the instances of the model */ + for (here = model->BSIM3v0instances; here != NULL ; + here=here->BSIM3v0nextInstance) + { + + if (here->BSIM3v0owner != ARCHme) + continue; + + vbs = model->BSIM3v0type + * (*(ckt->CKTrhsOld+here->BSIM3v0bNode) + - *(ckt->CKTrhsOld+here->BSIM3v0sNodePrime)); + vgs = model->BSIM3v0type + * (*(ckt->CKTrhsOld+here->BSIM3v0gNode) + - *(ckt->CKTrhsOld+here->BSIM3v0sNodePrime)); + vds = model->BSIM3v0type + * (*(ckt->CKTrhsOld+here->BSIM3v0dNodePrime) + - *(ckt->CKTrhsOld+here->BSIM3v0sNodePrime)); + vbd = vbs - vds; + vgd = vgs - vds; + vgdo = *(ckt->CKTstate0 + here->BSIM3v0vgs) + - *(ckt->CKTstate0 + here->BSIM3v0vds); + delvbs = vbs - *(ckt->CKTstate0 + here->BSIM3v0vbs); + delvbd = vbd - *(ckt->CKTstate0 + here->BSIM3v0vbd); + delvgs = vgs - *(ckt->CKTstate0 + here->BSIM3v0vgs); + delvds = vds - *(ckt->CKTstate0 + here->BSIM3v0vds); + delvgd = vgd-vgdo; + + cd = here->BSIM3v0cd; + if (here->BSIM3v0mode >= 0) + { cdhat = cd - here->BSIM3v0gbd * delvbd + + here->BSIM3v0gmbs * delvbs + here->BSIM3v0gm * delvgs + + here->BSIM3v0gds * delvds; + } + else + { cdhat = cd - (here->BSIM3v0gbd - here->BSIM3v0gmbs) * delvbd + - here->BSIM3v0gm * delvgd + here->BSIM3v0gds * delvds; + } + + /* + * check convergence + */ + if ((here->BSIM3v0off == 0) || (!(ckt->CKTmode & MODEINITFIX))) + { tol = ckt->CKTreltol * MAX(fabs(cdhat), fabs(cd)) + + ckt->CKTabstol; + if (fabs(cdhat - cd) >= tol) + { ckt->CKTnoncon++; + return(OK); + } + cbs = here->BSIM3v0cbs; + cbd = here->BSIM3v0cbd; + cbhat = cbs + cbd + here->BSIM3v0gbd * delvbd + + here->BSIM3v0gbs * delvbs; + tol = ckt->CKTreltol * MAX(fabs(cbhat), fabs(cbs + cbd)) + + ckt->CKTabstol; + if (fabs(cbhat - (cbs + cbd)) > tol) + { ckt->CKTnoncon++; + return(OK); + } + } + } + } + return(OK); +} + diff --git a/src/spicelib/devices/bsim3v0/b3v0del.c b/src/spicelib/devices/bsim3v0/b3v0del.c new file mode 100644 index 000000000..e10666d3d --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0del.c @@ -0,0 +1,38 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0del.c +**********/ +/* + */ + +#include "ngspice.h" +#include "bsim3v0def.h" +#include "sperror.h" +#include "gendefs.h" +#include "suffix.h" + + +int +BSIM3v0delete(GENmodel *inModel, IFuid name, GENinstance **inInst) +{ +BSIM3v0instance **fast = (BSIM3v0instance**)inInst; +BSIM3v0model *model = (BSIM3v0model*)inModel; +BSIM3v0instance **prev = NULL; +BSIM3v0instance *here; + + for (; model ; model = model->BSIM3v0nextModel) + { prev = &(model->BSIM3v0instances); + for (here = *prev; here ; here = *prev) + { if (here->BSIM3v0name == name || (fast && here==*fast)) + { *prev= here->BSIM3v0nextInstance; + FREE(here); + return(OK); + } + prev = &(here->BSIM3v0nextInstance); + } + } + return(E_NODEV); +} + + diff --git a/src/spicelib/devices/bsim3v0/b3v0dest.c b/src/spicelib/devices/bsim3v0/b3v0dest.c new file mode 100644 index 000000000..6eb753d06 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0dest.c @@ -0,0 +1,36 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0dest.c +**********/ + +#include "ngspice.h" +#include "bsim3v0def.h" +#include "suffix.h" + +void +BSIM3v0destroy(GENmodel **inModel) +{ +BSIM3v0model **model = (BSIM3v0model**)inModel; +BSIM3v0instance *here; +BSIM3v0instance *prev = NULL; +BSIM3v0model *mod = *model; +BSIM3v0model *oldmod = NULL; + + for (; mod ; mod = mod->BSIM3v0nextModel) + { if(oldmod) FREE(oldmod); + oldmod = mod; + prev = (BSIM3v0instance *)NULL; + for (here = mod->BSIM3v0instances; here; here = here->BSIM3v0nextInstance) + { if(prev) FREE(prev); + prev = here; + } + if(prev) FREE(prev); + } + if(oldmod) FREE(oldmod); + *model = NULL; + return; +} + + + diff --git a/src/spicelib/devices/bsim3v0/b3v0getic.c b/src/spicelib/devices/bsim3v0/b3v0getic.c new file mode 100644 index 000000000..f2ae1683a --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0getic.c @@ -0,0 +1,44 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0getic.c +**********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim3v0def.h" +#include "sperror.h" +#include "suffix.h" + + +int +BSIM3v0getic(GENmodel *inModel, CKTcircuit *ckt) +{ +BSIM3v0model *model = (BSIM3v0model*)inModel; +BSIM3v0instance *here; + + for (; model ; model = model->BSIM3v0nextModel) + { for (here = model->BSIM3v0instances; here; here = here->BSIM3v0nextInstance) + { + + if (here->BSIM3v0owner != ARCHme) + continue; + + if(!here->BSIM3v0icVBSGiven) + { here->BSIM3v0icVBS = *(ckt->CKTrhs + here->BSIM3v0bNode) + - *(ckt->CKTrhs + here->BSIM3v0sNode); + } + if (!here->BSIM3v0icVDSGiven) + { here->BSIM3v0icVDS = *(ckt->CKTrhs + here->BSIM3v0dNode) + - *(ckt->CKTrhs + here->BSIM3v0sNode); + } + if (!here->BSIM3v0icVGSGiven) + { here->BSIM3v0icVGS = *(ckt->CKTrhs + here->BSIM3v0gNode) + - *(ckt->CKTrhs + here->BSIM3v0sNode); + } + } + } + return(OK); +} + + diff --git a/src/spicelib/devices/bsim3v0/b3v0ld.c b/src/spicelib/devices/bsim3v0/b3v0ld.c new file mode 100644 index 000000000..853b01035 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0ld.c @@ -0,0 +1,1935 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1991 JianHui Huang and Min-Chie Jeng. +File: b3v0ld.c 1/3/92 +Modified by Mansun Chan (1995) +**********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim3v0def.h" +#include "trandefs.h" +#include "const.h" +#include "sperror.h" +#include "devdefs.h" +#include "suffix.h" + +#define MAX_EXP 5.834617425e14 +#define MIN_EXP 1.713908431e-15 +#define EXP_THRESHOLD 34.0 +#define EPSOX 3.453133e-11 +#define EPSSI 1.03594e-10 +#define Charge_q 1.60219e-19 +#define DELTA_1 0.02 +#define DELTA_2 0.02 +#define DELTA_3 0.02 +#define DELTA_4 0.02 + + +int +BSIM3v0load(GENmodel *inModel, CKTcircuit *ckt) +{ +BSIM3v0model *model = (BSIM3v0model*)inModel; +BSIM3v0instance *here; +double SourceSatCurrent, DrainSatCurrent; +double ag0, qgd, qgs, qgb, von, cbhat, VgstNVt, ExpVgst; +double cdrain, cdhat, cdreq, ceqbd, ceqbs, ceqqb, ceqqd, ceqqg, ceq, geq; +double czbd, czbdsw, czbs, czbssw, evbd, evbs, arg, sarg; +double delvbd, delvbs, delvds, delvgd, delvgs; +double Vfbeff, dVfbeff_dVg, dVfbeff_dVd, dVfbeff_dVb, V3, V4; +double gcbdb, gcbgb, gcbsb, gcddb, gcdgb, gcdsb, gcgdb, gcggb, gcgsb, gcsdb; +double gcsgb, gcssb, tol, PhiB, PhiBSW, MJ, MJSW; +double vbd, vbs, vds, vgb, vgd, vgs, vgdo, xfact; +double qgate, qbulk, qdrn, qsrc, cqgate, cqbulk, cqdrn; +double Vds, Vgs, Vbs, Gmbs, FwdSum, RevSum; +double Vgs_eff, Vfb, dVfb_dVb, dVfb_dVd, dVbs_dVb; +double Phis, dPhis_dVb, sqrtPhis, dsqrtPhis_dVb, Vth, dVth_dVb, dVth_dVd; +double Vgst, dVgs_eff_dVg; +double Vgdt, Vgsaddvth, Vgsaddvth2, Vgsaddvth1o3, n, dn_dVb, Vtm; +double ExpArg, ExpArg1; +double Denomi, dDenomi_dVg, dDenomi_dVd, dDenomi_dVb; +double ueff, dueff_dVg, dueff_dVd, dueff_dVb; +double Esat, dEsat_dVg, dEsat_dVd, dEsat_dVb, Vdsat, Vdsat0; +double EsatL, dEsatL_dVg, dEsatL_dVd, dEsatL_dVb; +double Ilimit, Iexp, dIexp_dVg, dIexp_dVd, dIexp_dVb; +double dVdsat_dVg, dVdsat_dVb, dVdsat_dVd, Vasat, dAlphaz_dVg, dAlphaz_dVb; +double dVasat_dVg, dVasat_dVb, dVasat_dVd, Va, Va2, dVa_dVd, dVa_dVg, dVa_dVb; +double Vbseff, dVbseff_dVb, VbseffCV, dVbseffCV_dVb; +double Arg1, Arg2, One_Third_CoxWL, Two_Third_CoxWL, Alphaz, CoxWL; +double dqbulk_dVb, dVgdt_dVg, dVgdt_dVd, dVgdt_dVb; +double T0, dT0_dVg, dT0_dVd, dT0_dVb; +double T1, dT1_dVg, dT1_dVd, dT1_dVb; +double T2, dT2_dVg, dT2_dVd, dT2_dVb; +double T3, dT3_dVg, dT3_dVd, dT3_dVb; +double T4, dT4_dVg, dT4_dVd, dT4_dVb; +double T5, dT5_dVg, dT5_dVd, dT5_dVb; +double T6, dT6_dVg, dT6_dVd, dT6_dVb; +double T7, dT7_dVg, dT7_dVd, dT7_dVb; +double T8, dT8_dVg, dT8_dVd, dT8_dVb; +double T9, dT9_dVg, dT9_dVd, dT9_dVb; +double T10, dT10_dVg, dT10_dVb, dT10_dVd; +double tmp, Abulk, dAbulk_dVb, Abulk0, dAbulk0_dVb; +double T100, T101; +double VACLM, dVACLM_dVg, dVACLM_dVd, dVACLM_dVb; +double VADIBL, dVADIBL_dVg, dVADIBL_dVd, dVADIBL_dVb; +double VAHCE, dVAHCE_dVg, dVAHCE_dVd, dVAHCE_dVb; +double Xdep, dXdep_dVb, lt1, dlt1_dVb, ltw, dltw_dVb, Delt_vth, dDelt_vth_dVb; +double Theta0, dTheta0_dVb, Theta1, dTheta1_dVb; +double Thetarout, dThetarout_dVb, TempRatio, tmp1, tmp2, tmp3, tmp4; +double DIBL_Sft, dDIBL_Sft_dVd, DIBL_fact, Pmos_factor; +double Rout_Vgs_factor, dRout_Vgs_factor_dVg, dRout_Vgs_factor_dVb; +double dRout_Vgs_factor_dVd; +double tempv, a1; + +double Vgsteff, dVgsteff_dVg, dVgsteff_dVd, dVgsteff_dVb; +double Vdseff, dVdseff_dVg, dVdseff_dVd, dVdseff_dVb; +double VdseffCV, dVdseffCV_dVg, dVdseffCV_dVd, dVdseffCV_dVb; +double diffVds, diffVdsCV; +double dAbulk_dVg, dn_dVd ; +double beta, dbeta_dVg, dbeta_dVd, dbeta_dVb; +double gche, dgche_dVg, dgche_dVd, dgche_dVb; +double fgche1, dfgche1_dVg, dfgche1_dVd, dfgche1_dVb; +double fgche2, dfgche2_dVg, dfgche2_dVd, dfgche2_dVb; +double Idl, dIdl_dVg, dIdl_dVd, dIdl_dVb; +double Idsa, dIdsa_dVg, dIdsa_dVd, dIdsa_dVb; +double Ids, Gm, Gds, Gmb; +double Isub, Isubd, Isubs, Gbd, Gbg, Gbb; +double VASCBE, dVASCBE_dVg, dVASCBE_dVd, dVASCBE_dVb; +double CoxWovL; +double Rds, dRds_dVg, dRds_dVb, WVCox, WVCoxRds; +double Vgst2Vtm, VdsatCV, dVdsatCV_dVd, dVdsatCV_dVg, dVdsatCV_dVb; +double Leff, Weff, dWeff_dVg, dWeff_dVb; +double AbulkCV, dAbulkCV_dVb; +double qgdo, qgso, cgdo, cgso; + +double qcheq, qdef, gqdef, cqdef, cqcheq, gtau_diff, gtau_drift, csreq; +double gcqdb,gcqsb,gcqgb,gcqbb,vss; +double dxpart, sxpart; + +double gbspsp, gbbdp, gbbsp, gbspg, gbspb, gbspdp; +double gbdpdp, gbdpg, gbdpb, gbdpsp; +double Cgg, Cgd, Cgs, Cgb, Cdg, Cdd, Cds, Cdb, Qg, Qd; +double Csg, Csd, Css, Csb, Cbg, Cbd, Cbs, Cbb, Qs, Qb; +double Cgg1, Cgb1, Cgd1, Cbg1, Cbb1, Cbd1, Csg1, Csd1, Csb1, Qac0, Qsub0; +double dQac0_dVg, dQac0_dVd, dQac0_dVb, dQsub0_dVg, dQsub0_dVd, dQsub0_dVb; + +struct bsim3v0SizeDependParam *pParam; +int ByPass, Check, ChargeComputationNeeded, J, error, I; +double junk[50]; + +double m; + +for (; model != NULL; model = model->BSIM3v0nextModel) +{ for (here = model->BSIM3v0instances; here != NULL; + here = here->BSIM3v0nextInstance) + { + + if (here->BSIM3v0owner != ARCHme) + continue; + + Check = 1; + ByPass = 0; + pParam = here->pParam; + if ((ckt->CKTmode & MODEINITSMSIG)) + { vbs = *(ckt->CKTstate0 + here->BSIM3v0vbs); + vgs = *(ckt->CKTstate0 + here->BSIM3v0vgs); + vds = *(ckt->CKTstate0 + here->BSIM3v0vds); + qdef = *(ckt->CKTstate0 + here->BSIM3v0qcdump); + } + else if ((ckt->CKTmode & MODEINITTRAN)) + { vbs = *(ckt->CKTstate1 + here->BSIM3v0vbs); + vgs = *(ckt->CKTstate1 + here->BSIM3v0vgs); + vds = *(ckt->CKTstate1 + here->BSIM3v0vds); + qdef = *(ckt->CKTstate1 + here->BSIM3v0qcdump); + } + else if ((ckt->CKTmode & MODEINITJCT) && !here->BSIM3v0off) + { vds = model->BSIM3v0type * here->BSIM3v0icVDS; + vgs = model->BSIM3v0type * here->BSIM3v0icVGS; + vbs = model->BSIM3v0type * here->BSIM3v0icVBS; + qdef = 0.0; + + if ((vds == 0.0) && (vgs == 0.0) && (vbs == 0.0) && + ((ckt->CKTmode & (MODETRAN | MODEAC|MODEDCOP | + MODEDCTRANCURVE)) || (!(ckt->CKTmode & MODEUIC)))) + { vbs = 0.0; + vgs = pParam->BSIM3v0vth0 + 0.1; + vds = 0.1; + } + } + else if ((ckt->CKTmode & (MODEINITJCT | MODEINITFIX)) && + (here->BSIM3v0off)) + { qdef = vbs = vgs = vds = 0.0; + } + else + { +#ifndef PREDICTOR + if ((ckt->CKTmode & MODEINITPRED)) + { xfact = ckt->CKTdelta / ckt->CKTdeltaOld[1]; + *(ckt->CKTstate0 + here->BSIM3v0vbs) = + *(ckt->CKTstate1 + here->BSIM3v0vbs); + vbs = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM3v0vbs)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM3v0vbs))); + *(ckt->CKTstate0 + here->BSIM3v0vgs) = + *(ckt->CKTstate1 + here->BSIM3v0vgs); + vgs = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM3v0vgs)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM3v0vgs))); + *(ckt->CKTstate0 + here->BSIM3v0vds) = + *(ckt->CKTstate1 + here->BSIM3v0vds); + vds = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM3v0vds)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM3v0vds))); + *(ckt->CKTstate0 + here->BSIM3v0vbd) = + *(ckt->CKTstate0 + here->BSIM3v0vbs) + - *(ckt->CKTstate0 + here->BSIM3v0vds); + qdef = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM3v0qcdump)) + -(xfact * (*(ckt->CKTstate2 + here->BSIM3v0qcdump))); + } + else + { +#endif /* PREDICTOR */ + vbs = model->BSIM3v0type + * (*(ckt->CKTrhsOld + here->BSIM3v0bNode) + - *(ckt->CKTrhsOld + here->BSIM3v0sNodePrime)); + vgs = model->BSIM3v0type + * (*(ckt->CKTrhsOld + here->BSIM3v0gNode) + - *(ckt->CKTrhsOld + here->BSIM3v0sNodePrime)); + vds = model->BSIM3v0type + * (*(ckt->CKTrhsOld + here->BSIM3v0dNodePrime) + - *(ckt->CKTrhsOld + here->BSIM3v0sNodePrime)); + qdef = *(ckt->CKTrhsOld + here->BSIM3v0qNode); +#ifndef PREDICTOR + } +#endif /* PREDICTOR */ + + vbd = vbs - vds; + vgd = vgs - vds; + vgdo = *(ckt->CKTstate0 + here->BSIM3v0vgs) + - *(ckt->CKTstate0 + here->BSIM3v0vds); + delvbs = vbs - *(ckt->CKTstate0 + here->BSIM3v0vbs); + delvbd = vbd - *(ckt->CKTstate0 + here->BSIM3v0vbd); + delvgs = vgs - *(ckt->CKTstate0 + here->BSIM3v0vgs); + delvds = vds - *(ckt->CKTstate0 + here->BSIM3v0vds); + delvgd = vgd - vgdo; + + if (here->BSIM3v0mode >= 0) + { cdhat = here->BSIM3v0cd - here->BSIM3v0gbd * delvbd + + here->BSIM3v0gmbs * delvbs + here->BSIM3v0gm * delvgs + + here->BSIM3v0gds * delvds; + } + else + { cdhat = here->BSIM3v0cd - (here->BSIM3v0gbd - here->BSIM3v0gmbs) + * delvbd - here->BSIM3v0gm * delvgd + + here->BSIM3v0gds * delvds; + + } + cbhat = here->BSIM3v0cbs + here->BSIM3v0cbd + here->BSIM3v0gbd + * delvbd + here->BSIM3v0gbs * delvbs; + +#ifndef NOBYPASS + /* following should be one big if connected by && all over + * the place, but some C compilers can't handle that, so + * we split it up here to let them digest it in stages + */ + + if ((!(ckt->CKTmode & MODEINITPRED)) && (ckt->CKTbypass)) + if ((fabs(delvbs) < (ckt->CKTreltol * MAX(fabs(vbs), + fabs(*(ckt->CKTstate0+here->BSIM3v0vbs))) + ckt->CKTvoltTol))) + if ((fabs(delvbd) < (ckt->CKTreltol * MAX(fabs(vbd), + fabs(*(ckt->CKTstate0+here->BSIM3v0vbd))) + ckt->CKTvoltTol))) + if ((fabs(delvgs) < (ckt->CKTreltol * MAX(fabs(vgs), + fabs(*(ckt->CKTstate0+here->BSIM3v0vgs))) + ckt->CKTvoltTol))) + if ((fabs(delvds) < (ckt->CKTreltol * MAX(fabs(vds), + fabs(*(ckt->CKTstate0+here->BSIM3v0vds))) + ckt->CKTvoltTol))) + if ((fabs(cdhat - here->BSIM3v0cd) < ckt->CKTreltol + * MAX(fabs(cdhat),fabs(here->BSIM3v0cd)) + ckt->CKTabstol)) + { tempv = MAX(fabs(cbhat),fabs(here->BSIM3v0cbs + + here->BSIM3v0cbd)) + ckt->CKTabstol; + if ((fabs(cbhat - (here->BSIM3v0cbs + here->BSIM3v0cbd)) + < ckt->CKTreltol * tempv)) + { /* bypass code */ + vbs = *(ckt->CKTstate0 + here->BSIM3v0vbs); + vbd = *(ckt->CKTstate0 + here->BSIM3v0vbd); + vgs = *(ckt->CKTstate0 + here->BSIM3v0vgs); + vds = *(ckt->CKTstate0 + here->BSIM3v0vds); + qcheq = *(ckt->CKTstate0 + here->BSIM3v0qcheq); + + vgd = vgs - vds; + vgb = vgs - vbs; + + cdrain = here->BSIM3v0mode * (here->BSIM3v0cd + + here->BSIM3v0cbd); + if ((ckt->CKTmode & (MODETRAN | MODEAC)) || + ((ckt->CKTmode & MODETRANOP) && + (ckt->CKTmode & MODEUIC))) + { ByPass = 1; + goto line755; + } + else + { goto line850; + } + } + } + +#endif /*NOBYPASS*/ + von = here->BSIM3v0von; + if (*(ckt->CKTstate0 + here->BSIM3v0vds) >= 0.0) + { vgs = DEVfetlim(vgs, *(ckt->CKTstate0+here->BSIM3v0vgs), von); + vds = vgs - vgd; + vds = DEVlimvds(vds, *(ckt->CKTstate0 + here->BSIM3v0vds)); + vgd = vgs - vds; + + } + else + { vgd = DEVfetlim(vgd, vgdo, von); + vds = vgs - vgd; + vds = -DEVlimvds(-vds, -(*(ckt->CKTstate0+here->BSIM3v0vds))); + vgs = vgd + vds; + } + + if (vds >= 0.0) + { vbs = DEVpnjlim(vbs, *(ckt->CKTstate0 + here->BSIM3v0vbs), + CONSTvt0, model->BSIM3v0vcrit, &Check); + vbd = vbs - vds; + + } + else + { vbd = DEVpnjlim(vbd, *(ckt->CKTstate0 + here->BSIM3v0vbd), + CONSTvt0, model->BSIM3v0vcrit, &Check); + vbs = vbd + vds; + } + } + + /* determine DC current and derivatives */ + vbd = vbs - vds; + vgd = vgs - vds; + vgb = vgs - vbs; + + m = here->BSIM3v0m; + + SourceSatCurrent = here->BSIM3v0sourceArea*model->BSIM3v0jctSatCurDensity; + if (here->BSIM3v0sourceArea <= 0.0) + SourceSatCurrent = 1.0e-14; + if (SourceSatCurrent <= 0.0) + { here->BSIM3v0gbs = ckt->CKTgmin; + here->BSIM3v0cbs = here->BSIM3v0gbs * vbs; + } + else if (vbs <= -0.5) + { here->BSIM3v0gbs = ckt->CKTgmin; + here->BSIM3v0cbs = -SourceSatCurrent + here->BSIM3v0gbs * vbs; + } + else if (vbs < 0.5) + { evbs = exp(vbs / CONSTvt0); + here->BSIM3v0gbs = SourceSatCurrent * evbs / CONSTvt0 + + ckt->CKTgmin; + here->BSIM3v0cbs = SourceSatCurrent * (evbs - 1.0) + + ckt->CKTgmin * vbs; + } + else + { evbs = exp(0.5 / CONSTvt0); + here->BSIM3v0gbs = SourceSatCurrent * evbs / CONSTvt0 + + ckt->CKTgmin; + here->BSIM3v0cbs = SourceSatCurrent * (evbs - 1.0) + + ckt->CKTgmin * 0.5; + } + + DrainSatCurrent = here->BSIM3v0drainArea * model->BSIM3v0jctSatCurDensity; + if (here->BSIM3v0drainArea <= 0.0) + DrainSatCurrent = 1.0e-14; + if (DrainSatCurrent <= 0.0) + { here->BSIM3v0gbd = ckt->CKTgmin; + here->BSIM3v0cbd = here->BSIM3v0gbd * vbd; + } + else if (vbd <= -0.5) + { here->BSIM3v0gbd = ckt->CKTgmin; + here->BSIM3v0cbd = -DrainSatCurrent + here->BSIM3v0gbd * vbd; + } + else if (vbd < 0.5) + { evbd = exp(vbd/CONSTvt0); + here->BSIM3v0gbd = DrainSatCurrent * evbd / CONSTvt0 + + ckt->CKTgmin; + here->BSIM3v0cbd = DrainSatCurrent * (evbd - 1.0) + + ckt->CKTgmin * vbd; + } + else + { evbd = exp(0.5/CONSTvt0); + here->BSIM3v0gbd = DrainSatCurrent * evbd / CONSTvt0 + + ckt->CKTgmin; + here->BSIM3v0cbd = DrainSatCurrent * (evbd - 1.0) + + ckt->CKTgmin * 0.5; + } + + if (vds >= 0.0) + { /* normal mode */ + here->BSIM3v0mode = 1; + Vds = vds; + Vgs = vgs; + Vbs = vbs; + } + else + { /* inverse mode */ + here->BSIM3v0mode = -1; + Vds = -vds; + Vgs = vgd; + Vbs = vbd; + } + + ChargeComputationNeeded = + ((ckt->CKTmode & (MODEAC | MODETRAN | MODEINITSMSIG)) || + ((ckt->CKTmode & MODETRANOP) && (ckt->CKTmode & MODEUIC))) + ? 1 : 0; + + T0 = Vbs - pParam->BSIM3v0vbsc - 0.001; + T1 = sqrt(T0 * T0 - 0.004 * pParam->BSIM3v0vbsc); + Vbseff = pParam->BSIM3v0vbsc + 0.5 * (T0 + T1); + dVbseff_dVb = 0.5 * (1.0 + T0 / T1); + + if (Vbseff > 0.0) + { T0 = pParam->BSIM3v0phi / (pParam->BSIM3v0phi + Vbseff); + Phis = pParam->BSIM3v0phi * T0; + dPhis_dVb = -T0 * T0; + sqrtPhis = pParam->BSIM3v0phis3 / (pParam->BSIM3v0phi + 0.5 * Vbseff); + dsqrtPhis_dVb = -0.5 * sqrtPhis * sqrtPhis / pParam->BSIM3v0phis3; + } + else + { Phis = pParam->BSIM3v0phi - Vbseff; + dPhis_dVb = -1.0; + sqrtPhis = sqrt(Phis); + dsqrtPhis_dVb = -0.5 / sqrtPhis; + } + Xdep = pParam->BSIM3v0Xdep0 * sqrtPhis / pParam->BSIM3v0sqrtPhi; + dXdep_dVb = (pParam->BSIM3v0Xdep0 / pParam->BSIM3v0sqrtPhi) + * dsqrtPhis_dVb; + + Leff = pParam->BSIM3v0leff; +/* Vth Calculation */ + if ((T1 = 1.0 + pParam->BSIM3v0dvt2 * Vbseff) < 1.0e-10) + T1 = 1.0E-10; + if ((T2 = 1.0 + pParam->BSIM3v0dvt2w * Vbseff) < 1.0E-10) + T2 = 1.0E-10; + + T3 = sqrt(Xdep); + lt1 = model->BSIM3v0factor1 * T3 * T1; + dlt1_dVb = model->BSIM3v0factor1 * (0.5 / T3 * T1 * dXdep_dVb + + T3 * pParam->BSIM3v0dvt2); + + ltw = model->BSIM3v0factor1 * T3 * T2; + dltw_dVb = model->BSIM3v0factor1 * (0.5 / T3 * T2 * dXdep_dVb + + T3 * pParam->BSIM3v0dvt2w); + + T0 = -0.5 * pParam->BSIM3v0dvt1 * Leff / lt1; + if (T0 > -EXP_THRESHOLD) + { T1 = exp(T0); + dT1_dVb = -T0 / lt1 * T1 * dlt1_dVb; + } + else + { T1 = MIN_EXP; + dT1_dVb = 0.0; + } + + Theta0 = T1 * (1.0 + 2.0 * T1); + dTheta0_dVb = (1.0 + 4.0 * T1) * dT1_dVb; + + here->BSIM3v0thetavth = pParam->BSIM3v0dvt0 * Theta0; + T0 = pParam->BSIM3v0vbi - pParam->BSIM3v0phi; + Delt_vth = here->BSIM3v0thetavth * T0; + dDelt_vth_dVb = pParam->BSIM3v0dvt0 * dTheta0_dVb * T0; + + T0 = -0.5 * pParam->BSIM3v0dvt1w * pParam->BSIM3v0weff * Leff / ltw; + if (T0 > -EXP_THRESHOLD) + { T1 = exp(T0); + dT1_dVb = -T0 / ltw * T1 * dltw_dVb; + } + else + { T1 = MIN_EXP; + dT1_dVb = 0.0; + } + + T2 = T1 * (1.0 + 2.0 * T1); + dT2_dVb = (1.0 + 4.0 * T1) * dT1_dVb; + + T0 = pParam->BSIM3v0dvt0w * T2; + T1 = pParam->BSIM3v0vbi - pParam->BSIM3v0phi; + T2 = T0 * T1; + dT2_dVb = pParam->BSIM3v0dvt0w * dT2_dVb * T1; + + TempRatio = ckt->CKTtemp / model->BSIM3v0tnom - 1.0; + T0 = sqrt(1.0 + pParam->BSIM3v0nlx / Leff); + T1 = pParam->BSIM3v0k1 * (T0 - 1.0) * pParam->BSIM3v0sqrtPhi + + (pParam->BSIM3v0kt1 + pParam->BSIM3v0kt1l / Leff + + pParam->BSIM3v0kt2 * Vbseff) * TempRatio; + tmp2 = model->BSIM3v0tox / (pParam->BSIM3v0weff + + pParam->BSIM3v0w0) * pParam->BSIM3v0phi; + + dDIBL_Sft_dVd = (pParam->BSIM3v0eta0 + pParam->BSIM3v0etab + * Vbseff) * pParam->BSIM3v0theta0vb0; + DIBL_Sft = dDIBL_Sft_dVd * Vds; + + Vth = model->BSIM3v0type * pParam->BSIM3v0vth0 + pParam->BSIM3v0k1 + * (sqrtPhis - pParam->BSIM3v0sqrtPhi) - pParam->BSIM3v0k2 + * Vbseff - Delt_vth - T2 + (pParam->BSIM3v0k3 + pParam->BSIM3v0k3b + * Vbseff) * tmp2 + T1 - DIBL_Sft; + + here->BSIM3v0von = Vth; + + dVth_dVb = pParam->BSIM3v0k1 * dsqrtPhis_dVb - pParam->BSIM3v0k2 + - dDelt_vth_dVb - dT2_dVb + pParam->BSIM3v0k3b * tmp2 + - pParam->BSIM3v0etab * Vds * pParam->BSIM3v0theta0vb0 + + pParam->BSIM3v0kt2 * TempRatio; + dVth_dVd = -dDIBL_Sft_dVd; + +/* Calculate n */ + tmp2 = pParam->BSIM3v0nfactor * EPSSI / Xdep; + tmp3 = pParam->BSIM3v0cdsc + pParam->BSIM3v0cdscb * Vbseff + + pParam->BSIM3v0cdscd * Vds; + n = 1.0 + (tmp2 + tmp3 * Theta0 + pParam->BSIM3v0cit) / model->BSIM3v0cox; + if (n > 1.0) + { dn_dVb = (-tmp2 / Xdep * dXdep_dVb + tmp3 * dTheta0_dVb + + pParam->BSIM3v0cdscb * Theta0) / model->BSIM3v0cox; + dn_dVd = pParam->BSIM3v0cdscd * Theta0 / model->BSIM3v0cox; + } + else + { n = 1.0; + dn_dVb = dn_dVd = 0.0; + } + +/* Poly Gate Si Depletion Effect */ + T0 = pParam->BSIM3v0vfb + pParam->BSIM3v0phi; + if (model->BSIM3v0ngateGiven && (Vgs > T0)) + { T1 = 1.0e6 * Charge_q * EPSSI * pParam->BSIM3v0ngate + / (model->BSIM3v0cox * model->BSIM3v0cox); + T4 = sqrt(1.0 + 2.0 * (Vgs - T0) / T1); + T2 = T1 * (T4 - 1.0); + T3 = 0.5 * T2 * T2 / T1; + + if (T3 < 1.12) + { Vgs_eff = T0 + T2; + dVgs_eff_dVg = 1.0 / T4; + } + else + { Vgs_eff = Vgs - 1.12; + dVgs_eff_dVg = 1.0; + } + } + else + { Vgs_eff = Vgs; + dVgs_eff_dVg = 1.0; + } + Vgst = Vgs_eff - Vth; + +/* Effective Vgst (Vgsteff) Calculation */ + Vtm = model->BSIM3v0vtm; + + T10 = 2.0 * n * Vtm; + VgstNVt = Vgst / T10; + if (VgstNVt < -EXP_THRESHOLD) + { T1 = T10 * MIN_EXP; + dT1_dVg = dT1_dVd = dT1_dVb = 0.0; + } + else if (VgstNVt > EXP_THRESHOLD) + { T1 = Vgst; + dT1_dVg = dVgs_eff_dVg; + dT1_dVd = -dVth_dVd; + dT1_dVb = -dVth_dVb; + } + else + { ExpVgst = exp(VgstNVt); + T1 = T10 * log(1.0 + ExpVgst); + dT1_dVg = ExpVgst / (1.0 + ExpVgst); + dT1_dVb = -dT1_dVg * (dVth_dVb + Vgst / n * dn_dVb) + + T1 / n * dn_dVb; + dT1_dVd = -dT1_dVg * (dVth_dVd + Vgst / n * dn_dVd) + + T1 / n * dn_dVd; + dT1_dVg *= dVgs_eff_dVg; + } + + T2 = model->BSIM3v0tox / (pParam->BSIM3v0weff + pParam->BSIM3v0w0); + ExpArg = (2.0 * pParam->BSIM3v0voff - Vgst) / T10; + if (ExpArg < -EXP_THRESHOLD) + { T2 = 1.0; + dT2_dVg = dT2_dVd = dT2_dVb = 0.0; + + } + else if (ExpArg > EXP_THRESHOLD) + { T2 = 1.0 + 2.0 * n * model->BSIM3v0cox / pParam->BSIM3v0cdep0 + * MAX_EXP; + dT2_dVg = dT2_dVd = dT2_dVb = 0.0; + } + else + { dT2_dVg = -model->BSIM3v0cox / Vtm / pParam->BSIM3v0cdep0 + * exp(ExpArg); + T2 = 1.0 - T10 * dT2_dVg; + dT2_dVd = -dT2_dVg * (dVth_dVd - 2.0 * Vtm + * ExpArg * dn_dVd) + (T2 - 1.0) / n * dn_dVd; + dT2_dVb = -dT2_dVg * (dVth_dVb - 2.0 * Vtm + * ExpArg * dn_dVb) + (T2 - 1.0) / n * dn_dVb; + dT2_dVg *= dVgs_eff_dVg; + } + + Vgsteff = T1 / T2; + dVgsteff_dVg = (T2 * dT1_dVg - T1 * dT2_dVg) / (T2 * T2); + dVgsteff_dVd = (T2 * dT1_dVd - T1 * dT2_dVd) / (T2 * T2); + dVgsteff_dVb = (T2 * dT1_dVb - T1 * dT2_dVb) / (T2 * T2); + +/* Calculate Effective Channel Geometry */ + Weff = pParam->BSIM3v0weff - 2.0 * (pParam->BSIM3v0dwg * Vgsteff + + pParam->BSIM3v0dwb * (sqrtPhis - pParam->BSIM3v0sqrtPhi)); + dWeff_dVg = -2.0 * pParam->BSIM3v0dwg; + dWeff_dVb = -2.0 * pParam->BSIM3v0dwb * dsqrtPhis_dVb; + + if (Weff < 1.0e-8) + { Weff = 1.0e-8; + dWeff_dVg = dWeff_dVb = 0; + } + + Rds = pParam->BSIM3v0rds0 * (1.0 + pParam->BSIM3v0prwg * Vgsteff + + pParam->BSIM3v0prwb * (sqrtPhis - pParam->BSIM3v0sqrtPhi)); + if (Rds > 0.0) + { dRds_dVg = pParam->BSIM3v0rds0 * pParam->BSIM3v0prwg; + dRds_dVb = pParam->BSIM3v0rds0 * pParam->BSIM3v0prwb * dsqrtPhis_dVb; + } + else + { Rds = dRds_dVg = dRds_dVb = 0.0; + } + + WVCox = Weff * pParam->BSIM3v0vsattemp * model->BSIM3v0cox; + WVCoxRds = WVCox * Rds; + +/* Calculate Abulk */ + T0 = 1.0 / (1.0 + pParam->BSIM3v0keta * Vbseff); + dT0_dVb = -pParam->BSIM3v0keta * T0 * T0; + + T1 = 0.5 * pParam->BSIM3v0k1 / sqrtPhis; + dT1_dVb = -T1 / sqrtPhis * dsqrtPhis_dVb; + + tmp1 = Leff + 2.0 * sqrt(pParam->BSIM3v0xj * Xdep); + T5 = Leff / tmp1; + tmp2 = pParam->BSIM3v0a0 *T5; + tmp3 = pParam->BSIM3v0weff + pParam->BSIM3v0b1; + tmp4 = pParam->BSIM3v0b0 / tmp3; + T2 = tmp2 + tmp4; + dT2_dVb = -tmp2 / tmp1 * sqrt(pParam->BSIM3v0xj / Xdep) * dXdep_dVb; + T6 = T5 * T5; + T7 = T5 * T6; + Abulk0 = T0 * (1.0 + T1 * T2); + if (Abulk0 < 0.01) + Abulk0= 0.01; + T8 = pParam->BSIM3v0ags * pParam->BSIM3v0a0 * T7; + dAbulk_dVg = -T1 * T0 * T8; + Abulk = Abulk0 + dAbulk_dVg * Vgsteff; + if (Abulk < 0.01) + Abulk= 0.01; + + dAbulk0_dVb = T0 * T1 * dT2_dVb + T0 * T2 * dT1_dVb + + (1.0 + T1 * T2) * dT0_dVb; + dAbulk_dVb = dAbulk0_dVb - T8 * Vgsteff * (T1 * (3.0 * T0 * dT2_dVb + / tmp2 + dT0_dVb) + T0 * dT1_dVb); +/* Mobility calculation */ + + if (model->BSIM3v0mobMod == 1) + { T0 = Vgsteff + Vth + Vth; + T2 = pParam->BSIM3v0ua + pParam->BSIM3v0uc * Vbseff; + T3 = T0 / model->BSIM3v0tox; + Denomi = 1.0 + T3 * (T2 + + pParam->BSIM3v0ub * T3); + T1 = T2 / model->BSIM3v0tox + 2.0 * pParam->BSIM3v0ub * T3 + / model->BSIM3v0tox; + dDenomi_dVg = T1; + dDenomi_dVd = T1 * 2.0 * dVth_dVd; + dDenomi_dVb = T1 * 2.0 * dVth_dVb + pParam->BSIM3v0uc * T3; + } + else if (model->BSIM3v0mobMod == 2) + { Denomi = 1.0 + Vgsteff / model->BSIM3v0tox * (pParam->BSIM3v0ua + + pParam->BSIM3v0uc * Vbseff + pParam->BSIM3v0ub * Vgsteff + / model->BSIM3v0tox); + T1 = (pParam->BSIM3v0ua + pParam->BSIM3v0uc * Vbseff) / model->BSIM3v0tox + + 2.0 * pParam->BSIM3v0ub / (model->BSIM3v0tox * model->BSIM3v0tox) + * Vgsteff; + dDenomi_dVg = T1; + dDenomi_dVd = 0.0; + dDenomi_dVb = Vgsteff * pParam->BSIM3v0uc / model->BSIM3v0tox; + } + else + { T0 = Vgsteff + Vth + Vth; + T2 = 1.0 + pParam->BSIM3v0uc * Vbseff; + T3 = T0 / model->BSIM3v0tox; + T4 = T3 * (pParam->BSIM3v0ua + pParam->BSIM3v0ub * T3); + Denomi = 1.0 + T4 * T2; + + T1 = (pParam->BSIM3v0ua / model->BSIM3v0tox + 2.0 * pParam->BSIM3v0ub + * T3 / model->BSIM3v0tox) * T2; + dDenomi_dVg = T1; + dDenomi_dVd = T1 * 2.0 * dVth_dVd; + dDenomi_dVb = T1 * 2.0 * dVth_dVb + pParam->BSIM3v0uc * T4; + } + + here->BSIM3v0ueff = ueff = pParam->BSIM3v0u0temp / Denomi; + dueff_dVg = -ueff / Denomi * dDenomi_dVg; + dueff_dVd = -ueff / Denomi * dDenomi_dVd; + dueff_dVb = -ueff / Denomi * dDenomi_dVb; + + +/* Saturation Drain Voltage Vdsat */ + Esat = 2.0 * pParam->BSIM3v0vsattemp / ueff; + EsatL = Esat * Leff; + T0 = -EsatL /ueff; + dEsatL_dVg = T0 * dueff_dVg; + dEsatL_dVd = T0 * dueff_dVd; + dEsatL_dVb = T0 * dueff_dVb; + + a1 = pParam->BSIM3v0a1; + if ((Pmos_factor = a1 * Vgsteff + pParam->BSIM3v0a2) > 1.0) + { Pmos_factor = 1.0; + a1 = 0.0; + } + + Vgst2Vtm = Vgsteff + 2.0 * Vtm; + if ((Rds == 0.0) && (Pmos_factor == 1.0)) + { T0 = 1.0 / (Abulk * EsatL + Vgst2Vtm); + here->BSIM3v0vdsat = Vdsat = EsatL * Vgst2Vtm * T0; + + dT0_dVg = -(Abulk * dEsatL_dVg +EsatL*dAbulk_dVg+ 1.0) * T0 * T0; + dT0_dVd = -(Abulk * dEsatL_dVd) * T0 * T0; + dT0_dVb = -(Abulk * dEsatL_dVb + dAbulk_dVb * EsatL) * T0 * T0; + + dVdsat_dVg = EsatL * Vgst2Vtm * dT0_dVg + EsatL * T0 + + Vgst2Vtm * T0 * dEsatL_dVg; + dVdsat_dVd = EsatL * Vgst2Vtm * dT0_dVd + + Vgst2Vtm * T0 * dEsatL_dVd; + dVdsat_dVb = EsatL * Vgst2Vtm * dT0_dVb + + Vgst2Vtm * T0 * dEsatL_dVb; + } + else + { tmp1 = a1 / (Pmos_factor * Pmos_factor); + if (Rds > 0) + { tmp2 = dRds_dVg / Rds + dWeff_dVg / Weff; + tmp3 = dRds_dVb / Rds + dWeff_dVb / Weff; + } + else + { tmp2 = dWeff_dVg / Weff; + tmp3 = dWeff_dVb / Weff; + } + + T0 = 2.0 * Abulk * (Abulk * WVCoxRds - 1.0 + 1.0 / Pmos_factor); + dT0_dVg = 2.0 * (Abulk * Abulk * WVCoxRds * tmp2 - Abulk * tmp1 + + (2.0 * WVCoxRds * Abulk + 1.0 / Pmos_factor - 1.0) + * dAbulk_dVg); + + dT0_dVb = 2.0 * (Abulk * Abulk * WVCoxRds * (2.0 / Abulk + * dAbulk_dVb + tmp3) + (1.0 / Pmos_factor - 1.0) + * dAbulk_dVb); + dT0_dVd= 0.0; + T1 = Vgst2Vtm * (2.0 / Pmos_factor - 1.0) + Abulk + * EsatL + 3.0 * Abulk * Vgst2Vtm * WVCoxRds; + + dT1_dVg = (2.0 / Pmos_factor - 1.0) - 2.0 * Vgst2Vtm * tmp1 + + Abulk * dEsatL_dVg + EsatL * dAbulk_dVg + 3.0 * (Abulk + * WVCoxRds + Abulk * Vgst2Vtm * WVCoxRds * tmp2 + Vgst2Vtm + * WVCoxRds * dAbulk_dVg); + dT1_dVb = Abulk * dEsatL_dVb + EsatL * dAbulk_dVb + + 3.0 * (Vgst2Vtm * WVCoxRds * dAbulk_dVb + + Abulk * Vgst2Vtm * WVCoxRds * tmp3); + dT1_dVd = Abulk * dEsatL_dVd; + + T2 = Vgst2Vtm * (EsatL + 2.0 * Vgst2Vtm * WVCoxRds); + dT2_dVg = EsatL + Vgst2Vtm * dEsatL_dVg + Vgst2Vtm * WVCoxRds + * (4.0 + 2.0 * Vgst2Vtm * tmp2); + dT2_dVb = Vgst2Vtm * dEsatL_dVb + 2.0 * Vgst2Vtm * WVCoxRds + * Vgst2Vtm * tmp3; + dT2_dVd = Vgst2Vtm * dEsatL_dVd; + + T3 = sqrt(T1 * T1 - 2.0 * T0 * T2); + here->BSIM3v0vdsat = Vdsat = (T1 - T3) / T0; + + dT3_dVg = (T1 * dT1_dVg - 2.0 * (T0 * dT2_dVg + T2 * dT0_dVg)) + / T3; + dT3_dVd = (T1 * dT1_dVd - 2.0 * (T0 * dT2_dVd + T2 * dT0_dVd)) + / T3; + dT3_dVb = (T1 * dT1_dVb - 2.0 * (T0 * dT2_dVb + T2 * dT0_dVb)) + / T3; + + T4 = T1 - T3; + dT4_dVg = - dT1_dVg - dT3_dVg; + dT4_dVd = - dT1_dVd - dT3_dVd; + dT4_dVb = - dT1_dVb - dT3_dVb; + + dVdsat_dVg = (dT1_dVg - (T1 * dT1_dVg - dT0_dVg * T2 + - T0 * dT2_dVg) / T3 - Vdsat * dT0_dVg) / T0; + dVdsat_dVb = (dT1_dVb - (T1 * dT1_dVb - dT0_dVb * T2 + - T0 * dT2_dVb) / T3 - Vdsat * dT0_dVb) / T0; + dVdsat_dVd = (dT1_dVd - (T1 * dT1_dVd - T0 * dT2_dVd) / T3) / T0; + } + +/* Effective Vds (Vdseff) Calculation */ + T1 = Vdsat - Vds - pParam->BSIM3v0delta; + dT1_dVg = dVdsat_dVg; + dT1_dVd = dVdsat_dVd - 1.0; + dT1_dVb = dVdsat_dVb; + + T2 = sqrt(T1 * T1 + 4.0 * pParam->BSIM3v0delta * Vdsat); + T0 = T1 / T2; + T3 = 2.0 * pParam->BSIM3v0delta / T2; + dT2_dVg = T0 * dT1_dVg + T3 * dVdsat_dVg; + dT2_dVd = T0 * dT1_dVd + T3 * dVdsat_dVd; + dT2_dVb = T0 * dT1_dVb + T3 * dVdsat_dVb; + + Vdseff = Vdsat - 0.5 * (T1 + T2); + dVdseff_dVg = dVdsat_dVg - 0.5 * (dT1_dVg + dT2_dVg); + dVdseff_dVd = dVdsat_dVd - 0.5 * (dT1_dVd + dT2_dVd); + dVdseff_dVb = dVdsat_dVb - 0.5 * (dT1_dVb + dT2_dVb); + +/* Calculate VAsat */ + tmp1 = a1 / (Pmos_factor * Pmos_factor); + if (Rds > 0) + { tmp2 = dRds_dVg / Rds + dWeff_dVg / Weff; + tmp3 = dRds_dVb / Rds + dWeff_dVb / Weff; + } + else + { tmp2 = dWeff_dVg / Weff; + tmp3 = dWeff_dVb / Weff; + } + tmp4 = 1.0 - 0.5 * Abulk * Vdsat / Vgst2Vtm; + T0 = EsatL + Vdsat + 2.0 * WVCoxRds * Vgsteff * tmp4; + + dT0_dVg = dEsatL_dVg + dVdsat_dVg + 2.0 * WVCoxRds * tmp4 + * (1.0 + tmp2 * Vgsteff) - WVCoxRds * Vgsteff / Vgst2Vtm + * (Abulk * dVdsat_dVg - Abulk * Vdsat / Vgst2Vtm + + Vdsat * dAbulk_dVg); + + dT0_dVb = dEsatL_dVb + dVdsat_dVb + 2.0 * WVCoxRds * tmp4 * tmp3 + * Vgsteff - WVCoxRds * Vgsteff / Vgst2Vtm * (dAbulk_dVb + * Vdsat + Abulk * dVdsat_dVb); + dT0_dVd = dEsatL_dVd + dVdsat_dVd - WVCoxRds * Vgsteff / Vgst2Vtm + * Abulk * dVdsat_dVd; + + T1 = 2.0 / Pmos_factor - 1.0 + WVCoxRds * Abulk; + dT1_dVg = -2.0 * tmp1 + WVCoxRds *(Abulk * tmp2+ dAbulk_dVg); + dT1_dVb = dAbulk_dVb * WVCoxRds + Abulk * WVCoxRds * tmp3; + + Vasat = T0 / T1; + dVasat_dVg = (dT0_dVg - T0 / T1 * dT1_dVg) / T1; + dVasat_dVb = (dT0_dVb - T0 / T1 * dT1_dVb) / T1; + dVasat_dVd = dT0_dVd / T1; + + diffVds = Vds - Vdseff; +/* Calculate VACLM */ + if (pParam->BSIM3v0pclm > 0.0) + { T0 = 1.0 / (pParam->BSIM3v0pclm * Abulk * pParam->BSIM3v0litl); + dT0_dVb = -T0 / Abulk * dAbulk_dVb; + dT0_dVg= - T0/Abulk*dAbulk_dVg; + + T2 = Vgsteff / EsatL; + T1 = Leff * (Abulk + T2); + dT1_dVg = Leff * ((1.0 - T2 * dEsatL_dVg) / EsatL+dAbulk_dVg); + dT1_dVb = Leff * (dAbulk_dVb - T2 * dEsatL_dVb / EsatL); + dT1_dVd = -T2 * dEsatL_dVd / Esat; + + VACLM = T0 * T1 * diffVds; + dVACLM_dVg = T0 * dT1_dVg * diffVds - T0 * T1 * dVdseff_dVg + + T1 * diffVds * dT0_dVg; + dVACLM_dVb = (dT0_dVb * T1 + T0 * dT1_dVb) * diffVds + - T0 * T1 * dVdseff_dVb; + dVACLM_dVd = T0 * dT1_dVd * diffVds + + T0 * T1 * (1.0 - dVdseff_dVd); + } + else + { VACLM = MAX_EXP; + dVACLM_dVd = dVACLM_dVg = dVACLM_dVb = 0.0; + } + +/* Calculate VADIBL */ + if (pParam->BSIM3v0thetaRout > 0.0) + { T0 = Vgst2Vtm * Abulk * Vdsat; + dT0_dVg = Vgst2Vtm * Abulk * dVdsat_dVg + Abulk * Vdsat + + Vgst2Vtm * Vdsat * dAbulk_dVg; + dT0_dVb = Vgst2Vtm * (dAbulk_dVb * Vdsat + Abulk * dVdsat_dVb); + dT0_dVd = Vgst2Vtm * Abulk * dVdsat_dVd; + + T1 = Vgst2Vtm + Abulk * Vdsat; + dT1_dVg = 1.0 + Abulk * dVdsat_dVg + Vdsat * dAbulk_dVg; + dT1_dVb = Abulk * dVdsat_dVb + dAbulk_dVb * Vdsat; + dT1_dVd = Abulk * dVdsat_dVd; + + T2 = pParam->BSIM3v0thetaRout * (1.0 + pParam->BSIM3v0pdiblb * Vbseff); + VADIBL = (Vgst2Vtm - T0 / T1) / T2; + dVADIBL_dVg = (1.0 - dT0_dVg / T1 + T0 * dT1_dVg / (T1 * T1)) / T2; + dVADIBL_dVb = ((-dT0_dVb / T1 + T0 * dT1_dVb / (T1 * T1)) - VADIBL + * pParam->BSIM3v0thetaRout * pParam->BSIM3v0pdiblb) / T2; + dVADIBL_dVd = (-dT0_dVd / T1 + T0 * dT1_dVd / (T1 * T1)) / T2; + } + else + { VADIBL = MAX_EXP; + dVADIBL_dVd = dVADIBL_dVg = dVADIBL_dVb = 0.0; + } + +/* Calculate VA */ + T0 = 1.0 + pParam->BSIM3v0pvag * Vgsteff / EsatL; + dT0_dVg = pParam->BSIM3v0pvag * (1.0 - Vgsteff * dEsatL_dVg + / EsatL) / EsatL; + dT0_dVb = -pParam->BSIM3v0pvag * Vgsteff * dEsatL_dVb + / EsatL / EsatL; + dT0_dVd = -pParam->BSIM3v0pvag * Vgsteff * dEsatL_dVd + / EsatL / EsatL; + + tmp1 = VACLM * VACLM; + tmp2 = VADIBL * VADIBL; + tmp3 = VACLM + VADIBL; + + T1 = VACLM * VADIBL / tmp3; + tmp3 *= tmp3; + dT1_dVg = (tmp1 * dVADIBL_dVg + tmp2 * dVACLM_dVg) / tmp3; + dT1_dVd = (tmp1 * dVADIBL_dVd + tmp2 * dVACLM_dVd) / tmp3; + dT1_dVb = (tmp1 * dVADIBL_dVb + tmp2 * dVACLM_dVb) / tmp3; + + Va = Vasat + T0 * T1; + dVa_dVg = dVasat_dVg + T1 * dT0_dVg + T0 * dT1_dVg; + dVa_dVd = dVasat_dVd + T1 * dT0_dVd + T0 * dT1_dVd; + dVa_dVb = dVasat_dVb + T1 * dT0_dVb + T0 * dT1_dVb; + +/* Calculate VASCBE */ + if ((diffVds) && ((T0 = pParam->BSIM3v0pscbe1 * pParam->BSIM3v0litl + / diffVds) > 0.0) && (T0 < EXP_THRESHOLD)) + { VASCBE = Leff * exp(T0) / pParam->BSIM3v0pscbe2; + T1 = T0 * VASCBE / diffVds; + dVASCBE_dVg = T1 * dVdseff_dVg; + dVASCBE_dVd = -T1 * (1.0 - dVdseff_dVd); + dVASCBE_dVb = T1 * dVdseff_dVb; + } + else + { VASCBE = MAX_EXP*Leff/pParam->BSIM3v0pscbe2; + dVASCBE_dVg = dVASCBE_dVd = dVASCBE_dVb = 0.0; + } + +/* Calculate Ids */ + CoxWovL = model->BSIM3v0cox * Weff / Leff; + beta = ueff * CoxWovL; + dbeta_dVg = CoxWovL * dueff_dVg + beta * dWeff_dVg / Weff; + dbeta_dVd = CoxWovL * dueff_dVd; + dbeta_dVb = CoxWovL * dueff_dVb + beta * dWeff_dVb / Weff; + + T0 = 1.0 - 0.5 * Abulk * Vdseff / Vgst2Vtm; + dT0_dVg = -0.5 * (Abulk * dVdseff_dVg + - Abulk * Vdseff / Vgst2Vtm+Vdseff*dAbulk_dVg) / Vgst2Vtm; + dT0_dVd = -0.5 * Abulk * dVdseff_dVd / Vgst2Vtm; + dT0_dVb = -0.5 * (Abulk * dVdseff_dVb + dAbulk_dVb * Vdseff) + / Vgst2Vtm; + + fgche1 = Vgsteff * T0; + dfgche1_dVg = Vgsteff * dT0_dVg + T0; + dfgche1_dVd = Vgsteff * dT0_dVd; + dfgche1_dVb = Vgsteff * dT0_dVb; + + fgche2 = 1.0 + Vdseff / EsatL; + dfgche2_dVg = (dVdseff_dVg - Vdseff / EsatL * dEsatL_dVg) / EsatL; + dfgche2_dVd = (dVdseff_dVd - Vdseff / EsatL * dEsatL_dVd) / EsatL; + dfgche2_dVb = (dVdseff_dVb - Vdseff / EsatL * dEsatL_dVb) / EsatL; + + gche = beta * fgche1 / fgche2; + dgche_dVg = (beta * dfgche1_dVg + fgche1 * dbeta_dVg + - gche * dfgche2_dVg) / fgche2; + dgche_dVd = (beta * dfgche1_dVd + fgche1 * dbeta_dVd + - gche * dfgche2_dVd) / fgche2; + dgche_dVb = (beta * dfgche1_dVb + fgche1 * dbeta_dVb + - gche * dfgche2_dVb) / fgche2; + + T0 = 1.0 + gche * Rds; + Idl = gche * Vdseff / T0; + + dIdl_dVg = (gche * dVdseff_dVg + Vdseff * dgche_dVg / T0) / T0 + - Idl * gche / T0 * dRds_dVg ; + + dIdl_dVd = (gche * dVdseff_dVd + Vdseff * dgche_dVd / T0) / T0; + dIdl_dVb = (gche * dVdseff_dVb + Vdseff * dgche_dVb / T0 + - Idl * dRds_dVb * gche) / T0; + + T0 = 1.0 + diffVds / Va; + Idsa = Idl * T0; + dIdsa_dVg = T0 * dIdl_dVg - Idl * (dVdseff_dVg + diffVds / Va + * dVa_dVg) / Va; + dIdsa_dVd = T0 * dIdl_dVd + Idl * (1.0 - dVdseff_dVd - diffVds / Va + * dVa_dVd) / Va; + dIdsa_dVb = T0 * dIdl_dVb - Idl * (dVdseff_dVb + diffVds / Va + * dVa_dVb) / Va; + + T0 = 1.0 + diffVds / VASCBE; + Ids = Idsa * T0; + + Gm = T0 * dIdsa_dVg - Idsa * (dVdseff_dVg + diffVds / VASCBE + * dVASCBE_dVg) / VASCBE; + Gds = T0 * dIdsa_dVd + Idsa * (1.0 - dVdseff_dVd - diffVds / VASCBE + * dVASCBE_dVd) / VASCBE; + Gmb = T0 * dIdsa_dVb - Idsa * (dVdseff_dVb + diffVds / VASCBE + * dVASCBE_dVb) / VASCBE; + + Gds += Gm * dVgsteff_dVd; + Gmb += Gm * dVgsteff_dVb; + Gm *= dVgsteff_dVg; + Gmb *= dVbseff_dVb; + +/* calculate substrate current Isub */ + if ((pParam->BSIM3v0alpha0 <= 0.0) || (pParam->BSIM3v0beta0 <= 0.0)) + { Isub = Gbd = Gbb = Gbg = 0.0; + } + else + { T2 = pParam->BSIM3v0alpha0 / Leff; + if (diffVds<0.0) { + diffVds=0.0; + Vdseff=Vds; + } /* added to avoid the hardwrae problem + when Vds=0 */ + + if ((diffVds != 0.0) && ((T0 = -pParam->BSIM3v0beta0 / diffVds) + > -EXP_THRESHOLD)) + { T1 = T2 * diffVds * exp(T0); + dT1_dVg = T1 / diffVds * (T0 - 1.0) * dVdseff_dVg; + dT1_dVd = T1 / diffVds * (1.0 - T0) * (1.0 - dVdseff_dVd); + dT1_dVb = T1 / diffVds * (T0 - 1.0) * dVdseff_dVb; + } + else + { T1 = T2 * diffVds * MIN_EXP; + dT1_dVg = -T2 * MIN_EXP * dVdseff_dVg; + dT1_dVd = T2 * MIN_EXP * (1.0 - dVdseff_dVd); + dT1_dVb = -T2 * MIN_EXP * dVdseff_dVb; + } + Isub = T1 * Idsa; + Gbg = T1 * dIdsa_dVg + Idsa * dT1_dVg; + Gbd = T1 * dIdsa_dVd + Idsa * dT1_dVd; + Gbb = T1 * dIdsa_dVb + Idsa * dT1_dVb; + + Gbd += Gbg * dVgsteff_dVd; + Gbb += Gbg * dVgsteff_dVb; + Gbg *= dVgsteff_dVg; + Gbg *= dVbseff_dVb; + } + + cdrain = Ids; + here->BSIM3v0gds = Gds; + here->BSIM3v0gm = Gm; + here->BSIM3v0gmbs = Gmb; + + here->BSIM3v0gbbs = Gbb; + here->BSIM3v0gbgs = Gbg; + here->BSIM3v0gbds = Gbd; + + here->BSIM3v0csub = Isub - (Gbb * Vbseff + Gbd * Vds + Gbg * Vgs); + +/* Calculate Qinv for Noise analysis */ + + T1 = Vgsteff * (1.0 - 0.5 * Abulk * Vdseff / Vgst2Vtm); + here->BSIM3v0qinv = -model->BSIM3v0cox * Weff * Leff * T1; + + if ((model->BSIM3v0xpart < 0) || (!ChargeComputationNeeded)) + { qgate = qdrn = qsrc = qbulk = 0.0; + here->BSIM3v0cggb = here->BSIM3v0cgsb = here->BSIM3v0cgdb = 0.0; + here->BSIM3v0cdgb = here->BSIM3v0cdsb = here->BSIM3v0cddb = 0.0; + here->BSIM3v0cbgb = here->BSIM3v0cbsb = here->BSIM3v0cbdb = 0.0; + here->BSIM3v0cqdb = here->BSIM3v0cqsb = here->BSIM3v0cqgb + = here->BSIM3v0cqbb = 0.0; + here->BSIM3v0gtau = 0.0; + goto finished; + } + else + { if (Vbseff < 0.0) + { VbseffCV = Vbseff; + dVbseffCV_dVb = 1.0; + } + else + { VbseffCV = pParam->BSIM3v0phi - Phis; + dVbseffCV_dVb = -dPhis_dVb; + } + + CoxWL = model->BSIM3v0cox * pParam->BSIM3v0weffCV + * pParam->BSIM3v0leffCV; + Vfb = Vth - pParam->BSIM3v0phi - pParam->BSIM3v0k1 * sqrtPhis; + + dVfb_dVb = dVth_dVb - pParam->BSIM3v0k1 * dsqrtPhis_dVb; + dVfb_dVd = dVth_dVd; + + if ((VgstNVt > -EXP_THRESHOLD) && (VgstNVt < EXP_THRESHOLD)) + { ExpVgst *= ExpVgst; + Vgsteff = n * Vtm * log(1.0 + ExpVgst); + dVgsteff_dVg = ExpVgst / (1.0 + ExpVgst); + dVgsteff_dVd = -dVgsteff_dVg * (dVth_dVd + (Vgs_eff - Vth) + / n * dn_dVd) + Vgsteff / n * dn_dVd; + dVgsteff_dVb = -dVgsteff_dVg * (dVth_dVb + (Vgs_eff - Vth) + / n * dn_dVb) + Vgsteff / n * dn_dVb; + dVgsteff_dVg *= dVgs_eff_dVg; + } + + if (model->BSIM3v0capMod == 1) + { Arg1 = Vgs_eff - VbseffCV - Vfb; + + if (Arg1 <= 0.0) + { qgate = CoxWL * (Arg1 - Vgsteff); + Cgg = CoxWL * (dVgs_eff_dVg - dVgsteff_dVg); + Cgd = -CoxWL * (dVfb_dVd + dVgsteff_dVd); + Cgb = -CoxWL * (dVfb_dVb + dVbseffCV_dVb + dVgsteff_dVb); + } + else + { T0 = 0.5 * pParam->BSIM3v0k1; + T1 = sqrt(T0 * T0 + Arg1 - Vgsteff); + qgate = CoxWL * pParam->BSIM3v0k1 * (T1 - T0); + + T2 = CoxWL * T0 / T1; + Cgg = T2 * (dVgs_eff_dVg - dVgsteff_dVg); + Cgd = -T2 * (dVfb_dVd + dVgsteff_dVd); + Cgb = -T2 * (dVfb_dVb + dVbseffCV_dVb + dVgsteff_dVb); + } + qbulk = -qgate; + Cbg = -Cgg; + Cbd = -Cgd; + Cbb = -Cgb; + + One_Third_CoxWL = CoxWL / 3.0; + Two_Third_CoxWL = 2.0 * One_Third_CoxWL; + AbulkCV = Abulk0 * pParam->BSIM3v0abulkCVfactor; + dAbulkCV_dVb = pParam->BSIM3v0abulkCVfactor * dAbulk0_dVb; + VdsatCV = Vgsteff / AbulkCV; + if (VdsatCV <= Vds) + { dVdsatCV_dVg = 1.0 / AbulkCV; + dVdsatCV_dVb = -VdsatCV * dAbulkCV_dVb / AbulkCV; + T0 = Vgsteff - VdsatCV / 3.0; + dT0_dVg = 1.0 - dVdsatCV_dVg / 3.0; + dT0_dVb = -dVdsatCV_dVb / 3.0; + qgate += CoxWL * T0; + Cgg1 = CoxWL * dT0_dVg; + Cgb1 = CoxWL * dT0_dVb + Cgg1 * dVgsteff_dVb; + Cgd1 = Cgg1 * dVgsteff_dVd; + Cgg1 *= dVgsteff_dVg; + Cgg += Cgg1; + Cgb += Cgb1; + Cgd += Cgd1; + + T0 = VdsatCV - Vgsteff; + dT0_dVg = dVdsatCV_dVg - 1.0; + dT0_dVb = dVdsatCV_dVb; + qbulk += One_Third_CoxWL * T0; + Cbg1 = One_Third_CoxWL * dT0_dVg; + Cbb1 = One_Third_CoxWL * dT0_dVb + Cbg1 * dVgsteff_dVb; + Cbd1 = Cbg1 * dVgsteff_dVd; + Cbg1 *= dVgsteff_dVg; + Cbg += Cbg1; + Cbb += Cbb1; + Cbd += Cbd1; + + if (model->BSIM3v0xpart > 0.5) + T0 = -Two_Third_CoxWL; + else if (model->BSIM3v0xpart < 0.5) + T0 = -0.4 * CoxWL; + else + T0 = -One_Third_CoxWL; + + qsrc = T0 * Vgsteff; + Csg = T0 * dVgsteff_dVg; + Csb = T0 * dVgsteff_dVb; + Csd = T0 * dVgsteff_dVd; + Cgb *= dVbseff_dVb; + Cbb *= dVbseff_dVb; + Csb *= dVbseff_dVb; + } + else + { T0 = AbulkCV * Vds; + T1 = 12.0 * (Vgsteff - 0.5 * T0); + T2 = Vds / T1; + T3 = T0 * T2; + dT3_dVg = -12.0 * T2 * T2 * AbulkCV; + dT3_dVd = 6.0 * T0 * (4.0 * Vgsteff - T0) / T1 / T1 - 0.5; + dT3_dVb = 12.0 * T2 * T2 * dAbulkCV_dVb * Vgsteff; + + qgate += CoxWL * (Vgsteff - 0.5 * Vds + T3); + Cgg1 = CoxWL * (1.0 + dT3_dVg); + Cgb1 = CoxWL * dT3_dVb + Cgg1 * dVgsteff_dVb; + Cgd1 = CoxWL * dT3_dVd + Cgg1 * dVgsteff_dVd; + Cgg1 *= dVgsteff_dVg; + Cgg += Cgg1; + Cgb += Cgb1; + Cgd += Cgd1; + + qbulk += CoxWL * (1.0 - AbulkCV) * (0.5 * Vds - T3); + Cbg1 = -CoxWL * ((1.0 - AbulkCV) * dT3_dVg); + Cbb1 = -CoxWL * ((1.0 - AbulkCV) * dT3_dVb + + (0.5 * Vds - T3) * dAbulkCV_dVb) + + Cbg1 * dVgsteff_dVb; + Cbd1 = -CoxWL * (1.0 - AbulkCV) * dT3_dVd + + Cbg1 * dVgsteff_dVd; + Cbg1 *= dVgsteff_dVg; + Cbg += Cbg1; + Cbb += Cbb1; + Cbd += Cbd1; + + if (model->BSIM3v0xpart > 0.5) + { /* 0/100 Charge petition model */ + T1 = T1 + T1; + qsrc = -CoxWL * (0.5 * Vgsteff + 0.25 * T0 + - T0 * T0 / T1); + Csg = -CoxWL * (0.5 + 24.0 * T0 * Vds / T1 / T1 + * AbulkCV); + Csb = -CoxWL * (0.25 * Vds * dAbulkCV_dVb + - 12.0 * T0 * Vds / T1 / T1 * (4.0 * Vgsteff - T0) + * dAbulkCV_dVb) + Csg * dVgsteff_dVb; + Csd = -CoxWL * (0.25 * AbulkCV - 12.0 * AbulkCV * T0 + / T1 / T1 * (4.0 * Vgsteff - T0)) + + Csg * dVgsteff_dVd; + Csg *= dVgsteff_dVg; + } + else if (model->BSIM3v0xpart < 0.5) + { /* 40/60 Charge petition model */ + T1 = T1 / 12.0; + T2 = 0.5 * CoxWL / (T1 * T1); + T3 = Vgsteff * (2.0 * T0 * T0 / 3.0 + Vgsteff + * (Vgsteff - 4.0 * T0 / 3.0)) + - 2.0 * T0 * T0 * T0 / 15.0; + qsrc = -T2 * T3; + T4 = 4.0 / 3.0 * Vgsteff * (Vgsteff - T0) + + 0.4 * T0 * T0; + Csg = -2.0 * qsrc / T1 - T2 * (Vgsteff * (3.0 + * Vgsteff - 8.0 * T0 / 3.0) + + 2.0 * T0 * T0 / 3.0); + Csb = (qsrc / T1 * Vds + T2 * T4 * Vds) * dAbulkCV_dVb + + Csg * dVgsteff_dVb; + Csd = (qsrc / T1 + T2 * T4) * AbulkCV + + Csg * dVgsteff_dVd; + Csg *= dVgsteff_dVg; + } + else + { /* 50/50 Charge petition model */ + qsrc = -0.5 * (qgate + qbulk); + Csg = -0.5 * (Cgg1 + Cbg1); + Csb = -0.5 * (Cgb1 + Cbb1); + Csd = -0.5 * (Cgd1 + Cbd1); + } + Cgb *= dVbseff_dVb; + Cbb *= dVbseff_dVb; + Csb *= dVbseff_dVb; + } + qdrn = -(qgate + qbulk + qsrc); + here->BSIM3v0cggb = Cgg; + here->BSIM3v0cgsb = -(Cgg + Cgd + Cgb); + here->BSIM3v0cgdb = Cgd; + here->BSIM3v0cdgb = -(Cgg + Cbg + Csg); + here->BSIM3v0cdsb = (Cgg + Cgd + Cgb + Cbg + Cbd + Cbb + + Csg + Csd + Csb); + here->BSIM3v0cddb = -(Cgd + Cbd + Csd); + here->BSIM3v0cbgb = Cbg; + here->BSIM3v0cbsb = -(Cbg + Cbd + Cbb); + here->BSIM3v0cbdb = Cbd; + } + else + { V3 = Vfb - Vgs_eff + VbseffCV - DELTA_3; + if (Vfb <= 0.0) + { T0 = sqrt(V3 * V3 - 4.0 * DELTA_3 * Vfb); + T2 = -DELTA_3 / T0; + } + else + { T0 = sqrt(V3 * V3 + 4.0 * DELTA_3 * Vfb); + T2 = DELTA_3 / T0; + } + + T1 = 0.5 * (1.0 + V3 / T0); + Vfbeff = Vfb - 0.5 * (V3 + T0); + dVfbeff_dVd = (1.0 - T1 - T2) * dVfb_dVd; + dVfbeff_dVg = T1 * dVgs_eff_dVg; + dVfbeff_dVb = (1.0 - T1 - T2) * dVfb_dVb + - T1 * dVbseffCV_dVb; + Qac0 = CoxWL * (Vfbeff - Vfb); + dQac0_dVg = CoxWL * dVfbeff_dVg; + dQac0_dVd = CoxWL * (dVfbeff_dVd - dVfb_dVd); + dQac0_dVb = CoxWL * (dVfbeff_dVb - dVfb_dVb); + + T0 = 0.5 * pParam->BSIM3v0k1; + T1 = sqrt(T0 * T0 + Vgs_eff - Vfbeff - VbseffCV - Vgsteff); + + Qsub0 = CoxWL * pParam->BSIM3v0k1 * (T1 - T0); + + T2 = CoxWL * T0 / T1; + dQsub0_dVg = T2 * (dVgs_eff_dVg - dVfbeff_dVg - dVgsteff_dVg); + dQsub0_dVd = -T2 * (dVfbeff_dVd + dVgsteff_dVd); + dQsub0_dVb = -T2 * (dVfbeff_dVb + dVbseffCV_dVb + + dVgsteff_dVb); + + One_Third_CoxWL = CoxWL / 3.0; + Two_Third_CoxWL = 2.0 * One_Third_CoxWL; + AbulkCV = Abulk0 * pParam->BSIM3v0abulkCVfactor; + dAbulkCV_dVb = pParam->BSIM3v0abulkCVfactor * dAbulk0_dVb; + VdsatCV = Vgsteff / AbulkCV; + + V4 = VdsatCV - Vds - DELTA_4; + T0 = sqrt(V4 * V4 + 4.0 * DELTA_4 * VdsatCV); + VdseffCV = VdsatCV - 0.5 * (V4 + T0); + T1 = 0.5 * (1.0 + V4 / T0); + T2 = DELTA_4 / T0; + T3 = (1.0 - T1 - T2) / AbulkCV; + dVdseffCV_dVg = T3; + dVdseffCV_dVd = T1; + dVdseffCV_dVb = -T3 * VdsatCV * dAbulkCV_dVb; + + T0 = AbulkCV * VdseffCV; + T1 = 12.0 * (Vgsteff - 0.5 * T0 + 1e-20); + T2 = VdseffCV / T1; + T3 = T0 * T2; + + T4 = (1.0 - 12.0 * T2 * T2 * AbulkCV); + T5 = (6.0 * T0 * (4.0 * Vgsteff - T0) / (T1 * T1) - 0.5); + T6 = 12.0 * T2 * T2 * Vgsteff; + + qgate = CoxWL * (Vgsteff - 0.5 * VdseffCV + T3); + Cgg1 = CoxWL * (T4 + T5 * dVdseffCV_dVg); + Cgd1 = CoxWL * T5 * dVdseffCV_dVd + Cgg1 * dVgsteff_dVd; + Cgb1 = CoxWL * (T5 * dVdseffCV_dVb + T6 * dAbulkCV_dVb) + + Cgg1 * dVgsteff_dVb; + Cgg1 *= dVgsteff_dVg; + + T7 = 1.0 - AbulkCV; + qbulk = CoxWL * T7 * (0.5 * VdseffCV - T3); + T4 = -T7 * (T4 - 1.0); + T5 = -T7 * T5; + T6 = -(T7 * T6 + (0.5 * VdseffCV - T3)); + Cbg1 = CoxWL * (T4 + T5 * dVdseffCV_dVg); + Cbd1 = CoxWL * T5 * dVdseffCV_dVd + Cbg1 * dVgsteff_dVd; + Cbb1 = CoxWL * (T5 * dVdseffCV_dVb + T6 * dAbulkCV_dVb) + + Cbg1 * dVgsteff_dVb; + Cbg1 *= dVgsteff_dVg; + + if (model->BSIM3v0xpart > 0.5) + { /* 0/100 Charge petition model */ + T1 = T1 + T1; + qsrc = -CoxWL * (0.5 * Vgsteff + 0.25 * T0 + - T0 * T0 / T1); + T7 = (4.0 * Vgsteff - T0) / (T1 * T1); + T4 = -(0.5 + 24.0 * T0 * T0 / (T1 * T1)); + T5 = -(0.25 * AbulkCV - 12.0 * AbulkCV * T0 * T7); + T6 = -(0.25 * VdseffCV - 12.0 * T0 * VdseffCV * T7); + Csg = CoxWL * (T4 + T5 * dVdseffCV_dVg); + Csd = CoxWL * T5 * dVdseffCV_dVd + Csg * dVgsteff_dVd; + Csb = CoxWL * (T5 * dVdseffCV_dVb + T6 * dAbulkCV_dVb) + + Csg * dVgsteff_dVb; + Csg *= dVgsteff_dVg; + } + else if (model->BSIM3v0xpart < 0.5) + { /* 40/60 Charge petition model */ + T1 = T1 / 12.0; + T2 = 0.5 * CoxWL / (T1 * T1); + T3 = Vgsteff * (2.0 * T0 * T0 / 3.0 + Vgsteff + * (Vgsteff - 4.0 * T0 / 3.0)) + - 2.0 * T0 * T0 * T0 / 15.0; + qsrc = -T2 * T3; + T7 = 4.0 / 3.0 * Vgsteff * (Vgsteff - T0) + + 0.4 * T0 * T0; + T4 = -2.0 * qsrc / T1 - T2 * (Vgsteff * (3.0 + * Vgsteff - 8.0 * T0 / 3.0) + + 2.0 * T0 * T0 / 3.0); + T5 = (qsrc / T1 + T2 * T7) * AbulkCV; + T6 = (qsrc / T1 * VdseffCV + T2 * T7 * VdseffCV); + Csg = (T4 + T5 * dVdseffCV_dVg); + Csd = T5 * dVdseffCV_dVd + Csg * dVgsteff_dVd; + Csb = (T5 * dVdseffCV_dVb + T6 * dAbulkCV_dVb) + + Csg * dVgsteff_dVb; + Csg *= dVgsteff_dVg; + } + else + { /* 50/50 Charge petition model */ + qsrc = -0.5 * (qgate + qbulk); + Csg = -0.5 * (Cgg1 + Cbg1); + Csb = -0.5 * (Cgb1 + Cbb1); + Csd = -0.5 * (Cgd1 + Cbd1); + } + + qgate += Qac0 + Qsub0; + qbulk -= (Qac0 + Qsub0); + qdrn = -(qgate + qbulk + qsrc); + + Cgg = dQac0_dVg + dQsub0_dVg + Cgg1; + Cgd = dQac0_dVd + dQsub0_dVd + Cgd1; + Cgb = dQac0_dVb + dQsub0_dVb + Cgb1; + + Cbg = Cbg1 - dQac0_dVg - dQsub0_dVg; + Cbd = Cbd1 - dQac0_dVd - dQsub0_dVd; + Cbb = Cbb1 - dQac0_dVb - dQsub0_dVb; + + Cgb *= dVbseff_dVb; + Cbb *= dVbseff_dVb; + Csb *= dVbseff_dVb; + + here->BSIM3v0cggb = Cgg; + here->BSIM3v0cgsb = -(Cgg + Cgd + Cgb); + here->BSIM3v0cgdb = Cgd; + here->BSIM3v0cdgb = -(Cgg + Cbg + Csg); + here->BSIM3v0cdsb = (Cgg + Cgd + Cgb + Cbg + Cbd + Cbb + + Csg + Csd + Csb); + here->BSIM3v0cddb = -(Cgd + Cbd + Csd); + here->BSIM3v0cbgb = Cbg; + here->BSIM3v0cbsb = -(Cbg + Cbd + Cbb); + here->BSIM3v0cbdb = Cbd; + + } + +/* Non-quasi-static Model */ + + if (here->BSIM3v0nqsMod) + { + qcheq = -qbulk - qgate; + qbulk = qgate = qdrn = qsrc = 0.0; + + here->BSIM3v0cqgb = -(here->BSIM3v0cggb + here->BSIM3v0cbgb); + here->BSIM3v0cqdb = -(here->BSIM3v0cgdb + here->BSIM3v0cbdb); + here->BSIM3v0cqsb = -(here->BSIM3v0cgsb + here->BSIM3v0cbsb); + here->BSIM3v0cqbb = here->BSIM3v0cggb + here->BSIM3v0cgdb + + here->BSIM3v0cgsb + here->BSIM3v0cbgb + + here->BSIM3v0cbdb + here->BSIM3v0cbsb; + + here->BSIM3v0cggb = here->BSIM3v0cgsb = here->BSIM3v0cgdb = 0.0; + here->BSIM3v0cdgb = here->BSIM3v0cdsb = here->BSIM3v0cddb = 0.0; + here->BSIM3v0cbgb = here->BSIM3v0cbsb = here->BSIM3v0cbdb = 0.0; + + T0 = pParam->BSIM3v0leffCV * pParam->BSIM3v0leffCV; + here->BSIM3v0tconst = pParam->BSIM3v0u0temp * pParam->BSIM3v0elm + / CoxWL / T0; + + if (qcheq == 0.0) + here->BSIM3v0tconst = 0.0; + else if (qcheq < 0.0) + here->BSIM3v0tconst = -here->BSIM3v0tconst; + + gtau_drift = fabs(here->BSIM3v0tconst * qcheq); + gtau_diff = 16.0 * pParam->BSIM3v0u0temp * model->BSIM3v0vtm / T0; + + here->BSIM3v0gtau = gtau_drift + gtau_diff; + + *(ckt->CKTstate0 + here->BSIM3v0qcheq) = qcheq; + + if (ckt->CKTmode & MODEINITTRAN) + *(ckt->CKTstate1 + here->BSIM3v0qcheq) = + *(ckt->CKTstate0 + here->BSIM3v0qcheq); + + error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM3v0qcheq); + if (error) return (error); + } + else + { here->BSIM3v0cqgb = here->BSIM3v0cqdb = here->BSIM3v0cqsb + = here->BSIM3v0cqbb = 0.0; + here->BSIM3v0gtau = 0.0; + } + } + +finished: /* returning Values to Calling Routine */ + /* + * COMPUTE EQUIVALENT DRAIN CURRENT SOURCE + */ + here->BSIM3v0cd = here->BSIM3v0mode * cdrain - here->BSIM3v0cbd; + if (ChargeComputationNeeded) + { /* charge storage elements + * bulk-drain and bulk-source depletion capacitances + * czbd : zero bias drain junction capacitance + * czbs : zero bias source junction capacitance + * czbdsw:zero bias drain junction sidewall capacitance + * czbssw:zero bias source junction sidewall capacitance + */ + + czbd = model->BSIM3v0unitAreaJctCap * here->BSIM3v0drainArea; + czbs = model->BSIM3v0unitAreaJctCap * here->BSIM3v0sourceArea; + czbdsw = model->BSIM3v0unitLengthSidewallJctCap + * here->BSIM3v0drainPerimeter; + czbssw = model->BSIM3v0unitLengthSidewallJctCap + * here->BSIM3v0sourcePerimeter; + PhiB = model->BSIM3v0bulkJctPotential; + PhiBSW = model->BSIM3v0sidewallJctPotential; + MJ = model->BSIM3v0bulkJctBotGradingCoeff; + MJSW = model->BSIM3v0bulkJctSideGradingCoeff; + + /* Source Bulk Junction */ + if (vbs == 0.0) + { *(ckt->CKTstate0 + here->BSIM3v0qbs) = 0.0; + here->BSIM3v0capbs = czbs + czbssw; + } + else if (vbs < 0.0) + { if (czbs > 0.0) + { arg = 1.0 - vbs / PhiB; + if (MJ == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJ * log(arg)); + *(ckt->CKTstate0 + here->BSIM3v0qbs) = PhiB * czbs + * (1.0 - arg * sarg) / (1.0 - MJ); + here->BSIM3v0capbs = czbs * sarg; + } + else + { *(ckt->CKTstate0 + here->BSIM3v0qbs) = 0.0; + here->BSIM3v0capbs = 0.0; + } + if (czbssw > 0.0) + { arg = 1.0 - vbs / PhiBSW; + if (MJSW == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJSW * log(arg)); + *(ckt->CKTstate0 + here->BSIM3v0qbs) += PhiBSW * czbssw + * (1.0 - arg * sarg) / (1.0 - MJSW); + here->BSIM3v0capbs += czbssw * sarg; + } + } + else + { *(ckt->CKTstate0+here->BSIM3v0qbs) = vbs * (czbs + czbssw) + + vbs * vbs * (czbs * MJ * 0.5 / PhiB + + czbssw * MJSW * 0.5 / PhiBSW); + here->BSIM3v0capbs = czbs + czbssw + vbs * (czbs * MJ /PhiB + + czbssw * MJSW / PhiBSW ); + } + + /* Drain Bulk Junction */ + if (vbd == 0.0) + { *(ckt->CKTstate0 + here->BSIM3v0qbd) = 0.0; + here->BSIM3v0capbd = czbd + czbdsw; + } + else if (vbd < 0.0) + { if (czbd > 0.0) + { arg = 1.0 - vbd / PhiB; + if (MJ == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJ * log(arg)); + *(ckt->CKTstate0 + here->BSIM3v0qbd) = PhiB * czbd + * (1.0 - arg * sarg) / (1.0 - MJ); + here->BSIM3v0capbd = czbd * sarg; + } + else + { *(ckt->CKTstate0 + here->BSIM3v0qbd) = 0.0; + here->BSIM3v0capbd = 0.0; + } + if (czbdsw > 0.0) + { arg = 1.0 - vbd / PhiBSW; + if (MJSW == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJSW * log(arg)); + *(ckt->CKTstate0 + here->BSIM3v0qbd) += PhiBSW * czbdsw + * (1.0 - arg * sarg) / (1.0 - MJSW); + here->BSIM3v0capbd += czbdsw * sarg; + } + } + else + { *(ckt->CKTstate0+here->BSIM3v0qbd) = vbd * (czbd + czbdsw) + + vbd * vbd * (czbd * MJ * 0.5 / PhiB + + czbdsw * MJSW * 0.5 / PhiBSW); + here->BSIM3v0capbd = czbd + czbdsw + vbd * (czbd * MJ / PhiB + + czbdsw * MJSW / PhiBSW ); + } + } + + /* + * check convergence + */ + if ((here->BSIM3v0off == 0) || (!(ckt->CKTmode & MODEINITFIX))) + { if (Check == 1) + { ckt->CKTnoncon++; +#ifndef NEWCONV + } + else + { tol = ckt->CKTreltol * MAX(fabs(cdhat), fabs(here->BSIM3v0cd)) + + ckt->CKTabstol; + if (fabs(cdhat - here->BSIM3v0cd) >= tol) + { ckt->CKTnoncon++; + } + else + { tol = ckt->CKTreltol * MAX(fabs(cbhat), + fabs(here->BSIM3v0cbs + here->BSIM3v0cbd)) + + ckt->CKTabstol; + if (fabs(cbhat - (here->BSIM3v0cbs + here->BSIM3v0cbd)) + > tol) + { ckt->CKTnoncon++; + } + } +#endif /* NEWCONV */ + } + } + *(ckt->CKTstate0 + here->BSIM3v0vbs) = vbs; + *(ckt->CKTstate0 + here->BSIM3v0vbd) = vbd; + *(ckt->CKTstate0 + here->BSIM3v0vgs) = vgs; + *(ckt->CKTstate0 + here->BSIM3v0vds) = vds; + + /* bulk and channel charge plus overlaps */ + + if (!ChargeComputationNeeded) + goto line850; + +line755: + ag0 = ckt->CKTag[0]; + + if (model->BSIM3v0capMod == 1) + { if (vgd < 0.0) + { T1 = sqrt(1.0 - 4.0 * vgd / pParam->BSIM3v0ckappa); + cgdo = pParam->BSIM3v0cgdo + pParam->BSIM3v0weffCV + * pParam->BSIM3v0cgdl / T1; + qgdo = pParam->BSIM3v0cgdo * vgd - pParam->BSIM3v0weffCV * 0.5 + * pParam->BSIM3v0cgdl * pParam->BSIM3v0ckappa * (T1 - 1.0); + } + else + { cgdo = pParam->BSIM3v0cgdo + pParam->BSIM3v0weffCV + * pParam->BSIM3v0cgdl; + qgdo = (pParam->BSIM3v0weffCV * pParam->BSIM3v0cgdl + + pParam->BSIM3v0cgdo) * vgd; + } + + if (vgs < 0.0) + { T1 = sqrt(1.0 - 4.0 * vgs / pParam->BSIM3v0ckappa); + cgso = pParam->BSIM3v0cgso + pParam->BSIM3v0weffCV + * pParam->BSIM3v0cgsl / T1; + qgso = pParam->BSIM3v0cgso * vgs - pParam->BSIM3v0weffCV * 0.5 + * pParam->BSIM3v0cgsl * pParam->BSIM3v0ckappa * (T1 - 1.0); + } + else + { cgso = pParam->BSIM3v0cgso + pParam->BSIM3v0weffCV + * pParam->BSIM3v0cgsl; + qgso = (pParam->BSIM3v0weffCV * pParam->BSIM3v0cgsl + + pParam->BSIM3v0cgso) * vgs; + } + } + else + { T0 = vgd + DELTA_1; + T1 = sqrt(T0 * T0 + 4.0 * DELTA_1); + T2 = 0.5 * (T0 - T1); + + T3 = pParam->BSIM3v0weffCV * pParam->BSIM3v0cgdl; + T4 = sqrt(1.0 - 4.0 * T2 / pParam->BSIM3v0ckappa); + cgdo = pParam->BSIM3v0cgdo + T3 - T3 * (1.0 - 1.0 / T4) + * (0.5 - 0.5 * T0 / T1); + qgdo = (pParam->BSIM3v0cgdo + T3) * vgd - T3 * (T2 + + 0.5 * pParam->BSIM3v0ckappa * (T4 - 1.0)); + + T0 = vgs + DELTA_1; + T1 = sqrt(T0 * T0 + 4.0 * DELTA_1); + T2 = 0.5 * (T0 - T1); + T3 = pParam->BSIM3v0weffCV * pParam->BSIM3v0cgsl; + T4 = sqrt(1.0 - 4.0 * T2 / pParam->BSIM3v0ckappa); + cgso = pParam->BSIM3v0cgso + T3 - T3 * (1.0 - 1.0 / T4) + * (0.5 - 0.5 * T0 / T1); + qgso = (pParam->BSIM3v0cgso + T3) * vgs - T3 * (T2 + + 0.5 * pParam->BSIM3v0ckappa * (T4 - 1.0)); + } + + if (here->BSIM3v0mode > 0) + { gcdgb = (here->BSIM3v0cdgb - cgdo) * ag0; + gcddb = (here->BSIM3v0cddb + here->BSIM3v0capbd + cgdo) * ag0; + gcdsb = here->BSIM3v0cdsb * ag0; + gcsgb = -(here->BSIM3v0cggb + here->BSIM3v0cbgb + here->BSIM3v0cdgb + + cgso) * ag0; + gcsdb = -(here->BSIM3v0cgdb + here->BSIM3v0cbdb + here->BSIM3v0cddb) + * ag0; + gcssb = (here->BSIM3v0capbs + cgso - (here->BSIM3v0cgsb + + here->BSIM3v0cbsb + here->BSIM3v0cdsb)) * ag0; + gcggb = (here->BSIM3v0cggb + cgdo + cgso + pParam->BSIM3v0cgbo ) * ag0; + gcgdb = (here->BSIM3v0cgdb - cgdo) * ag0; + gcgsb = (here->BSIM3v0cgsb - cgso) * ag0; + gcbgb = (here->BSIM3v0cbgb - pParam->BSIM3v0cgbo) * ag0; + gcbdb = (here->BSIM3v0cbdb - here->BSIM3v0capbd) * ag0; + gcbsb = (here->BSIM3v0cbsb - here->BSIM3v0capbs) * ag0; + + gcqgb = here->BSIM3v0cqgb * ag0; + gcqdb = here->BSIM3v0cqdb * ag0; + gcqsb = here->BSIM3v0cqsb * ag0; + gcqbb = here->BSIM3v0cqbb * ag0; + + T0 = here->BSIM3v0tconst * qdef; + here->BSIM3v0gtg = T0 * here->BSIM3v0cqgb; + here->BSIM3v0gtb = T0 * here->BSIM3v0cqbb; + here->BSIM3v0gtd = T0 * here->BSIM3v0cqdb; + here->BSIM3v0gts = T0 * here->BSIM3v0cqsb; + + sxpart = 0.6; + dxpart = 0.4; + + /* compute total terminal charge */ + qgd = qgdo; + qgs = qgso; + qgb = pParam->BSIM3v0cgbo * vgb; + qgate += qgd + qgs + qgb; + qbulk -= qgb; + qdrn -= qgd; + qsrc = -(qgate + qbulk + qdrn); + } + else + { gcsgb = (here->BSIM3v0cdgb - cgso) * ag0; + gcsdb = here->BSIM3v0cdsb * ag0; + gcssb = (here->BSIM3v0cddb + here->BSIM3v0capbs + cgso) * ag0; + + gcdgb = -(here->BSIM3v0cggb + here->BSIM3v0cbgb + here->BSIM3v0cdgb + + cgdo) * ag0; + gcdsb = -(here->BSIM3v0cgdb + here->BSIM3v0cbdb + here->BSIM3v0cddb) + * ag0; + gcddb = (here->BSIM3v0capbd + cgdo - (here->BSIM3v0cgsb + + here->BSIM3v0cbsb + here->BSIM3v0cdsb)) * ag0; + gcggb = (here->BSIM3v0cggb + cgdo + cgso + pParam->BSIM3v0cgbo ) * ag0; + gcgdb = (here->BSIM3v0cgsb - cgdo) * ag0; + gcgsb = (here->BSIM3v0cgdb - cgso) * ag0; + gcbgb = (here->BSIM3v0cbgb - pParam->BSIM3v0cgbo) * ag0; + gcbdb = (here->BSIM3v0cbsb - here->BSIM3v0capbd) * ag0; + gcbsb = (here->BSIM3v0cbdb - here->BSIM3v0capbs) * ag0; + + gcqgb = here->BSIM3v0cqgb * ag0; + gcqdb = here->BSIM3v0cqsb * ag0; + gcqsb = here->BSIM3v0cqdb * ag0; + gcqbb = here->BSIM3v0cqbb * ag0; + + T0 = here->BSIM3v0tconst * qdef; + here->BSIM3v0gtg = T0 * here->BSIM3v0cqgb; + here->BSIM3v0gtb = T0 * here->BSIM3v0cqbb; + here->BSIM3v0gtd = T0 * here->BSIM3v0cqdb; + here->BSIM3v0gts = T0 * here->BSIM3v0cqsb; + + dxpart = 0.6; + sxpart = 0.4; + + /* compute total terminal charge */ + qgd = qgdo; + qgs = qgso; + qgb = pParam->BSIM3v0cgbo * vgb; + qgate += qgd + qgs + qgb; + qbulk -= qgb; + qsrc = qdrn - qgs; + qdrn = -(qgate + qbulk + qsrc); + } + + here->BSIM3v0cgdo = cgdo; + here->BSIM3v0cgso = cgso; + +/* added by Mansun 11/1/93 */ + + + if (here->BSIM3v0nqsMod) + { *(ckt->CKTstate0 + here->BSIM3v0qcdump) = qdef; + + if (ckt->CKTmode & MODEINITTRAN) + *(ckt->CKTstate1 + here->BSIM3v0qcdump) = + *(ckt->CKTstate0 + here->BSIM3v0qcdump); + + error = NIintegrate(ckt, &gqdef, &cqdef, 1.0, here->BSIM3v0qcdump); + if (error) return (error); + } + else + { gqdef = cqdef = 0.0; + } + + if (ByPass) goto line860; + +/* End added by Mansun 11/1/93 */ + + *(ckt->CKTstate0 + here->BSIM3v0qg) = qgate; + *(ckt->CKTstate0 + here->BSIM3v0qd) = qdrn + - *(ckt->CKTstate0 + here->BSIM3v0qbd); + *(ckt->CKTstate0 + here->BSIM3v0qb) = qbulk + + *(ckt->CKTstate0 + here->BSIM3v0qbd) + + *(ckt->CKTstate0 + here->BSIM3v0qbs); + + /* store small signal parameters */ + if (ckt->CKTmode & MODEINITSMSIG) + { goto line1000; + } + if (!ChargeComputationNeeded) + goto line850; + + if (ckt->CKTmode & MODEINITTRAN) + { *(ckt->CKTstate1 + here->BSIM3v0qb) = + *(ckt->CKTstate0 + here->BSIM3v0qb); + *(ckt->CKTstate1 + here->BSIM3v0qg) = + *(ckt->CKTstate0 + here->BSIM3v0qg); + *(ckt->CKTstate1 + here->BSIM3v0qd) = + *(ckt->CKTstate0 + here->BSIM3v0qd); + } + + error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM3v0qb); + if (error) + return(error); + error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM3v0qg); + if (error) + return(error); + error = NIintegrate(ckt,&geq, &ceq, 0.0, here->BSIM3v0qd); + if (error) + return(error); + + goto line860; + +line850: + /* initialize to zero charge conductance and current */ + ceqqg = ceqqb = ceqqd = 0.0; + + cqcheq = cqdef = 0.0; + + gcdgb = gcddb = gcdsb = 0.0; + gcsgb = gcsdb = gcssb = 0.0; + gcggb = gcgdb = gcgsb = 0.0; + gcbgb = gcbdb = gcbsb = 0.0; + + gcqgb = gcqdb = gcqsb = gcqbb = 0.0; + here->BSIM3v0gtg = here->BSIM3v0gtd = here->BSIM3v0gts = here->BSIM3v0gtb = 0.0; + gqdef = 0.0; + sxpart = (1.0 - (dxpart = (here->BSIM3v0mode > 0) ? 0.4 : 0.6)); + if (here->BSIM3v0nqsMod) + here->BSIM3v0gtau = 16.0 * pParam->BSIM3v0u0temp * model->BSIM3v0vtm + / Leff / Leff; + else + here->BSIM3v0gtau = 0.0; + + goto line900; + +line860: + /* evaluate equivalent charge current */ + + cqgate = *(ckt->CKTstate0 + here->BSIM3v0cqg); + cqbulk = *(ckt->CKTstate0 + here->BSIM3v0cqb); + cqdrn = *(ckt->CKTstate0 + here->BSIM3v0cqd); + + ceqqg = cqgate - gcggb * vgb + gcgdb * vbd + gcgsb * vbs + + (here->BSIM3v0gtg * vgb - here->BSIM3v0gtd * vbd - here->BSIM3v0gts * vbs); + ceqqb = cqbulk - gcbgb * vgb + gcbdb * vbd + gcbsb * vbs; + ceqqd = cqdrn - gcdgb * vgb + gcddb * vbd + gcdsb * vbs + - dxpart * (here->BSIM3v0gtg * vgb - here->BSIM3v0gtd * vbd + - here->BSIM3v0gts * vbs); + + cqcheq = *(ckt->CKTstate0 + here->BSIM3v0cqcheq) + - (gcqgb * vgb - gcqdb * vbd - gcqsb * vbs) + + (here->BSIM3v0gtg * vgb - here->BSIM3v0gtd * vbd - here->BSIM3v0gts * vbs); + + if (ckt->CKTmode & MODEINITTRAN) + { *(ckt->CKTstate1 + here->BSIM3v0cqb) = + *(ckt->CKTstate0 + here->BSIM3v0cqb); + *(ckt->CKTstate1 + here->BSIM3v0cqg) = + *(ckt->CKTstate0 + here->BSIM3v0cqg); + *(ckt->CKTstate1 + here->BSIM3v0cqd) = + *(ckt->CKTstate0 + here->BSIM3v0cqd); + *(ckt->CKTstate1 + here->BSIM3v0cqcheq) = + *(ckt->CKTstate0 + here->BSIM3v0cqcheq); + *(ckt->CKTstate1 + here->BSIM3v0cqcdump) = + *(ckt->CKTstate0 + here->BSIM3v0cqcdump); + } + + /* + * load current vector + */ +line900: + + if (here->BSIM3v0mode >= 0) + { Gm = here->BSIM3v0gm; + Gmbs = here->BSIM3v0gmbs; + FwdSum = Gm + Gmbs; + RevSum = 0.0; + cdreq = model->BSIM3v0type * (cdrain - here->BSIM3v0gds * vds + - Gm * vgs - Gmbs * vbs); + ceqbs = -here->BSIM3v0csub; + ceqbd = 0.0; + + gbspsp = -here->BSIM3v0gbds - here->BSIM3v0gbgs - here->BSIM3v0gbbs; + gbbdp = -here->BSIM3v0gbds; + gbbsp = here->BSIM3v0gbds + here->BSIM3v0gbgs + here->BSIM3v0gbbs; + gbspg = here->BSIM3v0gbgs; + gbspb = here->BSIM3v0gbbs; + gbspdp = here->BSIM3v0gbds; + gbdpdp = 0.0; + gbdpg = 0.0; + gbdpb = 0.0; + gbdpsp = 0.0; + } + else + { Gm = -here->BSIM3v0gm; + Gmbs = -here->BSIM3v0gmbs; + FwdSum = 0.0; + RevSum = -(Gm + Gmbs); + cdreq = -model->BSIM3v0type * (cdrain + here->BSIM3v0gds * vds + + Gm * vgd + Gmbs * vbd); + ceqbs = 0.0; + ceqbd = -here->BSIM3v0csub; + + gbspsp = 0.0; + gbbdp = here->BSIM3v0gbds + here->BSIM3v0gbgs + here->BSIM3v0gbbs; + gbbsp = -here->BSIM3v0gbds; + gbspg = 0.0; + gbspb = 0.0; + gbspdp = 0.0; + gbdpdp = -here->BSIM3v0gbds - here->BSIM3v0gbgs - here->BSIM3v0gbbs; + gbdpg = here->BSIM3v0gbgs; + gbdpb = here->BSIM3v0gbbs; + gbdpsp = here->BSIM3v0gbds; + } + + if (model->BSIM3v0type > 0) + { ceqbs += (here->BSIM3v0cbs - (here->BSIM3v0gbs - ckt->CKTgmin) * vbs); + ceqbd += (here->BSIM3v0cbd - (here->BSIM3v0gbd - ckt->CKTgmin) * vbd); + ceqqg = ceqqg; + ceqqb = ceqqb; + ceqqd = ceqqd; + cqcheq = cqcheq; + } + else + { ceqbs = -ceqbs - (here->BSIM3v0cbs - (here->BSIM3v0gbs + - ckt->CKTgmin) * vbs); + ceqbd = -ceqbd - (here->BSIM3v0cbd - (here->BSIM3v0gbd + - ckt->CKTgmin) * vbd); + ceqqg = -ceqqg; + ceqqb = -ceqqb; + ceqqd = -ceqqd; + cqcheq = -cqcheq; + } + + (*(ckt->CKTrhs + here->BSIM3v0gNode) -= m * ceqqg); + (*(ckt->CKTrhs + here->BSIM3v0bNode) -= m * (ceqbs + ceqbd + ceqqb)); + (*(ckt->CKTrhs + here->BSIM3v0dNodePrime) += m * (ceqbd - cdreq - ceqqd)); + (*(ckt->CKTrhs + here->BSIM3v0sNodePrime) += m * (cdreq + ceqbs + ceqqg + + ceqqb + ceqqd)); + + *(ckt->CKTrhs + here->BSIM3v0qNode) += m * (cqcheq - cqdef); + + /* + * load y matrix + */ + + (*(here->BSIM3v0DdPtr) += m * here->BSIM3v0drainConductance); + (*(here->BSIM3v0GgPtr) += m * (gcggb - here->BSIM3v0gtg)); + (*(here->BSIM3v0SsPtr) += m * here->BSIM3v0sourceConductance); + (*(here->BSIM3v0BbPtr) += m * ((here->BSIM3v0gbd + here->BSIM3v0gbs + - gcbgb - gcbdb - gcbsb) - here->BSIM3v0gbbs)); + (*(here->BSIM3v0DPdpPtr) += m * ((here->BSIM3v0drainConductance + + here->BSIM3v0gds + here->BSIM3v0gbd + + RevSum + gcddb) + dxpart * here->BSIM3v0gtd + gbdpdp)); + (*(here->BSIM3v0SPspPtr) += m * ((here->BSIM3v0sourceConductance + + here->BSIM3v0gds + here->BSIM3v0gbs + + FwdSum + gcssb) + sxpart * here->BSIM3v0gts + gbspsp)); + (*(here->BSIM3v0DdpPtr) -= m * here->BSIM3v0drainConductance); + (*(here->BSIM3v0GbPtr) -= m * (gcggb + gcgdb + gcgsb + here->BSIM3v0gtb)); + (*(here->BSIM3v0GdpPtr) += m * (gcgdb - here->BSIM3v0gtd)); + (*(here->BSIM3v0GspPtr) += m * (gcgsb - here->BSIM3v0gts)); + (*(here->BSIM3v0SspPtr) -= m * here->BSIM3v0sourceConductance); + (*(here->BSIM3v0BgPtr) += m * (gcbgb - here->BSIM3v0gbgs)); + (*(here->BSIM3v0BdpPtr) += m * (gcbdb - here->BSIM3v0gbd + gbbdp)); + (*(here->BSIM3v0BspPtr) += m * (gcbsb - here->BSIM3v0gbs + gbbsp)); + (*(here->BSIM3v0DPdPtr) -= m * here->BSIM3v0drainConductance); + (*(here->BSIM3v0DPgPtr) += m * ((Gm + gcdgb) + dxpart * here->BSIM3v0gtg + gbdpg)); + (*(here->BSIM3v0DPbPtr) -= m * ((here->BSIM3v0gbd - Gmbs + gcdgb + gcddb + + gcdsb - dxpart * here->BSIM3v0gtb) - gbdpb)); + (*(here->BSIM3v0DPspPtr) -= m * ((here->BSIM3v0gds + FwdSum - gcdsb + - 0.5 * here->BSIM3v0gts) - gbdpsp)); + (*(here->BSIM3v0SPgPtr) += m * (gcsgb - Gm + sxpart * here->BSIM3v0gtg + gbspg)); + (*(here->BSIM3v0SPsPtr) -= m * here->BSIM3v0sourceConductance); + (*(here->BSIM3v0SPbPtr) -= m * ((here->BSIM3v0gbs + Gmbs + gcsgb + gcsdb + + gcssb - sxpart * here->BSIM3v0gtg) - gbspb)); + (*(here->BSIM3v0SPdpPtr) -= m * ((here->BSIM3v0gds + RevSum - gcsdb + - sxpart * here->BSIM3v0gtd - here->BSIM3v0gbd) - gbspdp)); + + *(here->BSIM3v0QqPtr) += m * (gqdef + here->BSIM3v0gtau); + + *(here->BSIM3v0DPqPtr) += m * (dxpart * here->BSIM3v0gtau); + *(here->BSIM3v0SPqPtr) += m * (sxpart * here->BSIM3v0gtau); + *(here->BSIM3v0GqPtr) -= m * here->BSIM3v0gtau; + + *(here->BSIM3v0QgPtr) += m * (-gcqgb + here->BSIM3v0gtg); + *(here->BSIM3v0QdpPtr) += m * (-gcqdb + here->BSIM3v0gtd); + *(here->BSIM3v0QspPtr) += m * (-gcqsb + here->BSIM3v0gts); + *(here->BSIM3v0QbPtr) += m * (-gcqbb + here->BSIM3v0gtb); + +line1000: ; + + } /* End of Mosfet Instance */ +} /* End of Model Instance */ + +return(OK); +} + + + + + diff --git a/src/spicelib/devices/bsim3v0/b3v0mask.c b/src/spicelib/devices/bsim3v0/b3v0mask.c new file mode 100644 index 000000000..51fee7e41 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0mask.c @@ -0,0 +1,1090 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0mask.c +**********/ + +#include "ngspice.h" +#include "ifsim.h" +#include "cktdefs.h" +#include "devdefs.h" +#include "bsim3v0def.h" +#include "sperror.h" +#include "suffix.h" + +int +BSIM3v0mAsk(ckt,inst,which,value) +CKTcircuit *ckt; +GENmodel *inst; +int which; +IFvalue *value; +{ + BSIM3v0model *model = (BSIM3v0model *)inst; + switch(which) + { case BSIM3v0_MOD_MOBMOD: + value->iValue = model->BSIM3v0mobMod; + return(OK); + case BSIM3v0_MOD_BINUNIT: + value->iValue = model->BSIM3v0binUnit; + return(OK); + case BSIM3v0_MOD_CAPMOD: + value->iValue = model->BSIM3v0capMod; + return(OK); + case BSIM3v0_MOD_NQSMOD: + value->iValue = model->BSIM3v0nqsMod; + return(OK); + case BSIM3v0_MOD_NOIMOD: + value->iValue = model->BSIM3v0noiMod; + return(OK); + case BSIM3v0_MOD_TOX : + value->rValue = model->BSIM3v0tox; + return(OK); + case BSIM3v0_MOD_CDSC : + value->rValue = model->BSIM3v0cdsc; + return(OK); + case BSIM3v0_MOD_CDSCB : + value->rValue = model->BSIM3v0cdscb; + return(OK); + + case BSIM3v0_MOD_CDSCD : + value->rValue = model->BSIM3v0cdscd; + return(OK); + + case BSIM3v0_MOD_CIT : + value->rValue = model->BSIM3v0cit; + return(OK); + case BSIM3v0_MOD_NFACTOR : + value->rValue = model->BSIM3v0nfactor; + return(OK); + case BSIM3v0_MOD_XJ: + value->rValue = model->BSIM3v0xj; + return(OK); + case BSIM3v0_MOD_VSAT: + value->rValue = model->BSIM3v0vsat; + return(OK); + case BSIM3v0_MOD_AT: + value->rValue = model->BSIM3v0at; + return(OK); + case BSIM3v0_MOD_A0: + value->rValue = model->BSIM3v0a0; + return(OK); + + case BSIM3v0_MOD_AGS: + value->rValue = model->BSIM3v0ags; + return(OK); + + case BSIM3v0_MOD_A1: + value->rValue = model->BSIM3v0a1; + return(OK); + case BSIM3v0_MOD_A2: + value->rValue = model->BSIM3v0a2; + return(OK); + case BSIM3v0_MOD_KETA: + value->rValue = model->BSIM3v0keta; + return(OK); + case BSIM3v0_MOD_NSUB: + value->rValue = model->BSIM3v0nsub; + return(OK); + case BSIM3v0_MOD_NPEAK: + value->rValue = model->BSIM3v0npeak; + return(OK); + case BSIM3v0_MOD_NGATE: + value->rValue = model->BSIM3v0ngate; + return(OK); + case BSIM3v0_MOD_GAMMA1: + value->rValue = model->BSIM3v0gamma1; + return(OK); + case BSIM3v0_MOD_GAMMA2: + value->rValue = model->BSIM3v0gamma2; + return(OK); + case BSIM3v0_MOD_VBX: + value->rValue = model->BSIM3v0vbx; + return(OK); + case BSIM3v0_MOD_VBM: + value->rValue = model->BSIM3v0vbm; + return(OK); + case BSIM3v0_MOD_XT: + value->rValue = model->BSIM3v0xt; + return(OK); + case BSIM3v0_MOD_K1: + value->rValue = model->BSIM3v0k1; + return(OK); + case BSIM3v0_MOD_KT1: + value->rValue = model->BSIM3v0kt1; + return(OK); + case BSIM3v0_MOD_KT1L: + value->rValue = model->BSIM3v0kt1l; + return(OK); + case BSIM3v0_MOD_KT2 : + value->rValue = model->BSIM3v0kt2; + return(OK); + case BSIM3v0_MOD_K2 : + value->rValue = model->BSIM3v0k2; + return(OK); + case BSIM3v0_MOD_K3: + value->rValue = model->BSIM3v0k3; + return(OK); + case BSIM3v0_MOD_K3B: + value->rValue = model->BSIM3v0k3b; + return(OK); + case BSIM3v0_MOD_W0: + value->rValue = model->BSIM3v0w0; + return(OK); + case BSIM3v0_MOD_NLX: + value->rValue = model->BSIM3v0nlx; + return(OK); + case BSIM3v0_MOD_DVT0 : + value->rValue = model->BSIM3v0dvt0; + return(OK); + case BSIM3v0_MOD_DVT1 : + value->rValue = model->BSIM3v0dvt1; + return(OK); + case BSIM3v0_MOD_DVT2 : + value->rValue = model->BSIM3v0dvt2; + return(OK); + case BSIM3v0_MOD_DVT0W : + value->rValue = model->BSIM3v0dvt0w; + return(OK); + case BSIM3v0_MOD_DVT1W : + value->rValue = model->BSIM3v0dvt1w; + return(OK); + case BSIM3v0_MOD_DVT2W : + value->rValue = model->BSIM3v0dvt2w; + return(OK); + case BSIM3v0_MOD_DROUT : + value->rValue = model->BSIM3v0drout; + return(OK); + case BSIM3v0_MOD_DSUB : + value->rValue = model->BSIM3v0dsub; + return(OK); + case BSIM3v0_MOD_VTH0: + value->rValue = model->BSIM3v0vth0; + return(OK); + case BSIM3v0_MOD_UA: + value->rValue = model->BSIM3v0ua; + return(OK); + case BSIM3v0_MOD_UA1: + value->rValue = model->BSIM3v0ua1; + return(OK); + case BSIM3v0_MOD_UB: + value->rValue = model->BSIM3v0ub; + return(OK); + case BSIM3v0_MOD_UB1: + value->rValue = model->BSIM3v0ub1; + return(OK); + case BSIM3v0_MOD_UC: + value->rValue = model->BSIM3v0uc; + return(OK); + case BSIM3v0_MOD_UC1: + value->rValue = model->BSIM3v0uc1; + return(OK); + case BSIM3v0_MOD_U0: + value->rValue = model->BSIM3v0u0; + return(OK); + case BSIM3v0_MOD_UTE: + value->rValue = model->BSIM3v0ute; + return(OK); + case BSIM3v0_MOD_VOFF: + value->rValue = model->BSIM3v0voff; + return(OK); + case BSIM3v0_MOD_DELTA: + value->rValue = model->BSIM3v0delta; + return(OK); + case BSIM3v0_MOD_RDSW: + value->rValue = model->BSIM3v0rdsw; + return(OK); + case BSIM3v0_MOD_PRWG: + value->rValue = model->BSIM3v0prwg; + return(OK); + case BSIM3v0_MOD_PRWB: + value->rValue = model->BSIM3v0prwb; + return(OK); + case BSIM3v0_MOD_PRT: + value->rValue = model->BSIM3v0prt; + return(OK); + case BSIM3v0_MOD_ETA0: + value->rValue = model->BSIM3v0eta0; + return(OK); + case BSIM3v0_MOD_ETAB: + value->rValue = model->BSIM3v0etab; + return(OK); + case BSIM3v0_MOD_PCLM: + value->rValue = model->BSIM3v0pclm; + return(OK); + case BSIM3v0_MOD_PDIBL1: + value->rValue = model->BSIM3v0pdibl1; + return(OK); + case BSIM3v0_MOD_PDIBL2: + value->rValue = model->BSIM3v0pdibl2; + return(OK); + case BSIM3v0_MOD_PDIBLB: + value->rValue = model->BSIM3v0pdiblb; + return(OK); + case BSIM3v0_MOD_PSCBE1: + value->rValue = model->BSIM3v0pscbe1; + return(OK); + case BSIM3v0_MOD_PSCBE2: + value->rValue = model->BSIM3v0pscbe2; + return(OK); + case BSIM3v0_MOD_PVAG: + value->rValue = model->BSIM3v0pvag; + return(OK); + case BSIM3v0_MOD_WR: + value->rValue = model->BSIM3v0wr; + return(OK); + case BSIM3v0_MOD_DWG: + value->rValue = model->BSIM3v0dwg; + return(OK); + case BSIM3v0_MOD_DWB: + value->rValue = model->BSIM3v0dwb; + return(OK); + case BSIM3v0_MOD_B0: + value->rValue = model->BSIM3v0b0; + return(OK); + case BSIM3v0_MOD_B1: + value->rValue = model->BSIM3v0b1; + return(OK); + case BSIM3v0_MOD_ALPHA0: + value->rValue = model->BSIM3v0alpha0; + return(OK); + case BSIM3v0_MOD_BETA0: + value->rValue = model->BSIM3v0beta0; + return(OK); + + case BSIM3v0_MOD_ELM: + value->rValue = model->BSIM3v0elm; + return(OK); + case BSIM3v0_MOD_CGSL: + value->rValue = model->BSIM3v0cgsl; + return(OK); + case BSIM3v0_MOD_CGDL: + value->rValue = model->BSIM3v0cgdl; + return(OK); + case BSIM3v0_MOD_CKAPPA: + value->rValue = model->BSIM3v0ckappa; + return(OK); + case BSIM3v0_MOD_CF: + value->rValue = model->BSIM3v0cf; + return(OK); + case BSIM3v0_MOD_CLC: + value->rValue = model->BSIM3v0clc; + return(OK); + case BSIM3v0_MOD_CLE: + value->rValue = model->BSIM3v0cle; + return(OK); + case BSIM3v0_MOD_DWC: + value->rValue = model->BSIM3v0dwc; + return(OK); + case BSIM3v0_MOD_DLC: + value->rValue = model->BSIM3v0dlc; + return(OK); + + /* Length dependence */ + case BSIM3v0_MOD_LCDSC : + value->rValue = model->BSIM3v0lcdsc; + return(OK); + case BSIM3v0_MOD_LCDSCB : + value->rValue = model->BSIM3v0lcdscb; + return(OK); + case BSIM3v0_MOD_LCDSCD : + value->rValue = model->BSIM3v0lcdscd; + return(OK); + case BSIM3v0_MOD_LCIT : + value->rValue = model->BSIM3v0lcit; + return(OK); + case BSIM3v0_MOD_LNFACTOR : + value->rValue = model->BSIM3v0lnfactor; + return(OK); + case BSIM3v0_MOD_LXJ: + value->rValue = model->BSIM3v0lxj; + return(OK); + case BSIM3v0_MOD_LVSAT: + value->rValue = model->BSIM3v0lvsat; + return(OK); + case BSIM3v0_MOD_LAT: + value->rValue = model->BSIM3v0lat; + return(OK); + case BSIM3v0_MOD_LA0: + value->rValue = model->BSIM3v0la0; + return(OK); + case BSIM3v0_MOD_LAGS: + value->rValue = model->BSIM3v0lags; + return(OK); + case BSIM3v0_MOD_LA1: + value->rValue = model->BSIM3v0la1; + return(OK); + case BSIM3v0_MOD_LA2: + value->rValue = model->BSIM3v0la2; + return(OK); + case BSIM3v0_MOD_LKETA: + value->rValue = model->BSIM3v0lketa; + return(OK); + case BSIM3v0_MOD_LNSUB: + value->rValue = model->BSIM3v0lnsub; + return(OK); + case BSIM3v0_MOD_LNPEAK: + value->rValue = model->BSIM3v0lnpeak; + return(OK); + case BSIM3v0_MOD_LNGATE: + value->rValue = model->BSIM3v0lngate; + return(OK); + case BSIM3v0_MOD_LGAMMA1: + value->rValue = model->BSIM3v0lgamma1; + return(OK); + case BSIM3v0_MOD_LGAMMA2: + value->rValue = model->BSIM3v0lgamma2; + return(OK); + case BSIM3v0_MOD_LVBX: + value->rValue = model->BSIM3v0lvbx; + return(OK); + case BSIM3v0_MOD_LVBM: + value->rValue = model->BSIM3v0lvbm; + return(OK); + case BSIM3v0_MOD_LXT: + value->rValue = model->BSIM3v0lxt; + return(OK); + case BSIM3v0_MOD_LK1: + value->rValue = model->BSIM3v0lk1; + return(OK); + case BSIM3v0_MOD_LKT1: + value->rValue = model->BSIM3v0lkt1; + return(OK); + case BSIM3v0_MOD_LKT1L: + value->rValue = model->BSIM3v0lkt1l; + return(OK); + case BSIM3v0_MOD_LKT2 : + value->rValue = model->BSIM3v0lkt2; + return(OK); + case BSIM3v0_MOD_LK2 : + value->rValue = model->BSIM3v0lk2; + return(OK); + case BSIM3v0_MOD_LK3: + value->rValue = model->BSIM3v0lk3; + return(OK); + case BSIM3v0_MOD_LK3B: + value->rValue = model->BSIM3v0lk3b; + return(OK); + case BSIM3v0_MOD_LW0: + value->rValue = model->BSIM3v0lw0; + return(OK); + case BSIM3v0_MOD_LNLX: + value->rValue = model->BSIM3v0lnlx; + return(OK); + case BSIM3v0_MOD_LDVT0: + value->rValue = model->BSIM3v0ldvt0; + return(OK); + case BSIM3v0_MOD_LDVT1 : + value->rValue = model->BSIM3v0ldvt1; + return(OK); + case BSIM3v0_MOD_LDVT2 : + value->rValue = model->BSIM3v0ldvt2; + return(OK); + case BSIM3v0_MOD_LDVT0W : + value->rValue = model->BSIM3v0ldvt0w; + return(OK); + case BSIM3v0_MOD_LDVT1W : + value->rValue = model->BSIM3v0ldvt1w; + return(OK); + case BSIM3v0_MOD_LDVT2W : + value->rValue = model->BSIM3v0ldvt2w; + return(OK); + case BSIM3v0_MOD_LDROUT : + value->rValue = model->BSIM3v0ldrout; + return(OK); + case BSIM3v0_MOD_LDSUB : + value->rValue = model->BSIM3v0ldsub; + return(OK); + case BSIM3v0_MOD_LVTH0: + value->rValue = model->BSIM3v0lvth0; + return(OK); + case BSIM3v0_MOD_LUA: + value->rValue = model->BSIM3v0lua; + return(OK); + case BSIM3v0_MOD_LUA1: + value->rValue = model->BSIM3v0lua1; + return(OK); + case BSIM3v0_MOD_LUB: + value->rValue = model->BSIM3v0lub; + return(OK); + case BSIM3v0_MOD_LUB1: + value->rValue = model->BSIM3v0lub1; + return(OK); + case BSIM3v0_MOD_LUC: + value->rValue = model->BSIM3v0luc; + return(OK); + case BSIM3v0_MOD_LUC1: + value->rValue = model->BSIM3v0luc1; + return(OK); + case BSIM3v0_MOD_LU0: + value->rValue = model->BSIM3v0lu0; + return(OK); + case BSIM3v0_MOD_LUTE: + value->rValue = model->BSIM3v0lute; + return(OK); + case BSIM3v0_MOD_LVOFF: + value->rValue = model->BSIM3v0lvoff; + return(OK); + case BSIM3v0_MOD_LDELTA: + value->rValue = model->BSIM3v0ldelta; + return(OK); + case BSIM3v0_MOD_LRDSW: + value->rValue = model->BSIM3v0lrdsw; + return(OK); + case BSIM3v0_MOD_LPRWB: + value->rValue = model->BSIM3v0lprwb; + return(OK); + case BSIM3v0_MOD_LPRWG: + value->rValue = model->BSIM3v0lprwg; + return(OK); + case BSIM3v0_MOD_LPRT: + value->rValue = model->BSIM3v0lprt; + return(OK); + case BSIM3v0_MOD_LETA0: + value->rValue = model->BSIM3v0leta0; + return(OK); + case BSIM3v0_MOD_LETAB: + value->rValue = model->BSIM3v0letab; + return(OK); + case BSIM3v0_MOD_LPCLM: + value->rValue = model->BSIM3v0lpclm; + return(OK); + case BSIM3v0_MOD_LPDIBL1: + value->rValue = model->BSIM3v0lpdibl1; + return(OK); + case BSIM3v0_MOD_LPDIBL2: + value->rValue = model->BSIM3v0lpdibl2; + return(OK); + case BSIM3v0_MOD_LPDIBLB: + value->rValue = model->BSIM3v0lpdiblb; + return(OK); + case BSIM3v0_MOD_LPSCBE1: + value->rValue = model->BSIM3v0lpscbe1; + return(OK); + case BSIM3v0_MOD_LPSCBE2: + value->rValue = model->BSIM3v0lpscbe2; + return(OK); + case BSIM3v0_MOD_LPVAG: + value->rValue = model->BSIM3v0lpvag; + return(OK); + case BSIM3v0_MOD_LWR: + value->rValue = model->BSIM3v0lwr; + return(OK); + case BSIM3v0_MOD_LDWG: + value->rValue = model->BSIM3v0ldwg; + return(OK); + case BSIM3v0_MOD_LDWB: + value->rValue = model->BSIM3v0ldwb; + return(OK); + case BSIM3v0_MOD_LB0: + value->rValue = model->BSIM3v0lb0; + return(OK); + case BSIM3v0_MOD_LB1: + value->rValue = model->BSIM3v0lb1; + return(OK); + case BSIM3v0_MOD_LALPHA0: + value->rValue = model->BSIM3v0lalpha0; + return(OK); + case BSIM3v0_MOD_LBETA0: + value->rValue = model->BSIM3v0lbeta0; + return(OK); + + case BSIM3v0_MOD_LELM: + value->rValue = model->BSIM3v0lelm; + return(OK); + case BSIM3v0_MOD_LCGSL: + value->rValue = model->BSIM3v0lcgsl; + return(OK); + case BSIM3v0_MOD_LCGDL: + value->rValue = model->BSIM3v0lcgdl; + return(OK); + case BSIM3v0_MOD_LCKAPPA: + value->rValue = model->BSIM3v0lckappa; + return(OK); + case BSIM3v0_MOD_LCF: + value->rValue = model->BSIM3v0lcf; + return(OK); + case BSIM3v0_MOD_LCLC: + value->rValue = model->BSIM3v0lclc; + return(OK); + case BSIM3v0_MOD_LCLE: + value->rValue = model->BSIM3v0lcle; + return(OK); + + /* Width dependence */ + case BSIM3v0_MOD_WCDSC : + value->rValue = model->BSIM3v0wcdsc; + return(OK); + case BSIM3v0_MOD_WCDSCB : + value->rValue = model->BSIM3v0wcdscb; + return(OK); + case BSIM3v0_MOD_WCDSCD : + value->rValue = model->BSIM3v0wcdscd; + return(OK); + case BSIM3v0_MOD_WCIT : + value->rValue = model->BSIM3v0wcit; + return(OK); + case BSIM3v0_MOD_WNFACTOR : + value->rValue = model->BSIM3v0wnfactor; + return(OK); + case BSIM3v0_MOD_WXJ: + value->rValue = model->BSIM3v0wxj; + return(OK); + case BSIM3v0_MOD_WVSAT: + value->rValue = model->BSIM3v0wvsat; + return(OK); + case BSIM3v0_MOD_WAT: + value->rValue = model->BSIM3v0wat; + return(OK); + case BSIM3v0_MOD_WA0: + value->rValue = model->BSIM3v0wa0; + return(OK); + case BSIM3v0_MOD_WAGS: + value->rValue = model->BSIM3v0wags; + return(OK); + case BSIM3v0_MOD_WA1: + value->rValue = model->BSIM3v0wa1; + return(OK); + case BSIM3v0_MOD_WA2: + value->rValue = model->BSIM3v0wa2; + return(OK); + case BSIM3v0_MOD_WKETA: + value->rValue = model->BSIM3v0wketa; + return(OK); + case BSIM3v0_MOD_WNSUB: + value->rValue = model->BSIM3v0wnsub; + return(OK); + case BSIM3v0_MOD_WNPEAK: + value->rValue = model->BSIM3v0wnpeak; + return(OK); + case BSIM3v0_MOD_WNGATE: + value->rValue = model->BSIM3v0wngate; + return(OK); + case BSIM3v0_MOD_WGAMMA1: + value->rValue = model->BSIM3v0wgamma1; + return(OK); + case BSIM3v0_MOD_WGAMMA2: + value->rValue = model->BSIM3v0wgamma2; + return(OK); + case BSIM3v0_MOD_WVBX: + value->rValue = model->BSIM3v0wvbx; + return(OK); + case BSIM3v0_MOD_WVBM: + value->rValue = model->BSIM3v0wvbm; + return(OK); + case BSIM3v0_MOD_WXT: + value->rValue = model->BSIM3v0wxt; + return(OK); + case BSIM3v0_MOD_WK1: + value->rValue = model->BSIM3v0wk1; + return(OK); + case BSIM3v0_MOD_WKT1: + value->rValue = model->BSIM3v0wkt1; + return(OK); + case BSIM3v0_MOD_WKT1L: + value->rValue = model->BSIM3v0wkt1l; + return(OK); + case BSIM3v0_MOD_WKT2 : + value->rValue = model->BSIM3v0wkt2; + return(OK); + case BSIM3v0_MOD_WK2 : + value->rValue = model->BSIM3v0wk2; + return(OK); + case BSIM3v0_MOD_WK3: + value->rValue = model->BSIM3v0wk3; + return(OK); + case BSIM3v0_MOD_WK3B: + value->rValue = model->BSIM3v0wk3b; + return(OK); + case BSIM3v0_MOD_WW0: + value->rValue = model->BSIM3v0ww0; + return(OK); + case BSIM3v0_MOD_WNLX: + value->rValue = model->BSIM3v0wnlx; + return(OK); + case BSIM3v0_MOD_WDVT0: + value->rValue = model->BSIM3v0wdvt0; + return(OK); + case BSIM3v0_MOD_WDVT1 : + value->rValue = model->BSIM3v0wdvt1; + return(OK); + case BSIM3v0_MOD_WDVT2 : + value->rValue = model->BSIM3v0wdvt2; + return(OK); + case BSIM3v0_MOD_WDVT0W : + value->rValue = model->BSIM3v0wdvt0w; + return(OK); + case BSIM3v0_MOD_WDVT1W : + value->rValue = model->BSIM3v0wdvt1w; + return(OK); + case BSIM3v0_MOD_WDVT2W : + value->rValue = model->BSIM3v0wdvt2w; + return(OK); + case BSIM3v0_MOD_WDROUT : + value->rValue = model->BSIM3v0wdrout; + return(OK); + case BSIM3v0_MOD_WDSUB : + value->rValue = model->BSIM3v0wdsub; + return(OK); + case BSIM3v0_MOD_WVTH0: + value->rValue = model->BSIM3v0wvth0; + return(OK); + case BSIM3v0_MOD_WUA: + value->rValue = model->BSIM3v0wua; + return(OK); + case BSIM3v0_MOD_WUA1: + value->rValue = model->BSIM3v0wua1; + return(OK); + case BSIM3v0_MOD_WUB: + value->rValue = model->BSIM3v0wub; + return(OK); + case BSIM3v0_MOD_WUB1: + value->rValue = model->BSIM3v0wub1; + return(OK); + case BSIM3v0_MOD_WUC: + value->rValue = model->BSIM3v0wuc; + return(OK); + case BSIM3v0_MOD_WUC1: + value->rValue = model->BSIM3v0wuc1; + return(OK); + case BSIM3v0_MOD_WU0: + value->rValue = model->BSIM3v0wu0; + return(OK); + case BSIM3v0_MOD_WUTE: + value->rValue = model->BSIM3v0wute; + return(OK); + case BSIM3v0_MOD_WVOFF: + value->rValue = model->BSIM3v0wvoff; + return(OK); + case BSIM3v0_MOD_WDELTA: + value->rValue = model->BSIM3v0wdelta; + return(OK); + case BSIM3v0_MOD_WRDSW: + value->rValue = model->BSIM3v0wrdsw; + return(OK); + case BSIM3v0_MOD_WPRWB: + value->rValue = model->BSIM3v0wprwb; + return(OK); + case BSIM3v0_MOD_WPRWG: + value->rValue = model->BSIM3v0wprwg; + return(OK); + case BSIM3v0_MOD_WPRT: + value->rValue = model->BSIM3v0wprt; + return(OK); + case BSIM3v0_MOD_WETA0: + value->rValue = model->BSIM3v0weta0; + return(OK); + case BSIM3v0_MOD_WETAB: + value->rValue = model->BSIM3v0wetab; + return(OK); + case BSIM3v0_MOD_WPCLM: + value->rValue = model->BSIM3v0wpclm; + return(OK); + case BSIM3v0_MOD_WPDIBL1: + value->rValue = model->BSIM3v0wpdibl1; + return(OK); + case BSIM3v0_MOD_WPDIBL2: + value->rValue = model->BSIM3v0wpdibl2; + return(OK); + case BSIM3v0_MOD_WPDIBLB: + value->rValue = model->BSIM3v0wpdiblb; + return(OK); + case BSIM3v0_MOD_WPSCBE1: + value->rValue = model->BSIM3v0wpscbe1; + return(OK); + case BSIM3v0_MOD_WPSCBE2: + value->rValue = model->BSIM3v0wpscbe2; + return(OK); + case BSIM3v0_MOD_WPVAG: + value->rValue = model->BSIM3v0wpvag; + return(OK); + case BSIM3v0_MOD_WWR: + value->rValue = model->BSIM3v0wwr; + return(OK); + case BSIM3v0_MOD_WDWG: + value->rValue = model->BSIM3v0wdwg; + return(OK); + case BSIM3v0_MOD_WDWB: + value->rValue = model->BSIM3v0wdwb; + return(OK); + case BSIM3v0_MOD_WB0: + value->rValue = model->BSIM3v0wb0; + return(OK); + case BSIM3v0_MOD_WB1: + value->rValue = model->BSIM3v0wb1; + return(OK); + case BSIM3v0_MOD_WALPHA0: + value->rValue = model->BSIM3v0walpha0; + return(OK); + case BSIM3v0_MOD_WBETA0: + value->rValue = model->BSIM3v0wbeta0; + return(OK); + + case BSIM3v0_MOD_WELM: + value->rValue = model->BSIM3v0welm; + return(OK); + case BSIM3v0_MOD_WCGSL: + value->rValue = model->BSIM3v0wcgsl; + return(OK); + case BSIM3v0_MOD_WCGDL: + value->rValue = model->BSIM3v0wcgdl; + return(OK); + case BSIM3v0_MOD_WCKAPPA: + value->rValue = model->BSIM3v0wckappa; + return(OK); + case BSIM3v0_MOD_WCF: + value->rValue = model->BSIM3v0wcf; + return(OK); + case BSIM3v0_MOD_WCLC: + value->rValue = model->BSIM3v0wclc; + return(OK); + case BSIM3v0_MOD_WCLE: + value->rValue = model->BSIM3v0wcle; + return(OK); + + /* Cross-term dependence */ + case BSIM3v0_MOD_PCDSC : + value->rValue = model->BSIM3v0pcdsc; + return(OK); + case BSIM3v0_MOD_PCDSCB : + value->rValue = model->BSIM3v0pcdscb; + return(OK); + case BSIM3v0_MOD_PCDSCD : + value->rValue = model->BSIM3v0pcdscd; + return(OK); + case BSIM3v0_MOD_PCIT : + value->rValue = model->BSIM3v0pcit; + return(OK); + case BSIM3v0_MOD_PNFACTOR : + value->rValue = model->BSIM3v0pnfactor; + return(OK); + case BSIM3v0_MOD_PXJ: + value->rValue = model->BSIM3v0pxj; + return(OK); + case BSIM3v0_MOD_PVSAT: + value->rValue = model->BSIM3v0pvsat; + return(OK); + case BSIM3v0_MOD_PAT: + value->rValue = model->BSIM3v0pat; + return(OK); + case BSIM3v0_MOD_PA0: + value->rValue = model->BSIM3v0pa0; + return(OK); + case BSIM3v0_MOD_PAGS: + value->rValue = model->BSIM3v0pags; + return(OK); + case BSIM3v0_MOD_PA1: + value->rValue = model->BSIM3v0pa1; + return(OK); + case BSIM3v0_MOD_PA2: + value->rValue = model->BSIM3v0pa2; + return(OK); + case BSIM3v0_MOD_PKETA: + value->rValue = model->BSIM3v0pketa; + return(OK); + case BSIM3v0_MOD_PNSUB: + value->rValue = model->BSIM3v0pnsub; + return(OK); + case BSIM3v0_MOD_PNPEAK: + value->rValue = model->BSIM3v0pnpeak; + return(OK); + case BSIM3v0_MOD_PNGATE: + value->rValue = model->BSIM3v0pngate; + return(OK); + case BSIM3v0_MOD_PGAMMA1: + value->rValue = model->BSIM3v0pgamma1; + return(OK); + case BSIM3v0_MOD_PGAMMA2: + value->rValue = model->BSIM3v0pgamma2; + return(OK); + case BSIM3v0_MOD_PVBX: + value->rValue = model->BSIM3v0pvbx; + return(OK); + case BSIM3v0_MOD_PVBM: + value->rValue = model->BSIM3v0pvbm; + return(OK); + case BSIM3v0_MOD_PXT: + value->rValue = model->BSIM3v0pxt; + return(OK); + case BSIM3v0_MOD_PK1: + value->rValue = model->BSIM3v0pk1; + return(OK); + case BSIM3v0_MOD_PKT1: + value->rValue = model->BSIM3v0pkt1; + return(OK); + case BSIM3v0_MOD_PKT1L: + value->rValue = model->BSIM3v0pkt1l; + return(OK); + case BSIM3v0_MOD_PKT2 : + value->rValue = model->BSIM3v0pkt2; + return(OK); + case BSIM3v0_MOD_PK2 : + value->rValue = model->BSIM3v0pk2; + return(OK); + case BSIM3v0_MOD_PK3: + value->rValue = model->BSIM3v0pk3; + return(OK); + case BSIM3v0_MOD_PK3B: + value->rValue = model->BSIM3v0pk3b; + return(OK); + case BSIM3v0_MOD_PW0: + value->rValue = model->BSIM3v0pw0; + return(OK); + case BSIM3v0_MOD_PNLX: + value->rValue = model->BSIM3v0pnlx; + return(OK); + case BSIM3v0_MOD_PDVT0 : + value->rValue = model->BSIM3v0pdvt0; + return(OK); + case BSIM3v0_MOD_PDVT1 : + value->rValue = model->BSIM3v0pdvt1; + return(OK); + case BSIM3v0_MOD_PDVT2 : + value->rValue = model->BSIM3v0pdvt2; + return(OK); + case BSIM3v0_MOD_PDVT0W : + value->rValue = model->BSIM3v0pdvt0w; + return(OK); + case BSIM3v0_MOD_PDVT1W : + value->rValue = model->BSIM3v0pdvt1w; + return(OK); + case BSIM3v0_MOD_PDVT2W : + value->rValue = model->BSIM3v0pdvt2w; + return(OK); + case BSIM3v0_MOD_PDROUT : + value->rValue = model->BSIM3v0pdrout; + return(OK); + case BSIM3v0_MOD_PDSUB : + value->rValue = model->BSIM3v0pdsub; + return(OK); + case BSIM3v0_MOD_PVTH0: + value->rValue = model->BSIM3v0pvth0; + return(OK); + case BSIM3v0_MOD_PUA: + value->rValue = model->BSIM3v0pua; + return(OK); + case BSIM3v0_MOD_PUA1: + value->rValue = model->BSIM3v0pua1; + return(OK); + case BSIM3v0_MOD_PUB: + value->rValue = model->BSIM3v0pub; + return(OK); + case BSIM3v0_MOD_PUB1: + value->rValue = model->BSIM3v0pub1; + return(OK); + case BSIM3v0_MOD_PUC: + value->rValue = model->BSIM3v0puc; + return(OK); + case BSIM3v0_MOD_PUC1: + value->rValue = model->BSIM3v0puc1; + return(OK); + case BSIM3v0_MOD_PU0: + value->rValue = model->BSIM3v0pu0; + return(OK); + case BSIM3v0_MOD_PUTE: + value->rValue = model->BSIM3v0pute; + return(OK); + case BSIM3v0_MOD_PVOFF: + value->rValue = model->BSIM3v0pvoff; + return(OK); + case BSIM3v0_MOD_PDELTA: + value->rValue = model->BSIM3v0pdelta; + return(OK); + case BSIM3v0_MOD_PRDSW: + value->rValue = model->BSIM3v0prdsw; + return(OK); + case BSIM3v0_MOD_PPRWB: + value->rValue = model->BSIM3v0pprwb; + return(OK); + case BSIM3v0_MOD_PPRWG: + value->rValue = model->BSIM3v0pprwg; + return(OK); + case BSIM3v0_MOD_PPRT: + value->rValue = model->BSIM3v0pprt; + return(OK); + case BSIM3v0_MOD_PETA0: + value->rValue = model->BSIM3v0peta0; + return(OK); + case BSIM3v0_MOD_PETAB: + value->rValue = model->BSIM3v0petab; + return(OK); + case BSIM3v0_MOD_PPCLM: + value->rValue = model->BSIM3v0ppclm; + return(OK); + case BSIM3v0_MOD_PPDIBL1: + value->rValue = model->BSIM3v0ppdibl1; + return(OK); + case BSIM3v0_MOD_PPDIBL2: + value->rValue = model->BSIM3v0ppdibl2; + return(OK); + case BSIM3v0_MOD_PPDIBLB: + value->rValue = model->BSIM3v0ppdiblb; + return(OK); + case BSIM3v0_MOD_PPSCBE1: + value->rValue = model->BSIM3v0ppscbe1; + return(OK); + case BSIM3v0_MOD_PPSCBE2: + value->rValue = model->BSIM3v0ppscbe2; + return(OK); + case BSIM3v0_MOD_PPVAG: + value->rValue = model->BSIM3v0ppvag; + return(OK); + case BSIM3v0_MOD_PWR: + value->rValue = model->BSIM3v0pwr; + return(OK); + case BSIM3v0_MOD_PDWG: + value->rValue = model->BSIM3v0pdwg; + return(OK); + case BSIM3v0_MOD_PDWB: + value->rValue = model->BSIM3v0pdwb; + return(OK); + case BSIM3v0_MOD_PB0: + value->rValue = model->BSIM3v0pb0; + return(OK); + case BSIM3v0_MOD_PB1: + value->rValue = model->BSIM3v0pb1; + return(OK); + case BSIM3v0_MOD_PALPHA0: + value->rValue = model->BSIM3v0palpha0; + return(OK); + case BSIM3v0_MOD_PBETA0: + value->rValue = model->BSIM3v0pbeta0; + return(OK); + + case BSIM3v0_MOD_PELM: + value->rValue = model->BSIM3v0pelm; + return(OK); + case BSIM3v0_MOD_PCGSL: + value->rValue = model->BSIM3v0pcgsl; + return(OK); + case BSIM3v0_MOD_PCGDL: + value->rValue = model->BSIM3v0pcgdl; + return(OK); + case BSIM3v0_MOD_PCKAPPA: + value->rValue = model->BSIM3v0pckappa; + return(OK); + case BSIM3v0_MOD_PCF: + value->rValue = model->BSIM3v0pcf; + return(OK); + case BSIM3v0_MOD_PCLC: + value->rValue = model->BSIM3v0pclc; + return(OK); + case BSIM3v0_MOD_PCLE: + value->rValue = model->BSIM3v0pcle; + return(OK); + + case BSIM3v0_MOD_TNOM : + value->rValue = model->BSIM3v0tnom; + return(OK); + case BSIM3v0_MOD_CGSO: + value->rValue = model->BSIM3v0cgso; + return(OK); + case BSIM3v0_MOD_CGDO: + value->rValue = model->BSIM3v0cgdo; + return(OK); + case BSIM3v0_MOD_CGBO: + value->rValue = model->BSIM3v0cgbo; + return(OK); + case BSIM3v0_MOD_XPART: + value->rValue = model->BSIM3v0xpart; + return(OK); + case BSIM3v0_MOD_RSH: + value->rValue = model->BSIM3v0sheetResistance; + return(OK); + case BSIM3v0_MOD_JS: + value->rValue = model->BSIM3v0jctSatCurDensity; + return(OK); + case BSIM3v0_MOD_PB: + value->rValue = model->BSIM3v0bulkJctPotential; + return(OK); + case BSIM3v0_MOD_MJ: + value->rValue = model->BSIM3v0bulkJctBotGradingCoeff; + return(OK); + case BSIM3v0_MOD_PBSW: + value->rValue = model->BSIM3v0sidewallJctPotential; + return(OK); + case BSIM3v0_MOD_MJSW: + value->rValue = model->BSIM3v0bulkJctSideGradingCoeff; + return(OK); + case BSIM3v0_MOD_CJ: + value->rValue = model->BSIM3v0unitAreaJctCap; + return(OK); + case BSIM3v0_MOD_CJSW: + value->rValue = model->BSIM3v0unitLengthSidewallJctCap; + return(OK); + case BSIM3v0_MOD_LINT: + value->rValue = model->BSIM3v0Lint; + return(OK); + case BSIM3v0_MOD_LL: + value->rValue = model->BSIM3v0Ll; + return(OK); + case BSIM3v0_MOD_LLN: + value->rValue = model->BSIM3v0Lln; + return(OK); + case BSIM3v0_MOD_LW: + value->rValue = model->BSIM3v0Lw; + return(OK); + case BSIM3v0_MOD_LWN: + value->rValue = model->BSIM3v0Lwn; + return(OK); + case BSIM3v0_MOD_LWL: + value->rValue = model->BSIM3v0Lwl; + return(OK); + case BSIM3v0_MOD_LMIN: + value->rValue = model->BSIM3v0Lmin; + return(OK); + case BSIM3v0_MOD_LMAX: + value->rValue = model->BSIM3v0Lmax; + return(OK); + case BSIM3v0_MOD_WINT: + value->rValue = model->BSIM3v0Wint; + return(OK); + case BSIM3v0_MOD_WL: + value->rValue = model->BSIM3v0Wl; + return(OK); + case BSIM3v0_MOD_WLN: + value->rValue = model->BSIM3v0Wln; + return(OK); + case BSIM3v0_MOD_WW: + value->rValue = model->BSIM3v0Ww; + return(OK); + case BSIM3v0_MOD_WWN: + value->rValue = model->BSIM3v0Wwn; + return(OK); + case BSIM3v0_MOD_WWL: + value->rValue = model->BSIM3v0Wwl; + return(OK); + case BSIM3v0_MOD_WMIN: + value->rValue = model->BSIM3v0Wmin; + return(OK); + case BSIM3v0_MOD_WMAX: + value->rValue = model->BSIM3v0Wmax; + return(OK); + case BSIM3v0_MOD_NOIA: + value->rValue = model->BSIM3v0oxideTrapDensityA; + return(OK); + case BSIM3v0_MOD_NOIB: + value->rValue = model->BSIM3v0oxideTrapDensityB; + return(OK); + case BSIM3v0_MOD_NOIC: + value->rValue = model->BSIM3v0oxideTrapDensityC; + return(OK); + case BSIM3v0_MOD_EM: + value->rValue = model->BSIM3v0em; + return(OK); + case BSIM3v0_MOD_EF: + value->rValue = model->BSIM3v0ef; + return(OK); + case BSIM3v0_MOD_AF: + value->rValue = model->BSIM3v0af; + return(OK); + case BSIM3v0_MOD_KF: + value->rValue = model->BSIM3v0kf; + return(OK); + default: + return(E_BADPARM); + } + /* NOTREACHED */ +} + + + diff --git a/src/spicelib/devices/bsim3v0/b3v0mdel.c b/src/spicelib/devices/bsim3v0/b3v0mdel.c new file mode 100644 index 000000000..528377aa4 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0mdel.c @@ -0,0 +1,42 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0mdel.c +**********/ + +#include "ngspice.h" +#include "bsim3v0def.h" +#include "sperror.h" +#include "suffix.h" + +int +BSIM3v0mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) +{ +BSIM3v0model **model = (BSIM3v0model**)inModel; +BSIM3v0model *modfast = (BSIM3v0model*)kill; +BSIM3v0instance *here; +BSIM3v0instance *prev = NULL; +BSIM3v0model **oldmod; + + oldmod = model; + for (; *model ; model = &((*model)->BSIM3v0nextModel)) + { if ((*model)->BSIM3v0modName == modname || + (modfast && *model == modfast)) + goto delgot; + oldmod = model; + } + return(E_NOMOD); + +delgot: + *oldmod = (*model)->BSIM3v0nextModel; /* cut deleted device out of list */ + for (here = (*model)->BSIM3v0instances; here; here = here->BSIM3v0nextInstance) + { if(prev) FREE(prev); + prev = here; + } + if(prev) FREE(prev); + FREE(*model); + return(OK); +} + + + diff --git a/src/spicelib/devices/bsim3v0/b3v0mpar.c b/src/spicelib/devices/bsim3v0/b3v0mpar.c new file mode 100644 index 000000000..4aa466e06 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0mpar.c @@ -0,0 +1,1482 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0mpar.c +**********/ + +#include "ngspice.h" +#include "bsim3v0def.h" +#include "ifsim.h" +#include "sperror.h" +#include "suffix.h" + + +int +BSIM3v0mParam(int param, IFvalue *value, GENmodel *inMod) +{ + BSIM3v0model *mod = (BSIM3v0model*)inMod; + switch(param) + { case BSIM3v0_MOD_MOBMOD : + mod->BSIM3v0mobMod = value->iValue; + mod->BSIM3v0mobModGiven = TRUE; + break; + case BSIM3v0_MOD_BINUNIT : + mod->BSIM3v0binUnit = value->iValue; + mod->BSIM3v0binUnitGiven = TRUE; + break; + case BSIM3v0_MOD_CAPMOD : + mod->BSIM3v0capMod = value->iValue; + mod->BSIM3v0capModGiven = TRUE; + break; + case BSIM3v0_MOD_NQSMOD : + mod->BSIM3v0nqsMod = value->iValue; + mod->BSIM3v0nqsModGiven = TRUE; + break; + case BSIM3v0_MOD_NOIMOD : + mod->BSIM3v0noiMod = value->iValue; + mod->BSIM3v0noiModGiven = TRUE; + break; + case BSIM3v0_MOD_TOX : + mod->BSIM3v0tox = value->rValue; + mod->BSIM3v0toxGiven = TRUE; + break; + + case BSIM3v0_MOD_CDSC : + mod->BSIM3v0cdsc = value->rValue; + mod->BSIM3v0cdscGiven = TRUE; + break; + case BSIM3v0_MOD_CDSCB : + mod->BSIM3v0cdscb = value->rValue; + mod->BSIM3v0cdscbGiven = TRUE; + break; + + case BSIM3v0_MOD_CDSCD : + mod->BSIM3v0cdscd = value->rValue; + mod->BSIM3v0cdscdGiven = TRUE; + break; + + case BSIM3v0_MOD_CIT : + mod->BSIM3v0cit = value->rValue; + mod->BSIM3v0citGiven = TRUE; + break; + case BSIM3v0_MOD_NFACTOR : + mod->BSIM3v0nfactor = value->rValue; + mod->BSIM3v0nfactorGiven = TRUE; + break; + case BSIM3v0_MOD_XJ: + mod->BSIM3v0xj = value->rValue; + mod->BSIM3v0xjGiven = TRUE; + break; + case BSIM3v0_MOD_VSAT: + mod->BSIM3v0vsat = value->rValue; + mod->BSIM3v0vsatGiven = TRUE; + break; + case BSIM3v0_MOD_A0: + mod->BSIM3v0a0 = value->rValue; + mod->BSIM3v0a0Given = TRUE; + break; + + case BSIM3v0_MOD_AGS: + mod->BSIM3v0ags= value->rValue; + mod->BSIM3v0agsGiven = TRUE; + break; + + case BSIM3v0_MOD_A1: + mod->BSIM3v0a1 = value->rValue; + mod->BSIM3v0a1Given = TRUE; + break; + case BSIM3v0_MOD_A2: + mod->BSIM3v0a2 = value->rValue; + mod->BSIM3v0a2Given = TRUE; + break; + case BSIM3v0_MOD_AT: + mod->BSIM3v0at = value->rValue; + mod->BSIM3v0atGiven = TRUE; + break; + case BSIM3v0_MOD_KETA: + mod->BSIM3v0keta = value->rValue; + mod->BSIM3v0ketaGiven = TRUE; + break; + case BSIM3v0_MOD_NSUB: + mod->BSIM3v0nsub = value->rValue; + mod->BSIM3v0nsubGiven = TRUE; + break; + case BSIM3v0_MOD_NPEAK: + mod->BSIM3v0npeak = value->rValue; + mod->BSIM3v0npeakGiven = TRUE; + if (mod->BSIM3v0npeak > 1.0e20) + mod->BSIM3v0npeak *= 1.0e-6; + break; + case BSIM3v0_MOD_NGATE: + mod->BSIM3v0ngate = value->rValue; + mod->BSIM3v0ngateGiven = TRUE; + if (mod->BSIM3v0ngate > 1.0e23) + mod->BSIM3v0ngate *= 1.0e-6; + break; + case BSIM3v0_MOD_GAMMA1: + mod->BSIM3v0gamma1 = value->rValue; + mod->BSIM3v0gamma1Given = TRUE; + break; + case BSIM3v0_MOD_GAMMA2: + mod->BSIM3v0gamma2 = value->rValue; + mod->BSIM3v0gamma2Given = TRUE; + break; + case BSIM3v0_MOD_VBX: + mod->BSIM3v0vbx = value->rValue; + mod->BSIM3v0vbxGiven = TRUE; + break; + case BSIM3v0_MOD_VBM: + mod->BSIM3v0vbm = value->rValue; + mod->BSIM3v0vbmGiven = TRUE; + break; + case BSIM3v0_MOD_XT: + mod->BSIM3v0xt = value->rValue; + mod->BSIM3v0xtGiven = TRUE; + break; + case BSIM3v0_MOD_K1: + mod->BSIM3v0k1 = value->rValue; + mod->BSIM3v0k1Given = TRUE; + break; + case BSIM3v0_MOD_KT1: + mod->BSIM3v0kt1 = value->rValue; + mod->BSIM3v0kt1Given = TRUE; + break; + case BSIM3v0_MOD_KT1L: + mod->BSIM3v0kt1l = value->rValue; + mod->BSIM3v0kt1lGiven = TRUE; + break; + case BSIM3v0_MOD_KT2: + mod->BSIM3v0kt2 = value->rValue; + mod->BSIM3v0kt2Given = TRUE; + break; + case BSIM3v0_MOD_K2: + mod->BSIM3v0k2 = value->rValue; + mod->BSIM3v0k2Given = TRUE; + break; + case BSIM3v0_MOD_K3: + mod->BSIM3v0k3 = value->rValue; + mod->BSIM3v0k3Given = TRUE; + break; + case BSIM3v0_MOD_K3B: + mod->BSIM3v0k3b = value->rValue; + mod->BSIM3v0k3bGiven = TRUE; + break; + case BSIM3v0_MOD_NLX: + mod->BSIM3v0nlx = value->rValue; + mod->BSIM3v0nlxGiven = TRUE; + break; + case BSIM3v0_MOD_W0: + mod->BSIM3v0w0 = value->rValue; + mod->BSIM3v0w0Given = TRUE; + break; + case BSIM3v0_MOD_DVT0: + mod->BSIM3v0dvt0 = value->rValue; + mod->BSIM3v0dvt0Given = TRUE; + break; + case BSIM3v0_MOD_DVT1: + mod->BSIM3v0dvt1 = value->rValue; + mod->BSIM3v0dvt1Given = TRUE; + break; + case BSIM3v0_MOD_DVT2: + mod->BSIM3v0dvt2 = value->rValue; + mod->BSIM3v0dvt2Given = TRUE; + break; + case BSIM3v0_MOD_DVT0W: + mod->BSIM3v0dvt0w = value->rValue; + mod->BSIM3v0dvt0wGiven = TRUE; + break; + case BSIM3v0_MOD_DVT1W: + mod->BSIM3v0dvt1w = value->rValue; + mod->BSIM3v0dvt1wGiven = TRUE; + break; + case BSIM3v0_MOD_DVT2W: + mod->BSIM3v0dvt2w = value->rValue; + mod->BSIM3v0dvt2wGiven = TRUE; + break; + case BSIM3v0_MOD_DROUT: + mod->BSIM3v0drout = value->rValue; + mod->BSIM3v0droutGiven = TRUE; + break; + case BSIM3v0_MOD_DSUB: + mod->BSIM3v0dsub = value->rValue; + mod->BSIM3v0dsubGiven = TRUE; + break; + case BSIM3v0_MOD_VTH0: + mod->BSIM3v0vth0 = value->rValue; + mod->BSIM3v0vth0Given = TRUE; + break; + case BSIM3v0_MOD_UA: + mod->BSIM3v0ua = value->rValue; + mod->BSIM3v0uaGiven = TRUE; + break; + case BSIM3v0_MOD_UA1: + mod->BSIM3v0ua1 = value->rValue; + mod->BSIM3v0ua1Given = TRUE; + break; + case BSIM3v0_MOD_UB: + mod->BSIM3v0ub = value->rValue; + mod->BSIM3v0ubGiven = TRUE; + break; + case BSIM3v0_MOD_UB1: + mod->BSIM3v0ub1 = value->rValue; + mod->BSIM3v0ub1Given = TRUE; + break; + case BSIM3v0_MOD_UC: + mod->BSIM3v0uc = value->rValue; + mod->BSIM3v0ucGiven = TRUE; + break; + case BSIM3v0_MOD_UC1: + mod->BSIM3v0uc1 = value->rValue; + mod->BSIM3v0uc1Given = TRUE; + break; + case BSIM3v0_MOD_U0 : + mod->BSIM3v0u0 = value->rValue; + mod->BSIM3v0u0Given = TRUE; + if (mod->BSIM3v0u0 > 1.0) + mod->BSIM3v0u0 *= 1.0e-4; + break; + case BSIM3v0_MOD_UTE : + mod->BSIM3v0ute = value->rValue; + mod->BSIM3v0uteGiven = TRUE; + break; + case BSIM3v0_MOD_VOFF: + mod->BSIM3v0voff = value->rValue; + mod->BSIM3v0voffGiven = TRUE; + break; + case BSIM3v0_MOD_DELTA : + mod->BSIM3v0delta = value->rValue; + mod->BSIM3v0deltaGiven = TRUE; + break; + case BSIM3v0_MOD_RDSW: + mod->BSIM3v0rdsw = value->rValue; + mod->BSIM3v0rdswGiven = TRUE; + break; + case BSIM3v0_MOD_PRWG: + mod->BSIM3v0prwg = value->rValue; + mod->BSIM3v0prwgGiven = TRUE; + break; + case BSIM3v0_MOD_PRWB: + mod->BSIM3v0prwb = value->rValue; + mod->BSIM3v0prwbGiven = TRUE; + break; + case BSIM3v0_MOD_PRT: + mod->BSIM3v0prt = value->rValue; + mod->BSIM3v0prtGiven = TRUE; + break; + case BSIM3v0_MOD_ETA0: + mod->BSIM3v0eta0 = value->rValue; + mod->BSIM3v0eta0Given = TRUE; + break; + case BSIM3v0_MOD_ETAB: + mod->BSIM3v0etab = value->rValue; + mod->BSIM3v0etabGiven = TRUE; + break; + case BSIM3v0_MOD_PCLM: + mod->BSIM3v0pclm = value->rValue; + mod->BSIM3v0pclmGiven = TRUE; + break; + case BSIM3v0_MOD_PDIBL1: + mod->BSIM3v0pdibl1 = value->rValue; + mod->BSIM3v0pdibl1Given = TRUE; + break; + case BSIM3v0_MOD_PDIBL2: + mod->BSIM3v0pdibl2 = value->rValue; + mod->BSIM3v0pdibl2Given = TRUE; + break; + case BSIM3v0_MOD_PDIBLB: + mod->BSIM3v0pdiblb = value->rValue; + mod->BSIM3v0pdiblbGiven = TRUE; + break; + case BSIM3v0_MOD_PSCBE1: + mod->BSIM3v0pscbe1 = value->rValue; + mod->BSIM3v0pscbe1Given = TRUE; + break; + case BSIM3v0_MOD_PSCBE2: + mod->BSIM3v0pscbe2 = value->rValue; + mod->BSIM3v0pscbe2Given = TRUE; + break; + case BSIM3v0_MOD_PVAG: + mod->BSIM3v0pvag = value->rValue; + mod->BSIM3v0pvagGiven = TRUE; + break; + case BSIM3v0_MOD_WR : + mod->BSIM3v0wr = value->rValue; + mod->BSIM3v0wrGiven = TRUE; + break; + case BSIM3v0_MOD_DWG : + mod->BSIM3v0dwg = value->rValue; + mod->BSIM3v0dwgGiven = TRUE; + break; + case BSIM3v0_MOD_DWB : + mod->BSIM3v0dwb = value->rValue; + mod->BSIM3v0dwbGiven = TRUE; + break; + case BSIM3v0_MOD_B0 : + mod->BSIM3v0b0 = value->rValue; + mod->BSIM3v0b0Given = TRUE; + break; + case BSIM3v0_MOD_B1 : + mod->BSIM3v0b1 = value->rValue; + mod->BSIM3v0b1Given = TRUE; + break; + case BSIM3v0_MOD_ALPHA0 : + mod->BSIM3v0alpha0 = value->rValue; + mod->BSIM3v0alpha0Given = TRUE; + break; + case BSIM3v0_MOD_BETA0 : + mod->BSIM3v0beta0 = value->rValue; + mod->BSIM3v0beta0Given = TRUE; + break; + + case BSIM3v0_MOD_ELM : + mod->BSIM3v0elm = value->rValue; + mod->BSIM3v0elmGiven = TRUE; + break; + case BSIM3v0_MOD_CGSL : + mod->BSIM3v0cgsl = value->rValue; + mod->BSIM3v0cgslGiven = TRUE; + break; + case BSIM3v0_MOD_CGDL : + mod->BSIM3v0cgdl = value->rValue; + mod->BSIM3v0cgdlGiven = TRUE; + break; + case BSIM3v0_MOD_CKAPPA : + mod->BSIM3v0ckappa = value->rValue; + mod->BSIM3v0ckappaGiven = TRUE; + break; + case BSIM3v0_MOD_CF : + mod->BSIM3v0cf = value->rValue; + mod->BSIM3v0cfGiven = TRUE; + break; + case BSIM3v0_MOD_CLC : + mod->BSIM3v0clc = value->rValue; + mod->BSIM3v0clcGiven = TRUE; + break; + case BSIM3v0_MOD_CLE : + mod->BSIM3v0cle = value->rValue; + mod->BSIM3v0cleGiven = TRUE; + break; + case BSIM3v0_MOD_DWC : + mod->BSIM3v0dwc = value->rValue; + mod->BSIM3v0dwcGiven = TRUE; + break; + case BSIM3v0_MOD_DLC : + mod->BSIM3v0dlc = value->rValue; + mod->BSIM3v0dlcGiven = TRUE; + break; + + /* Length dependence */ + case BSIM3v0_MOD_LCDSC : + mod->BSIM3v0lcdsc = value->rValue; + mod->BSIM3v0lcdscGiven = TRUE; + break; + + + case BSIM3v0_MOD_LCDSCB : + mod->BSIM3v0lcdscb = value->rValue; + mod->BSIM3v0lcdscbGiven = TRUE; + break; + case BSIM3v0_MOD_LCDSCD : + mod->BSIM3v0lcdscd = value->rValue; + mod->BSIM3v0lcdscdGiven = TRUE; + break; + case BSIM3v0_MOD_LCIT : + mod->BSIM3v0lcit = value->rValue; + mod->BSIM3v0lcitGiven = TRUE; + break; + case BSIM3v0_MOD_LNFACTOR : + mod->BSIM3v0lnfactor = value->rValue; + mod->BSIM3v0lnfactorGiven = TRUE; + break; + case BSIM3v0_MOD_LXJ: + mod->BSIM3v0lxj = value->rValue; + mod->BSIM3v0lxjGiven = TRUE; + break; + case BSIM3v0_MOD_LVSAT: + mod->BSIM3v0lvsat = value->rValue; + mod->BSIM3v0lvsatGiven = TRUE; + break; + + + case BSIM3v0_MOD_LA0: + mod->BSIM3v0la0 = value->rValue; + mod->BSIM3v0la0Given = TRUE; + break; + case BSIM3v0_MOD_LAGS: + mod->BSIM3v0lags = value->rValue; + mod->BSIM3v0lagsGiven = TRUE; + break; + case BSIM3v0_MOD_LA1: + mod->BSIM3v0la1 = value->rValue; + mod->BSIM3v0la1Given = TRUE; + break; + case BSIM3v0_MOD_LA2: + mod->BSIM3v0la2 = value->rValue; + mod->BSIM3v0la2Given = TRUE; + break; + case BSIM3v0_MOD_LAT: + mod->BSIM3v0lat = value->rValue; + mod->BSIM3v0latGiven = TRUE; + break; + case BSIM3v0_MOD_LKETA: + mod->BSIM3v0lketa = value->rValue; + mod->BSIM3v0lketaGiven = TRUE; + break; + case BSIM3v0_MOD_LNSUB: + mod->BSIM3v0lnsub = value->rValue; + mod->BSIM3v0lnsubGiven = TRUE; + break; + case BSIM3v0_MOD_LNPEAK: + mod->BSIM3v0lnpeak = value->rValue; + mod->BSIM3v0lnpeakGiven = TRUE; + if (mod->BSIM3v0lnpeak > 1.0e20) + mod->BSIM3v0lnpeak *= 1.0e-6; + break; + case BSIM3v0_MOD_LNGATE: + mod->BSIM3v0lngate = value->rValue; + mod->BSIM3v0lngateGiven = TRUE; + if (mod->BSIM3v0lngate > 1.0e23) + mod->BSIM3v0lngate *= 1.0e-6; + break; + case BSIM3v0_MOD_LGAMMA1: + mod->BSIM3v0lgamma1 = value->rValue; + mod->BSIM3v0lgamma1Given = TRUE; + break; + case BSIM3v0_MOD_LGAMMA2: + mod->BSIM3v0lgamma2 = value->rValue; + mod->BSIM3v0lgamma2Given = TRUE; + break; + case BSIM3v0_MOD_LVBX: + mod->BSIM3v0lvbx = value->rValue; + mod->BSIM3v0lvbxGiven = TRUE; + break; + case BSIM3v0_MOD_LVBM: + mod->BSIM3v0lvbm = value->rValue; + mod->BSIM3v0lvbmGiven = TRUE; + break; + case BSIM3v0_MOD_LXT: + mod->BSIM3v0lxt = value->rValue; + mod->BSIM3v0lxtGiven = TRUE; + break; + case BSIM3v0_MOD_LK1: + mod->BSIM3v0lk1 = value->rValue; + mod->BSIM3v0lk1Given = TRUE; + break; + case BSIM3v0_MOD_LKT1: + mod->BSIM3v0lkt1 = value->rValue; + mod->BSIM3v0lkt1Given = TRUE; + break; + case BSIM3v0_MOD_LKT1L: + mod->BSIM3v0lkt1l = value->rValue; + mod->BSIM3v0lkt1lGiven = TRUE; + break; + case BSIM3v0_MOD_LKT2: + mod->BSIM3v0lkt2 = value->rValue; + mod->BSIM3v0lkt2Given = TRUE; + break; + case BSIM3v0_MOD_LK2: + mod->BSIM3v0lk2 = value->rValue; + mod->BSIM3v0lk2Given = TRUE; + break; + case BSIM3v0_MOD_LK3: + mod->BSIM3v0lk3 = value->rValue; + mod->BSIM3v0lk3Given = TRUE; + break; + case BSIM3v0_MOD_LK3B: + mod->BSIM3v0lk3b = value->rValue; + mod->BSIM3v0lk3bGiven = TRUE; + break; + case BSIM3v0_MOD_LNLX: + mod->BSIM3v0lnlx = value->rValue; + mod->BSIM3v0lnlxGiven = TRUE; + break; + case BSIM3v0_MOD_LW0: + mod->BSIM3v0lw0 = value->rValue; + mod->BSIM3v0lw0Given = TRUE; + break; + case BSIM3v0_MOD_LDVT0: + mod->BSIM3v0ldvt0 = value->rValue; + mod->BSIM3v0ldvt0Given = TRUE; + break; + case BSIM3v0_MOD_LDVT1: + mod->BSIM3v0ldvt1 = value->rValue; + mod->BSIM3v0ldvt1Given = TRUE; + break; + case BSIM3v0_MOD_LDVT2: + mod->BSIM3v0ldvt2 = value->rValue; + mod->BSIM3v0ldvt2Given = TRUE; + break; + case BSIM3v0_MOD_LDVT0W: + mod->BSIM3v0ldvt0w = value->rValue; + mod->BSIM3v0ldvt0Given = TRUE; + break; + case BSIM3v0_MOD_LDVT1W: + mod->BSIM3v0ldvt1 = value->rValue; + mod->BSIM3v0ldvt1wGiven = TRUE; + break; + case BSIM3v0_MOD_LDVT2W: + mod->BSIM3v0ldvt2 = value->rValue; + mod->BSIM3v0ldvt2wGiven = TRUE; + break; + case BSIM3v0_MOD_LDROUT: + mod->BSIM3v0ldrout = value->rValue; + mod->BSIM3v0ldroutGiven = TRUE; + break; + case BSIM3v0_MOD_LDSUB: + mod->BSIM3v0ldsub = value->rValue; + mod->BSIM3v0ldsubGiven = TRUE; + break; + case BSIM3v0_MOD_LVTH0: + mod->BSIM3v0lvth0 = value->rValue; + mod->BSIM3v0lvth0Given = TRUE; + break; + case BSIM3v0_MOD_LUA: + mod->BSIM3v0lua = value->rValue; + mod->BSIM3v0luaGiven = TRUE; + break; + case BSIM3v0_MOD_LUA1: + mod->BSIM3v0lua1 = value->rValue; + mod->BSIM3v0lua1Given = TRUE; + break; + case BSIM3v0_MOD_LUB: + mod->BSIM3v0lub = value->rValue; + mod->BSIM3v0lubGiven = TRUE; + break; + case BSIM3v0_MOD_LUB1: + mod->BSIM3v0lub1 = value->rValue; + mod->BSIM3v0lub1Given = TRUE; + break; + case BSIM3v0_MOD_LUC: + mod->BSIM3v0luc = value->rValue; + mod->BSIM3v0lucGiven = TRUE; + break; + case BSIM3v0_MOD_LUC1: + mod->BSIM3v0luc1 = value->rValue; + mod->BSIM3v0luc1Given = TRUE; + break; + case BSIM3v0_MOD_LU0 : + mod->BSIM3v0lu0 = value->rValue; + mod->BSIM3v0lu0Given = TRUE; + if (mod->BSIM3v0lu0 > 1.0) + mod->BSIM3v0lu0 *= 1.0e-4; + break; + case BSIM3v0_MOD_LUTE : + mod->BSIM3v0lute = value->rValue; + mod->BSIM3v0luteGiven = TRUE; + break; + case BSIM3v0_MOD_LVOFF: + mod->BSIM3v0lvoff = value->rValue; + mod->BSIM3v0lvoffGiven = TRUE; + break; + case BSIM3v0_MOD_LDELTA : + mod->BSIM3v0ldelta = value->rValue; + mod->BSIM3v0ldeltaGiven = TRUE; + break; + case BSIM3v0_MOD_LRDSW: + mod->BSIM3v0lrdsw = value->rValue; + mod->BSIM3v0lrdswGiven = TRUE; + break; + case BSIM3v0_MOD_LPRWB: + mod->BSIM3v0lprwb = value->rValue; + mod->BSIM3v0lprwbGiven = TRUE; + break; + case BSIM3v0_MOD_LPRWG: + mod->BSIM3v0lprwg = value->rValue; + mod->BSIM3v0lprwgGiven = TRUE; + break; + case BSIM3v0_MOD_LPRT: + mod->BSIM3v0lprt = value->rValue; + mod->BSIM3v0lprtGiven = TRUE; + break; + case BSIM3v0_MOD_LETA0: + mod->BSIM3v0leta0 = value->rValue; + mod->BSIM3v0leta0Given = TRUE; + break; + case BSIM3v0_MOD_LETAB: + mod->BSIM3v0letab = value->rValue; + mod->BSIM3v0letabGiven = TRUE; + break; + case BSIM3v0_MOD_LPCLM: + mod->BSIM3v0lpclm = value->rValue; + mod->BSIM3v0lpclmGiven = TRUE; + break; + case BSIM3v0_MOD_LPDIBL1: + mod->BSIM3v0lpdibl1 = value->rValue; + mod->BSIM3v0lpdibl1Given = TRUE; + break; + case BSIM3v0_MOD_LPDIBL2: + mod->BSIM3v0lpdibl2 = value->rValue; + mod->BSIM3v0lpdibl2Given = TRUE; + break; + case BSIM3v0_MOD_LPDIBLB: + mod->BSIM3v0lpdiblb = value->rValue; + mod->BSIM3v0lpdiblbGiven = TRUE; + break; + case BSIM3v0_MOD_LPSCBE1: + mod->BSIM3v0lpscbe1 = value->rValue; + mod->BSIM3v0lpscbe1Given = TRUE; + break; + case BSIM3v0_MOD_LPSCBE2: + mod->BSIM3v0lpscbe2 = value->rValue; + mod->BSIM3v0lpscbe2Given = TRUE; + break; + case BSIM3v0_MOD_LPVAG: + mod->BSIM3v0lpvag = value->rValue; + mod->BSIM3v0lpvagGiven = TRUE; + break; + case BSIM3v0_MOD_LWR : + mod->BSIM3v0lwr = value->rValue; + mod->BSIM3v0lwrGiven = TRUE; + break; + case BSIM3v0_MOD_LDWG : + mod->BSIM3v0ldwg = value->rValue; + mod->BSIM3v0ldwgGiven = TRUE; + break; + case BSIM3v0_MOD_LDWB : + mod->BSIM3v0ldwb = value->rValue; + mod->BSIM3v0ldwbGiven = TRUE; + break; + case BSIM3v0_MOD_LB0 : + mod->BSIM3v0lb0 = value->rValue; + mod->BSIM3v0lb0Given = TRUE; + break; + case BSIM3v0_MOD_LB1 : + mod->BSIM3v0lb1 = value->rValue; + mod->BSIM3v0lb1Given = TRUE; + break; + case BSIM3v0_MOD_LALPHA0 : + mod->BSIM3v0lalpha0 = value->rValue; + mod->BSIM3v0lalpha0Given = TRUE; + break; + case BSIM3v0_MOD_LBETA0 : + mod->BSIM3v0lbeta0 = value->rValue; + mod->BSIM3v0lbeta0Given = TRUE; + break; + + case BSIM3v0_MOD_LELM : + mod->BSIM3v0lelm = value->rValue; + mod->BSIM3v0lelmGiven = TRUE; + break; + case BSIM3v0_MOD_LCGSL : + mod->BSIM3v0lcgsl = value->rValue; + mod->BSIM3v0lcgslGiven = TRUE; + break; + case BSIM3v0_MOD_LCGDL : + mod->BSIM3v0lcgdl = value->rValue; + mod->BSIM3v0lcgdlGiven = TRUE; + break; + case BSIM3v0_MOD_LCKAPPA : + mod->BSIM3v0lckappa = value->rValue; + mod->BSIM3v0lckappaGiven = TRUE; + break; + case BSIM3v0_MOD_LCF : + mod->BSIM3v0lcf = value->rValue; + mod->BSIM3v0lcfGiven = TRUE; + break; + case BSIM3v0_MOD_LCLC : + mod->BSIM3v0lclc = value->rValue; + mod->BSIM3v0lclcGiven = TRUE; + break; + case BSIM3v0_MOD_LCLE : + mod->BSIM3v0lcle = value->rValue; + mod->BSIM3v0lcleGiven = TRUE; + break; + + /* Width dependence */ + case BSIM3v0_MOD_WCDSC : + mod->BSIM3v0wcdsc = value->rValue; + mod->BSIM3v0wcdscGiven = TRUE; + break; + + + case BSIM3v0_MOD_WCDSCB : + mod->BSIM3v0wcdscb = value->rValue; + mod->BSIM3v0wcdscbGiven = TRUE; + break; + case BSIM3v0_MOD_WCDSCD : + mod->BSIM3v0wcdscd = value->rValue; + mod->BSIM3v0wcdscdGiven = TRUE; + break; + case BSIM3v0_MOD_WCIT : + mod->BSIM3v0wcit = value->rValue; + mod->BSIM3v0wcitGiven = TRUE; + break; + case BSIM3v0_MOD_WNFACTOR : + mod->BSIM3v0wnfactor = value->rValue; + mod->BSIM3v0wnfactorGiven = TRUE; + break; + case BSIM3v0_MOD_WXJ: + mod->BSIM3v0wxj = value->rValue; + mod->BSIM3v0wxjGiven = TRUE; + break; + case BSIM3v0_MOD_WVSAT: + mod->BSIM3v0wvsat = value->rValue; + mod->BSIM3v0wvsatGiven = TRUE; + break; + + + case BSIM3v0_MOD_WA0: + mod->BSIM3v0wa0 = value->rValue; + mod->BSIM3v0wa0Given = TRUE; + break; + case BSIM3v0_MOD_WAGS: + mod->BSIM3v0wags = value->rValue; + mod->BSIM3v0wagsGiven = TRUE; + break; + case BSIM3v0_MOD_WA1: + mod->BSIM3v0wa1 = value->rValue; + mod->BSIM3v0wa1Given = TRUE; + break; + case BSIM3v0_MOD_WA2: + mod->BSIM3v0wa2 = value->rValue; + mod->BSIM3v0wa2Given = TRUE; + break; + case BSIM3v0_MOD_WAT: + mod->BSIM3v0wat = value->rValue; + mod->BSIM3v0watGiven = TRUE; + break; + case BSIM3v0_MOD_WKETA: + mod->BSIM3v0wketa = value->rValue; + mod->BSIM3v0wketaGiven = TRUE; + break; + case BSIM3v0_MOD_WNSUB: + mod->BSIM3v0wnsub = value->rValue; + mod->BSIM3v0wnsubGiven = TRUE; + break; + case BSIM3v0_MOD_WNPEAK: + mod->BSIM3v0wnpeak = value->rValue; + mod->BSIM3v0wnpeakGiven = TRUE; + if (mod->BSIM3v0wnpeak > 1.0e20) + mod->BSIM3v0wnpeak *= 1.0e-6; + break; + case BSIM3v0_MOD_WNGATE: + mod->BSIM3v0wngate = value->rValue; + mod->BSIM3v0wngateGiven = TRUE; + if (mod->BSIM3v0wngate > 1.0e23) + mod->BSIM3v0wngate *= 1.0e-6; + break; + case BSIM3v0_MOD_WGAMMA1: + mod->BSIM3v0wgamma1 = value->rValue; + mod->BSIM3v0wgamma1Given = TRUE; + break; + case BSIM3v0_MOD_WGAMMA2: + mod->BSIM3v0wgamma2 = value->rValue; + mod->BSIM3v0wgamma2Given = TRUE; + break; + case BSIM3v0_MOD_WVBX: + mod->BSIM3v0wvbx = value->rValue; + mod->BSIM3v0wvbxGiven = TRUE; + break; + case BSIM3v0_MOD_WVBM: + mod->BSIM3v0wvbm = value->rValue; + mod->BSIM3v0wvbmGiven = TRUE; + break; + case BSIM3v0_MOD_WXT: + mod->BSIM3v0wxt = value->rValue; + mod->BSIM3v0wxtGiven = TRUE; + break; + case BSIM3v0_MOD_WK1: + mod->BSIM3v0wk1 = value->rValue; + mod->BSIM3v0wk1Given = TRUE; + break; + case BSIM3v0_MOD_WKT1: + mod->BSIM3v0wkt1 = value->rValue; + mod->BSIM3v0wkt1Given = TRUE; + break; + case BSIM3v0_MOD_WKT1L: + mod->BSIM3v0wkt1l = value->rValue; + mod->BSIM3v0wkt1lGiven = TRUE; + break; + case BSIM3v0_MOD_WKT2: + mod->BSIM3v0wkt2 = value->rValue; + mod->BSIM3v0wkt2Given = TRUE; + break; + case BSIM3v0_MOD_WK2: + mod->BSIM3v0wk2 = value->rValue; + mod->BSIM3v0wk2Given = TRUE; + break; + case BSIM3v0_MOD_WK3: + mod->BSIM3v0wk3 = value->rValue; + mod->BSIM3v0wk3Given = TRUE; + break; + case BSIM3v0_MOD_WK3B: + mod->BSIM3v0wk3b = value->rValue; + mod->BSIM3v0wk3bGiven = TRUE; + break; + case BSIM3v0_MOD_WNLX: + mod->BSIM3v0wnlx = value->rValue; + mod->BSIM3v0wnlxGiven = TRUE; + break; + case BSIM3v0_MOD_WW0: + mod->BSIM3v0ww0 = value->rValue; + mod->BSIM3v0ww0Given = TRUE; + break; + case BSIM3v0_MOD_WDVT0: + mod->BSIM3v0wdvt0 = value->rValue; + mod->BSIM3v0wdvt0Given = TRUE; + break; + case BSIM3v0_MOD_WDVT1: + mod->BSIM3v0wdvt1 = value->rValue; + mod->BSIM3v0wdvt1Given = TRUE; + break; + case BSIM3v0_MOD_WDVT2: + mod->BSIM3v0wdvt2 = value->rValue; + mod->BSIM3v0wdvt2Given = TRUE; + break; + case BSIM3v0_MOD_WDVT0W: + mod->BSIM3v0wdvt0w = value->rValue; + mod->BSIM3v0wdvt0wGiven = TRUE; + break; + case BSIM3v0_MOD_WDVT1W: + mod->BSIM3v0wdvt1w = value->rValue; + mod->BSIM3v0wdvt1wGiven = TRUE; + break; + case BSIM3v0_MOD_WDVT2W: + mod->BSIM3v0wdvt2w = value->rValue; + mod->BSIM3v0wdvt2wGiven = TRUE; + break; + case BSIM3v0_MOD_WDROUT: + mod->BSIM3v0wdrout = value->rValue; + mod->BSIM3v0wdroutGiven = TRUE; + break; + case BSIM3v0_MOD_WDSUB: + mod->BSIM3v0wdsub = value->rValue; + mod->BSIM3v0wdsubGiven = TRUE; + break; + case BSIM3v0_MOD_WVTH0: + mod->BSIM3v0wvth0 = value->rValue; + mod->BSIM3v0wvth0Given = TRUE; + break; + case BSIM3v0_MOD_WUA: + mod->BSIM3v0wua = value->rValue; + mod->BSIM3v0wuaGiven = TRUE; + break; + case BSIM3v0_MOD_WUA1: + mod->BSIM3v0wua1 = value->rValue; + mod->BSIM3v0wua1Given = TRUE; + break; + case BSIM3v0_MOD_WUB: + mod->BSIM3v0wub = value->rValue; + mod->BSIM3v0wubGiven = TRUE; + break; + case BSIM3v0_MOD_WUB1: + mod->BSIM3v0wub1 = value->rValue; + mod->BSIM3v0wub1Given = TRUE; + break; + case BSIM3v0_MOD_WUC: + mod->BSIM3v0wuc = value->rValue; + mod->BSIM3v0wucGiven = TRUE; + break; + case BSIM3v0_MOD_WUC1: + mod->BSIM3v0wuc1 = value->rValue; + mod->BSIM3v0wuc1Given = TRUE; + break; + case BSIM3v0_MOD_WU0 : + mod->BSIM3v0wu0 = value->rValue; + mod->BSIM3v0wu0Given = TRUE; + if (mod->BSIM3v0wu0 > 1.0) + mod->BSIM3v0wu0 *= 1.0e-4; + break; + case BSIM3v0_MOD_WUTE : + mod->BSIM3v0wute = value->rValue; + mod->BSIM3v0wuteGiven = TRUE; + break; + case BSIM3v0_MOD_WVOFF: + mod->BSIM3v0wvoff = value->rValue; + mod->BSIM3v0wvoffGiven = TRUE; + break; + case BSIM3v0_MOD_WDELTA : + mod->BSIM3v0wdelta = value->rValue; + mod->BSIM3v0wdeltaGiven = TRUE; + break; + case BSIM3v0_MOD_WRDSW: + mod->BSIM3v0wrdsw = value->rValue; + mod->BSIM3v0wrdswGiven = TRUE; + break; + case BSIM3v0_MOD_WPRWB: + mod->BSIM3v0wprwb = value->rValue; + mod->BSIM3v0wprwbGiven = TRUE; + break; + case BSIM3v0_MOD_WPRWG: + mod->BSIM3v0wprwg = value->rValue; + mod->BSIM3v0wprwgGiven = TRUE; + break; + case BSIM3v0_MOD_WPRT: + mod->BSIM3v0wprt = value->rValue; + mod->BSIM3v0wprtGiven = TRUE; + break; + case BSIM3v0_MOD_WETA0: + mod->BSIM3v0weta0 = value->rValue; + mod->BSIM3v0weta0Given = TRUE; + break; + case BSIM3v0_MOD_WETAB: + mod->BSIM3v0wetab = value->rValue; + mod->BSIM3v0wetabGiven = TRUE; + break; + case BSIM3v0_MOD_WPCLM: + mod->BSIM3v0wpclm = value->rValue; + mod->BSIM3v0wpclmGiven = TRUE; + break; + case BSIM3v0_MOD_WPDIBL1: + mod->BSIM3v0wpdibl1 = value->rValue; + mod->BSIM3v0wpdibl1Given = TRUE; + break; + case BSIM3v0_MOD_WPDIBL2: + mod->BSIM3v0wpdibl2 = value->rValue; + mod->BSIM3v0wpdibl2Given = TRUE; + break; + case BSIM3v0_MOD_WPDIBLB: + mod->BSIM3v0wpdiblb = value->rValue; + mod->BSIM3v0wpdiblbGiven = TRUE; + break; + case BSIM3v0_MOD_WPSCBE1: + mod->BSIM3v0wpscbe1 = value->rValue; + mod->BSIM3v0wpscbe1Given = TRUE; + break; + case BSIM3v0_MOD_WPSCBE2: + mod->BSIM3v0wpscbe2 = value->rValue; + mod->BSIM3v0wpscbe2Given = TRUE; + break; + case BSIM3v0_MOD_WPVAG: + mod->BSIM3v0wpvag = value->rValue; + mod->BSIM3v0wpvagGiven = TRUE; + break; + case BSIM3v0_MOD_WWR : + mod->BSIM3v0wwr = value->rValue; + mod->BSIM3v0wwrGiven = TRUE; + break; + case BSIM3v0_MOD_WDWG : + mod->BSIM3v0wdwg = value->rValue; + mod->BSIM3v0wdwgGiven = TRUE; + break; + case BSIM3v0_MOD_WDWB : + mod->BSIM3v0wdwb = value->rValue; + mod->BSIM3v0wdwbGiven = TRUE; + break; + case BSIM3v0_MOD_WB0 : + mod->BSIM3v0wb0 = value->rValue; + mod->BSIM3v0wb0Given = TRUE; + break; + case BSIM3v0_MOD_WB1 : + mod->BSIM3v0wb1 = value->rValue; + mod->BSIM3v0wb1Given = TRUE; + break; + case BSIM3v0_MOD_WALPHA0 : + mod->BSIM3v0walpha0 = value->rValue; + mod->BSIM3v0walpha0Given = TRUE; + break; + case BSIM3v0_MOD_WBETA0 : + mod->BSIM3v0wbeta0 = value->rValue; + mod->BSIM3v0wbeta0Given = TRUE; + break; + + case BSIM3v0_MOD_WELM : + mod->BSIM3v0welm = value->rValue; + mod->BSIM3v0welmGiven = TRUE; + break; + case BSIM3v0_MOD_WCGSL : + mod->BSIM3v0wcgsl = value->rValue; + mod->BSIM3v0wcgslGiven = TRUE; + break; + case BSIM3v0_MOD_WCGDL : + mod->BSIM3v0wcgdl = value->rValue; + mod->BSIM3v0wcgdlGiven = TRUE; + break; + case BSIM3v0_MOD_WCKAPPA : + mod->BSIM3v0wckappa = value->rValue; + mod->BSIM3v0wckappaGiven = TRUE; + break; + case BSIM3v0_MOD_WCF : + mod->BSIM3v0wcf = value->rValue; + mod->BSIM3v0wcfGiven = TRUE; + break; + case BSIM3v0_MOD_WCLC : + mod->BSIM3v0wclc = value->rValue; + mod->BSIM3v0wclcGiven = TRUE; + break; + case BSIM3v0_MOD_WCLE : + mod->BSIM3v0wcle = value->rValue; + mod->BSIM3v0wcleGiven = TRUE; + break; + + /* Cross-term dependence */ + case BSIM3v0_MOD_PCDSC : + mod->BSIM3v0pcdsc = value->rValue; + mod->BSIM3v0pcdscGiven = TRUE; + break; + + + case BSIM3v0_MOD_PCDSCB : + mod->BSIM3v0pcdscb = value->rValue; + mod->BSIM3v0pcdscbGiven = TRUE; + break; + case BSIM3v0_MOD_PCDSCD : + mod->BSIM3v0pcdscd = value->rValue; + mod->BSIM3v0pcdscdGiven = TRUE; + break; + case BSIM3v0_MOD_PCIT : + mod->BSIM3v0pcit = value->rValue; + mod->BSIM3v0pcitGiven = TRUE; + break; + case BSIM3v0_MOD_PNFACTOR : + mod->BSIM3v0pnfactor = value->rValue; + mod->BSIM3v0pnfactorGiven = TRUE; + break; + case BSIM3v0_MOD_PXJ: + mod->BSIM3v0pxj = value->rValue; + mod->BSIM3v0pxjGiven = TRUE; + break; + case BSIM3v0_MOD_PVSAT: + mod->BSIM3v0pvsat = value->rValue; + mod->BSIM3v0pvsatGiven = TRUE; + break; + + + case BSIM3v0_MOD_PA0: + mod->BSIM3v0pa0 = value->rValue; + mod->BSIM3v0pa0Given = TRUE; + break; + case BSIM3v0_MOD_PAGS: + mod->BSIM3v0pags = value->rValue; + mod->BSIM3v0pagsGiven = TRUE; + break; + case BSIM3v0_MOD_PA1: + mod->BSIM3v0pa1 = value->rValue; + mod->BSIM3v0pa1Given = TRUE; + break; + case BSIM3v0_MOD_PA2: + mod->BSIM3v0pa2 = value->rValue; + mod->BSIM3v0pa2Given = TRUE; + break; + case BSIM3v0_MOD_PAT: + mod->BSIM3v0pat = value->rValue; + mod->BSIM3v0patGiven = TRUE; + break; + case BSIM3v0_MOD_PKETA: + mod->BSIM3v0pketa = value->rValue; + mod->BSIM3v0pketaGiven = TRUE; + break; + case BSIM3v0_MOD_PNSUB: + mod->BSIM3v0pnsub = value->rValue; + mod->BSIM3v0pnsubGiven = TRUE; + break; + case BSIM3v0_MOD_PNPEAK: + mod->BSIM3v0pnpeak = value->rValue; + mod->BSIM3v0pnpeakGiven = TRUE; + if (mod->BSIM3v0pnpeak > 1.0e20) + mod->BSIM3v0pnpeak *= 1.0e-6; + break; + case BSIM3v0_MOD_PNGATE: + mod->BSIM3v0pngate = value->rValue; + mod->BSIM3v0pngateGiven = TRUE; + if (mod->BSIM3v0pngate > 1.0e23) + mod->BSIM3v0pngate *= 1.0e-6; + break; + case BSIM3v0_MOD_PGAMMA1: + mod->BSIM3v0pgamma1 = value->rValue; + mod->BSIM3v0pgamma1Given = TRUE; + break; + case BSIM3v0_MOD_PGAMMA2: + mod->BSIM3v0pgamma2 = value->rValue; + mod->BSIM3v0pgamma2Given = TRUE; + break; + case BSIM3v0_MOD_PVBX: + mod->BSIM3v0pvbx = value->rValue; + mod->BSIM3v0pvbxGiven = TRUE; + break; + case BSIM3v0_MOD_PVBM: + mod->BSIM3v0pvbm = value->rValue; + mod->BSIM3v0pvbmGiven = TRUE; + break; + case BSIM3v0_MOD_PXT: + mod->BSIM3v0pxt = value->rValue; + mod->BSIM3v0pxtGiven = TRUE; + break; + case BSIM3v0_MOD_PK1: + mod->BSIM3v0pk1 = value->rValue; + mod->BSIM3v0pk1Given = TRUE; + break; + case BSIM3v0_MOD_PKT1: + mod->BSIM3v0pkt1 = value->rValue; + mod->BSIM3v0pkt1Given = TRUE; + break; + case BSIM3v0_MOD_PKT1L: + mod->BSIM3v0pkt1l = value->rValue; + mod->BSIM3v0pkt1lGiven = TRUE; + break; + case BSIM3v0_MOD_PKT2: + mod->BSIM3v0pkt2 = value->rValue; + mod->BSIM3v0pkt2Given = TRUE; + break; + case BSIM3v0_MOD_PK2: + mod->BSIM3v0pk2 = value->rValue; + mod->BSIM3v0pk2Given = TRUE; + break; + case BSIM3v0_MOD_PK3: + mod->BSIM3v0pk3 = value->rValue; + mod->BSIM3v0pk3Given = TRUE; + break; + case BSIM3v0_MOD_PK3B: + mod->BSIM3v0pk3b = value->rValue; + mod->BSIM3v0pk3bGiven = TRUE; + break; + case BSIM3v0_MOD_PNLX: + mod->BSIM3v0pnlx = value->rValue; + mod->BSIM3v0pnlxGiven = TRUE; + break; + case BSIM3v0_MOD_PW0: + mod->BSIM3v0pw0 = value->rValue; + mod->BSIM3v0pw0Given = TRUE; + break; + case BSIM3v0_MOD_PDVT0: + mod->BSIM3v0pdvt0 = value->rValue; + mod->BSIM3v0pdvt0Given = TRUE; + break; + case BSIM3v0_MOD_PDVT1: + mod->BSIM3v0pdvt1 = value->rValue; + mod->BSIM3v0pdvt1Given = TRUE; + break; + case BSIM3v0_MOD_PDVT2: + mod->BSIM3v0pdvt2 = value->rValue; + mod->BSIM3v0pdvt2Given = TRUE; + break; + case BSIM3v0_MOD_PDVT0W: + mod->BSIM3v0pdvt0w = value->rValue; + mod->BSIM3v0pdvt0wGiven = TRUE; + break; + case BSIM3v0_MOD_PDVT1W: + mod->BSIM3v0pdvt1w = value->rValue; + mod->BSIM3v0pdvt1wGiven = TRUE; + break; + case BSIM3v0_MOD_PDVT2W: + mod->BSIM3v0pdvt2w = value->rValue; + mod->BSIM3v0pdvt2wGiven = TRUE; + break; + case BSIM3v0_MOD_PDROUT: + mod->BSIM3v0pdrout = value->rValue; + mod->BSIM3v0pdroutGiven = TRUE; + break; + case BSIM3v0_MOD_PDSUB: + mod->BSIM3v0pdsub = value->rValue; + mod->BSIM3v0pdsubGiven = TRUE; + break; + case BSIM3v0_MOD_PVTH0: + mod->BSIM3v0pvth0 = value->rValue; + mod->BSIM3v0pvth0Given = TRUE; + break; + case BSIM3v0_MOD_PUA: + mod->BSIM3v0pua = value->rValue; + mod->BSIM3v0puaGiven = TRUE; + break; + case BSIM3v0_MOD_PUA1: + mod->BSIM3v0pua1 = value->rValue; + mod->BSIM3v0pua1Given = TRUE; + break; + case BSIM3v0_MOD_PUB: + mod->BSIM3v0pub = value->rValue; + mod->BSIM3v0pubGiven = TRUE; + break; + case BSIM3v0_MOD_PUB1: + mod->BSIM3v0pub1 = value->rValue; + mod->BSIM3v0pub1Given = TRUE; + break; + case BSIM3v0_MOD_PUC: + mod->BSIM3v0puc = value->rValue; + mod->BSIM3v0pucGiven = TRUE; + break; + case BSIM3v0_MOD_PUC1: + mod->BSIM3v0puc1 = value->rValue; + mod->BSIM3v0puc1Given = TRUE; + break; + case BSIM3v0_MOD_PU0 : + mod->BSIM3v0pu0 = value->rValue; + mod->BSIM3v0pu0Given = TRUE; + if (mod->BSIM3v0pu0 > 1.0) + mod->BSIM3v0pu0 *= 1.0e-4; + break; + case BSIM3v0_MOD_PUTE : + mod->BSIM3v0pute = value->rValue; + mod->BSIM3v0puteGiven = TRUE; + break; + case BSIM3v0_MOD_PVOFF: + mod->BSIM3v0pvoff = value->rValue; + mod->BSIM3v0pvoffGiven = TRUE; + break; + case BSIM3v0_MOD_PDELTA : + mod->BSIM3v0pdelta = value->rValue; + mod->BSIM3v0pdeltaGiven = TRUE; + break; + case BSIM3v0_MOD_PRDSW: + mod->BSIM3v0prdsw = value->rValue; + mod->BSIM3v0prdswGiven = TRUE; + break; + case BSIM3v0_MOD_PPRWB: + mod->BSIM3v0pprwb = value->rValue; + mod->BSIM3v0pprwbGiven = TRUE; + break; + case BSIM3v0_MOD_PPRWG: + mod->BSIM3v0pprwg = value->rValue; + mod->BSIM3v0pprwgGiven = TRUE; + break; + case BSIM3v0_MOD_PPRT: + mod->BSIM3v0pprt = value->rValue; + mod->BSIM3v0pprtGiven = TRUE; + break; + case BSIM3v0_MOD_PETA0: + mod->BSIM3v0peta0 = value->rValue; + mod->BSIM3v0peta0Given = TRUE; + break; + case BSIM3v0_MOD_PETAB: + mod->BSIM3v0petab = value->rValue; + mod->BSIM3v0petabGiven = TRUE; + break; + case BSIM3v0_MOD_PPCLM: + mod->BSIM3v0ppclm = value->rValue; + mod->BSIM3v0ppclmGiven = TRUE; + break; + case BSIM3v0_MOD_PPDIBL1: + mod->BSIM3v0ppdibl1 = value->rValue; + mod->BSIM3v0ppdibl1Given = TRUE; + break; + case BSIM3v0_MOD_PPDIBL2: + mod->BSIM3v0ppdibl2 = value->rValue; + mod->BSIM3v0ppdibl2Given = TRUE; + break; + case BSIM3v0_MOD_PPDIBLB: + mod->BSIM3v0ppdiblb = value->rValue; + mod->BSIM3v0ppdiblbGiven = TRUE; + break; + case BSIM3v0_MOD_PPSCBE1: + mod->BSIM3v0ppscbe1 = value->rValue; + mod->BSIM3v0ppscbe1Given = TRUE; + break; + case BSIM3v0_MOD_PPSCBE2: + mod->BSIM3v0ppscbe2 = value->rValue; + mod->BSIM3v0ppscbe2Given = TRUE; + break; + case BSIM3v0_MOD_PPVAG: + mod->BSIM3v0ppvag = value->rValue; + mod->BSIM3v0ppvagGiven = TRUE; + break; + case BSIM3v0_MOD_PWR : + mod->BSIM3v0pwr = value->rValue; + mod->BSIM3v0pwrGiven = TRUE; + break; + case BSIM3v0_MOD_PDWG : + mod->BSIM3v0pdwg = value->rValue; + mod->BSIM3v0pdwgGiven = TRUE; + break; + case BSIM3v0_MOD_PDWB : + mod->BSIM3v0pdwb = value->rValue; + mod->BSIM3v0pdwbGiven = TRUE; + break; + case BSIM3v0_MOD_PB0 : + mod->BSIM3v0pb0 = value->rValue; + mod->BSIM3v0pb0Given = TRUE; + break; + case BSIM3v0_MOD_PB1 : + mod->BSIM3v0pb1 = value->rValue; + mod->BSIM3v0pb1Given = TRUE; + break; + case BSIM3v0_MOD_PALPHA0 : + mod->BSIM3v0palpha0 = value->rValue; + mod->BSIM3v0palpha0Given = TRUE; + break; + case BSIM3v0_MOD_PBETA0 : + mod->BSIM3v0pbeta0 = value->rValue; + mod->BSIM3v0pbeta0Given = TRUE; + break; + + case BSIM3v0_MOD_PELM : + mod->BSIM3v0pelm = value->rValue; + mod->BSIM3v0pelmGiven = TRUE; + break; + case BSIM3v0_MOD_PCGSL : + mod->BSIM3v0pcgsl = value->rValue; + mod->BSIM3v0pcgslGiven = TRUE; + break; + case BSIM3v0_MOD_PCGDL : + mod->BSIM3v0pcgdl = value->rValue; + mod->BSIM3v0pcgdlGiven = TRUE; + break; + case BSIM3v0_MOD_PCKAPPA : + mod->BSIM3v0pckappa = value->rValue; + mod->BSIM3v0pckappaGiven = TRUE; + break; + case BSIM3v0_MOD_PCF : + mod->BSIM3v0pcf = value->rValue; + mod->BSIM3v0pcfGiven = TRUE; + break; + case BSIM3v0_MOD_PCLC : + mod->BSIM3v0pclc = value->rValue; + mod->BSIM3v0pclcGiven = TRUE; + break; + case BSIM3v0_MOD_PCLE : + mod->BSIM3v0pcle = value->rValue; + mod->BSIM3v0pcleGiven = TRUE; + break; + + case BSIM3v0_MOD_TNOM : + mod->BSIM3v0tnom = value->rValue + 273.15; + mod->BSIM3v0tnomGiven = TRUE; + break; + case BSIM3v0_MOD_CGSO : + mod->BSIM3v0cgso = value->rValue; + mod->BSIM3v0cgsoGiven = TRUE; + break; + case BSIM3v0_MOD_CGDO : + mod->BSIM3v0cgdo = value->rValue; + mod->BSIM3v0cgdoGiven = TRUE; + break; + case BSIM3v0_MOD_CGBO : + mod->BSIM3v0cgbo = value->rValue; + mod->BSIM3v0cgboGiven = TRUE; + break; + case BSIM3v0_MOD_XPART : + mod->BSIM3v0xpart = value->rValue; + mod->BSIM3v0xpartGiven = TRUE; + break; + case BSIM3v0_MOD_RSH : + mod->BSIM3v0sheetResistance = value->rValue; + mod->BSIM3v0sheetResistanceGiven = TRUE; + break; + case BSIM3v0_MOD_JS : + mod->BSIM3v0jctSatCurDensity = value->rValue; + mod->BSIM3v0jctSatCurDensityGiven = TRUE; + break; + case BSIM3v0_MOD_PB : + mod->BSIM3v0bulkJctPotential = value->rValue; + mod->BSIM3v0bulkJctPotentialGiven = TRUE; + break; + case BSIM3v0_MOD_MJ : + mod->BSIM3v0bulkJctBotGradingCoeff = value->rValue; + mod->BSIM3v0bulkJctBotGradingCoeffGiven = TRUE; + break; + case BSIM3v0_MOD_PBSW : + mod->BSIM3v0sidewallJctPotential = value->rValue; + mod->BSIM3v0sidewallJctPotentialGiven = TRUE; + break; + case BSIM3v0_MOD_MJSW : + mod->BSIM3v0bulkJctSideGradingCoeff = value->rValue; + mod->BSIM3v0bulkJctSideGradingCoeffGiven = TRUE; + break; + case BSIM3v0_MOD_CJ : + mod->BSIM3v0unitAreaJctCap = value->rValue; + mod->BSIM3v0unitAreaJctCapGiven = TRUE; + break; + case BSIM3v0_MOD_CJSW : + mod->BSIM3v0unitLengthSidewallJctCap = value->rValue; + mod->BSIM3v0unitLengthSidewallJctCapGiven = TRUE; + break; + case BSIM3v0_MOD_LINT : + mod->BSIM3v0Lint = value->rValue; + mod->BSIM3v0LintGiven = TRUE; + break; + case BSIM3v0_MOD_LL : + mod->BSIM3v0Ll = value->rValue; + mod->BSIM3v0LlGiven = TRUE; + break; + case BSIM3v0_MOD_LLN : + mod->BSIM3v0Lln = value->rValue; + mod->BSIM3v0LlnGiven = TRUE; + break; + case BSIM3v0_MOD_LW : + mod->BSIM3v0Lw = value->rValue; + mod->BSIM3v0LwGiven = TRUE; + break; + case BSIM3v0_MOD_LWN : + mod->BSIM3v0Lwn = value->rValue; + mod->BSIM3v0LwnGiven = TRUE; + break; + case BSIM3v0_MOD_LWL : + mod->BSIM3v0Lwl = value->rValue; + mod->BSIM3v0LwlGiven = TRUE; + break; + case BSIM3v0_MOD_LMIN : + mod->BSIM3v0Lmin = value->rValue; + mod->BSIM3v0LminGiven = TRUE; + break; + case BSIM3v0_MOD_LMAX : + mod->BSIM3v0Lmax = value->rValue; + mod->BSIM3v0LmaxGiven = TRUE; + break; + case BSIM3v0_MOD_WINT : + mod->BSIM3v0Wint = value->rValue; + mod->BSIM3v0WintGiven = TRUE; + break; + case BSIM3v0_MOD_WL : + mod->BSIM3v0Wl = value->rValue; + mod->BSIM3v0WlGiven = TRUE; + break; + case BSIM3v0_MOD_WLN : + mod->BSIM3v0Wln = value->rValue; + mod->BSIM3v0WlnGiven = TRUE; + break; + case BSIM3v0_MOD_WW : + mod->BSIM3v0Ww = value->rValue; + mod->BSIM3v0WwGiven = TRUE; + break; + case BSIM3v0_MOD_WWN : + mod->BSIM3v0Wwn = value->rValue; + mod->BSIM3v0WwnGiven = TRUE; + break; + case BSIM3v0_MOD_WWL : + mod->BSIM3v0Wwl = value->rValue; + mod->BSIM3v0WwlGiven = TRUE; + break; + case BSIM3v0_MOD_WMIN : + mod->BSIM3v0Wmin = value->rValue; + mod->BSIM3v0WminGiven = TRUE; + break; + case BSIM3v0_MOD_WMAX : + mod->BSIM3v0Wmax = value->rValue; + mod->BSIM3v0WmaxGiven = TRUE; + break; + + case BSIM3v0_MOD_NOIA : + mod->BSIM3v0oxideTrapDensityA = value->rValue; + mod->BSIM3v0oxideTrapDensityAGiven = TRUE; + break; + case BSIM3v0_MOD_NOIB : + mod->BSIM3v0oxideTrapDensityB = value->rValue; + mod->BSIM3v0oxideTrapDensityBGiven = TRUE; + break; + case BSIM3v0_MOD_NOIC : + mod->BSIM3v0oxideTrapDensityC = value->rValue; + mod->BSIM3v0oxideTrapDensityCGiven = TRUE; + break; + case BSIM3v0_MOD_EM : + mod->BSIM3v0em = value->rValue; + mod->BSIM3v0emGiven = TRUE; + break; + case BSIM3v0_MOD_EF : + mod->BSIM3v0ef = value->rValue; + mod->BSIM3v0efGiven = TRUE; + break; + case BSIM3v0_MOD_AF : + mod->BSIM3v0af = value->rValue; + mod->BSIM3v0afGiven = TRUE; + break; + case BSIM3v0_MOD_KF : + mod->BSIM3v0kf = value->rValue; + mod->BSIM3v0kfGiven = TRUE; + break; + case BSIM3v0_MOD_NMOS : + if(value->iValue) { + mod->BSIM3v0type = 1; + mod->BSIM3v0typeGiven = TRUE; + } + break; + case BSIM3v0_MOD_PMOS : + if(value->iValue) { + mod->BSIM3v0type = - 1; + mod->BSIM3v0typeGiven = TRUE; + } + break; + default: + return(E_BADPARM); + } + return(OK); +} + + diff --git a/src/spicelib/devices/bsim3v0/b3v0noi.c b/src/spicelib/devices/bsim3v0/b3v0noi.c new file mode 100644 index 000000000..f1904496e --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0noi.c @@ -0,0 +1,356 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Gary W. Ng and Min-Chie Jeng. +File: b3v0noi.c +**********/ + +#include "ngspice.h" +#include "bsim3v0def.h" +#include "cktdefs.h" +#include "iferrmsg.h" +#include "noisedef.h" +#include "suffix.h" +#include "const.h" /* jwan */ + +/* + * BSIM3v0noise (mode, operation, firstModel, ckt, data, OnDens) + * This routine names and evaluates all of the noise sources + * associated with MOSFET's. It starts with the model *firstModel and + * traverses all of its insts. It then proceeds to any other models + * on the linked list. The total output noise density generated by + * all of the MOSFET's is summed with the variable "OnDens". + */ + +extern void NevalSrc(); +extern double Nintegrate(); + + +double +StrongInversionNoiseEval(double vgs, double vds, BSIM3v0model *model, + BSIM3v0instance *here, double freq, double temp) +{ +struct bsim3v0SizeDependParam *pParam; +double cd, esat, DelClm, EffFreq, N0, Nl, Vgst; +double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, Ssi; + + pParam = here->pParam; + cd = fabs(here->BSIM3v0cd) * here->BSIM3v0m; + if (vds > here->BSIM3v0vdsat) + { esat = 2.0 * pParam->BSIM3v0vsattemp / here->BSIM3v0ueff; + T0 = ((((vds - here->BSIM3v0vdsat) / pParam->BSIM3v0litl) + model->BSIM3v0em) + / esat); + DelClm = pParam->BSIM3v0litl * log (MAX(T0, N_MINLOG)); + } + else + DelClm = 0.0; + EffFreq = pow(freq, model->BSIM3v0ef); + T1 = CHARGE * CHARGE * 8.62e-5 * cd * (temp + CONSTCtoK) * here->BSIM3v0ueff; + T2 = 1.0e8 * EffFreq * model->BSIM3v0cox + * pParam->BSIM3v0leff * pParam->BSIM3v0leff; + Vgst = vgs - here->BSIM3v0von; + N0 = model->BSIM3v0cox * Vgst / CHARGE; + if (N0 < 0.0) + N0 = 0.0; + Nl = model->BSIM3v0cox * (Vgst - MIN(vds, here->BSIM3v0vdsat)) / CHARGE; + if (Nl < 0.0) + Nl = 0.0; + + T3 = model->BSIM3v0oxideTrapDensityA + * log(MAX(((N0 + 2.0e14) / (Nl + 2.0e14)), N_MINLOG)); + T4 = model->BSIM3v0oxideTrapDensityB * (N0 - Nl); + T5 = model->BSIM3v0oxideTrapDensityC * 0.5 * (N0 * N0 - Nl * Nl); + + T6 = 8.62e-5 * (temp + CONSTCtoK) * cd * cd; + T7 = 1.0e8 * EffFreq * pParam->BSIM3v0leff + * pParam->BSIM3v0leff * pParam->BSIM3v0weff * here->BSIM3v0m; + T8 = model->BSIM3v0oxideTrapDensityA + model->BSIM3v0oxideTrapDensityB * Nl + + model->BSIM3v0oxideTrapDensityC * Nl * Nl; + T9 = (Nl + 2.0e14) * (Nl + 2.0e14); + + Ssi = T1 / T2 * (T3 + T4 + T5) + T6 / T7 * DelClm * T8 / T9; + return Ssi; +} + +int +BSIM3v0noise (int mode, int operation, GENmodel *inModel, CKTcircuit *ckt, + Ndata *data, double *OnDens) +{ +BSIM3v0model *model = (BSIM3v0model *)inModel; +BSIM3v0instance *here; +struct bsim3v0SizeDependParam *pParam; +char name[N_MXVLNTH]; +double tempOnoise; +double tempInoise; +double noizDens[BSIM3v0NSRCS]; +double lnNdens[BSIM3v0NSRCS]; + +double vgs, vds, Slimit; +double N0, Nl; +double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13; +double n, ExpArg, Ssi, Swi; + +int error, i; + + /* define the names of the noise sources */ + static char *BSIM3v0nNames[BSIM3v0NSRCS] = + { /* Note that we have to keep the order */ + ".rd", /* noise due to rd */ + /* consistent with the index definitions */ + ".rs", /* noise due to rs */ + /* in BSIM3v0defs.h */ + ".id", /* noise due to id */ + ".1overf", /* flicker (1/f) noise */ + "" /* total transistor noise */ + }; + + for (; model != NULL; model = model->BSIM3v0nextModel) + { for (here = model->BSIM3v0instances; here != NULL; + here = here->BSIM3v0nextInstance) + { + + if (here->BSIM3v0owner != ARCHme) + continue; + + pParam = here->pParam; + switch (operation) + { case N_OPEN: + /* see if we have to to produce a summary report */ + /* if so, name all the noise generators */ + + if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) + { switch (mode) + { case N_DENS: + for (i = 0; i < BSIM3v0NSRCS; i++) + { (void) sprintf(name, "onoise.%s%s", + here->BSIM3v0name, + BSIM3v0nNames[i]); + data->namelist = (IFuid *) trealloc( + (char *) data->namelist, + (data->numPlots + 1) + * sizeof(IFuid)); + if (!data->namelist) + return(E_NOMEM); + (*(SPfrontEnd->IFnewUid)) (ckt, + &(data->namelist[data->numPlots++]), + (IFuid) NULL, name, UID_OTHER, + (void **) NULL); + /* we've added one more plot */ + } + break; + case INT_NOIZ: + for (i = 0; i < BSIM3v0NSRCS; i++) + { (void) sprintf(name, "onoise_total.%s%s", + here->BSIM3v0name, + BSIM3v0nNames[i]); + data->namelist = (IFuid *) trealloc( + (char *) data->namelist, + (data->numPlots + 1) + * sizeof(IFuid)); + if (!data->namelist) + return(E_NOMEM); + (*(SPfrontEnd->IFnewUid)) (ckt, + &(data->namelist[data->numPlots++]), + (IFuid) NULL, name, UID_OTHER, + (void **) NULL); + /* we've added one more plot */ + + (void) sprintf(name, "inoise_total.%s%s", + here->BSIM3v0name, + BSIM3v0nNames[i]); + data->namelist = (IFuid *) trealloc( + (char *) data->namelist, + (data->numPlots + 1) + * sizeof(IFuid)); + if (!data->namelist) + return(E_NOMEM); + (*(SPfrontEnd->IFnewUid)) (ckt, + &(data->namelist[data->numPlots++]), + (IFuid) NULL, name, UID_OTHER, + (void **)NULL); + /* we've added one more plot */ + } + break; + } + } + break; + case N_CALC: + switch (mode) + { case N_DENS: + NevalSrc(&noizDens[BSIM3v0RDNOIZ], + &lnNdens[BSIM3v0RDNOIZ], ckt, THERMNOISE, + here->BSIM3v0dNodePrime, here->BSIM3v0dNode, + here->BSIM3v0drainConductance * here->BSIM3v0m); + + NevalSrc(&noizDens[BSIM3v0RSNOIZ], + &lnNdens[BSIM3v0RSNOIZ], ckt, THERMNOISE, + here->BSIM3v0sNodePrime, here->BSIM3v0sNode, + here->BSIM3v0sourceConductance * here->BSIM3v0m); + + if (model->BSIM3v0noiMod == 2) + { NevalSrc(&noizDens[BSIM3v0IDNOIZ], + &lnNdens[BSIM3v0IDNOIZ], ckt, THERMNOISE, + here->BSIM3v0dNodePrime, + here->BSIM3v0sNodePrime, (here->BSIM3v0ueff + * fabs((here->BSIM3v0qinv * here->BSIM3v0m) + / (pParam->BSIM3v0leff + * pParam->BSIM3v0leff)))); + } + else + { NevalSrc(&noizDens[BSIM3v0IDNOIZ], + &lnNdens[BSIM3v0IDNOIZ], ckt, THERMNOISE, + here->BSIM3v0dNodePrime, + here->BSIM3v0sNodePrime, + (2.0 / 3.0 * fabs(here->BSIM3v0gm + + here->BSIM3v0gds) * here->BSIM3v0m)); + + } + NevalSrc(&noizDens[BSIM3v0FLNOIZ], (double*) NULL, + ckt, N_GAIN, here->BSIM3v0dNodePrime, + here->BSIM3v0sNodePrime, (double) 0.0); + + if (model->BSIM3v0noiMod == 2) + { vgs = *(ckt->CKTstates[0] + here->BSIM3v0vgs); + vds = *(ckt->CKTstates[0] + here->BSIM3v0vds); + if (vds < 0.0) + { vds = -vds; + vgs = vgs + vds; + } + if (vgs >= here->BSIM3v0von + 0.1) + { Ssi = StrongInversionNoiseEval(vgs, vds, + model, here, data->freq, + ckt->CKTtemp); + noizDens[BSIM3v0FLNOIZ] *= Ssi; + } + else + { pParam = here->pParam; + T10 = model->BSIM3v0oxideTrapDensityA + * 8.62e-5 * (ckt->CKTtemp + CONSTCtoK); + T11 = pParam->BSIM3v0weff * here->BSIM3v0m * pParam->BSIM3v0leff + * pow(data->freq, model->BSIM3v0ef) + * 4.0e36; + Swi = T10 / T11 * here->BSIM3v0cd * here->BSIM3v0m + * here->BSIM3v0cd * here->BSIM3v0m; + Slimit = StrongInversionNoiseEval( + here->BSIM3v0von + 0.1, + vds, model, here, + data->freq, ckt->CKTtemp); + T1 = Swi + Slimit; + if (T1 > 0.0) + noizDens[BSIM3v0FLNOIZ] *= (Slimit * Swi) + / T1; + else + noizDens[BSIM3v0FLNOIZ] *= 0.0; + } + } + else + { noizDens[BSIM3v0FLNOIZ] *= model->BSIM3v0kf * + exp(model->BSIM3v0af + * log(MAX(fabs(here->BSIM3v0cd * here->BSIM3v0m), + N_MINLOG))) + / (pow(data->freq, model->BSIM3v0ef) + * pParam->BSIM3v0leff + * pParam->BSIM3v0leff + * model->BSIM3v0cox); + } + + lnNdens[BSIM3v0FLNOIZ] = + log(MAX(noizDens[BSIM3v0FLNOIZ], N_MINLOG)); + + noizDens[BSIM3v0TOTNOIZ] = noizDens[BSIM3v0RDNOIZ] + + noizDens[BSIM3v0RSNOIZ] + + noizDens[BSIM3v0IDNOIZ] + + noizDens[BSIM3v0FLNOIZ]; + lnNdens[BSIM3v0TOTNOIZ] = + log(MAX(noizDens[BSIM3v0TOTNOIZ], N_MINLOG)); + + *OnDens += noizDens[BSIM3v0TOTNOIZ]; + + if (data->delFreq == 0.0) + { /* if we haven't done any previous + integration, we need to initialize our + "history" variables. + */ + + for (i = 0; i < BSIM3v0NSRCS; i++) + { here->BSIM3v0nVar[LNLSTDENS][i] = + lnNdens[i]; + } + + /* clear out our integration variables + if it's the first pass + */ + if (data->freq == + ((NOISEAN*) ckt->CKTcurJob)->NstartFreq) + { for (i = 0; i < BSIM3v0NSRCS; i++) + { here->BSIM3v0nVar[OUTNOIZ][i] = 0.0; + here->BSIM3v0nVar[INNOIZ][i] = 0.0; + } + } + } + else + { /* data->delFreq != 0.0, + we have to integrate. + */ + for (i = 0; i < BSIM3v0NSRCS; i++) + { if (i != BSIM3v0TOTNOIZ) + { tempOnoise = Nintegrate(noizDens[i], + lnNdens[i], + here->BSIM3v0nVar[LNLSTDENS][i], + data); + tempInoise = Nintegrate(noizDens[i] + * data->GainSqInv, lnNdens[i] + + data->lnGainInv, + here->BSIM3v0nVar[LNLSTDENS][i] + + data->lnGainInv, data); + here->BSIM3v0nVar[LNLSTDENS][i] = + lnNdens[i]; + data->outNoiz += tempOnoise; + data->inNoise += tempInoise; + if (((NOISEAN*) + ckt->CKTcurJob)->NStpsSm != 0) + { here->BSIM3v0nVar[OUTNOIZ][i] + += tempOnoise; + here->BSIM3v0nVar[OUTNOIZ][BSIM3v0TOTNOIZ] + += tempOnoise; + here->BSIM3v0nVar[INNOIZ][i] + += tempInoise; + here->BSIM3v0nVar[INNOIZ][BSIM3v0TOTNOIZ] + += tempInoise; + } + } + } + } + if (data->prtSummary) + { for (i = 0; i < BSIM3v0NSRCS; i++) + { /* print a summary report */ + data->outpVector[data->outNumber++] + = noizDens[i]; + } + } + break; + case INT_NOIZ: + /* already calculated, just output */ + if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) + { for (i = 0; i < BSIM3v0NSRCS; i++) + { data->outpVector[data->outNumber++] + = here->BSIM3v0nVar[OUTNOIZ][i]; + data->outpVector[data->outNumber++] + = here->BSIM3v0nVar[INNOIZ][i]; + } + } + break; + } + break; + case N_CLOSE: + /* do nothing, the main calling routine will close */ + return (OK); + break; /* the plots */ + } /* switch (operation) */ + } /* for here */ + } /* for model */ + + return(OK); +} + + + diff --git a/src/spicelib/devices/bsim3v0/b3v0par.c b/src/spicelib/devices/bsim3v0/b3v0par.c new file mode 100644 index 000000000..f59718e3e --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0par.c @@ -0,0 +1,96 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0par.c +**********/ + +#include "ngspice.h" +#include "ifsim.h" +#include "bsim3v0def.h" +#include "sperror.h" +#include "suffix.h" + +int +BSIM3v0param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) +{ + BSIM3v0instance *here = (BSIM3v0instance*)inst; + switch(param) + { case BSIM3v0_W: + here->BSIM3v0w = value->rValue; + here->BSIM3v0wGiven = TRUE; + break; + case BSIM3v0_L: + here->BSIM3v0l = value->rValue; + here->BSIM3v0lGiven = TRUE; + break; + case BSIM3v0_M: + here->BSIM3v0m = value->rValue; + here->BSIM3v0mGiven = TRUE; + break; + case BSIM3v0_AS: + here->BSIM3v0sourceArea = value->rValue; + here->BSIM3v0sourceAreaGiven = TRUE; + break; + case BSIM3v0_AD: + here->BSIM3v0drainArea = value->rValue; + here->BSIM3v0drainAreaGiven = TRUE; + break; + case BSIM3v0_PS: + here->BSIM3v0sourcePerimeter = value->rValue; + here->BSIM3v0sourcePerimeterGiven = TRUE; + break; + case BSIM3v0_PD: + here->BSIM3v0drainPerimeter = value->rValue; + here->BSIM3v0drainPerimeterGiven = TRUE; + break; + case BSIM3v0_NRS: + here->BSIM3v0sourceSquares = value->rValue; + here->BSIM3v0sourceSquaresGiven = TRUE; + break; + case BSIM3v0_NRD: + here->BSIM3v0drainSquares = value->rValue; + here->BSIM3v0drainSquaresGiven = TRUE; + break; + case BSIM3v0_OFF: + here->BSIM3v0off = value->iValue; + break; + case BSIM3v0_IC_VBS: + here->BSIM3v0icVBS = value->rValue; + here->BSIM3v0icVBSGiven = TRUE; + break; + case BSIM3v0_IC_VDS: + here->BSIM3v0icVDS = value->rValue; + here->BSIM3v0icVDSGiven = TRUE; + break; + case BSIM3v0_IC_VGS: + here->BSIM3v0icVGS = value->rValue; + here->BSIM3v0icVGSGiven = TRUE; + break; + case BSIM3v0_NQSMOD: + here->BSIM3v0nqsMod = value->iValue; + here->BSIM3v0nqsModGiven = TRUE; + break; + case BSIM3v0_IC: + switch(value->v.numValue){ + case 3: + here->BSIM3v0icVBS = *(value->v.vec.rVec+2); + here->BSIM3v0icVBSGiven = TRUE; + case 2: + here->BSIM3v0icVGS = *(value->v.vec.rVec+1); + here->BSIM3v0icVGSGiven = TRUE; + case 1: + here->BSIM3v0icVDS = *(value->v.vec.rVec); + here->BSIM3v0icVDSGiven = TRUE; + break; + default: + return(E_BADPARM); + } + break; + default: + return(E_BADPARM); + } + return(OK); +} + + + diff --git a/src/spicelib/devices/bsim3v0/b3v0pzld.c b/src/spicelib/devices/bsim3v0/b3v0pzld.c new file mode 100644 index 000000000..73c467b63 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0pzld.c @@ -0,0 +1,150 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0pzld.c +**********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "complex.h" +#include "sperror.h" +#include "bsim3v0def.h" +#include "suffix.h" + +int +BSIM3v0pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) +{ +register BSIM3v0model *model = (BSIM3v0model*)inModel; +register BSIM3v0instance *here; +double xcggb, xcgdb, xcgsb, xcbgb, xcbdb, xcbsb, xcddb, xcssb, xcdgb; +double gdpr, gspr, gds, gbd, gbs, capbd, capbs, xcsgb, xcdsb, xcsdb; +double cggb, cgdb, cgsb, cbgb, cbdb, cbsb, cddb, cdgb, cdsb; +double GSoverlapCap, GDoverlapCap, GBoverlapCap; +double FwdSum, RevSum, Gm, Gmbs; + +double m; + + for (; model != NULL; model = model->BSIM3v0nextModel) + { for (here = model->BSIM3v0instances; here!= NULL; + here = here->BSIM3v0nextInstance) + { + + if (here->BSIM3v0owner != ARCHme) + continue; + + if (here->BSIM3v0mode >= 0) + { Gm = here->BSIM3v0gm; + Gmbs = here->BSIM3v0gmbs; + FwdSum = Gm + Gmbs; + RevSum = 0.0; + cggb = here->BSIM3v0cggb; + cgsb = here->BSIM3v0cgsb; + cgdb = here->BSIM3v0cgdb; + + cbgb = here->BSIM3v0cbgb; + cbsb = here->BSIM3v0cbsb; + cbdb = here->BSIM3v0cbdb; + + cdgb = here->BSIM3v0cdgb; + cdsb = here->BSIM3v0cdsb; + cddb = here->BSIM3v0cddb; + } + else + { Gm = -here->BSIM3v0gm; + Gmbs = -here->BSIM3v0gmbs; + FwdSum = 0.0; + RevSum = -Gm - Gmbs; + cggb = here->BSIM3v0cggb; + cgsb = here->BSIM3v0cgdb; + cgdb = here->BSIM3v0cgsb; + + cbgb = here->BSIM3v0cbgb; + cbsb = here->BSIM3v0cbdb; + cbdb = here->BSIM3v0cbsb; + + cdgb = -(here->BSIM3v0cdgb + cggb + cbgb); + cdsb = -(here->BSIM3v0cddb + cgsb + cbsb); + cddb = -(here->BSIM3v0cdsb + cgdb + cbdb); + } + gdpr=here->BSIM3v0drainConductance; + gspr=here->BSIM3v0sourceConductance; + gds= here->BSIM3v0gds; + gbd= here->BSIM3v0gbd; + gbs= here->BSIM3v0gbs; + capbd= here->BSIM3v0capbd; + capbs= here->BSIM3v0capbs; + GSoverlapCap = here->BSIM3v0cgso; + GDoverlapCap = here->BSIM3v0cgdo; + GBoverlapCap = here->pParam->BSIM3v0cgbo; + + xcdgb = (cdgb - GDoverlapCap); + xcddb = (cddb + capbd + GDoverlapCap); + xcdsb = cdsb; + xcsgb = -(cggb + cbgb + cdgb + GSoverlapCap); + xcsdb = -(cgdb + cbdb + cddb); + xcssb = (capbs + GSoverlapCap - (cgsb+cbsb+cdsb)); + xcggb = (cggb + GDoverlapCap + GSoverlapCap + GBoverlapCap); + xcgdb = (cgdb - GDoverlapCap); + xcgsb = (cgsb - GSoverlapCap); + xcbgb = (cbgb - GBoverlapCap); + xcbdb = (cbdb - capbd); + xcbsb = (cbsb - capbs); + + m = here->BSIM3v0m; + + *(here->BSIM3v0GgPtr ) += m * (xcggb * s->real); + *(here->BSIM3v0GgPtr +1) += m * (xcggb * s->imag); + *(here->BSIM3v0BbPtr ) += m * ((-xcbgb-xcbdb-xcbsb) * s->real); + *(here->BSIM3v0BbPtr +1) += m * ((-xcbgb-xcbdb-xcbsb) * s->imag); + *(here->BSIM3v0DPdpPtr ) += m * (xcddb * s->real); + *(here->BSIM3v0DPdpPtr +1) += m * (xcddb * s->imag); + *(here->BSIM3v0SPspPtr ) += m * (xcssb * s->real); + *(here->BSIM3v0SPspPtr +1) += m * (xcssb * s->imag); + *(here->BSIM3v0GbPtr ) += m * ((-xcggb-xcgdb-xcgsb) * s->real); + *(here->BSIM3v0GbPtr +1) += m * ((-xcggb-xcgdb-xcgsb) * s->imag); + *(here->BSIM3v0GdpPtr ) += m * (xcgdb * s->real); + *(here->BSIM3v0GdpPtr +1) += m * (xcgdb * s->imag); + *(here->BSIM3v0GspPtr ) += m * (xcgsb * s->real); + *(here->BSIM3v0GspPtr +1) += m * (xcgsb * s->imag); + *(here->BSIM3v0BgPtr ) += m * (xcbgb * s->real); + *(here->BSIM3v0BgPtr +1) += m * (xcbgb * s->imag); + *(here->BSIM3v0BdpPtr ) += m * (xcbdb * s->real); + *(here->BSIM3v0BdpPtr +1) += m * (xcbdb * s->imag); + *(here->BSIM3v0BspPtr ) += m * (xcbsb * s->real); + *(here->BSIM3v0BspPtr +1) += m * (xcbsb * s->imag); + *(here->BSIM3v0DPgPtr ) += m * (xcdgb * s->real); + *(here->BSIM3v0DPgPtr +1) += m * (xcdgb * s->imag); + *(here->BSIM3v0DPbPtr ) += m * ((-xcdgb-xcddb-xcdsb) * s->real); + *(here->BSIM3v0DPbPtr +1) += m * ((-xcdgb-xcddb-xcdsb) * s->imag); + *(here->BSIM3v0DPspPtr ) += m * (xcdsb * s->real); + *(here->BSIM3v0DPspPtr +1) += m * (xcdsb * s->imag); + *(here->BSIM3v0SPgPtr ) += m * (xcsgb * s->real); + *(here->BSIM3v0SPgPtr +1) += m * (xcsgb * s->imag); + *(here->BSIM3v0SPbPtr ) += m * ((-xcsgb-xcsdb-xcssb) * s->real); + *(here->BSIM3v0SPbPtr +1) += m * ((-xcsgb-xcsdb-xcssb) * s->imag); + *(here->BSIM3v0SPdpPtr ) += m * (xcsdb * s->real); + *(here->BSIM3v0SPdpPtr +1) += m * (xcsdb * s->imag); + *(here->BSIM3v0DdPtr) += m * gdpr; + *(here->BSIM3v0SsPtr) += m * gspr; + *(here->BSIM3v0BbPtr) += m * (gbd + gbs); + *(here->BSIM3v0DPdpPtr) += m * (gdpr + gds + gbd + RevSum); + *(here->BSIM3v0SPspPtr) += m * (gspr + gds + gbs + FwdSum); + *(here->BSIM3v0DdpPtr) -= m * gdpr; + *(here->BSIM3v0SspPtr) -= m * gspr; + *(here->BSIM3v0BdpPtr) -= m * gbd; + *(here->BSIM3v0BspPtr) -= m * gbs; + *(here->BSIM3v0DPdPtr) -= m * gdpr; + *(here->BSIM3v0DPgPtr) += m * Gm; + *(here->BSIM3v0DPbPtr) -= m * (gbd - Gmbs); + *(here->BSIM3v0DPspPtr) -= m * (gds + FwdSum); + *(here->BSIM3v0SPgPtr) -= m * Gm; + *(here->BSIM3v0SPsPtr) -= m * gspr; + *(here->BSIM3v0SPbPtr) -= m * (gbs + Gmbs); + *(here->BSIM3v0SPdpPtr) -= m * (gds + RevSum); + + } + } + return(OK); +} + + diff --git a/src/spicelib/devices/bsim3v0/b3v0set.c b/src/spicelib/devices/bsim3v0/b3v0set.c new file mode 100644 index 000000000..4c1ea0601 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0set.c @@ -0,0 +1,926 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0set.c +**********/ + +#include "ngspice.h" +#include "smpdefs.h" +#include "cktdefs.h" +#include "bsim3v0def.h" +#include "const.h" +#include "sperror.h" +#include "suffix.h" + +#define MAX_EXP 5.834617425e14 +#define MIN_EXP 1.713908431e-15 +#define EXP_THRESHOLD 34.0 +#define SMOOTHFACTOR 0.1 +#define EPSOX 3.453133e-11 +#define EPSSI 1.03594e-10 +#define PI 3.141592654 +#define Charge_q 1.60219e-19 +#define Meter2Micron 1.0e6 + +int +BSIM3v0setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, + int *states) +{ +BSIM3v0model *model = (BSIM3v0model*)inModel; +BSIM3v0instance *here; +int error; +CKTnode *tmp; + +double tmp1, tmp2; + +CKTnode *tmpNode; +IFuid tmpName; + + /* loop through all the BSIM3v0 device models */ + for( ; model != NULL; model = model->BSIM3v0nextModel ) + { +/* Default value Processing for BSIM3v0 MOSFET Models */ + if (!model->BSIM3v0typeGiven) + model->BSIM3v0type = NMOS; + if (!model->BSIM3v0mobModGiven) + model->BSIM3v0mobMod = 1; + if (!model->BSIM3v0binUnitGiven) + model->BSIM3v0binUnit = 1; + if (!model->BSIM3v0capModGiven) + model->BSIM3v0capMod = 1; + if (!model->BSIM3v0nqsModGiven) + model->BSIM3v0nqsMod = 0; + if (!model->BSIM3v0noiModGiven) + model->BSIM3v0noiMod = 1; + if (!model->BSIM3v0toxGiven) + model->BSIM3v0tox = 150.0e-10; + model->BSIM3v0cox = 3.453133e-11 / model->BSIM3v0tox; + + if (!model->BSIM3v0cdscGiven) + model->BSIM3v0cdsc = 2.4e-4; /* unit Q/V/m^2 */ + if (!model->BSIM3v0cdscbGiven) + model->BSIM3v0cdscb = 0.0; /* unit Q/V/m^2 */ + if (!model->BSIM3v0cdscdGiven) + model->BSIM3v0cdscd = 0.0; /* unit Q/V/m^2 */ + if (!model->BSIM3v0citGiven) + model->BSIM3v0cit = 0.0; /* unit Q/V/m^2 */ + if (!model->BSIM3v0nfactorGiven) + model->BSIM3v0nfactor = 1; + if (!model->BSIM3v0xjGiven) + model->BSIM3v0xj = .15e-6; + if (!model->BSIM3v0vsatGiven) + model->BSIM3v0vsat = 8.0e4; /* unit m/s */ + if (!model->BSIM3v0atGiven) + model->BSIM3v0at = 3.3e4; /* unit m/s */ + if (!model->BSIM3v0a0Given) + model->BSIM3v0a0 = 1.0; + if (!model->BSIM3v0agsGiven) + model->BSIM3v0ags = 0.0; + if (!model->BSIM3v0a1Given) + model->BSIM3v0a1 = 0.0; + if (!model->BSIM3v0a2Given) + model->BSIM3v0a2 = 1.0; + if (!model->BSIM3v0ketaGiven) + model->BSIM3v0keta = -0.047; /* unit / V */ + if (!model->BSIM3v0nsubGiven) + model->BSIM3v0nsub = 6.0e16; /* unit 1/cm3 */ + if (!model->BSIM3v0npeakGiven) + model->BSIM3v0npeak = 1.7e17; /* unit 1/cm3 */ + if (!model->BSIM3v0vbmGiven) + model->BSIM3v0vbm = -5.0; + if (!model->BSIM3v0xtGiven) + model->BSIM3v0xt = 1.55e-7; + if (!model->BSIM3v0kt1Given) + model->BSIM3v0kt1 = -0.11; /* unit V */ + if (!model->BSIM3v0kt1lGiven) + model->BSIM3v0kt1l = 0.0; /* unit V*m */ + if (!model->BSIM3v0kt2Given) + model->BSIM3v0kt2 = 0.022; /* No unit */ + if (!model->BSIM3v0k3Given) + model->BSIM3v0k3 = 80.0; + if (!model->BSIM3v0k3bGiven) + model->BSIM3v0k3b = 0.0; + if (!model->BSIM3v0w0Given) + model->BSIM3v0w0 = 2.5e-6; + if (!model->BSIM3v0nlxGiven) + model->BSIM3v0nlx = 1.74e-7; + if (!model->BSIM3v0dvt0Given) + model->BSIM3v0dvt0 = 2.2; + if (!model->BSIM3v0dvt1Given) + model->BSIM3v0dvt1 = 0.53; + if (!model->BSIM3v0dvt2Given) + model->BSIM3v0dvt2 = -0.032; /* unit 1 / V */ + + if (!model->BSIM3v0dvt0wGiven) + model->BSIM3v0dvt0w = 0.0; + if (!model->BSIM3v0dvt1wGiven) + model->BSIM3v0dvt1w = 5.3e6; + if (!model->BSIM3v0dvt2wGiven) + model->BSIM3v0dvt2w = -0.032; + + if (!model->BSIM3v0droutGiven) + model->BSIM3v0drout = 0.56; + if (!model->BSIM3v0dsubGiven) + model->BSIM3v0dsub = model->BSIM3v0drout; + if (!model->BSIM3v0vth0Given) + model->BSIM3v0vth0 = (model->BSIM3v0type == NMOS) ? 0.7 : -0.7; + if (!model->BSIM3v0uaGiven) + model->BSIM3v0ua = 2.25e-9; /* unit m/V */ + if (!model->BSIM3v0ua1Given) + model->BSIM3v0ua1 = 4.31e-9; /* unit m/V */ + if (!model->BSIM3v0ubGiven) + model->BSIM3v0ub = 5.87e-19; /* unit (m/V)**2 */ + if (!model->BSIM3v0ub1Given) + model->BSIM3v0ub1 = -7.61e-18; /* unit (m/V)**2 */ + if (!model->BSIM3v0ucGiven) + model->BSIM3v0uc = (model->BSIM3v0mobMod == 3) ? -0.0465 : -0.0465e-9; + if (!model->BSIM3v0uc1Given) + model->BSIM3v0uc1 = (model->BSIM3v0mobMod == 3) ? -0.056 : -0.056e-9; + if (!model->BSIM3v0u0Given) + model->BSIM3v0u0 = (model->BSIM3v0type == NMOS) ? 0.067 : 0.025; + else if (model->BSIM3v0u0 > 1.0) + model->BSIM3v0u0 = model->BSIM3v0u0 / 1.0e4; + /* if u0 > 1.0, cm.g.sec unit system is used. If should be + converted into SI unit system. */ + if (!model->BSIM3v0uteGiven) + model->BSIM3v0ute = -1.5; + if (!model->BSIM3v0voffGiven) + model->BSIM3v0voff = -0.08; + if (!model->BSIM3v0deltaGiven) + model->BSIM3v0delta = 0.01; + if (!model->BSIM3v0rdswGiven) + model->BSIM3v0rdsw = 0; + if (!model->BSIM3v0prwgGiven) + model->BSIM3v0prwg = 0.0; /* unit 1/V */ + if (!model->BSIM3v0prwbGiven) + model->BSIM3v0prwb = 0.0; + if (!model->BSIM3v0prtGiven) + if (!model->BSIM3v0prtGiven) + model->BSIM3v0prt = 0.0; + if (!model->BSIM3v0eta0Given) + model->BSIM3v0eta0 = 0.08; /* no unit */ + if (!model->BSIM3v0etabGiven) + model->BSIM3v0etab = -0.07; /* unit 1/V */ + if (!model->BSIM3v0pclmGiven) + model->BSIM3v0pclm = 1.3; /* no unit */ + if (!model->BSIM3v0pdibl1Given) + model->BSIM3v0pdibl1 = .39; /* no unit */ + if (!model->BSIM3v0pdibl2Given) + model->BSIM3v0pdibl2 = 0.0086; /* no unit */ + if (!model->BSIM3v0pdiblbGiven) + model->BSIM3v0pdiblb = 0.0; /* 1/V */ + if (!model->BSIM3v0pscbe1Given) + model->BSIM3v0pscbe1 = 4.24e8; + if (!model->BSIM3v0pscbe2Given) + model->BSIM3v0pscbe2 = 1.0e-5; + if (!model->BSIM3v0pvagGiven) + model->BSIM3v0pvag = 0.0; + if (!model->BSIM3v0wrGiven) + model->BSIM3v0wr = 1.0; + if (!model->BSIM3v0dwgGiven) + model->BSIM3v0dwg = 0.0; + if (!model->BSIM3v0dwbGiven) + model->BSIM3v0dwb = 0.0; + if (!model->BSIM3v0b0Given) + model->BSIM3v0b0 = 0.0; + if (!model->BSIM3v0b1Given) + model->BSIM3v0b1 = 0.0; + if (!model->BSIM3v0alpha0Given) + model->BSIM3v0alpha0 = 0.0; + if (!model->BSIM3v0beta0Given) + model->BSIM3v0beta0 = 30.0; + + if (!model->BSIM3v0elmGiven) + model->BSIM3v0elm = 5.0; + if (!model->BSIM3v0cgslGiven) + model->BSIM3v0cgsl = 0.0; + if (!model->BSIM3v0cgdlGiven) + model->BSIM3v0cgdl = 0.0; + if (!model->BSIM3v0ckappaGiven) + model->BSIM3v0ckappa = 0.6; + if (!model->BSIM3v0clcGiven) + model->BSIM3v0clc = 0.1e-6; + if (!model->BSIM3v0cleGiven) + model->BSIM3v0cle = 0.6; + + /* Length dependence */ + if (!model->BSIM3v0lcdscGiven) + model->BSIM3v0lcdsc = 0.0; + if (!model->BSIM3v0lcdscbGiven) + model->BSIM3v0lcdscb = 0.0; + if (!model->BSIM3v0lcdscdGiven) + model->BSIM3v0lcdscd = 0.0; + if (!model->BSIM3v0lcitGiven) + model->BSIM3v0lcit = 0.0; + if (!model->BSIM3v0lnfactorGiven) + model->BSIM3v0lnfactor = 0.0; + if (!model->BSIM3v0lxjGiven) + model->BSIM3v0lxj = 0.0; + if (!model->BSIM3v0lvsatGiven) + model->BSIM3v0lvsat = 0.0; + if (!model->BSIM3v0latGiven) + model->BSIM3v0lat = 0.0; + if (!model->BSIM3v0la0Given) + model->BSIM3v0la0 = 0.0; + if (!model->BSIM3v0lagsGiven) + model->BSIM3v0lags = 0.0; + if (!model->BSIM3v0la1Given) + model->BSIM3v0la1 = 0.0; + if (!model->BSIM3v0la2Given) + model->BSIM3v0la2 = 0.0; + if (!model->BSIM3v0lketaGiven) + model->BSIM3v0lketa = 0.0; + if (!model->BSIM3v0lnsubGiven) + model->BSIM3v0lnsub = 0.0; + if (!model->BSIM3v0lnpeakGiven) + model->BSIM3v0lnpeak = 0.0; + if (!model->BSIM3v0lvbmGiven) + model->BSIM3v0lvbm = 0.0; + if (!model->BSIM3v0lxtGiven) + model->BSIM3v0lxt = 0.0; + if (!model->BSIM3v0lkt1Given) + model->BSIM3v0lkt1 = 0.0; + if (!model->BSIM3v0lkt1lGiven) + model->BSIM3v0lkt1l = 0.0; + if (!model->BSIM3v0lkt2Given) + model->BSIM3v0lkt2 = 0.0; + if (!model->BSIM3v0lk3Given) + model->BSIM3v0lk3 = 0.0; + if (!model->BSIM3v0lk3bGiven) + model->BSIM3v0lk3b = 0.0; + if (!model->BSIM3v0lw0Given) + model->BSIM3v0lw0 = 0.0; + if (!model->BSIM3v0lnlxGiven) + model->BSIM3v0lnlx = 0.0; + if (!model->BSIM3v0ldvt0Given) + model->BSIM3v0ldvt0 = 0.0; + if (!model->BSIM3v0ldvt1Given) + model->BSIM3v0ldvt1 = 0.0; + if (!model->BSIM3v0ldvt2Given) + model->BSIM3v0ldvt2 = 0.0; + if (!model->BSIM3v0ldvt0wGiven) + model->BSIM3v0ldvt0w = 0.0; + if (!model->BSIM3v0ldvt1wGiven) + model->BSIM3v0ldvt1w = 0.0; + if (!model->BSIM3v0ldvt2wGiven) + model->BSIM3v0ldvt2w = 0.0; + if (!model->BSIM3v0ldroutGiven) + model->BSIM3v0ldrout = 0.0; + if (!model->BSIM3v0ldsubGiven) + model->BSIM3v0ldsub = 0.0; + if (!model->BSIM3v0lvth0Given) + model->BSIM3v0lvth0 = 0.0; + if (!model->BSIM3v0luaGiven) + model->BSIM3v0lua = 0.0; + if (!model->BSIM3v0lua1Given) + model->BSIM3v0lua1 = 0.0; + if (!model->BSIM3v0lubGiven) + model->BSIM3v0lub = 0.0; + if (!model->BSIM3v0lub1Given) + model->BSIM3v0lub1 = 0.0; + if (!model->BSIM3v0lucGiven) + model->BSIM3v0luc = 0.0; + if (!model->BSIM3v0luc1Given) + model->BSIM3v0luc1 = 0.0; + if (!model->BSIM3v0lu0Given) + model->BSIM3v0lu0 = 0.0; + else if (model->BSIM3v0u0 > 1.0) + model->BSIM3v0lu0 = model->BSIM3v0lu0 / 1.0e4; + if (!model->BSIM3v0luteGiven) + model->BSIM3v0lute = 0.0; + if (!model->BSIM3v0lvoffGiven) + model->BSIM3v0lvoff = 0.0; + if (!model->BSIM3v0ldeltaGiven) + model->BSIM3v0ldelta = 0.0; + if (!model->BSIM3v0lrdswGiven) + model->BSIM3v0lrdsw = 0.0; + if (!model->BSIM3v0lprwbGiven) + model->BSIM3v0lprwb = 0.0; + if (!model->BSIM3v0lprwgGiven) + model->BSIM3v0lprwg = 0.0; + if (!model->BSIM3v0lprtGiven) + if (!model->BSIM3v0lprtGiven) + model->BSIM3v0lprt = 0.0; + if (!model->BSIM3v0leta0Given) + model->BSIM3v0leta0 = 0.0; + if (!model->BSIM3v0letabGiven) + model->BSIM3v0letab = -0.0; + if (!model->BSIM3v0lpclmGiven) + model->BSIM3v0lpclm = 0.0; + if (!model->BSIM3v0lpdibl1Given) + model->BSIM3v0lpdibl1 = 0.0; + if (!model->BSIM3v0lpdibl2Given) + model->BSIM3v0lpdibl2 = 0.0; + if (!model->BSIM3v0lpdiblbGiven) + model->BSIM3v0lpdiblb = 0.0; + if (!model->BSIM3v0lpscbe1Given) + model->BSIM3v0lpscbe1 = 0.0; + if (!model->BSIM3v0lpscbe2Given) + model->BSIM3v0lpscbe2 = 0.0; + if (!model->BSIM3v0lpvagGiven) + model->BSIM3v0lpvag = 0.0; + if (!model->BSIM3v0lwrGiven) + model->BSIM3v0lwr = 0.0; + if (!model->BSIM3v0ldwgGiven) + model->BSIM3v0ldwg = 0.0; + if (!model->BSIM3v0ldwbGiven) + model->BSIM3v0ldwb = 0.0; + if (!model->BSIM3v0lb0Given) + model->BSIM3v0lb0 = 0.0; + if (!model->BSIM3v0lb1Given) + model->BSIM3v0lb1 = 0.0; + if (!model->BSIM3v0lalpha0Given) + model->BSIM3v0lalpha0 = 0.0; + if (!model->BSIM3v0lbeta0Given) + model->BSIM3v0lbeta0 = 0.0; + + if (!model->BSIM3v0lelmGiven) + model->BSIM3v0lelm = 0.0; + if (!model->BSIM3v0lcgslGiven) + model->BSIM3v0lcgsl = 0.0; + if (!model->BSIM3v0lcgdlGiven) + model->BSIM3v0lcgdl = 0.0; + if (!model->BSIM3v0lckappaGiven) + model->BSIM3v0lckappa = 0.0; + if (!model->BSIM3v0lcfGiven) + model->BSIM3v0lcf = 0.0; + if (!model->BSIM3v0lclcGiven) + model->BSIM3v0lclc = 0.0; + if (!model->BSIM3v0lcleGiven) + model->BSIM3v0lcle = 0.0; + + /* Width dependence */ + if (!model->BSIM3v0wcdscGiven) + model->BSIM3v0wcdsc = 0.0; + if (!model->BSIM3v0wcdscbGiven) + model->BSIM3v0wcdscb = 0.0; + if (!model->BSIM3v0wcdscdGiven) + model->BSIM3v0wcdscd = 0.0; + if (!model->BSIM3v0wcitGiven) + model->BSIM3v0wcit = 0.0; + if (!model->BSIM3v0wnfactorGiven) + model->BSIM3v0wnfactor = 0.0; + if (!model->BSIM3v0wxjGiven) + model->BSIM3v0wxj = 0.0; + if (!model->BSIM3v0wvsatGiven) + model->BSIM3v0wvsat = 0.0; + if (!model->BSIM3v0watGiven) + model->BSIM3v0wat = 0.0; + if (!model->BSIM3v0wa0Given) + model->BSIM3v0wa0 = 0.0; + if (!model->BSIM3v0wagsGiven) + model->BSIM3v0wags = 0.0; + if (!model->BSIM3v0wa1Given) + model->BSIM3v0wa1 = 0.0; + if (!model->BSIM3v0wa2Given) + model->BSIM3v0wa2 = 0.0; + if (!model->BSIM3v0wketaGiven) + model->BSIM3v0wketa = 0.0; + if (!model->BSIM3v0wnsubGiven) + model->BSIM3v0wnsub = 0.0; + if (!model->BSIM3v0wnpeakGiven) + model->BSIM3v0wnpeak = 0.0; + if (!model->BSIM3v0wvbmGiven) + model->BSIM3v0wvbm = 0.0; + if (!model->BSIM3v0wxtGiven) + model->BSIM3v0wxt = 0.0; + if (!model->BSIM3v0wkt1Given) + model->BSIM3v0wkt1 = 0.0; + if (!model->BSIM3v0wkt1lGiven) + model->BSIM3v0wkt1l = 0.0; + if (!model->BSIM3v0wkt2Given) + model->BSIM3v0wkt2 = 0.0; + if (!model->BSIM3v0wk3Given) + model->BSIM3v0wk3 = 0.0; + if (!model->BSIM3v0wk3bGiven) + model->BSIM3v0wk3b = 0.0; + if (!model->BSIM3v0ww0Given) + model->BSIM3v0ww0 = 0.0; + if (!model->BSIM3v0wnlxGiven) + model->BSIM3v0wnlx = 0.0; + if (!model->BSIM3v0wdvt0Given) + model->BSIM3v0wdvt0 = 0.0; + if (!model->BSIM3v0wdvt1Given) + model->BSIM3v0wdvt1 = 0.0; + if (!model->BSIM3v0wdvt2Given) + model->BSIM3v0wdvt2 = 0.0; + if (!model->BSIM3v0wdvt0wGiven) + model->BSIM3v0wdvt0w = 0.0; + if (!model->BSIM3v0wdvt1wGiven) + model->BSIM3v0wdvt1w = 0.0; + if (!model->BSIM3v0wdvt2wGiven) + model->BSIM3v0wdvt2w = 0.0; + if (!model->BSIM3v0wdroutGiven) + model->BSIM3v0wdrout = 0.0; + if (!model->BSIM3v0wdsubGiven) + model->BSIM3v0wdsub = 0.0; + if (!model->BSIM3v0wvth0Given) + model->BSIM3v0wvth0 = 0.0; + if (!model->BSIM3v0wuaGiven) + model->BSIM3v0wua = 0.0; + if (!model->BSIM3v0wua1Given) + model->BSIM3v0wua1 = 0.0; + if (!model->BSIM3v0wubGiven) + model->BSIM3v0wub = 0.0; + if (!model->BSIM3v0wub1Given) + model->BSIM3v0wub1 = 0.0; + if (!model->BSIM3v0wucGiven) + model->BSIM3v0wuc = 0.0; + if (!model->BSIM3v0wuc1Given) + model->BSIM3v0wuc1 = 0.0; + if (!model->BSIM3v0wu0Given) + model->BSIM3v0wu0 = 0.0; + else if (model->BSIM3v0u0 > 1.0) + model->BSIM3v0wu0 = model->BSIM3v0wu0 / 1.0e4; + if (!model->BSIM3v0wuteGiven) + model->BSIM3v0wute = 0.0; + if (!model->BSIM3v0wvoffGiven) + model->BSIM3v0wvoff = 0.0; + if (!model->BSIM3v0wdeltaGiven) + model->BSIM3v0wdelta = 0.0; + if (!model->BSIM3v0wrdswGiven) + model->BSIM3v0wrdsw = 0.0; + if (!model->BSIM3v0wprwbGiven) + model->BSIM3v0wprwb = 0.0; + if (!model->BSIM3v0wprwgGiven) + model->BSIM3v0wprwg = 0.0; + if (!model->BSIM3v0wprtGiven) + model->BSIM3v0wprt = 0.0; + if (!model->BSIM3v0weta0Given) + model->BSIM3v0weta0 = 0.0; + if (!model->BSIM3v0wetabGiven) + model->BSIM3v0wetab = 0.0; + if (!model->BSIM3v0wpclmGiven) + model->BSIM3v0wpclm = 0.0; + if (!model->BSIM3v0wpdibl1Given) + model->BSIM3v0wpdibl1 = 0.0; + if (!model->BSIM3v0wpdibl2Given) + model->BSIM3v0wpdibl2 = 0.0; + if (!model->BSIM3v0wpdiblbGiven) + model->BSIM3v0wpdiblb = 0.0; + if (!model->BSIM3v0wpscbe1Given) + model->BSIM3v0wpscbe1 = 0.0; + if (!model->BSIM3v0wpscbe2Given) + model->BSIM3v0wpscbe2 = 0.0; + if (!model->BSIM3v0wpvagGiven) + model->BSIM3v0wpvag = 0.0; + if (!model->BSIM3v0wwrGiven) + model->BSIM3v0wwr = 0.0; + if (!model->BSIM3v0wdwgGiven) + model->BSIM3v0wdwg = 0.0; + if (!model->BSIM3v0wdwbGiven) + model->BSIM3v0wdwb = 0.0; + if (!model->BSIM3v0wb0Given) + model->BSIM3v0wb0 = 0.0; + if (!model->BSIM3v0wb1Given) + model->BSIM3v0wb1 = 0.0; + if (!model->BSIM3v0walpha0Given) + model->BSIM3v0walpha0 = 0.0; + if (!model->BSIM3v0wbeta0Given) + model->BSIM3v0wbeta0 = 0.0; + + if (!model->BSIM3v0welmGiven) + model->BSIM3v0welm = 0.0; + if (!model->BSIM3v0wcgslGiven) + model->BSIM3v0wcgsl = 0.0; + if (!model->BSIM3v0wcgdlGiven) + model->BSIM3v0wcgdl = 0.0; + if (!model->BSIM3v0wckappaGiven) + model->BSIM3v0wckappa = 0.0; + if (!model->BSIM3v0wcfGiven) + model->BSIM3v0wcf = 0.0; + if (!model->BSIM3v0wclcGiven) + model->BSIM3v0wclc = 0.0; + if (!model->BSIM3v0wcleGiven) + model->BSIM3v0wcle = 0.0; + + /* Cross-term dependence */ + if (!model->BSIM3v0pcdscGiven) + model->BSIM3v0pcdsc = 0.0; + if (!model->BSIM3v0pcdscbGiven) + model->BSIM3v0pcdscb = 0.0; + if (!model->BSIM3v0pcdscdGiven) + model->BSIM3v0pcdscd = 0.0; + if (!model->BSIM3v0pcitGiven) + model->BSIM3v0pcit = 0.0; + if (!model->BSIM3v0pnfactorGiven) + model->BSIM3v0pnfactor = 0.0; + if (!model->BSIM3v0pxjGiven) + model->BSIM3v0pxj = 0.0; + if (!model->BSIM3v0pvsatGiven) + model->BSIM3v0pvsat = 0.0; + if (!model->BSIM3v0patGiven) + model->BSIM3v0pat = 0.0; + if (!model->BSIM3v0pa0Given) + model->BSIM3v0pa0 = 0.0; + + if (!model->BSIM3v0pagsGiven) + model->BSIM3v0pags = 0.0; + if (!model->BSIM3v0pa1Given) + model->BSIM3v0pa1 = 0.0; + if (!model->BSIM3v0pa2Given) + model->BSIM3v0pa2 = 0.0; + if (!model->BSIM3v0pketaGiven) + model->BSIM3v0pketa = 0.0; + if (!model->BSIM3v0pnsubGiven) + model->BSIM3v0pnsub = 0.0; + if (!model->BSIM3v0pnpeakGiven) + model->BSIM3v0pnpeak = 0.0; + if (!model->BSIM3v0pvbmGiven) + model->BSIM3v0pvbm = 0.0; + if (!model->BSIM3v0pxtGiven) + model->BSIM3v0pxt = 0.0; + if (!model->BSIM3v0pkt1Given) + model->BSIM3v0pkt1 = 0.0; + if (!model->BSIM3v0pkt1lGiven) + model->BSIM3v0pkt1l = 0.0; + if (!model->BSIM3v0pkt2Given) + model->BSIM3v0pkt2 = 0.0; + if (!model->BSIM3v0pk3Given) + model->BSIM3v0pk3 = 0.0; + if (!model->BSIM3v0pk3bGiven) + model->BSIM3v0pk3b = 0.0; + if (!model->BSIM3v0pw0Given) + model->BSIM3v0pw0 = 0.0; + if (!model->BSIM3v0pnlxGiven) + model->BSIM3v0pnlx = 0.0; + if (!model->BSIM3v0pdvt0Given) + model->BSIM3v0pdvt0 = 0.0; + if (!model->BSIM3v0pdvt1Given) + model->BSIM3v0pdvt1 = 0.0; + if (!model->BSIM3v0pdvt2Given) + model->BSIM3v0pdvt2 = 0.0; + if (!model->BSIM3v0pdvt0wGiven) + model->BSIM3v0pdvt0w = 0.0; + if (!model->BSIM3v0pdvt1wGiven) + model->BSIM3v0pdvt1w = 0.0; + if (!model->BSIM3v0pdvt2wGiven) + model->BSIM3v0pdvt2w = 0.0; + if (!model->BSIM3v0pdroutGiven) + model->BSIM3v0pdrout = 0.0; + if (!model->BSIM3v0pdsubGiven) + model->BSIM3v0pdsub = 0.0; + if (!model->BSIM3v0pvth0Given) + model->BSIM3v0pvth0 = 0.0; + if (!model->BSIM3v0puaGiven) + model->BSIM3v0pua = 0.0; + if (!model->BSIM3v0pua1Given) + model->BSIM3v0pua1 = 0.0; + if (!model->BSIM3v0pubGiven) + model->BSIM3v0pub = 0.0; + if (!model->BSIM3v0pub1Given) + model->BSIM3v0pub1 = 0.0; + if (!model->BSIM3v0pucGiven) + model->BSIM3v0puc = 0.0; + if (!model->BSIM3v0puc1Given) + model->BSIM3v0puc1 = 0.0; + if (!model->BSIM3v0pu0Given) + model->BSIM3v0pu0 = 0.0; + else if (model->BSIM3v0u0 > 1.0) + model->BSIM3v0pu0 = model->BSIM3v0pu0 / 1.0e4; + if (!model->BSIM3v0puteGiven) + model->BSIM3v0pute = 0.0; + if (!model->BSIM3v0pvoffGiven) + model->BSIM3v0pvoff = 0.0; + if (!model->BSIM3v0pdeltaGiven) + model->BSIM3v0pdelta = 0.0; + if (!model->BSIM3v0prdswGiven) + model->BSIM3v0prdsw = 0.0; + if (!model->BSIM3v0pprwbGiven) + model->BSIM3v0pprwb = 0.0; + if (!model->BSIM3v0pprwgGiven) + model->BSIM3v0pprwg = 0.0; + if (!model->BSIM3v0pprtGiven) + model->BSIM3v0pprt = 0.0; + if (!model->BSIM3v0peta0Given) + model->BSIM3v0peta0 = 0.0; + if (!model->BSIM3v0petabGiven) + model->BSIM3v0petab = 0.0; + if (!model->BSIM3v0ppclmGiven) + model->BSIM3v0ppclm = 0.0; + if (!model->BSIM3v0ppdibl1Given) + model->BSIM3v0ppdibl1 = 0.0; + if (!model->BSIM3v0ppdibl2Given) + model->BSIM3v0ppdibl2 = 0.0; + if (!model->BSIM3v0ppdiblbGiven) + model->BSIM3v0ppdiblb = 0.0; + if (!model->BSIM3v0ppscbe1Given) + model->BSIM3v0ppscbe1 = 0.0; + if (!model->BSIM3v0ppscbe2Given) + model->BSIM3v0ppscbe2 = 0.0; + if (!model->BSIM3v0ppvagGiven) + model->BSIM3v0ppvag = 0.0; + if (!model->BSIM3v0pwrGiven) + model->BSIM3v0pwr = 0.0; + if (!model->BSIM3v0pdwgGiven) + model->BSIM3v0pdwg = 0.0; + if (!model->BSIM3v0pdwbGiven) + model->BSIM3v0pdwb = 0.0; + if (!model->BSIM3v0pb0Given) + model->BSIM3v0pb0 = 0.0; + if (!model->BSIM3v0pb1Given) + model->BSIM3v0pb1 = 0.0; + if (!model->BSIM3v0palpha0Given) + model->BSIM3v0palpha0 = 0.0; + if (!model->BSIM3v0pbeta0Given) + model->BSIM3v0pbeta0 = 0.0; + + if (!model->BSIM3v0pelmGiven) + model->BSIM3v0pelm = 0.0; + if (!model->BSIM3v0pcgslGiven) + model->BSIM3v0pcgsl = 0.0; + if (!model->BSIM3v0pcgdlGiven) + model->BSIM3v0pcgdl = 0.0; + if (!model->BSIM3v0pckappaGiven) + model->BSIM3v0pckappa = 0.0; + if (!model->BSIM3v0pcfGiven) + model->BSIM3v0pcf = 0.0; + if (!model->BSIM3v0pclcGiven) + model->BSIM3v0pclc = 0.0; + if (!model->BSIM3v0pcleGiven) + model->BSIM3v0pcle = 0.0; + + /* unit degree celcius */ + if (!model->BSIM3v0tnomGiven) + model->BSIM3v0tnom = ckt->CKTnomTemp; + if (!model->BSIM3v0LintGiven) + model->BSIM3v0Lint = 0.0; + if (!model->BSIM3v0LlGiven) + model->BSIM3v0Ll = 0.0; + if (!model->BSIM3v0LlnGiven) + model->BSIM3v0Lln = 1.0; + if (!model->BSIM3v0LwGiven) + model->BSIM3v0Lw = 0.0; + if (!model->BSIM3v0LwnGiven) + model->BSIM3v0Lwn = 1.0; + if (!model->BSIM3v0LwlGiven) + model->BSIM3v0Lwl = 0.0; + if (!model->BSIM3v0LminGiven) + model->BSIM3v0Lmin = 0.0; + if (!model->BSIM3v0LmaxGiven) + model->BSIM3v0Lmax = 1.0; + if (!model->BSIM3v0WintGiven) + model->BSIM3v0Wint = 0.0; + if (!model->BSIM3v0WlGiven) + model->BSIM3v0Wl = 0.0; + if (!model->BSIM3v0WlnGiven) + model->BSIM3v0Wln = 1.0; + if (!model->BSIM3v0WwGiven) + model->BSIM3v0Ww = 0.0; + if (!model->BSIM3v0WwnGiven) + model->BSIM3v0Wwn = 1.0; + if (!model->BSIM3v0WwlGiven) + model->BSIM3v0Wwl = 0.0; + if (!model->BSIM3v0WminGiven) + model->BSIM3v0Wmin = 0.0; + if (!model->BSIM3v0WmaxGiven) + model->BSIM3v0Wmax = 1.0; + if (!model->BSIM3v0dwcGiven) + model->BSIM3v0dwc = model->BSIM3v0Wint; + if (!model->BSIM3v0dlcGiven) + model->BSIM3v0dlc = model->BSIM3v0Lint; + if (!model->BSIM3v0cfGiven) + model->BSIM3v0cf = 2.0 * EPSOX / PI + * log(1.0 + 0.4e-6 / model->BSIM3v0tox); + if (!model->BSIM3v0cgdoGiven) + { if (model->BSIM3v0dlcGiven && (model->BSIM3v0dlc > 0.0)) + { model->BSIM3v0cgdo = model->BSIM3v0dlc * model->BSIM3v0cox + - model->BSIM3v0cgdl ; + if (model->BSIM3v0cgdo < 0.0) + model->BSIM3v0cgdo = 0.0; + } + else + model->BSIM3v0cgdo = 0.6 * model->BSIM3v0xj * model->BSIM3v0cox; + } + if (!model->BSIM3v0cgsoGiven) + { if (model->BSIM3v0dlcGiven && (model->BSIM3v0dlc > 0.0)) + { model->BSIM3v0cgso = model->BSIM3v0dlc * model->BSIM3v0cox + - model->BSIM3v0cgsl ; + if (model->BSIM3v0cgso < 0.0) + model->BSIM3v0cgso = 0.0; + } + else + model->BSIM3v0cgso = 0.6 * model->BSIM3v0xj * model->BSIM3v0cox; + } + + if (!model->BSIM3v0cgboGiven) + model->BSIM3v0cgbo = 0.0; + if (!model->BSIM3v0xpartGiven) + model->BSIM3v0xpart = 0.0; + if (!model->BSIM3v0sheetResistanceGiven) + model->BSIM3v0sheetResistance = 0.0; + if (!model->BSIM3v0unitAreaJctCapGiven) + model->BSIM3v0unitAreaJctCap = 5.0E-4; + if (!model->BSIM3v0unitLengthSidewallJctCapGiven) + model->BSIM3v0unitLengthSidewallJctCap = 5.0E-10; + if (!model->BSIM3v0jctSatCurDensityGiven) + model->BSIM3v0jctSatCurDensity = 1.0E-4; + if (!model->BSIM3v0bulkJctPotentialGiven) + model->BSIM3v0bulkJctPotential = 1.0; + if (!model->BSIM3v0sidewallJctPotentialGiven) + model->BSIM3v0sidewallJctPotential = 1.0; + if (!model->BSIM3v0bulkJctBotGradingCoeffGiven) + model->BSIM3v0bulkJctBotGradingCoeff = 0.5; + if (!model->BSIM3v0bulkJctSideGradingCoeffGiven) + model->BSIM3v0bulkJctSideGradingCoeff = 0.33; + if (!model->BSIM3v0oxideTrapDensityAGiven) + { if (model->BSIM3v0type == NMOS) + model->BSIM3v0oxideTrapDensityA = 1e20; + else + model->BSIM3v0oxideTrapDensityA=9.9e18; + } + if (!model->BSIM3v0oxideTrapDensityBGiven) + { if (model->BSIM3v0type == NMOS) + model->BSIM3v0oxideTrapDensityB = 5e4; + else + model->BSIM3v0oxideTrapDensityB = 2.4e3; + } + if (!model->BSIM3v0oxideTrapDensityCGiven) + { if (model->BSIM3v0type == NMOS) + model->BSIM3v0oxideTrapDensityC = -1.4e-12; + else + model->BSIM3v0oxideTrapDensityC = 1.4e-12; + + } + if (!model->BSIM3v0emGiven) + model->BSIM3v0em = 4.1e7; /* V/m */ + if (!model->BSIM3v0efGiven) + model->BSIM3v0ef = 1.0; + if (!model->BSIM3v0afGiven) + model->BSIM3v0af = 1.0; + if (!model->BSIM3v0kfGiven) + model->BSIM3v0kf = 0.0; + /* loop through all the instances of the model */ + for (here = model->BSIM3v0instances; here != NULL ; + here=here->BSIM3v0nextInstance) + { + + if (here->BSIM3v0owner == ARCHme) + { + /* allocate a chunk of the state vector */ + here->BSIM3v0states = *states; + *states += BSIM3v0numStates; + } + + /* perform the parameter defaulting */ + if (!here->BSIM3v0drainAreaGiven) + here->BSIM3v0drainArea = 0.0; + if (!here->BSIM3v0drainPerimeterGiven) + here->BSIM3v0drainPerimeter = 0.0; + if (!here->BSIM3v0drainSquaresGiven) + here->BSIM3v0drainSquares = 1.0; + if (!here->BSIM3v0icVBSGiven) + here->BSIM3v0icVBS = 0; + if (!here->BSIM3v0icVDSGiven) + here->BSIM3v0icVDS = 0; + if (!here->BSIM3v0icVGSGiven) + here->BSIM3v0icVGS = 0; + if (!here->BSIM3v0lGiven) + here->BSIM3v0l = 5e-6; + if (!here->BSIM3v0sourceAreaGiven) + here->BSIM3v0sourceArea = 0; + if (!here->BSIM3v0sourcePerimeterGiven) + here->BSIM3v0sourcePerimeter = 0; + if (!here->BSIM3v0sourceSquaresGiven) + here->BSIM3v0sourceSquares = 1; + if (!here->BSIM3v0wGiven) + here->BSIM3v0w = 5e-6; + + if (!here->BSIM3v0mGiven) + here->BSIM3v0m = 1; + + if (!here->BSIM3v0nqsModGiven) + here->BSIM3v0nqsMod = model->BSIM3v0nqsMod; + + /* process drain series resistance */ + if ((model->BSIM3v0sheetResistance > 0.0) && + (here->BSIM3v0drainSquares > 0.0 ) && + (here->BSIM3v0dNodePrime == 0)) + { error = CKTmkVolt(ckt,&tmp,here->BSIM3v0name,"drain"); + if(error) return(error); + here->BSIM3v0dNodePrime = tmp->number; + + if (ckt->CKTcopyNodesets) { + if (CKTinst2Node(ckt,here,1,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + } + else + { here->BSIM3v0dNodePrime = here->BSIM3v0dNode; + } + + /* process source series resistance */ + if ((model->BSIM3v0sheetResistance > 0.0) && + (here->BSIM3v0sourceSquares > 0.0 ) && + (here->BSIM3v0sNodePrime == 0)) + { error = CKTmkVolt(ckt,&tmp,here->BSIM3v0name,"source"); + if(error) return(error); + here->BSIM3v0sNodePrime = tmp->number; + + if (ckt->CKTcopyNodesets) { + if (CKTinst2Node(ckt,here,3,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + + } + else + { here->BSIM3v0sNodePrime = here->BSIM3v0sNode; + } + + /* internal charge node */ + + if ((here->BSIM3v0nqsMod) && (here->BSIM3v0qNode == 0)) + { error = CKTmkVolt(ckt,&tmp,here->BSIM3v0name,"charge"); + if(error) return(error); + here->BSIM3v0qNode = tmp->number; + } + else + { here->BSIM3v0qNode = 0; + } + + /* set Sparse Matrix Pointers */ + +/* macro to make elements with built in test for out of memory */ +#define TSTALLOC(ptr,first,second) \ +if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ + return(E_NOMEM);\ +} + + TSTALLOC(BSIM3v0DdPtr, BSIM3v0dNode, BSIM3v0dNode) + TSTALLOC(BSIM3v0GgPtr, BSIM3v0gNode, BSIM3v0gNode) + TSTALLOC(BSIM3v0SsPtr, BSIM3v0sNode, BSIM3v0sNode) + TSTALLOC(BSIM3v0BbPtr, BSIM3v0bNode, BSIM3v0bNode) + TSTALLOC(BSIM3v0DPdpPtr, BSIM3v0dNodePrime, BSIM3v0dNodePrime) + TSTALLOC(BSIM3v0SPspPtr, BSIM3v0sNodePrime, BSIM3v0sNodePrime) + TSTALLOC(BSIM3v0DdpPtr, BSIM3v0dNode, BSIM3v0dNodePrime) + TSTALLOC(BSIM3v0GbPtr, BSIM3v0gNode, BSIM3v0bNode) + TSTALLOC(BSIM3v0GdpPtr, BSIM3v0gNode, BSIM3v0dNodePrime) + TSTALLOC(BSIM3v0GspPtr, BSIM3v0gNode, BSIM3v0sNodePrime) + TSTALLOC(BSIM3v0SspPtr, BSIM3v0sNode, BSIM3v0sNodePrime) + TSTALLOC(BSIM3v0BdpPtr, BSIM3v0bNode, BSIM3v0dNodePrime) + TSTALLOC(BSIM3v0BspPtr, BSIM3v0bNode, BSIM3v0sNodePrime) + TSTALLOC(BSIM3v0DPspPtr, BSIM3v0dNodePrime, BSIM3v0sNodePrime) + TSTALLOC(BSIM3v0DPdPtr, BSIM3v0dNodePrime, BSIM3v0dNode) + TSTALLOC(BSIM3v0BgPtr, BSIM3v0bNode, BSIM3v0gNode) + TSTALLOC(BSIM3v0DPgPtr, BSIM3v0dNodePrime, BSIM3v0gNode) + TSTALLOC(BSIM3v0SPgPtr, BSIM3v0sNodePrime, BSIM3v0gNode) + TSTALLOC(BSIM3v0SPsPtr, BSIM3v0sNodePrime, BSIM3v0sNode) + TSTALLOC(BSIM3v0DPbPtr, BSIM3v0dNodePrime, BSIM3v0bNode) + TSTALLOC(BSIM3v0SPbPtr, BSIM3v0sNodePrime, BSIM3v0bNode) + TSTALLOC(BSIM3v0SPdpPtr, BSIM3v0sNodePrime, BSIM3v0dNodePrime) + + TSTALLOC(BSIM3v0QqPtr, BSIM3v0qNode, BSIM3v0qNode) + + TSTALLOC(BSIM3v0QdpPtr, BSIM3v0qNode, BSIM3v0dNodePrime) + TSTALLOC(BSIM3v0QspPtr, BSIM3v0qNode, BSIM3v0sNodePrime) + TSTALLOC(BSIM3v0QgPtr, BSIM3v0qNode, BSIM3v0gNode) + TSTALLOC(BSIM3v0QbPtr, BSIM3v0qNode, BSIM3v0bNode) + TSTALLOC(BSIM3v0DPqPtr, BSIM3v0dNodePrime, BSIM3v0qNode) + TSTALLOC(BSIM3v0SPqPtr, BSIM3v0sNodePrime, BSIM3v0qNode) + TSTALLOC(BSIM3v0GqPtr, BSIM3v0gNode, BSIM3v0qNode) + TSTALLOC(BSIM3v0BqPtr, BSIM3v0bNode, BSIM3v0qNode) + + } + } + return(OK); +} + + +int +BSIM3v0unsetup(GENmodel *inModel, CKTcircuit *ckt) +{ + BSIM3v0model *model; + BSIM3v0instance *here; + + for (model = (BSIM3v0model *)inModel; model != NULL; + model = model->BSIM3v0nextModel) + { + for (here = model->BSIM3v0instances; here != NULL; + here=here->BSIM3v0nextInstance) + { + if (here->BSIM3v0dNodePrime + && here->BSIM3v0dNodePrime != here->BSIM3v0dNode) + { + CKTdltNNum(ckt, here->BSIM3v0dNodePrime); + here->BSIM3v0dNodePrime = 0; + } + if (here->BSIM3v0sNodePrime + && here->BSIM3v0sNodePrime != here->BSIM3v0sNode) + { + CKTdltNNum(ckt, here->BSIM3v0sNodePrime); + here->BSIM3v0sNodePrime = 0; + } + } + } + return OK; +} + + diff --git a/src/spicelib/devices/bsim3v0/b3v0temp.c b/src/spicelib/devices/bsim3v0/b3v0temp.c new file mode 100644 index 000000000..f003a7088 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0temp.c @@ -0,0 +1,631 @@ +/*********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0temp.c +**********/ +/* Lmin, Lmax, Wmin, Wmax */ + +#include "ngspice.h" +#include "smpdefs.h" +#include "cktdefs.h" +#include "bsim3v0def.h" +#include "const.h" +#include "sperror.h" +#include "suffix.h" + +#define Kb 1.3806226e-23 +#define KboQ 8.617087e-5 /* Kb / q where q = 1.60219e-19 */ +#define EPSOX 3.453133e-11 +#define EPSSI 1.03594e-10 +#define PI 3.141592654 +#define MAX_EXP 5.834617425e14 +#define MIN_EXP 1.713908431e-15 +#define EXP_THRESHOLD 34.0 +#define Charge_q 1.60219e-19 + + +/* ARGSUSED */ +int +BSIM3v0temp(GENmodel *inModel, CKTcircuit *ckt) +{ +register BSIM3v0model *model = (BSIM3v0model*) inModel; +register BSIM3v0instance *here; +struct bsim3v0SizeDependParam *pSizeDependParamKnot, *pLastKnot, *pParam; +double tmp, tmp1, tmp2, Eg, ni, T0, T1, T2, T3, T4, T5, Ldrn, Wdrn; +double Temp, TRatio, Inv_L, Inv_W, Inv_LW, Dw, Dl, Vtm0, Tnom; +int Size_Not_Found; + + /* loop through all the BSIM3v0 device models */ + for (; model != NULL; model = model->BSIM3v0nextModel) + { Temp = ckt->CKTtemp; + if (model->BSIM3v0bulkJctPotential < 0.1) + model->BSIM3v0bulkJctPotential = 0.1; + if (model->BSIM3v0sidewallJctPotential < 0.1) + model->BSIM3v0sidewallJctPotential = 0.1; + model->pSizeDependParamKnot = NULL; + pLastKnot = NULL; + + Tnom = model->BSIM3v0tnom; + TRatio = Temp / Tnom; + + /* loop through all the instances of the model */ + for (here = model->BSIM3v0instances; here != NULL; + here=here->BSIM3v0nextInstance) + { + + if (here->BSIM3v0owner != ARCHme) + continue; + + pSizeDependParamKnot = model->pSizeDependParamKnot; + Size_Not_Found = 1; + while ((pSizeDependParamKnot != NULL) && Size_Not_Found) + { if ((here->BSIM3v0l == pSizeDependParamKnot->Length) + && (here->BSIM3v0w == pSizeDependParamKnot->Width)) + { Size_Not_Found = 0; + here->pParam = pSizeDependParamKnot; + } + else + { pLastKnot = pSizeDependParamKnot; + pSizeDependParamKnot = pSizeDependParamKnot->pNext; + } + } + + if (Size_Not_Found) + { pParam = (struct bsim3v0SizeDependParam *)tmalloc( + sizeof(struct bsim3v0SizeDependParam)); + if (pLastKnot == NULL) + model->pSizeDependParamKnot = pParam; + else + pLastKnot->pNext = pParam; + pParam->pNext = NULL; + here->pParam = pParam; + + Ldrn = here->BSIM3v0l; + Wdrn = here->BSIM3v0w; + + T0 = pow(Ldrn, model->BSIM3v0Lln); + T1 = pow(Wdrn, model->BSIM3v0Lwn); + tmp1 = model->BSIM3v0Ll / T0 + model->BSIM3v0Lw / T1 + + model->BSIM3v0Lwl / (T0 * T1); + pParam->BSIM3v0dl = model->BSIM3v0Lint + tmp1; + pParam->BSIM3v0dlc = model->BSIM3v0dlc + tmp1; + + T2 = pow(Ldrn, model->BSIM3v0Wln); + T3 = pow(Wdrn, model->BSIM3v0Wwn); + tmp2 = model->BSIM3v0Wl / T2 + model->BSIM3v0Ww / T3 + + model->BSIM3v0Wwl / (T2 * T3); + pParam->BSIM3v0dw = model->BSIM3v0Wint + tmp2; + pParam->BSIM3v0dwc = model->BSIM3v0dwc + tmp2; + + pParam->BSIM3v0leff = here->BSIM3v0l - 2.0 * pParam->BSIM3v0dl; + if (pParam->BSIM3v0leff <= 0.0) + { IFuid namarray[2]; + namarray[0] = model->BSIM3v0modName; + namarray[1] = here->BSIM3v0name; + (*(SPfrontEnd->IFerror))(ERR_FATAL, + "BSIM3v0: mosfet %s, model %s: Effective channel length <= 0", + namarray); + return(E_BADPARM); + } + + pParam->BSIM3v0weff = here->BSIM3v0w - 2.0 * pParam->BSIM3v0dw; + if (pParam->BSIM3v0weff <= 0.0) + { IFuid namarray[2]; + namarray[0] = model->BSIM3v0modName; + namarray[1] = here->BSIM3v0name; + (*(SPfrontEnd->IFerror))(ERR_FATAL, + "BSIM3v0: mosfet %s, model %s: Effective channel width <= 0", + namarray); + return(E_BADPARM); + } + + pParam->BSIM3v0leffCV = here->BSIM3v0l - 2.0 * pParam->BSIM3v0dlc; + if (pParam->BSIM3v0leffCV <= 0.0) + { IFuid namarray[2]; + namarray[0] = model->BSIM3v0modName; + namarray[1] = here->BSIM3v0name; + (*(SPfrontEnd->IFerror))(ERR_FATAL, + "BSIM3v0: mosfet %s, model %s: Effective channel length for C-V <= 0", + namarray); + return(E_BADPARM); + } + + pParam->BSIM3v0weffCV = here->BSIM3v0w - 2.0 * pParam->BSIM3v0dwc; + if (pParam->BSIM3v0weffCV <= 0.0) + { IFuid namarray[2]; + namarray[0] = model->BSIM3v0modName; + namarray[1] = here->BSIM3v0name; + (*(SPfrontEnd->IFerror))(ERR_FATAL, + "BSIM3v0: mosfet %s, model %s: Effective channel width for C-V <= 0", + namarray); + return(E_BADPARM); + } + + model->BSIM3v0vcrit = CONSTvt0 * log(CONSTvt0 + / (CONSTroot2 * 1.0e-14)); + model->BSIM3v0factor1 = sqrt(EPSSI / EPSOX * model->BSIM3v0tox); + + + if (model->BSIM3v0binUnit == 1) + { Inv_L = 1.0e-6 / pParam->BSIM3v0leff; + Inv_W = 1.0e-6 / pParam->BSIM3v0weff; + Inv_LW = 1.0e-12 / (pParam->BSIM3v0leff + * pParam->BSIM3v0weff); + } + else + { Inv_L = 1.0 / pParam->BSIM3v0leff; + Inv_W = 1.0 / pParam->BSIM3v0weff; + Inv_LW = 1.0 / (pParam->BSIM3v0leff + * pParam->BSIM3v0weff); + } + pParam->BSIM3v0cdsc = model->BSIM3v0cdsc + + model->BSIM3v0lcdsc * Inv_L + + model->BSIM3v0wcdsc * Inv_W + + model->BSIM3v0pcdsc * Inv_LW; + pParam->BSIM3v0cdscb = model->BSIM3v0cdscb + + model->BSIM3v0lcdscb * Inv_L + + model->BSIM3v0wcdscb * Inv_W + + model->BSIM3v0pcdscb * Inv_LW; + + pParam->BSIM3v0cdscd = model->BSIM3v0cdscd + + model->BSIM3v0lcdscd * Inv_L + + model->BSIM3v0wcdscd * Inv_W + + model->BSIM3v0pcdscd * Inv_LW; + + pParam->BSIM3v0cit = model->BSIM3v0cit + + model->BSIM3v0lcit * Inv_L + + model->BSIM3v0wcit * Inv_W + + model->BSIM3v0pcit * Inv_LW; + pParam->BSIM3v0nfactor = model->BSIM3v0nfactor + + model->BSIM3v0lnfactor * Inv_L + + model->BSIM3v0wnfactor * Inv_W + + model->BSIM3v0pnfactor * Inv_LW; + pParam->BSIM3v0xj = model->BSIM3v0xj + + model->BSIM3v0lxj * Inv_L + + model->BSIM3v0wxj * Inv_W + + model->BSIM3v0pxj * Inv_LW; + pParam->BSIM3v0vsat = model->BSIM3v0vsat + + model->BSIM3v0lvsat * Inv_L + + model->BSIM3v0wvsat * Inv_W + + model->BSIM3v0pvsat * Inv_LW; + pParam->BSIM3v0at = model->BSIM3v0at + + model->BSIM3v0lat * Inv_L + + model->BSIM3v0wat * Inv_W + + model->BSIM3v0pat * Inv_LW; + pParam->BSIM3v0a0 = model->BSIM3v0a0 + + model->BSIM3v0la0 * Inv_L + + model->BSIM3v0wa0 * Inv_W + + model->BSIM3v0pa0 * Inv_LW; + + pParam->BSIM3v0ags = model->BSIM3v0ags + + model->BSIM3v0lags * Inv_L + + model->BSIM3v0wags * Inv_W + + model->BSIM3v0pags * Inv_LW; + + pParam->BSIM3v0a1 = model->BSIM3v0a1 + + model->BSIM3v0la1 * Inv_L + + model->BSIM3v0wa1 * Inv_W + + model->BSIM3v0pa1 * Inv_LW; + pParam->BSIM3v0a2 = model->BSIM3v0a2 + + model->BSIM3v0la2 * Inv_L + + model->BSIM3v0wa2 * Inv_W + + model->BSIM3v0pa2 * Inv_LW; + pParam->BSIM3v0keta = model->BSIM3v0keta + + model->BSIM3v0lketa * Inv_L + + model->BSIM3v0wketa * Inv_W + + model->BSIM3v0pketa * Inv_LW; + pParam->BSIM3v0nsub = model->BSIM3v0nsub + + model->BSIM3v0lnsub * Inv_L + + model->BSIM3v0wnsub * Inv_W + + model->BSIM3v0pnsub * Inv_LW; + pParam->BSIM3v0npeak = model->BSIM3v0npeak + + model->BSIM3v0lnpeak * Inv_L + + model->BSIM3v0wnpeak * Inv_W + + model->BSIM3v0pnpeak * Inv_LW; + pParam->BSIM3v0ngate = model->BSIM3v0ngate + + model->BSIM3v0lngate * Inv_L + + model->BSIM3v0wngate * Inv_W + + model->BSIM3v0pngate * Inv_LW; + pParam->BSIM3v0gamma1 = model->BSIM3v0gamma1 + + model->BSIM3v0lgamma1 * Inv_L + + model->BSIM3v0wgamma1 * Inv_W + + model->BSIM3v0pgamma1 * Inv_LW; + pParam->BSIM3v0gamma2 = model->BSIM3v0gamma2 + + model->BSIM3v0lgamma2 * Inv_L + + model->BSIM3v0wgamma2 * Inv_W + + model->BSIM3v0pgamma2 * Inv_LW; + pParam->BSIM3v0vbx = model->BSIM3v0vbx + + model->BSIM3v0lvbx * Inv_L + + model->BSIM3v0wvbx * Inv_W + + model->BSIM3v0pvbx * Inv_LW; + pParam->BSIM3v0vbm = model->BSIM3v0vbm + + model->BSIM3v0lvbm * Inv_L + + model->BSIM3v0wvbm * Inv_W + + model->BSIM3v0pvbm * Inv_LW; + pParam->BSIM3v0xt = model->BSIM3v0xt + + model->BSIM3v0lxt * Inv_L + + model->BSIM3v0wxt * Inv_W + + model->BSIM3v0pxt * Inv_LW; + pParam->BSIM3v0k1 = model->BSIM3v0k1 + + model->BSIM3v0lk1 * Inv_L + + model->BSIM3v0wk1 * Inv_W + + model->BSIM3v0pk1 * Inv_LW; + pParam->BSIM3v0kt1 = model->BSIM3v0kt1 + + model->BSIM3v0lkt1 * Inv_L + + model->BSIM3v0wkt1 * Inv_W + + model->BSIM3v0pkt1 * Inv_LW; + pParam->BSIM3v0kt1l = model->BSIM3v0kt1l + + model->BSIM3v0lkt1l * Inv_L + + model->BSIM3v0wkt1l * Inv_W + + model->BSIM3v0pkt1l * Inv_LW; + pParam->BSIM3v0k2 = model->BSIM3v0k2 + + model->BSIM3v0lk2 * Inv_L + + model->BSIM3v0wk2 * Inv_W + + model->BSIM3v0pk2 * Inv_LW; + pParam->BSIM3v0kt2 = model->BSIM3v0kt2 + + model->BSIM3v0lkt2 * Inv_L + + model->BSIM3v0wkt2 * Inv_W + + model->BSIM3v0pkt2 * Inv_LW; + pParam->BSIM3v0k3 = model->BSIM3v0k3 + + model->BSIM3v0lk3 * Inv_L + + model->BSIM3v0wk3 * Inv_W + + model->BSIM3v0pk3 * Inv_LW; + pParam->BSIM3v0k3b = model->BSIM3v0k3b + + model->BSIM3v0lk3b * Inv_L + + model->BSIM3v0wk3b * Inv_W + + model->BSIM3v0pk3b * Inv_LW; + pParam->BSIM3v0w0 = model->BSIM3v0w0 + + model->BSIM3v0lw0 * Inv_L + + model->BSIM3v0ww0 * Inv_W + + model->BSIM3v0pw0 * Inv_LW; + pParam->BSIM3v0nlx = model->BSIM3v0nlx + + model->BSIM3v0lnlx * Inv_L + + model->BSIM3v0wnlx * Inv_W + + model->BSIM3v0pnlx * Inv_LW; + pParam->BSIM3v0dvt0 = model->BSIM3v0dvt0 + + model->BSIM3v0ldvt0 * Inv_L + + model->BSIM3v0wdvt0 * Inv_W + + model->BSIM3v0pdvt0 * Inv_LW; + pParam->BSIM3v0dvt1 = model->BSIM3v0dvt1 + + model->BSIM3v0ldvt1 * Inv_L + + model->BSIM3v0wdvt1 * Inv_W + + model->BSIM3v0pdvt1 * Inv_LW; + pParam->BSIM3v0dvt2 = model->BSIM3v0dvt2 + + model->BSIM3v0ldvt2 * Inv_L + + model->BSIM3v0wdvt2 * Inv_W + + model->BSIM3v0pdvt2 * Inv_LW; + pParam->BSIM3v0dvt0w = model->BSIM3v0dvt0w + + model->BSIM3v0ldvt0w * Inv_L + + model->BSIM3v0wdvt0w * Inv_W + + model->BSIM3v0pdvt0w * Inv_LW; + pParam->BSIM3v0dvt1w = model->BSIM3v0dvt1w + + model->BSIM3v0ldvt1w * Inv_L + + model->BSIM3v0wdvt1w * Inv_W + + model->BSIM3v0pdvt1w * Inv_LW; + pParam->BSIM3v0dvt2w = model->BSIM3v0dvt2w + + model->BSIM3v0ldvt2w * Inv_L + + model->BSIM3v0wdvt2w * Inv_W + + model->BSIM3v0pdvt2w * Inv_LW; + pParam->BSIM3v0drout = model->BSIM3v0drout + + model->BSIM3v0ldrout * Inv_L + + model->BSIM3v0wdrout * Inv_W + + model->BSIM3v0pdrout * Inv_LW; + pParam->BSIM3v0dsub = model->BSIM3v0dsub + + model->BSIM3v0ldsub * Inv_L + + model->BSIM3v0wdsub * Inv_W + + model->BSIM3v0pdsub * Inv_LW; + pParam->BSIM3v0vth0 = model->BSIM3v0vth0 + + model->BSIM3v0lvth0 * Inv_L + + model->BSIM3v0wvth0 * Inv_W + + model->BSIM3v0pvth0 * Inv_LW; + pParam->BSIM3v0ua = model->BSIM3v0ua + + model->BSIM3v0lua * Inv_L + + model->BSIM3v0wua * Inv_W + + model->BSIM3v0pua * Inv_LW; + pParam->BSIM3v0ua1 = model->BSIM3v0ua1 + + model->BSIM3v0lua1 * Inv_L + + model->BSIM3v0wua1 * Inv_W + + model->BSIM3v0pua1 * Inv_LW; + pParam->BSIM3v0ub = model->BSIM3v0ub + + model->BSIM3v0lub * Inv_L + + model->BSIM3v0wub * Inv_W + + model->BSIM3v0pub * Inv_LW; + pParam->BSIM3v0ub1 = model->BSIM3v0ub1 + + model->BSIM3v0lub1 * Inv_L + + model->BSIM3v0wub1 * Inv_W + + model->BSIM3v0pub1 * Inv_LW; + pParam->BSIM3v0uc = model->BSIM3v0uc + + model->BSIM3v0luc * Inv_L + + model->BSIM3v0wuc * Inv_W + + model->BSIM3v0puc * Inv_LW; + pParam->BSIM3v0uc1 = model->BSIM3v0uc1 + + model->BSIM3v0luc1 * Inv_L + + model->BSIM3v0wuc1 * Inv_W + + model->BSIM3v0puc1 * Inv_LW; + pParam->BSIM3v0u0 = model->BSIM3v0u0 + + model->BSIM3v0lu0 * Inv_L + + model->BSIM3v0wu0 * Inv_W + + model->BSIM3v0pu0 * Inv_LW; + pParam->BSIM3v0ute = model->BSIM3v0ute + + model->BSIM3v0lute * Inv_L + + model->BSIM3v0wute * Inv_W + + model->BSIM3v0pute * Inv_LW; + pParam->BSIM3v0voff = model->BSIM3v0voff + + model->BSIM3v0lvoff * Inv_L + + model->BSIM3v0wvoff * Inv_W + + model->BSIM3v0pvoff * Inv_LW; + pParam->BSIM3v0delta = model->BSIM3v0delta + + model->BSIM3v0ldelta * Inv_L + + model->BSIM3v0wdelta * Inv_W + + model->BSIM3v0pdelta * Inv_LW; + pParam->BSIM3v0rdsw = model->BSIM3v0rdsw + + model->BSIM3v0lrdsw * Inv_L + + model->BSIM3v0wrdsw * Inv_W + + model->BSIM3v0prdsw * Inv_LW; + pParam->BSIM3v0prwg = model->BSIM3v0prwg + + model->BSIM3v0lprwg * Inv_L + + model->BSIM3v0wprwg * Inv_W + + model->BSIM3v0pprwg * Inv_LW; + pParam->BSIM3v0prwb = model->BSIM3v0prwb + + model->BSIM3v0lprwb * Inv_L + + model->BSIM3v0wprwb * Inv_W + + model->BSIM3v0pprwb * Inv_LW; + pParam->BSIM3v0prt = model->BSIM3v0prt + + model->BSIM3v0lprt * Inv_L + + model->BSIM3v0wprt * Inv_W + + model->BSIM3v0pprt * Inv_LW; + pParam->BSIM3v0eta0 = model->BSIM3v0eta0 + + model->BSIM3v0leta0 * Inv_L + + model->BSIM3v0weta0 * Inv_W + + model->BSIM3v0peta0 * Inv_LW; + pParam->BSIM3v0etab = model->BSIM3v0etab + + model->BSIM3v0letab * Inv_L + + model->BSIM3v0wetab * Inv_W + + model->BSIM3v0petab * Inv_LW; + pParam->BSIM3v0pclm = model->BSIM3v0pclm + + model->BSIM3v0lpclm * Inv_L + + model->BSIM3v0wpclm * Inv_W + + model->BSIM3v0ppclm * Inv_LW; + pParam->BSIM3v0pdibl1 = model->BSIM3v0pdibl1 + + model->BSIM3v0lpdibl1 * Inv_L + + model->BSIM3v0wpdibl1 * Inv_W + + model->BSIM3v0ppdibl1 * Inv_LW; + pParam->BSIM3v0pdibl2 = model->BSIM3v0pdibl2 + + model->BSIM3v0lpdibl2 * Inv_L + + model->BSIM3v0wpdibl2 * Inv_W + + model->BSIM3v0ppdibl2 * Inv_LW; + pParam->BSIM3v0pdiblb = model->BSIM3v0pdiblb + + model->BSIM3v0lpdiblb * Inv_L + + model->BSIM3v0wpdiblb * Inv_W + + model->BSIM3v0ppdiblb * Inv_LW; + pParam->BSIM3v0pscbe1 = model->BSIM3v0pscbe1 + + model->BSIM3v0lpscbe1 * Inv_L + + model->BSIM3v0wpscbe1 * Inv_W + + model->BSIM3v0ppscbe1 * Inv_LW; + pParam->BSIM3v0pscbe2 = model->BSIM3v0pscbe2 + + model->BSIM3v0lpscbe2 * Inv_L + + model->BSIM3v0wpscbe2 * Inv_W + + model->BSIM3v0ppscbe2 * Inv_LW; + pParam->BSIM3v0pvag = model->BSIM3v0pvag + + model->BSIM3v0lpvag * Inv_L + + model->BSIM3v0wpvag * Inv_W + + model->BSIM3v0ppvag * Inv_LW; + pParam->BSIM3v0wr = model->BSIM3v0wr + + model->BSIM3v0lwr * Inv_L + + model->BSIM3v0wwr * Inv_W + + model->BSIM3v0pwr * Inv_LW; + pParam->BSIM3v0dwg = model->BSIM3v0dwg + + model->BSIM3v0ldwg * Inv_L + + model->BSIM3v0wdwg * Inv_W + + model->BSIM3v0pdwg * Inv_LW; + pParam->BSIM3v0dwb = model->BSIM3v0dwb + + model->BSIM3v0ldwb * Inv_L + + model->BSIM3v0wdwb * Inv_W + + model->BSIM3v0pdwb * Inv_LW; + pParam->BSIM3v0b0 = model->BSIM3v0b0 + + model->BSIM3v0lb0 * Inv_L + + model->BSIM3v0wb0 * Inv_W + + model->BSIM3v0pb0 * Inv_LW; + pParam->BSIM3v0b1 = model->BSIM3v0b1 + + model->BSIM3v0lb1 * Inv_L + + model->BSIM3v0wb1 * Inv_W + + model->BSIM3v0pb1 * Inv_LW; + pParam->BSIM3v0alpha0 = model->BSIM3v0alpha0 + + model->BSIM3v0lalpha0 * Inv_L + + model->BSIM3v0walpha0 * Inv_W + + model->BSIM3v0palpha0 * Inv_LW; + pParam->BSIM3v0beta0 = model->BSIM3v0beta0 + + model->BSIM3v0lbeta0 * Inv_L + + model->BSIM3v0wbeta0 * Inv_W + + model->BSIM3v0pbeta0 * Inv_LW; + /* CV model */ + pParam->BSIM3v0elm = model->BSIM3v0elm + + model->BSIM3v0lelm * Inv_L + + model->BSIM3v0welm * Inv_W + + model->BSIM3v0pelm * Inv_LW; + pParam->BSIM3v0cgsl = model->BSIM3v0cgsl + + model->BSIM3v0lcgsl * Inv_L + + model->BSIM3v0wcgsl * Inv_W + + model->BSIM3v0pcgsl * Inv_LW; + pParam->BSIM3v0cgdl = model->BSIM3v0cgdl + + model->BSIM3v0lcgdl * Inv_L + + model->BSIM3v0wcgdl * Inv_W + + model->BSIM3v0pcgdl * Inv_LW; + pParam->BSIM3v0ckappa = model->BSIM3v0ckappa + + model->BSIM3v0lckappa * Inv_L + + model->BSIM3v0wckappa * Inv_W + + model->BSIM3v0pckappa * Inv_LW; + pParam->BSIM3v0cf = model->BSIM3v0cf + + model->BSIM3v0lcf * Inv_L + + model->BSIM3v0wcf * Inv_W + + model->BSIM3v0pcf * Inv_LW; + pParam->BSIM3v0clc = model->BSIM3v0clc + + model->BSIM3v0lclc * Inv_L + + model->BSIM3v0wclc * Inv_W + + model->BSIM3v0pclc * Inv_LW; + pParam->BSIM3v0cle = model->BSIM3v0cle + + model->BSIM3v0lcle * Inv_L + + model->BSIM3v0wcle * Inv_W + + model->BSIM3v0pcle * Inv_LW; + pParam->BSIM3v0abulkCVfactor = 1.0 + pow((pParam->BSIM3v0clc + / pParam->BSIM3v0leff), + pParam->BSIM3v0cle); + + pParam->BSIM3v0cgdo = (model->BSIM3v0cgdo + pParam->BSIM3v0cf) + * pParam->BSIM3v0weffCV; + pParam->BSIM3v0cgso = (model->BSIM3v0cgso + pParam->BSIM3v0cf) + * pParam->BSIM3v0weffCV; + pParam->BSIM3v0cgbo = model->BSIM3v0cgbo * pParam->BSIM3v0leffCV; + + T0 = (TRatio - 1.0); + pParam->BSIM3v0ua = pParam->BSIM3v0ua + pParam->BSIM3v0ua1 * T0; + pParam->BSIM3v0ub = pParam->BSIM3v0ub + pParam->BSIM3v0ub1 * T0; + pParam->BSIM3v0uc = pParam->BSIM3v0uc + pParam->BSIM3v0uc1 * T0; + + pParam->BSIM3v0u0temp = pParam->BSIM3v0u0 + * pow(TRatio, pParam->BSIM3v0ute); + pParam->BSIM3v0vsattemp = pParam->BSIM3v0vsat - pParam->BSIM3v0at + * T0; + pParam->BSIM3v0rds0 = (pParam->BSIM3v0rdsw + pParam->BSIM3v0prt * T0) + / pow(pParam->BSIM3v0weff * 1E6, pParam->BSIM3v0wr); + + if (!model->BSIM3v0npeakGiven && model->BSIM3v0gamma1Given) + { T0 = pParam->BSIM3v0gamma1 * model->BSIM3v0cox; + pParam->BSIM3v0npeak = 3.021E22 * T0 * T0; + } + + Vtm0 = KboQ * Tnom; + Eg = 1.16 - 7.02e-4 * Tnom * Tnom / (Tnom + 1108.0); + ni = 1.45e10 * (Tnom / 300.15) * sqrt(Tnom / 300.15) + * exp(21.5565981 - Eg / (2.0 * Vtm0)); + + pParam->BSIM3v0phi = 2.0 * Vtm0 + * log(pParam->BSIM3v0npeak / ni); + + pParam->BSIM3v0sqrtPhi = sqrt(pParam->BSIM3v0phi); + pParam->BSIM3v0phis3 = pParam->BSIM3v0sqrtPhi * pParam->BSIM3v0phi; + + pParam->BSIM3v0Xdep0 = sqrt(2.0 * EPSSI / (Charge_q + * pParam->BSIM3v0npeak * 1.0e6)) + * pParam->BSIM3v0sqrtPhi; + pParam->BSIM3v0sqrtXdep0 = sqrt(pParam->BSIM3v0Xdep0); + pParam->BSIM3v0litl = sqrt(3.0 * pParam->BSIM3v0xj + * model->BSIM3v0tox); + pParam->BSIM3v0vbi = Vtm0 * log(1.0e20 + * pParam->BSIM3v0npeak / (ni * ni)); + pParam->BSIM3v0cdep0 = sqrt(Charge_q * EPSSI + * pParam->BSIM3v0npeak * 1.0e6 / 2.0 + / pParam->BSIM3v0phi); + + if (model->BSIM3v0k1Given || model->BSIM3v0k2Given) + { if (!model->BSIM3v0k1Given) + { fprintf(stdout, "Warning: k1 should be specified with k2.\n"); + pParam->BSIM3v0k1 = 0.53; + } + if (!model->BSIM3v0k2Given) + { fprintf(stdout, "Warning: k2 should be specified with k1.\n"); + pParam->BSIM3v0k2 = -0.0186; + } + if (model->BSIM3v0nsubGiven) + fprintf(stdout, "Warning: nsub is ignored because k1 or k2 is given.\n"); + if (model->BSIM3v0xtGiven) + fprintf(stdout, "Warning: xt is ignored because k1 or k2 is given.\n"); + if (model->BSIM3v0vbxGiven) + fprintf(stdout, "Warning: vbx is ignored because k1 or k2 is given.\n"); + if (model->BSIM3v0vbmGiven) + fprintf(stdout, "Warning: vbm is ignored because k1 or k2 is given.\n"); + if (model->BSIM3v0gamma1Given) + fprintf(stdout, "Warning: gamma1 is ignored because k1 or k2 is given.\n"); + if (model->BSIM3v0gamma2Given) + fprintf(stdout, "Warning: gamma2 is ignored because k1 or k2 is given.\n"); + } + else + { if (!model->BSIM3v0vbxGiven) + pParam->BSIM3v0vbx = pParam->BSIM3v0phi - 7.7348e-4 + * pParam->BSIM3v0npeak + * pParam->BSIM3v0xt * pParam->BSIM3v0xt; + if (pParam->BSIM3v0vbx > 0.0) + pParam->BSIM3v0vbx = -pParam->BSIM3v0vbx; + if (pParam->BSIM3v0vbm > 0.0) + pParam->BSIM3v0vbm = -pParam->BSIM3v0vbm; + + if (!model->BSIM3v0gamma1Given) + pParam->BSIM3v0gamma1 = 5.753e-12 + * sqrt(pParam->BSIM3v0npeak) + / model->BSIM3v0cox; + if (!model->BSIM3v0gamma2Given) + pParam->BSIM3v0gamma2 = 5.753e-12 + * sqrt(pParam->BSIM3v0nsub) + / model->BSIM3v0cox; + + T0 = pParam->BSIM3v0gamma1 - pParam->BSIM3v0gamma2; + T1 = sqrt(pParam->BSIM3v0phi - pParam->BSIM3v0vbx) + - pParam->BSIM3v0sqrtPhi; + T2 = sqrt(pParam->BSIM3v0phi * (pParam->BSIM3v0phi + - pParam->BSIM3v0vbm)) - pParam->BSIM3v0phi; + pParam->BSIM3v0k2 = T0 * T1 / (2.0 * T2 + pParam->BSIM3v0vbm); + pParam->BSIM3v0k1 = pParam->BSIM3v0gamma2 - 2.0 + * pParam->BSIM3v0k2 * sqrt(pParam->BSIM3v0phi + - pParam->BSIM3v0vbm); + } + + if (pParam->BSIM3v0k2 > 0.0) + { T0 = 0.5 * pParam->BSIM3v0k1 / pParam->BSIM3v0k2; + pParam->BSIM3v0vbsc = 0.9 * (pParam->BSIM3v0phi - T0 * T0); + if (pParam->BSIM3v0vbsc > -3.0) + pParam->BSIM3v0vbsc = -3.0; + else if (pParam->BSIM3v0vbsc < -30.0) + pParam->BSIM3v0vbsc = -30.0; + } + else + { pParam->BSIM3v0vbsc = -10.0; + } + + model->BSIM3v0vtm = KboQ * Temp; + + if (model->BSIM3v0vth0Given) + pParam->BSIM3v0vfb = model->BSIM3v0type * pParam->BSIM3v0vth0 + - pParam->BSIM3v0phi - pParam->BSIM3v0k1 + * pParam->BSIM3v0sqrtPhi; + else + pParam->BSIM3v0vth0 = model->BSIM3v0type * (-1.0 + + pParam->BSIM3v0phi + pParam->BSIM3v0k1 + * pParam->BSIM3v0sqrtPhi); + + T1 = sqrt(EPSSI / EPSOX * model->BSIM3v0tox + * pParam->BSIM3v0Xdep0); + T0 = exp(-0.5 * pParam->BSIM3v0dsub * pParam->BSIM3v0leff / T1); + pParam->BSIM3v0theta0vb0 = (T0 + 2.0 * T0 * T0); + + T0 = exp(-0.5 * pParam->BSIM3v0drout * pParam->BSIM3v0leff / T1); + T2 = (T0 + 2.0 * T0 * T0); + pParam->BSIM3v0thetaRout = pParam->BSIM3v0pdibl1 * T2 + + pParam->BSIM3v0pdibl2; + + /* process source/drain series resistance */ + here->BSIM3v0drainConductance = model->BSIM3v0sheetResistance + * here->BSIM3v0drainSquares; + if (here->BSIM3v0drainConductance > 0.0) + here->BSIM3v0drainConductance = 1.0 + / here->BSIM3v0drainConductance; + else + here->BSIM3v0drainConductance = 0.0; + + here->BSIM3v0sourceConductance = model->BSIM3v0sheetResistance + * here->BSIM3v0sourceSquares; + if (here->BSIM3v0sourceConductance > 0.0) + here->BSIM3v0sourceConductance = 1.0 + / here->BSIM3v0sourceConductance; + else + here->BSIM3v0sourceConductance = 0.0; + } + here->BSIM3v0cgso = pParam->BSIM3v0cgso; + here->BSIM3v0cgdo = pParam->BSIM3v0cgdo; + } + } + return(OK); +} + + + + diff --git a/src/spicelib/devices/bsim3v0/b3v0trunc.c b/src/spicelib/devices/bsim3v0/b3v0trunc.c new file mode 100644 index 000000000..4bb469685 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/b3v0trunc.c @@ -0,0 +1,50 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan. +File: b3v0trunc.c +**********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim3v0def.h" +#include "sperror.h" +#include "suffix.h" + + +int +BSIM3v0trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) +{ +BSIM3v0model *model = (BSIM3v0model*)inModel; +BSIM3v0instance *here; + +#ifdef STEPDEBUG + double debugtemp; +#endif /* STEPDEBUG */ + + for (; model != NULL; model = model->BSIM3v0nextModel) + { for (here = model->BSIM3v0instances; here != NULL; + here = here->BSIM3v0nextInstance) + { + + if (here->BSIM3v0owner != ARCHme) + continue; + +#ifdef STEPDEBUG + debugtemp = *timeStep; +#endif /* STEPDEBUG */ + CKTterr(here->BSIM3v0qb,ckt,timeStep); + CKTterr(here->BSIM3v0qg,ckt,timeStep); + CKTterr(here->BSIM3v0qd,ckt,timeStep); +#ifdef STEPDEBUG + if(debugtemp != *timeStep) + { printf("device %s reduces step from %g to %g\n", + here->BSIM3v0name,debugtemp,*timeStep); + } +#endif /* STEPDEBUG */ + } + } + return(OK); +} + + + diff --git a/src/spicelib/devices/bsim3v0/bsim3v0def.h b/src/spicelib/devices/bsim3v0/bsim3v0def.h new file mode 100644 index 000000000..5e694d6f6 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/bsim3v0def.h @@ -0,0 +1,1580 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1995 Min-Chie Jeng and Mansun Chan +File: bsim3v0def.h +**********/ + +#ifndef BSIM3v0 +#define BSIM3v0 + +#include "ifsim.h" +#include "gendefs.h" +#include "cktdefs.h" +#include "complex.h" +#include "noisedef.h" + +typedef struct sBSIM3v0instance +{ + struct sBSIM3v0model *BSIM3v0modPtr; + struct sBSIM3v0instance *BSIM3v0nextInstance; + IFuid BSIM3v0name; + int BSIM3v0owner; /* number of owner process */ + int BSIM3v0states; /* index into state table for this device */ + + int BSIM3v0dNode; + int BSIM3v0gNode; + int BSIM3v0sNode; + int BSIM3v0bNode; + int BSIM3v0dNodePrime; + int BSIM3v0sNodePrime; + int BSIM3v0qNode; /* MCJ */ + + /* MCJ */ + double BSIM3v0ueff; + double BSIM3v0thetavth; + double BSIM3v0von; + double BSIM3v0vdsat; + double BSIM3v0cgdo; + double BSIM3v0cgso; + + double BSIM3v0l; + double BSIM3v0w; + double BSIM3v0m; + double BSIM3v0drainArea; + double BSIM3v0sourceArea; + double BSIM3v0drainSquares; + double BSIM3v0sourceSquares; + double BSIM3v0drainPerimeter; + double BSIM3v0sourcePerimeter; + double BSIM3v0sourceConductance; + double BSIM3v0drainConductance; + + double BSIM3v0icVBS; + double BSIM3v0icVDS; + double BSIM3v0icVGS; + int BSIM3v0off; + int BSIM3v0mode; + int BSIM3v0nqsMod; + + /* OP point */ + double BSIM3v0qinv; + double BSIM3v0cd; + double BSIM3v0cbs; + double BSIM3v0cbd; + double BSIM3v0csub; + double BSIM3v0gm; + double BSIM3v0gds; + double BSIM3v0gmbs; + double BSIM3v0gbd; + double BSIM3v0gbs; + + double BSIM3v0gbbs; + double BSIM3v0gbgs; + double BSIM3v0gbds; + + double BSIM3v0cggb; + double BSIM3v0cgdb; + double BSIM3v0cgsb; + double BSIM3v0cbgb; + double BSIM3v0cbdb; + double BSIM3v0cbsb; + double BSIM3v0cdgb; + double BSIM3v0cddb; + double BSIM3v0cdsb; + double BSIM3v0capbd; + double BSIM3v0capbs; + + double BSIM3v0cqgb; + double BSIM3v0cqdb; + double BSIM3v0cqsb; + double BSIM3v0cqbb; + + double BSIM3v0gtau; + double BSIM3v0gtg; + double BSIM3v0gtd; + double BSIM3v0gts; + double BSIM3v0gtb; + double BSIM3v0tconst; + + struct bsim3v0SizeDependParam *pParam; + + unsigned BSIM3v0lGiven :1; + unsigned BSIM3v0wGiven :1; + unsigned BSIM3v0mGiven :1; + unsigned BSIM3v0drainAreaGiven :1; + unsigned BSIM3v0sourceAreaGiven :1; + unsigned BSIM3v0drainSquaresGiven :1; + unsigned BSIM3v0sourceSquaresGiven :1; + unsigned BSIM3v0drainPerimeterGiven :1; + unsigned BSIM3v0sourcePerimeterGiven :1; + unsigned BSIM3v0dNodePrimeSet :1; + unsigned BSIM3v0sNodePrimeSet :1; + unsigned BSIM3v0icVBSGiven :1; + unsigned BSIM3v0icVDSGiven :1; + unsigned BSIM3v0icVGSGiven :1; + unsigned BSIM3v0nqsModGiven :1; + + double *BSIM3v0DdPtr; + double *BSIM3v0GgPtr; + double *BSIM3v0SsPtr; + double *BSIM3v0BbPtr; + double *BSIM3v0DPdpPtr; + double *BSIM3v0SPspPtr; + double *BSIM3v0DdpPtr; + double *BSIM3v0GbPtr; + double *BSIM3v0GdpPtr; + double *BSIM3v0GspPtr; + double *BSIM3v0SspPtr; + double *BSIM3v0BdpPtr; + double *BSIM3v0BspPtr; + double *BSIM3v0DPspPtr; + double *BSIM3v0DPdPtr; + double *BSIM3v0BgPtr; + double *BSIM3v0DPgPtr; + double *BSIM3v0SPgPtr; + double *BSIM3v0SPsPtr; + double *BSIM3v0DPbPtr; + double *BSIM3v0SPbPtr; + double *BSIM3v0SPdpPtr; + + double *BSIM3v0QqPtr; + double *BSIM3v0QdpPtr; + double *BSIM3v0QgPtr; + double *BSIM3v0QspPtr; + double *BSIM3v0QbPtr; + double *BSIM3v0DPqPtr; + double *BSIM3v0GqPtr; + double *BSIM3v0SPqPtr; + double *BSIM3v0BqPtr; + +#define BSIM3v0vbd BSIM3v0states+ 0 +#define BSIM3v0vbs BSIM3v0states+ 1 +#define BSIM3v0vgs BSIM3v0states+ 2 +#define BSIM3v0vds BSIM3v0states+ 3 + +#define BSIM3v0qb BSIM3v0states+ 4 +#define BSIM3v0cqb BSIM3v0states+ 5 +#define BSIM3v0qg BSIM3v0states+ 6 +#define BSIM3v0cqg BSIM3v0states+ 7 +#define BSIM3v0qd BSIM3v0states+ 8 +#define BSIM3v0cqd BSIM3v0states+ 9 + +#define BSIM3v0qbs BSIM3v0states+ 10 +#define BSIM3v0qbd BSIM3v0states+ 11 + +#define BSIM3v0qcheq BSIM3v0states+ 12 +#define BSIM3v0cqcheq BSIM3v0states+ 13 +#define BSIM3v0qcdump BSIM3v0states+ 14 +#define BSIM3v0cqcdump BSIM3v0states+ 15 + +#define BSIM3v0tau BSIM3v0states+ 16 +#define BSIM3v0qdef BSIM3v0states+ 17 + +#define BSIM3v0numStates 18 + + +/* indices to the array of BSIM3v0 NOISE SOURCES */ + +#define BSIM3v0RDNOIZ 0 +#define BSIM3v0RSNOIZ 1 +#define BSIM3v0IDNOIZ 2 +#define BSIM3v0FLNOIZ 3 +#define BSIM3v0TOTNOIZ 4 + +#define BSIM3v0NSRCS 5 /* the number of MOSFET(3) noise sources */ + +#ifndef NONOISE + double BSIM3v0nVar[NSTATVARS][BSIM3v0NSRCS]; +#else /* NONOISE */ + double **BSIM3v0nVar; +#endif /* NONOISE */ + +} BSIM3v0instance ; + +struct bsim3v0SizeDependParam +{ + double Width; + double Length; + + double BSIM3v0cdsc; + double BSIM3v0cdscb; + double BSIM3v0cdscd; + double BSIM3v0cit; + double BSIM3v0nfactor; + double BSIM3v0xj; + double BSIM3v0vsat; + double BSIM3v0at; + double BSIM3v0a0; + double BSIM3v0ags; + double BSIM3v0a1; + double BSIM3v0a2; + double BSIM3v0keta; + double BSIM3v0nsub; + double BSIM3v0npeak; + double BSIM3v0ngate; + double BSIM3v0gamma1; + double BSIM3v0gamma2; + double BSIM3v0vbx; + double BSIM3v0vbi; + double BSIM3v0vbm; + double BSIM3v0vbsc; + double BSIM3v0xt; + double BSIM3v0phi; + double BSIM3v0litl; + double BSIM3v0k1; + double BSIM3v0kt1; + double BSIM3v0kt1l; + double BSIM3v0kt2; + double BSIM3v0k2; + double BSIM3v0k3; + double BSIM3v0k3b; + double BSIM3v0w0; + double BSIM3v0nlx; + double BSIM3v0dvt0; + double BSIM3v0dvt1; + double BSIM3v0dvt2; + double BSIM3v0dvt0w; + double BSIM3v0dvt1w; + double BSIM3v0dvt2w; + double BSIM3v0drout; + double BSIM3v0dsub; + double BSIM3v0vth0; + double BSIM3v0ua; + double BSIM3v0ua1; + double BSIM3v0ub; + double BSIM3v0ub1; + double BSIM3v0uc; + double BSIM3v0uc1; + double BSIM3v0u0; + double BSIM3v0ute; + double BSIM3v0voff; + double BSIM3v0vfb; + double BSIM3v0delta; + double BSIM3v0rdsw; + double BSIM3v0rds0; + double BSIM3v0prwg; + double BSIM3v0prwb; + double BSIM3v0prt; + double BSIM3v0eta0; + double BSIM3v0etab; + double BSIM3v0pclm; + double BSIM3v0pdibl1; + double BSIM3v0pdibl2; + double BSIM3v0pdiblb; + double BSIM3v0pscbe1; + double BSIM3v0pscbe2; + double BSIM3v0pvag; + double BSIM3v0wr; + double BSIM3v0dwg; + double BSIM3v0dwb; + double BSIM3v0b0; + double BSIM3v0b1; + double BSIM3v0alpha0; + double BSIM3v0beta0; + + + /* CV model */ + double BSIM3v0elm; + double BSIM3v0cgsl; + double BSIM3v0cgdl; + double BSIM3v0ckappa; + double BSIM3v0cf; + double BSIM3v0clc; + double BSIM3v0cle; + + +/* Pre-calculated constants */ + + double BSIM3v0dw; + double BSIM3v0dl; + double BSIM3v0leff; + double BSIM3v0weff; + + double BSIM3v0dwc; + double BSIM3v0dlc; + double BSIM3v0leffCV; + double BSIM3v0weffCV; + double BSIM3v0abulkCVfactor; + double BSIM3v0cgso; + double BSIM3v0cgdo; + double BSIM3v0cgbo; + + double BSIM3v0u0temp; + double BSIM3v0vsattemp; + double BSIM3v0sqrtPhi; + double BSIM3v0phis3; + double BSIM3v0Xdep0; + double BSIM3v0sqrtXdep0; + double BSIM3v0theta0vb0; + double BSIM3v0thetaRout; + + double BSIM3v0cof1; + double BSIM3v0cof2; + double BSIM3v0cof3; + double BSIM3v0cof4; + double BSIM3v0cdep0; + struct bsim3v0SizeDependParam *pNext; +}; + + +typedef struct sBSIM3v0model +{ + int BSIM3v0modType; + struct sBSIM3v0model *BSIM3v0nextModel; + BSIM3v0instance *BSIM3v0instances; + IFuid BSIM3v0modName; + int BSIM3v0type; + + int BSIM3v0mobMod; + int BSIM3v0capMod; + int BSIM3v0nqsMod; + int BSIM3v0noiMod; + int BSIM3v0binUnit; + double BSIM3v0tox; + double BSIM3v0cdsc; + double BSIM3v0cdscb; + double BSIM3v0cdscd; + double BSIM3v0cit; + double BSIM3v0nfactor; + double BSIM3v0xj; + double BSIM3v0vsat; + double BSIM3v0at; + double BSIM3v0a0; + double BSIM3v0ags; + double BSIM3v0a1; + double BSIM3v0a2; + double BSIM3v0keta; + double BSIM3v0nsub; + double BSIM3v0npeak; + double BSIM3v0ngate; + double BSIM3v0gamma1; + double BSIM3v0gamma2; + double BSIM3v0vbx; + double BSIM3v0vbm; + double BSIM3v0xt; + double BSIM3v0k1; + double BSIM3v0kt1; + double BSIM3v0kt1l; + double BSIM3v0kt2; + double BSIM3v0k2; + double BSIM3v0k3; + double BSIM3v0k3b; + double BSIM3v0w0; + double BSIM3v0nlx; + double BSIM3v0dvt0; + double BSIM3v0dvt1; + double BSIM3v0dvt2; + double BSIM3v0dvt0w; + double BSIM3v0dvt1w; + double BSIM3v0dvt2w; + double BSIM3v0drout; + double BSIM3v0dsub; + double BSIM3v0vth0; + double BSIM3v0ua; + double BSIM3v0ua1; + double BSIM3v0ub; + double BSIM3v0ub1; + double BSIM3v0uc; + double BSIM3v0uc1; + double BSIM3v0u0; + double BSIM3v0ute; + double BSIM3v0voff; + double BSIM3v0delta; + double BSIM3v0rdsw; + double BSIM3v0prwg; + double BSIM3v0prwb; + double BSIM3v0prt; + double BSIM3v0eta0; + double BSIM3v0etab; + double BSIM3v0pclm; + double BSIM3v0pdibl1; + double BSIM3v0pdibl2; + double BSIM3v0pdiblb; + double BSIM3v0pscbe1; + double BSIM3v0pscbe2; + double BSIM3v0pvag; + double BSIM3v0wr; + double BSIM3v0dwg; + double BSIM3v0dwb; + double BSIM3v0b0; + double BSIM3v0b1; + double BSIM3v0alpha0; + double BSIM3v0beta0; + + /* CV model */ + double BSIM3v0elm; + double BSIM3v0cgsl; + double BSIM3v0cgdl; + double BSIM3v0ckappa; + double BSIM3v0cf; + double BSIM3v0clc; + double BSIM3v0cle; + double BSIM3v0dwc; + double BSIM3v0dlc; + + /* Length Dependence */ + double BSIM3v0lcdsc; + double BSIM3v0lcdscb; + double BSIM3v0lcdscd; + double BSIM3v0lcit; + double BSIM3v0lnfactor; + double BSIM3v0lxj; + double BSIM3v0lvsat; + double BSIM3v0lat; + double BSIM3v0la0; + double BSIM3v0lags; + double BSIM3v0la1; + double BSIM3v0la2; + double BSIM3v0lketa; + double BSIM3v0lnsub; + double BSIM3v0lnpeak; + double BSIM3v0lngate; + double BSIM3v0lgamma1; + double BSIM3v0lgamma2; + double BSIM3v0lvbx; + double BSIM3v0lvbm; + double BSIM3v0lxt; + double BSIM3v0lk1; + double BSIM3v0lkt1; + double BSIM3v0lkt1l; + double BSIM3v0lkt2; + double BSIM3v0lk2; + double BSIM3v0lk3; + double BSIM3v0lk3b; + double BSIM3v0lw0; + double BSIM3v0lnlx; + double BSIM3v0ldvt0; + double BSIM3v0ldvt1; + double BSIM3v0ldvt2; + double BSIM3v0ldvt0w; + double BSIM3v0ldvt1w; + double BSIM3v0ldvt2w; + double BSIM3v0ldrout; + double BSIM3v0ldsub; + double BSIM3v0lvth0; + double BSIM3v0lua; + double BSIM3v0lua1; + double BSIM3v0lub; + double BSIM3v0lub1; + double BSIM3v0luc; + double BSIM3v0luc1; + double BSIM3v0lu0; + double BSIM3v0lute; + double BSIM3v0lvoff; + double BSIM3v0ldelta; + double BSIM3v0lrdsw; + double BSIM3v0lprwg; + double BSIM3v0lprwb; + double BSIM3v0lprt; + double BSIM3v0leta0; + double BSIM3v0letab; + double BSIM3v0lpclm; + double BSIM3v0lpdibl1; + double BSIM3v0lpdibl2; + double BSIM3v0lpdiblb; + double BSIM3v0lpscbe1; + double BSIM3v0lpscbe2; + double BSIM3v0lpvag; + double BSIM3v0lwr; + double BSIM3v0ldwg; + double BSIM3v0ldwb; + double BSIM3v0lb0; + double BSIM3v0lb1; + double BSIM3v0lalpha0; + double BSIM3v0lbeta0; + + /* CV model */ + double BSIM3v0lelm; + double BSIM3v0lcgsl; + double BSIM3v0lcgdl; + double BSIM3v0lckappa; + double BSIM3v0lcf; + double BSIM3v0lclc; + double BSIM3v0lcle; + + /* Width Dependence */ + double BSIM3v0wcdsc; + double BSIM3v0wcdscb; + double BSIM3v0wcdscd; + double BSIM3v0wcit; + double BSIM3v0wnfactor; + double BSIM3v0wxj; + double BSIM3v0wvsat; + double BSIM3v0wat; + double BSIM3v0wa0; + double BSIM3v0wags; + double BSIM3v0wa1; + double BSIM3v0wa2; + double BSIM3v0wketa; + double BSIM3v0wnsub; + double BSIM3v0wnpeak; + double BSIM3v0wngate; + double BSIM3v0wgamma1; + double BSIM3v0wgamma2; + double BSIM3v0wvbx; + double BSIM3v0wvbm; + double BSIM3v0wxt; + double BSIM3v0wk1; + double BSIM3v0wkt1; + double BSIM3v0wkt1l; + double BSIM3v0wkt2; + double BSIM3v0wk2; + double BSIM3v0wk3; + double BSIM3v0wk3b; + double BSIM3v0ww0; + double BSIM3v0wnlx; + double BSIM3v0wdvt0; + double BSIM3v0wdvt1; + double BSIM3v0wdvt2; + double BSIM3v0wdvt0w; + double BSIM3v0wdvt1w; + double BSIM3v0wdvt2w; + double BSIM3v0wdrout; + double BSIM3v0wdsub; + double BSIM3v0wvth0; + double BSIM3v0wua; + double BSIM3v0wua1; + double BSIM3v0wub; + double BSIM3v0wub1; + double BSIM3v0wuc; + double BSIM3v0wuc1; + double BSIM3v0wu0; + double BSIM3v0wute; + double BSIM3v0wvoff; + double BSIM3v0wdelta; + double BSIM3v0wrdsw; + double BSIM3v0wprwg; + double BSIM3v0wprwb; + double BSIM3v0wprt; + double BSIM3v0weta0; + double BSIM3v0wetab; + double BSIM3v0wpclm; + double BSIM3v0wpdibl1; + double BSIM3v0wpdibl2; + double BSIM3v0wpdiblb; + double BSIM3v0wpscbe1; + double BSIM3v0wpscbe2; + double BSIM3v0wpvag; + double BSIM3v0wwr; + double BSIM3v0wdwg; + double BSIM3v0wdwb; + double BSIM3v0wb0; + double BSIM3v0wb1; + double BSIM3v0walpha0; + double BSIM3v0wbeta0; + + /* CV model */ + double BSIM3v0welm; + double BSIM3v0wcgsl; + double BSIM3v0wcgdl; + double BSIM3v0wckappa; + double BSIM3v0wcf; + double BSIM3v0wclc; + double BSIM3v0wcle; + + /* Cross-term Dependence */ + double BSIM3v0pcdsc; + double BSIM3v0pcdscb; + double BSIM3v0pcdscd; + double BSIM3v0pcit; + double BSIM3v0pnfactor; + double BSIM3v0pxj; + double BSIM3v0pvsat; + double BSIM3v0pat; + double BSIM3v0pa0; + double BSIM3v0pags; + double BSIM3v0pa1; + double BSIM3v0pa2; + double BSIM3v0pketa; + double BSIM3v0pnsub; + double BSIM3v0pnpeak; + double BSIM3v0pngate; + double BSIM3v0pgamma1; + double BSIM3v0pgamma2; + double BSIM3v0pvbx; + double BSIM3v0pvbm; + double BSIM3v0pxt; + double BSIM3v0pk1; + double BSIM3v0pkt1; + double BSIM3v0pkt1l; + double BSIM3v0pkt2; + double BSIM3v0pk2; + double BSIM3v0pk3; + double BSIM3v0pk3b; + double BSIM3v0pw0; + double BSIM3v0pnlx; + double BSIM3v0pdvt0; + double BSIM3v0pdvt1; + double BSIM3v0pdvt2; + double BSIM3v0pdvt0w; + double BSIM3v0pdvt1w; + double BSIM3v0pdvt2w; + double BSIM3v0pdrout; + double BSIM3v0pdsub; + double BSIM3v0pvth0; + double BSIM3v0pua; + double BSIM3v0pua1; + double BSIM3v0pub; + double BSIM3v0pub1; + double BSIM3v0puc; + double BSIM3v0puc1; + double BSIM3v0pu0; + double BSIM3v0pute; + double BSIM3v0pvoff; + double BSIM3v0pdelta; + double BSIM3v0prdsw; + double BSIM3v0pprwg; + double BSIM3v0pprwb; + double BSIM3v0pprt; + double BSIM3v0peta0; + double BSIM3v0petab; + double BSIM3v0ppclm; + double BSIM3v0ppdibl1; + double BSIM3v0ppdibl2; + double BSIM3v0ppdiblb; + double BSIM3v0ppscbe1; + double BSIM3v0ppscbe2; + double BSIM3v0ppvag; + double BSIM3v0pwr; + double BSIM3v0pdwg; + double BSIM3v0pdwb; + double BSIM3v0pb0; + double BSIM3v0pb1; + double BSIM3v0palpha0; + double BSIM3v0pbeta0; + + /* CV model */ + double BSIM3v0pelm; + double BSIM3v0pcgsl; + double BSIM3v0pcgdl; + double BSIM3v0pckappa; + double BSIM3v0pcf; + double BSIM3v0pclc; + double BSIM3v0pcle; + + double BSIM3v0tnom; + double BSIM3v0cgso; + double BSIM3v0cgdo; + double BSIM3v0cgbo; + double BSIM3v0xpart; + double BSIM3v0cFringOut; + double BSIM3v0cFringMax; + + double BSIM3v0sheetResistance; + double BSIM3v0jctSatCurDensity; + double BSIM3v0bulkJctPotential; + double BSIM3v0bulkJctBotGradingCoeff; + double BSIM3v0bulkJctSideGradingCoeff; + double BSIM3v0sidewallJctPotential; + double BSIM3v0unitAreaJctCap; + double BSIM3v0unitLengthSidewallJctCap; + + double BSIM3v0Lint; + double BSIM3v0Ll; + double BSIM3v0Lln; + double BSIM3v0Lw; + double BSIM3v0Lwn; + double BSIM3v0Lwl; + double BSIM3v0Lmin; + double BSIM3v0Lmax; + + double BSIM3v0Wint; + double BSIM3v0Wl; + double BSIM3v0Wln; + double BSIM3v0Ww; + double BSIM3v0Wwn; + double BSIM3v0Wwl; + double BSIM3v0Wmin; + double BSIM3v0Wmax; + + +/* Pre-calculated constants */ + /* MCJ: move to size-dependent param. */ + double BSIM3v0vtm; + double BSIM3v0cox; + double BSIM3v0cof1; + double BSIM3v0cof2; + double BSIM3v0cof3; + double BSIM3v0cof4; + double BSIM3v0vcrit; + double BSIM3v0factor1; + + double BSIM3v0oxideTrapDensityA; + double BSIM3v0oxideTrapDensityB; + double BSIM3v0oxideTrapDensityC; + double BSIM3v0em; + double BSIM3v0ef; + double BSIM3v0af; + double BSIM3v0kf; + + struct bsim3v0SizeDependParam *pSizeDependParamKnot; + + /* Flags */ + unsigned BSIM3v0mobModGiven :1; + unsigned BSIM3v0binUnitGiven :1; + unsigned BSIM3v0capModGiven :1; + unsigned BSIM3v0nqsModGiven :1; + unsigned BSIM3v0noiModGiven :1; + unsigned BSIM3v0typeGiven :1; + unsigned BSIM3v0toxGiven :1; + + unsigned BSIM3v0cdscGiven :1; + unsigned BSIM3v0cdscbGiven :1; + unsigned BSIM3v0cdscdGiven :1; + unsigned BSIM3v0citGiven :1; + unsigned BSIM3v0nfactorGiven :1; + unsigned BSIM3v0xjGiven :1; + unsigned BSIM3v0vsatGiven :1; + unsigned BSIM3v0atGiven :1; + unsigned BSIM3v0a0Given :1; + unsigned BSIM3v0agsGiven :1; + unsigned BSIM3v0a1Given :1; + unsigned BSIM3v0a2Given :1; + unsigned BSIM3v0ketaGiven :1; + unsigned BSIM3v0nsubGiven :1; + unsigned BSIM3v0npeakGiven :1; + unsigned BSIM3v0ngateGiven :1; + unsigned BSIM3v0gamma1Given :1; + unsigned BSIM3v0gamma2Given :1; + unsigned BSIM3v0vbxGiven :1; + unsigned BSIM3v0vbmGiven :1; + unsigned BSIM3v0xtGiven :1; + unsigned BSIM3v0k1Given :1; + unsigned BSIM3v0kt1Given :1; + unsigned BSIM3v0kt1lGiven :1; + unsigned BSIM3v0kt2Given :1; + unsigned BSIM3v0k2Given :1; + unsigned BSIM3v0k3Given :1; + unsigned BSIM3v0k3bGiven :1; + unsigned BSIM3v0w0Given :1; + unsigned BSIM3v0nlxGiven :1; + unsigned BSIM3v0dvt0Given :1; + unsigned BSIM3v0dvt1Given :1; + unsigned BSIM3v0dvt2Given :1; + unsigned BSIM3v0dvt0wGiven :1; + unsigned BSIM3v0dvt1wGiven :1; + unsigned BSIM3v0dvt2wGiven :1; + unsigned BSIM3v0droutGiven :1; + unsigned BSIM3v0dsubGiven :1; + unsigned BSIM3v0vth0Given :1; + unsigned BSIM3v0uaGiven :1; + unsigned BSIM3v0ua1Given :1; + unsigned BSIM3v0ubGiven :1; + unsigned BSIM3v0ub1Given :1; + unsigned BSIM3v0ucGiven :1; + unsigned BSIM3v0uc1Given :1; + unsigned BSIM3v0u0Given :1; + unsigned BSIM3v0uteGiven :1; + unsigned BSIM3v0voffGiven :1; + unsigned BSIM3v0rdswGiven :1; + unsigned BSIM3v0prwgGiven :1; + unsigned BSIM3v0prwbGiven :1; + unsigned BSIM3v0prtGiven :1; + unsigned BSIM3v0eta0Given :1; + unsigned BSIM3v0etabGiven :1; + unsigned BSIM3v0pclmGiven :1; + unsigned BSIM3v0pdibl1Given :1; + unsigned BSIM3v0pdibl2Given :1; + unsigned BSIM3v0pdiblbGiven :1; + unsigned BSIM3v0pscbe1Given :1; + unsigned BSIM3v0pscbe2Given :1; + unsigned BSIM3v0pvagGiven :1; + unsigned BSIM3v0deltaGiven :1; + unsigned BSIM3v0wrGiven :1; + unsigned BSIM3v0dwgGiven :1; + unsigned BSIM3v0dwbGiven :1; + unsigned BSIM3v0b0Given :1; + unsigned BSIM3v0b1Given :1; + unsigned BSIM3v0alpha0Given :1; + unsigned BSIM3v0beta0Given :1; + + /* CV model */ + unsigned BSIM3v0elmGiven :1; + unsigned BSIM3v0cgslGiven :1; + unsigned BSIM3v0cgdlGiven :1; + unsigned BSIM3v0ckappaGiven :1; + unsigned BSIM3v0cfGiven :1; + unsigned BSIM3v0clcGiven :1; + unsigned BSIM3v0cleGiven :1; + unsigned BSIM3v0dwcGiven :1; + unsigned BSIM3v0dlcGiven :1; + + + /* Length dependence */ + unsigned BSIM3v0lcdscGiven :1; + unsigned BSIM3v0lcdscbGiven :1; + unsigned BSIM3v0lcdscdGiven :1; + unsigned BSIM3v0lcitGiven :1; + unsigned BSIM3v0lnfactorGiven :1; + unsigned BSIM3v0lxjGiven :1; + unsigned BSIM3v0lvsatGiven :1; + unsigned BSIM3v0latGiven :1; + unsigned BSIM3v0la0Given :1; + unsigned BSIM3v0lagsGiven :1; + unsigned BSIM3v0la1Given :1; + unsigned BSIM3v0la2Given :1; + unsigned BSIM3v0lketaGiven :1; + unsigned BSIM3v0lnsubGiven :1; + unsigned BSIM3v0lnpeakGiven :1; + unsigned BSIM3v0lngateGiven :1; + unsigned BSIM3v0lgamma1Given :1; + unsigned BSIM3v0lgamma2Given :1; + unsigned BSIM3v0lvbxGiven :1; + unsigned BSIM3v0lvbmGiven :1; + unsigned BSIM3v0lxtGiven :1; + unsigned BSIM3v0lk1Given :1; + unsigned BSIM3v0lkt1Given :1; + unsigned BSIM3v0lkt1lGiven :1; + unsigned BSIM3v0lkt2Given :1; + unsigned BSIM3v0lk2Given :1; + unsigned BSIM3v0lk3Given :1; + unsigned BSIM3v0lk3bGiven :1; + unsigned BSIM3v0lw0Given :1; + unsigned BSIM3v0lnlxGiven :1; + unsigned BSIM3v0ldvt0Given :1; + unsigned BSIM3v0ldvt1Given :1; + unsigned BSIM3v0ldvt2Given :1; + unsigned BSIM3v0ldvt0wGiven :1; + unsigned BSIM3v0ldvt1wGiven :1; + unsigned BSIM3v0ldvt2wGiven :1; + unsigned BSIM3v0ldroutGiven :1; + unsigned BSIM3v0ldsubGiven :1; + unsigned BSIM3v0lvth0Given :1; + unsigned BSIM3v0luaGiven :1; + unsigned BSIM3v0lua1Given :1; + unsigned BSIM3v0lubGiven :1; + unsigned BSIM3v0lub1Given :1; + unsigned BSIM3v0lucGiven :1; + unsigned BSIM3v0luc1Given :1; + unsigned BSIM3v0lu0Given :1; + unsigned BSIM3v0luteGiven :1; + unsigned BSIM3v0lvoffGiven :1; + unsigned BSIM3v0lrdswGiven :1; + unsigned BSIM3v0lprwgGiven :1; + unsigned BSIM3v0lprwbGiven :1; + unsigned BSIM3v0lprtGiven :1; + unsigned BSIM3v0leta0Given :1; + unsigned BSIM3v0letabGiven :1; + unsigned BSIM3v0lpclmGiven :1; + unsigned BSIM3v0lpdibl1Given :1; + unsigned BSIM3v0lpdibl2Given :1; + unsigned BSIM3v0lpdiblbGiven :1; + unsigned BSIM3v0lpscbe1Given :1; + unsigned BSIM3v0lpscbe2Given :1; + unsigned BSIM3v0lpvagGiven :1; + unsigned BSIM3v0ldeltaGiven :1; + unsigned BSIM3v0lwrGiven :1; + unsigned BSIM3v0ldwgGiven :1; + unsigned BSIM3v0ldwbGiven :1; + unsigned BSIM3v0lb0Given :1; + unsigned BSIM3v0lb1Given :1; + unsigned BSIM3v0lalpha0Given :1; + unsigned BSIM3v0lbeta0Given :1; + + /* CV model */ + unsigned BSIM3v0lelmGiven :1; + unsigned BSIM3v0lcgslGiven :1; + unsigned BSIM3v0lcgdlGiven :1; + unsigned BSIM3v0lckappaGiven :1; + unsigned BSIM3v0lcfGiven :1; + unsigned BSIM3v0lclcGiven :1; + unsigned BSIM3v0lcleGiven :1; + + /* Width dependence */ + unsigned BSIM3v0wcdscGiven :1; + unsigned BSIM3v0wcdscbGiven :1; + unsigned BSIM3v0wcdscdGiven :1; + unsigned BSIM3v0wcitGiven :1; + unsigned BSIM3v0wnfactorGiven :1; + unsigned BSIM3v0wxjGiven :1; + unsigned BSIM3v0wvsatGiven :1; + unsigned BSIM3v0watGiven :1; + unsigned BSIM3v0wa0Given :1; + unsigned BSIM3v0wagsGiven :1; + unsigned BSIM3v0wa1Given :1; + unsigned BSIM3v0wa2Given :1; + unsigned BSIM3v0wketaGiven :1; + unsigned BSIM3v0wnsubGiven :1; + unsigned BSIM3v0wnpeakGiven :1; + unsigned BSIM3v0wngateGiven :1; + unsigned BSIM3v0wgamma1Given :1; + unsigned BSIM3v0wgamma2Given :1; + unsigned BSIM3v0wvbxGiven :1; + unsigned BSIM3v0wvbmGiven :1; + unsigned BSIM3v0wxtGiven :1; + unsigned BSIM3v0wk1Given :1; + unsigned BSIM3v0wkt1Given :1; + unsigned BSIM3v0wkt1lGiven :1; + unsigned BSIM3v0wkt2Given :1; + unsigned BSIM3v0wk2Given :1; + unsigned BSIM3v0wk3Given :1; + unsigned BSIM3v0wk3bGiven :1; + unsigned BSIM3v0ww0Given :1; + unsigned BSIM3v0wnlxGiven :1; + unsigned BSIM3v0wdvt0Given :1; + unsigned BSIM3v0wdvt1Given :1; + unsigned BSIM3v0wdvt2Given :1; + unsigned BSIM3v0wdvt0wGiven :1; + unsigned BSIM3v0wdvt1wGiven :1; + unsigned BSIM3v0wdvt2wGiven :1; + unsigned BSIM3v0wdroutGiven :1; + unsigned BSIM3v0wdsubGiven :1; + unsigned BSIM3v0wvth0Given :1; + unsigned BSIM3v0wuaGiven :1; + unsigned BSIM3v0wua1Given :1; + unsigned BSIM3v0wubGiven :1; + unsigned BSIM3v0wub1Given :1; + unsigned BSIM3v0wucGiven :1; + unsigned BSIM3v0wuc1Given :1; + unsigned BSIM3v0wu0Given :1; + unsigned BSIM3v0wuteGiven :1; + unsigned BSIM3v0wvoffGiven :1; + unsigned BSIM3v0wrdswGiven :1; + unsigned BSIM3v0wprwgGiven :1; + unsigned BSIM3v0wprwbGiven :1; + unsigned BSIM3v0wprtGiven :1; + unsigned BSIM3v0weta0Given :1; + unsigned BSIM3v0wetabGiven :1; + unsigned BSIM3v0wpclmGiven :1; + unsigned BSIM3v0wpdibl1Given :1; + unsigned BSIM3v0wpdibl2Given :1; + unsigned BSIM3v0wpdiblbGiven :1; + unsigned BSIM3v0wpscbe1Given :1; + unsigned BSIM3v0wpscbe2Given :1; + unsigned BSIM3v0wpvagGiven :1; + unsigned BSIM3v0wdeltaGiven :1; + unsigned BSIM3v0wwrGiven :1; + unsigned BSIM3v0wdwgGiven :1; + unsigned BSIM3v0wdwbGiven :1; + unsigned BSIM3v0wb0Given :1; + unsigned BSIM3v0wb1Given :1; + unsigned BSIM3v0walpha0Given :1; + unsigned BSIM3v0wbeta0Given :1; + + /* CV model */ + unsigned BSIM3v0welmGiven :1; + unsigned BSIM3v0wcgslGiven :1; + unsigned BSIM3v0wcgdlGiven :1; + unsigned BSIM3v0wckappaGiven :1; + unsigned BSIM3v0wcfGiven :1; + unsigned BSIM3v0wclcGiven :1; + unsigned BSIM3v0wcleGiven :1; + + /* Cross-term dependence */ + unsigned BSIM3v0pcdscGiven :1; + unsigned BSIM3v0pcdscbGiven :1; + unsigned BSIM3v0pcdscdGiven :1; + unsigned BSIM3v0pcitGiven :1; + unsigned BSIM3v0pnfactorGiven :1; + unsigned BSIM3v0pxjGiven :1; + unsigned BSIM3v0pvsatGiven :1; + unsigned BSIM3v0patGiven :1; + unsigned BSIM3v0pa0Given :1; + unsigned BSIM3v0pagsGiven :1; + unsigned BSIM3v0pa1Given :1; + unsigned BSIM3v0pa2Given :1; + unsigned BSIM3v0pketaGiven :1; + unsigned BSIM3v0pnsubGiven :1; + unsigned BSIM3v0pnpeakGiven :1; + unsigned BSIM3v0pngateGiven :1; + unsigned BSIM3v0pgamma1Given :1; + unsigned BSIM3v0pgamma2Given :1; + unsigned BSIM3v0pvbxGiven :1; + unsigned BSIM3v0pvbmGiven :1; + unsigned BSIM3v0pxtGiven :1; + unsigned BSIM3v0pk1Given :1; + unsigned BSIM3v0pkt1Given :1; + unsigned BSIM3v0pkt1lGiven :1; + unsigned BSIM3v0pkt2Given :1; + unsigned BSIM3v0pk2Given :1; + unsigned BSIM3v0pk3Given :1; + unsigned BSIM3v0pk3bGiven :1; + unsigned BSIM3v0pw0Given :1; + unsigned BSIM3v0pnlxGiven :1; + unsigned BSIM3v0pdvt0Given :1; + unsigned BSIM3v0pdvt1Given :1; + unsigned BSIM3v0pdvt2Given :1; + unsigned BSIM3v0pdvt0wGiven :1; + unsigned BSIM3v0pdvt1wGiven :1; + unsigned BSIM3v0pdvt2wGiven :1; + unsigned BSIM3v0pdroutGiven :1; + unsigned BSIM3v0pdsubGiven :1; + unsigned BSIM3v0pvth0Given :1; + unsigned BSIM3v0puaGiven :1; + unsigned BSIM3v0pua1Given :1; + unsigned BSIM3v0pubGiven :1; + unsigned BSIM3v0pub1Given :1; + unsigned BSIM3v0pucGiven :1; + unsigned BSIM3v0puc1Given :1; + unsigned BSIM3v0pu0Given :1; + unsigned BSIM3v0puteGiven :1; + unsigned BSIM3v0pvoffGiven :1; + unsigned BSIM3v0prdswGiven :1; + unsigned BSIM3v0pprwgGiven :1; + unsigned BSIM3v0pprwbGiven :1; + unsigned BSIM3v0pprtGiven :1; + unsigned BSIM3v0peta0Given :1; + unsigned BSIM3v0petabGiven :1; + unsigned BSIM3v0ppclmGiven :1; + unsigned BSIM3v0ppdibl1Given :1; + unsigned BSIM3v0ppdibl2Given :1; + unsigned BSIM3v0ppdiblbGiven :1; + unsigned BSIM3v0ppscbe1Given :1; + unsigned BSIM3v0ppscbe2Given :1; + unsigned BSIM3v0ppvagGiven :1; + unsigned BSIM3v0pdeltaGiven :1; + unsigned BSIM3v0pwrGiven :1; + unsigned BSIM3v0pdwgGiven :1; + unsigned BSIM3v0pdwbGiven :1; + unsigned BSIM3v0pb0Given :1; + unsigned BSIM3v0pb1Given :1; + unsigned BSIM3v0palpha0Given :1; + unsigned BSIM3v0pbeta0Given :1; + + /* CV model */ + unsigned BSIM3v0pelmGiven :1; + unsigned BSIM3v0pcgslGiven :1; + unsigned BSIM3v0pcgdlGiven :1; + unsigned BSIM3v0pckappaGiven :1; + unsigned BSIM3v0pcfGiven :1; + unsigned BSIM3v0pclcGiven :1; + unsigned BSIM3v0pcleGiven :1; + + unsigned BSIM3v0useFringeGiven :1; + + unsigned BSIM3v0tnomGiven :1; + unsigned BSIM3v0cgsoGiven :1; + unsigned BSIM3v0cgdoGiven :1; + unsigned BSIM3v0cgboGiven :1; + unsigned BSIM3v0xpartGiven :1; + unsigned BSIM3v0sheetResistanceGiven :1; + unsigned BSIM3v0jctSatCurDensityGiven :1; + unsigned BSIM3v0bulkJctPotentialGiven :1; + unsigned BSIM3v0bulkJctBotGradingCoeffGiven :1; + unsigned BSIM3v0sidewallJctPotentialGiven :1; + unsigned BSIM3v0bulkJctSideGradingCoeffGiven :1; + unsigned BSIM3v0unitAreaJctCapGiven :1; + unsigned BSIM3v0unitLengthSidewallJctCapGiven :1; + + unsigned BSIM3v0oxideTrapDensityAGiven :1; + unsigned BSIM3v0oxideTrapDensityBGiven :1; + unsigned BSIM3v0oxideTrapDensityCGiven :1; + unsigned BSIM3v0emGiven :1; + unsigned BSIM3v0efGiven :1; + unsigned BSIM3v0afGiven :1; + unsigned BSIM3v0kfGiven :1; + + unsigned BSIM3v0LintGiven :1; + unsigned BSIM3v0LlGiven :1; + unsigned BSIM3v0LlnGiven :1; + unsigned BSIM3v0LwGiven :1; + unsigned BSIM3v0LwnGiven :1; + unsigned BSIM3v0LwlGiven :1; + unsigned BSIM3v0LminGiven :1; + unsigned BSIM3v0LmaxGiven :1; + + unsigned BSIM3v0WintGiven :1; + unsigned BSIM3v0WlGiven :1; + unsigned BSIM3v0WlnGiven :1; + unsigned BSIM3v0WwGiven :1; + unsigned BSIM3v0WwnGiven :1; + unsigned BSIM3v0WwlGiven :1; + unsigned BSIM3v0WminGiven :1; + unsigned BSIM3v0WmaxGiven :1; + +} BSIM3v0model; + + +#ifndef NMOS +#define NMOS 1 +#define PMOS -1 +#endif /*NMOS*/ + + +/* device parameters */ +#define BSIM3v0_W 1 +#define BSIM3v0_L 2 +#define BSIM3v0_M 15 +#define BSIM3v0_AS 3 +#define BSIM3v0_AD 4 +#define BSIM3v0_PS 5 +#define BSIM3v0_PD 6 +#define BSIM3v0_NRS 7 +#define BSIM3v0_NRD 8 +#define BSIM3v0_OFF 9 +#define BSIM3v0_IC_VBS 10 +#define BSIM3v0_IC_VDS 11 +#define BSIM3v0_IC_VGS 12 +#define BSIM3v0_IC 13 +#define BSIM3v0_NQSMOD 14 + +/* model parameters */ +#define BSIM3v0_MOD_CAPMOD 101 +#define BSIM3v0_MOD_NQSMOD 102 +#define BSIM3v0_MOD_MOBMOD 103 +#define BSIM3v0_MOD_NOIMOD 104 + +#define BSIM3v0_MOD_TOX 105 + +#define BSIM3v0_MOD_CDSC 106 +#define BSIM3v0_MOD_CDSCB 107 +#define BSIM3v0_MOD_CIT 108 +#define BSIM3v0_MOD_NFACTOR 109 +#define BSIM3v0_MOD_XJ 110 +#define BSIM3v0_MOD_VSAT 111 +#define BSIM3v0_MOD_AT 112 +#define BSIM3v0_MOD_A0 113 +#define BSIM3v0_MOD_A1 114 +#define BSIM3v0_MOD_A2 115 +#define BSIM3v0_MOD_KETA 116 +#define BSIM3v0_MOD_NSUB 117 +#define BSIM3v0_MOD_NPEAK 118 +#define BSIM3v0_MOD_NGATE 120 +#define BSIM3v0_MOD_GAMMA1 121 +#define BSIM3v0_MOD_GAMMA2 122 +#define BSIM3v0_MOD_VBX 123 +#define BSIM3v0_MOD_BINUNIT 124 + +#define BSIM3v0_MOD_VBM 125 + +#define BSIM3v0_MOD_XT 126 +#define BSIM3v0_MOD_K1 129 +#define BSIM3v0_MOD_KT1 130 +#define BSIM3v0_MOD_KT1L 131 +#define BSIM3v0_MOD_K2 132 +#define BSIM3v0_MOD_KT2 133 +#define BSIM3v0_MOD_K3 134 +#define BSIM3v0_MOD_K3B 135 +#define BSIM3v0_MOD_W0 136 +#define BSIM3v0_MOD_NLX 137 + +#define BSIM3v0_MOD_DVT0 138 +#define BSIM3v0_MOD_DVT1 139 +#define BSIM3v0_MOD_DVT2 140 + +#define BSIM3v0_MOD_DVT0W 141 +#define BSIM3v0_MOD_DVT1W 142 +#define BSIM3v0_MOD_DVT2W 143 + +#define BSIM3v0_MOD_DROUT 144 +#define BSIM3v0_MOD_DSUB 145 +#define BSIM3v0_MOD_VTH0 146 +#define BSIM3v0_MOD_UA 147 +#define BSIM3v0_MOD_UA1 148 +#define BSIM3v0_MOD_UB 149 +#define BSIM3v0_MOD_UB1 150 +#define BSIM3v0_MOD_UC 151 +#define BSIM3v0_MOD_UC1 152 +#define BSIM3v0_MOD_U0 153 +#define BSIM3v0_MOD_UTE 154 +#define BSIM3v0_MOD_VOFF 155 +#define BSIM3v0_MOD_DELTA 156 +#define BSIM3v0_MOD_RDSW 157 +#define BSIM3v0_MOD_PRT 158 +#define BSIM3v0_MOD_LDD 159 +#define BSIM3v0_MOD_ETA 160 +#define BSIM3v0_MOD_ETA0 161 +#define BSIM3v0_MOD_ETAB 162 +#define BSIM3v0_MOD_PCLM 163 +#define BSIM3v0_MOD_PDIBL1 164 +#define BSIM3v0_MOD_PDIBL2 165 +#define BSIM3v0_MOD_PSCBE1 166 +#define BSIM3v0_MOD_PSCBE2 167 +#define BSIM3v0_MOD_PVAG 168 +#define BSIM3v0_MOD_WR 169 +#define BSIM3v0_MOD_DWG 170 +#define BSIM3v0_MOD_DWB 171 +#define BSIM3v0_MOD_B0 172 +#define BSIM3v0_MOD_B1 173 +#define BSIM3v0_MOD_ALPHA0 174 +#define BSIM3v0_MOD_BETA0 175 +#define BSIM3v0_MOD_PDIBLB 178 + +#define BSIM3v0_MOD_PRWG 179 +#define BSIM3v0_MOD_PRWB 180 + +#define BSIM3v0_MOD_CDSCD 181 +#define BSIM3v0_MOD_AGS 182 + +#define BSIM3v0_MOD_FRINGE 184 +#define BSIM3v0_MOD_ELM 185 +#define BSIM3v0_MOD_CGSL 186 +#define BSIM3v0_MOD_CGDL 187 +#define BSIM3v0_MOD_CKAPPA 188 +#define BSIM3v0_MOD_CF 189 +#define BSIM3v0_MOD_CLC 190 +#define BSIM3v0_MOD_CLE 191 + +/* Length dependence */ +#define BSIM3v0_MOD_LCDSC 201 +#define BSIM3v0_MOD_LCDSCB 202 +#define BSIM3v0_MOD_LCIT 203 +#define BSIM3v0_MOD_LNFACTOR 204 +#define BSIM3v0_MOD_LXJ 205 +#define BSIM3v0_MOD_LVSAT 206 +#define BSIM3v0_MOD_LAT 207 +#define BSIM3v0_MOD_LA0 208 +#define BSIM3v0_MOD_LA1 209 +#define BSIM3v0_MOD_LA2 210 +#define BSIM3v0_MOD_LKETA 211 +#define BSIM3v0_MOD_LNSUB 212 +#define BSIM3v0_MOD_LNPEAK 213 +#define BSIM3v0_MOD_LNGATE 215 +#define BSIM3v0_MOD_LGAMMA1 216 +#define BSIM3v0_MOD_LGAMMA2 217 +#define BSIM3v0_MOD_LVBX 218 + +#define BSIM3v0_MOD_LVBM 220 + +#define BSIM3v0_MOD_LXT 222 +#define BSIM3v0_MOD_LK1 225 +#define BSIM3v0_MOD_LKT1 226 +#define BSIM3v0_MOD_LKT1L 227 +#define BSIM3v0_MOD_LK2 228 +#define BSIM3v0_MOD_LKT2 229 +#define BSIM3v0_MOD_LK3 230 +#define BSIM3v0_MOD_LK3B 231 +#define BSIM3v0_MOD_LW0 232 +#define BSIM3v0_MOD_LNLX 233 + +#define BSIM3v0_MOD_LDVT0 234 +#define BSIM3v0_MOD_LDVT1 235 +#define BSIM3v0_MOD_LDVT2 236 + +#define BSIM3v0_MOD_LDVT0W 237 +#define BSIM3v0_MOD_LDVT1W 238 +#define BSIM3v0_MOD_LDVT2W 239 + +#define BSIM3v0_MOD_LDROUT 240 +#define BSIM3v0_MOD_LDSUB 241 +#define BSIM3v0_MOD_LVTH0 242 +#define BSIM3v0_MOD_LUA 243 +#define BSIM3v0_MOD_LUA1 244 +#define BSIM3v0_MOD_LUB 245 +#define BSIM3v0_MOD_LUB1 246 +#define BSIM3v0_MOD_LUC 247 +#define BSIM3v0_MOD_LUC1 248 +#define BSIM3v0_MOD_LU0 249 +#define BSIM3v0_MOD_LUTE 250 +#define BSIM3v0_MOD_LVOFF 251 +#define BSIM3v0_MOD_LDELTA 252 +#define BSIM3v0_MOD_LRDSW 253 +#define BSIM3v0_MOD_LPRT 254 +#define BSIM3v0_MOD_LLDD 255 +#define BSIM3v0_MOD_LETA 256 +#define BSIM3v0_MOD_LETA0 257 +#define BSIM3v0_MOD_LETAB 258 +#define BSIM3v0_MOD_LPCLM 259 +#define BSIM3v0_MOD_LPDIBL1 260 +#define BSIM3v0_MOD_LPDIBL2 261 +#define BSIM3v0_MOD_LPSCBE1 262 +#define BSIM3v0_MOD_LPSCBE2 263 +#define BSIM3v0_MOD_LPVAG 264 +#define BSIM3v0_MOD_LWR 265 +#define BSIM3v0_MOD_LDWG 266 +#define BSIM3v0_MOD_LDWB 267 +#define BSIM3v0_MOD_LB0 268 +#define BSIM3v0_MOD_LB1 269 +#define BSIM3v0_MOD_LALPHA0 270 +#define BSIM3v0_MOD_LBETA0 271 +#define BSIM3v0_MOD_LPDIBLB 274 + +#define BSIM3v0_MOD_LPRWG 275 +#define BSIM3v0_MOD_LPRWB 276 + +#define BSIM3v0_MOD_LCDSCD 277 +#define BSIM3v0_MOD_LAGS 278 + + +#define BSIM3v0_MOD_LFRINGE 281 +#define BSIM3v0_MOD_LELM 282 +#define BSIM3v0_MOD_LCGSL 283 +#define BSIM3v0_MOD_LCGDL 284 +#define BSIM3v0_MOD_LCKAPPA 285 +#define BSIM3v0_MOD_LCF 286 +#define BSIM3v0_MOD_LCLC 287 +#define BSIM3v0_MOD_LCLE 288 + +/* Width dependence */ +#define BSIM3v0_MOD_WCDSC 301 +#define BSIM3v0_MOD_WCDSCB 302 +#define BSIM3v0_MOD_WCIT 303 +#define BSIM3v0_MOD_WNFACTOR 304 +#define BSIM3v0_MOD_WXJ 305 +#define BSIM3v0_MOD_WVSAT 306 +#define BSIM3v0_MOD_WAT 307 +#define BSIM3v0_MOD_WA0 308 +#define BSIM3v0_MOD_WA1 309 +#define BSIM3v0_MOD_WA2 310 +#define BSIM3v0_MOD_WKETA 311 +#define BSIM3v0_MOD_WNSUB 312 +#define BSIM3v0_MOD_WNPEAK 313 +#define BSIM3v0_MOD_WNGATE 315 +#define BSIM3v0_MOD_WGAMMA1 316 +#define BSIM3v0_MOD_WGAMMA2 317 +#define BSIM3v0_MOD_WVBX 318 + +#define BSIM3v0_MOD_WVBM 320 + +#define BSIM3v0_MOD_WXT 322 +#define BSIM3v0_MOD_WK1 325 +#define BSIM3v0_MOD_WKT1 326 +#define BSIM3v0_MOD_WKT1L 327 +#define BSIM3v0_MOD_WK2 328 +#define BSIM3v0_MOD_WKT2 329 +#define BSIM3v0_MOD_WK3 330 +#define BSIM3v0_MOD_WK3B 331 +#define BSIM3v0_MOD_WW0 332 +#define BSIM3v0_MOD_WNLX 333 + +#define BSIM3v0_MOD_WDVT0 334 +#define BSIM3v0_MOD_WDVT1 335 +#define BSIM3v0_MOD_WDVT2 336 + +#define BSIM3v0_MOD_WDVT0W 337 +#define BSIM3v0_MOD_WDVT1W 338 +#define BSIM3v0_MOD_WDVT2W 339 + +#define BSIM3v0_MOD_WDROUT 340 +#define BSIM3v0_MOD_WDSUB 341 +#define BSIM3v0_MOD_WVTH0 342 +#define BSIM3v0_MOD_WUA 343 +#define BSIM3v0_MOD_WUA1 344 +#define BSIM3v0_MOD_WUB 345 +#define BSIM3v0_MOD_WUB1 346 +#define BSIM3v0_MOD_WUC 347 +#define BSIM3v0_MOD_WUC1 348 +#define BSIM3v0_MOD_WU0 349 +#define BSIM3v0_MOD_WUTE 350 +#define BSIM3v0_MOD_WVOFF 351 +#define BSIM3v0_MOD_WDELTA 352 +#define BSIM3v0_MOD_WRDSW 353 +#define BSIM3v0_MOD_WPRT 354 +#define BSIM3v0_MOD_WLDD 355 +#define BSIM3v0_MOD_WETA 356 +#define BSIM3v0_MOD_WETA0 357 +#define BSIM3v0_MOD_WETAB 358 +#define BSIM3v0_MOD_WPCLM 359 +#define BSIM3v0_MOD_WPDIBL1 360 +#define BSIM3v0_MOD_WPDIBL2 361 +#define BSIM3v0_MOD_WPSCBE1 362 +#define BSIM3v0_MOD_WPSCBE2 363 +#define BSIM3v0_MOD_WPVAG 364 +#define BSIM3v0_MOD_WWR 365 +#define BSIM3v0_MOD_WDWG 366 +#define BSIM3v0_MOD_WDWB 367 +#define BSIM3v0_MOD_WB0 368 +#define BSIM3v0_MOD_WB1 369 +#define BSIM3v0_MOD_WALPHA0 370 +#define BSIM3v0_MOD_WBETA0 371 +#define BSIM3v0_MOD_WPDIBLB 374 + +#define BSIM3v0_MOD_WPRWG 375 +#define BSIM3v0_MOD_WPRWB 376 + +#define BSIM3v0_MOD_WCDSCD 377 +#define BSIM3v0_MOD_WAGS 378 + + +#define BSIM3v0_MOD_WFRINGE 381 +#define BSIM3v0_MOD_WELM 382 +#define BSIM3v0_MOD_WCGSL 383 +#define BSIM3v0_MOD_WCGDL 384 +#define BSIM3v0_MOD_WCKAPPA 385 +#define BSIM3v0_MOD_WCF 386 +#define BSIM3v0_MOD_WCLC 387 +#define BSIM3v0_MOD_WCLE 388 + +/* Cross-term dependence */ +#define BSIM3v0_MOD_PCDSC 401 +#define BSIM3v0_MOD_PCDSCB 402 +#define BSIM3v0_MOD_PCIT 403 +#define BSIM3v0_MOD_PNFACTOR 404 +#define BSIM3v0_MOD_PXJ 405 +#define BSIM3v0_MOD_PVSAT 406 +#define BSIM3v0_MOD_PAT 407 +#define BSIM3v0_MOD_PA0 408 +#define BSIM3v0_MOD_PA1 409 +#define BSIM3v0_MOD_PA2 410 +#define BSIM3v0_MOD_PKETA 411 +#define BSIM3v0_MOD_PNSUB 412 +#define BSIM3v0_MOD_PNPEAK 413 +#define BSIM3v0_MOD_PNGATE 415 +#define BSIM3v0_MOD_PGAMMA1 416 +#define BSIM3v0_MOD_PGAMMA2 417 +#define BSIM3v0_MOD_PVBX 418 + +#define BSIM3v0_MOD_PVBM 420 + +#define BSIM3v0_MOD_PXT 422 +#define BSIM3v0_MOD_PK1 425 +#define BSIM3v0_MOD_PKT1 426 +#define BSIM3v0_MOD_PKT1L 427 +#define BSIM3v0_MOD_PK2 428 +#define BSIM3v0_MOD_PKT2 429 +#define BSIM3v0_MOD_PK3 430 +#define BSIM3v0_MOD_PK3B 431 +#define BSIM3v0_MOD_PW0 432 +#define BSIM3v0_MOD_PNLX 433 + +#define BSIM3v0_MOD_PDVT0 434 +#define BSIM3v0_MOD_PDVT1 435 +#define BSIM3v0_MOD_PDVT2 436 + +#define BSIM3v0_MOD_PDVT0W 437 +#define BSIM3v0_MOD_PDVT1W 438 +#define BSIM3v0_MOD_PDVT2W 439 + +#define BSIM3v0_MOD_PDROUT 440 +#define BSIM3v0_MOD_PDSUB 441 +#define BSIM3v0_MOD_PVTH0 442 +#define BSIM3v0_MOD_PUA 443 +#define BSIM3v0_MOD_PUA1 444 +#define BSIM3v0_MOD_PUB 445 +#define BSIM3v0_MOD_PUB1 446 +#define BSIM3v0_MOD_PUC 447 +#define BSIM3v0_MOD_PUC1 448 +#define BSIM3v0_MOD_PU0 449 +#define BSIM3v0_MOD_PUTE 450 +#define BSIM3v0_MOD_PVOFF 451 +#define BSIM3v0_MOD_PDELTA 452 +#define BSIM3v0_MOD_PRDSW 453 +#define BSIM3v0_MOD_PPRT 454 +#define BSIM3v0_MOD_PLDD 455 +#define BSIM3v0_MOD_PETA 456 +#define BSIM3v0_MOD_PETA0 457 +#define BSIM3v0_MOD_PETAB 458 +#define BSIM3v0_MOD_PPCLM 459 +#define BSIM3v0_MOD_PPDIBL1 460 +#define BSIM3v0_MOD_PPDIBL2 461 +#define BSIM3v0_MOD_PPSCBE1 462 +#define BSIM3v0_MOD_PPSCBE2 463 +#define BSIM3v0_MOD_PPVAG 464 +#define BSIM3v0_MOD_PWR 465 +#define BSIM3v0_MOD_PDWG 466 +#define BSIM3v0_MOD_PDWB 467 +#define BSIM3v0_MOD_PB0 468 +#define BSIM3v0_MOD_PB1 469 +#define BSIM3v0_MOD_PALPHA0 470 +#define BSIM3v0_MOD_PBETA0 471 +#define BSIM3v0_MOD_PPDIBLB 474 + +#define BSIM3v0_MOD_PPRWG 475 +#define BSIM3v0_MOD_PPRWB 476 + +#define BSIM3v0_MOD_PCDSCD 477 +#define BSIM3v0_MOD_PAGS 478 + +#define BSIM3v0_MOD_PFRINGE 481 +#define BSIM3v0_MOD_PELM 482 +#define BSIM3v0_MOD_PCGSL 483 +#define BSIM3v0_MOD_PCGDL 484 +#define BSIM3v0_MOD_PCKAPPA 485 +#define BSIM3v0_MOD_PCF 486 +#define BSIM3v0_MOD_PCLC 487 +#define BSIM3v0_MOD_PCLE 488 + +#define BSIM3v0_MOD_TNOM 501 +#define BSIM3v0_MOD_CGSO 502 +#define BSIM3v0_MOD_CGDO 503 +#define BSIM3v0_MOD_CGBO 504 +#define BSIM3v0_MOD_XPART 505 + +#define BSIM3v0_MOD_RSH 506 +#define BSIM3v0_MOD_JS 507 +#define BSIM3v0_MOD_PB 508 +#define BSIM3v0_MOD_MJ 509 +#define BSIM3v0_MOD_PBSW 510 +#define BSIM3v0_MOD_MJSW 511 +#define BSIM3v0_MOD_CJ 512 +#define BSIM3v0_MOD_CJSW 513 +#define BSIM3v0_MOD_NMOS 514 +#define BSIM3v0_MOD_PMOS 515 + +#define BSIM3v0_MOD_NOIA 516 +#define BSIM3v0_MOD_NOIB 517 +#define BSIM3v0_MOD_NOIC 518 + +#define BSIM3v0_MOD_LINT 519 +#define BSIM3v0_MOD_LL 520 +#define BSIM3v0_MOD_LLN 521 +#define BSIM3v0_MOD_LW 522 +#define BSIM3v0_MOD_LWN 523 +#define BSIM3v0_MOD_LWL 524 +#define BSIM3v0_MOD_LMIN 525 +#define BSIM3v0_MOD_LMAX 526 + +#define BSIM3v0_MOD_WINT 527 +#define BSIM3v0_MOD_WL 528 +#define BSIM3v0_MOD_WLN 529 +#define BSIM3v0_MOD_WW 530 +#define BSIM3v0_MOD_WWN 531 +#define BSIM3v0_MOD_WWL 532 +#define BSIM3v0_MOD_WMIN 533 +#define BSIM3v0_MOD_WMAX 534 + +#define BSIM3v0_MOD_DWC 535 +#define BSIM3v0_MOD_DLC 536 + +#define BSIM3v0_MOD_EM 537 +#define BSIM3v0_MOD_EF 538 +#define BSIM3v0_MOD_AF 539 +#define BSIM3v0_MOD_KF 540 + + +/* device questions */ +#define BSIM3v0_DNODE 601 +#define BSIM3v0_GNODE 602 +#define BSIM3v0_SNODE 603 +#define BSIM3v0_BNODE 604 +#define BSIM3v0_DNODEPRIME 605 +#define BSIM3v0_SNODEPRIME 606 +#define BSIM3v0_VBD 607 +#define BSIM3v0_VBS 608 +#define BSIM3v0_VGS 609 +#define BSIM3v0_VDS 610 +#define BSIM3v0_CD 611 +#define BSIM3v0_CBS 612 +#define BSIM3v0_CBD 613 +#define BSIM3v0_GM 614 +#define BSIM3v0_GDS 615 +#define BSIM3v0_GMBS 616 +#define BSIM3v0_GBD 617 +#define BSIM3v0_GBS 618 +#define BSIM3v0_QB 619 +#define BSIM3v0_CQB 620 +#define BSIM3v0_QG 621 +#define BSIM3v0_CQG 622 +#define BSIM3v0_QD 623 +#define BSIM3v0_CQD 624 +#define BSIM3v0_CGG 625 +#define BSIM3v0_CGD 626 +#define BSIM3v0_CGS 627 +#define BSIM3v0_CBG 628 +#define BSIM3v0_CAPBD 629 +#define BSIM3v0_CQBD 630 +#define BSIM3v0_CAPBS 631 +#define BSIM3v0_CQBS 632 +#define BSIM3v0_CDG 633 +#define BSIM3v0_CDD 634 +#define BSIM3v0_CDS 635 +#define BSIM3v0_VON 636 +#define BSIM3v0_VDSAT 637 +#define BSIM3v0_QBS 638 +#define BSIM3v0_QBD 639 +#define BSIM3v0_SOURCECONDUCT 640 +#define BSIM3v0_DRAINCONDUCT 641 +#define BSIM3v0_CBDB 642 +#define BSIM3v0_CBSB 643 + +#include "bsim3v0ext.h" + +extern void BSIM3v0evaluate(double,double,double,BSIM3v0instance*,BSIM3v0model*, + double*,double*,double*, double*, double*, double*, double*, + double*, double*, double*, double*, double*, double*, double*, + double*, double*, double*, double*, CKTcircuit*); + +#endif /*BSIM3v0*/ + + + diff --git a/src/spicelib/devices/bsim3v0/bsim3v0ext.h b/src/spicelib/devices/bsim3v0/bsim3v0ext.h new file mode 100644 index 000000000..02ad75173 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/bsim3v0ext.h @@ -0,0 +1,30 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1991 JianHui Huang and Min-Chie Jeng. +File: bsim3v0ext.h +**********/ + +extern int BSIM3v0acLoad(GENmodel *,CKTcircuit*); +extern int BSIM3v0ask(CKTcircuit *,GENinstance*,int,IFvalue*,IFvalue*); +extern int BSIM3v0convTest(GENmodel *,CKTcircuit*); +extern int BSIM3v0delete(GENmodel*,IFuid,GENinstance**); +extern void BSIM3v0destroy(GENmodel**); +extern int BSIM3v0getic(GENmodel*,CKTcircuit*); +extern int BSIM3v0load(GENmodel*,CKTcircuit*); +extern int BSIM3v0mAsk(CKTcircuit*,GENmodel *,int, IFvalue*); +extern int BSIM3v0mDelete(GENmodel**,IFuid,GENmodel*); +extern int BSIM3v0mParam(int,IFvalue*,GENmodel*); +extern void BSIM3v0mosCap(CKTcircuit*, double, double, double, double, + double, double, double, double, double, double, double, + double, double, double, double, double, double, double*, + double*, double*, double*, double*, double*, double*, double*, + double*, double*, double*, double*, double*, double*, double*, + double*); +extern int BSIM3v0param(int,IFvalue*,GENinstance*,IFvalue*); +extern int BSIM3v0pzLoad(GENmodel*,CKTcircuit*,SPcomplex*); +extern int BSIM3v0setup(SMPmatrix*,GENmodel*,CKTcircuit*,int*); +extern int BSIM3v0temp(GENmodel*,CKTcircuit*); +extern int BSIM3v0trunc(GENmodel*,CKTcircuit*,double*); +extern int BSIM3v0noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); +extern int BSIM3v0unsetup(GENmodel *, CKTcircuit *); + diff --git a/src/spicelib/devices/bsim3v0/bsim3v0init.c b/src/spicelib/devices/bsim3v0/bsim3v0init.c new file mode 100644 index 000000000..5dccaf3cc --- /dev/null +++ b/src/spicelib/devices/bsim3v0/bsim3v0init.c @@ -0,0 +1,82 @@ +#include + +#include + +#include "bsim3v0itf.h" +#include "bsim3v0ext.h" +#include "bsim3v0init.h" + +SPICEdev B3v0info = { + { "BSIM3v0", + "Berkeley Short Channel IGFET Model Version-3 (3.0)", + + &BSIM3v0nSize, + &BSIM3v0nSize, + BSIM3v0names, + + &BSIM3v0pTSize, + BSIM3v0pTable, + + &BSIM3v0mPTSize, + BSIM3v0mPTable, + +#ifdef XSPICE +/*---- Fixed by SDB 5.2.2003 to enable XSPICE/tclspice integration -----*/ + NULL, /* This is a SPICE device, it has no MIF info data */ + + 0, /* This is a SPICE device, it has no MIF info data */ + NULL, /* This is a SPICE device, it has no MIF info data */ + + 0, /* This is a SPICE device, it has no MIF info data */ + NULL, /* This is a SPICE device, it has no MIF info data */ + + 0, /* This is a SPICE device, it has no MIF info data */ + NULL, /* This is a SPICE device, it has no MIF info data */ +/*--------------------------- End of SDB fix -------------------------*/ +#endif + + DEV_DEFAULT + }, + + DEVparam : BSIM3v0param, + DEVmodParam : BSIM3v0mParam, + DEVload : BSIM3v0load, + DEVsetup : BSIM3v0setup, + DEVunsetup : BSIM3v0unsetup, + DEVpzSetup : BSIM3v0setup, + DEVtemperature: BSIM3v0temp, + DEVtrunc : BSIM3v0trunc, + DEVfindBranch : NULL, + DEVacLoad : BSIM3v0acLoad, + DEVaccept : NULL, + DEVdestroy : BSIM3v0destroy, + DEVmodDelete : BSIM3v0mDelete, + DEVdelete : BSIM3v0delete, + DEVsetic : BSIM3v0getic, + DEVask : BSIM3v0ask, + DEVmodAsk : BSIM3v0mAsk, + DEVpzLoad : BSIM3v0pzLoad, + DEVconvTest : BSIM3v0convTest, + DEVsenSetup : NULL, + DEVsenLoad : NULL, + DEVsenUpdate : NULL, + DEVsenAcLoad : NULL, + DEVsenPrint : NULL, + DEVsenTrunc : NULL, + DEVdisto : NULL, + DEVnoise : BSIM3v0noise, +#ifdef CIDER + DEVdump : NULL, + DEVacct : NULL, +#endif + DEVinstSize : &BSIM3v0iSize, + DEVmodSize : &BSIM3v0mSize + +}; + + +SPICEdev * +get_bsim3v0_info(void) +{ + return &B3v0info; +} diff --git a/src/spicelib/devices/bsim3v0/bsim3v0init.h b/src/spicelib/devices/bsim3v0/bsim3v0init.h new file mode 100644 index 000000000..b4692b4cd --- /dev/null +++ b/src/spicelib/devices/bsim3v0/bsim3v0init.h @@ -0,0 +1,13 @@ +#ifndef _BSIM3v0INIT_H +#define _BSIM3v0INIT_H + +extern IFparm BSIM3v0pTable[ ]; +extern IFparm BSIM3v0mPTable[ ]; +extern char *BSIM3v0names[ ]; +extern int BSIM3v0pTSize; +extern int BSIM3v0mPTSize; +extern int BSIM3v0nSize; +extern int BSIM3v0iSize; +extern int BSIM3v0mSize; + +#endif diff --git a/src/spicelib/devices/bsim3v0/bsim3v0itf.h b/src/spicelib/devices/bsim3v0/bsim3v0itf.h new file mode 100644 index 000000000..ecf993ea1 --- /dev/null +++ b/src/spicelib/devices/bsim3v0/bsim3v0itf.h @@ -0,0 +1,12 @@ +/********** +Copyright 1990 Regents of the University of California. All rights reserved. +Author: 1991 JianHui Huang and Min-Chie Jeng. +File: bsim3v0itf.h +**********/ + +#ifdef DEV_bsim3v0 + +SPICEdev *get_bsim3v0_info(void); + +#endif +