From 4ec429100fd40505c8f364ee096923f4bc277c91 Mon Sep 17 00:00:00 2001 From: dwarning Date: Wed, 31 Oct 2007 07:22:05 +0000 Subject: [PATCH] bsim4v4 version code added --- configure.in | 1 + src/Makefile.am | 1 + src/spicelib/devices/Makefile.am | 2 + src/spicelib/devices/bsim4v4/ChangeLog | 0 src/spicelib/devices/bsim4v4/Makefile.am | 35 + src/spicelib/devices/bsim4v4/b4v4.c | 824 ++++ src/spicelib/devices/bsim4v4/b4v4acld.c | 672 +++ src/spicelib/devices/bsim4v4/b4v4ask.c | 323 ++ src/spicelib/devices/bsim4v4/b4v4check.c | 747 +++ src/spicelib/devices/bsim4v4/b4v4cvtest.c | 199 + src/spicelib/devices/bsim4v4/b4v4del.c | 41 + src/spicelib/devices/bsim4v4/b4v4dest.c | 38 + src/spicelib/devices/bsim4v4/b4v4geo.c | 385 ++ src/spicelib/devices/bsim4v4/b4v4getic.c | 44 + src/spicelib/devices/bsim4v4/b4v4ld.c | 4743 ++++++++++++++++++++ src/spicelib/devices/bsim4v4/b4v4mask.c | 1979 ++++++++ src/spicelib/devices/bsim4v4/b4v4mdel.c | 46 + src/spicelib/devices/bsim4v4/b4v4mpar.c | 2817 ++++++++++++ src/spicelib/devices/bsim4v4/b4v4noi.c | 488 ++ src/spicelib/devices/bsim4v4/b4v4par.c | 169 + src/spicelib/devices/bsim4v4/b4v4pzld.c | 758 ++++ src/spicelib/devices/bsim4v4/b4v4set.c | 1922 ++++++++ src/spicelib/devices/bsim4v4/b4v4temp.c | 1709 +++++++ src/spicelib/devices/bsim4v4/b4v4trunc.c | 58 + src/spicelib/devices/bsim4v4/bsim4v4def.h | 2935 ++++++++++++ src/spicelib/devices/bsim4v4/bsim4v4ext.h | 33 + src/spicelib/devices/bsim4v4/bsim4v4init.c | 83 + src/spicelib/devices/bsim4v4/bsim4v4init.h | 13 + src/spicelib/devices/bsim4v4/bsim4v4itf.h | 13 + src/spicelib/devices/dev.c | 112 +- src/spicelib/parser/inp2m.c | 1 + src/spicelib/parser/inpdomod.c | 15 +- src/spicelib/parser/inpgmod.c | 2 +- 33 files changed, 21145 insertions(+), 63 deletions(-) create mode 100644 src/spicelib/devices/bsim4v4/ChangeLog create mode 100644 src/spicelib/devices/bsim4v4/Makefile.am create mode 100644 src/spicelib/devices/bsim4v4/b4v4.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4acld.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4ask.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4check.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4cvtest.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4del.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4dest.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4geo.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4getic.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4ld.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4mask.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4mdel.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4mpar.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4noi.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4par.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4pzld.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4set.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4temp.c create mode 100644 src/spicelib/devices/bsim4v4/b4v4trunc.c create mode 100644 src/spicelib/devices/bsim4v4/bsim4v4def.h create mode 100644 src/spicelib/devices/bsim4v4/bsim4v4ext.h create mode 100644 src/spicelib/devices/bsim4v4/bsim4v4init.c create mode 100644 src/spicelib/devices/bsim4v4/bsim4v4init.h create mode 100644 src/spicelib/devices/bsim4v4/bsim4v4itf.h diff --git a/configure.in b/configure.in index 7ef24f712..9de578a95 100644 --- a/configure.in +++ b/configure.in @@ -812,6 +812,7 @@ src/spicelib/devices/bsim3v1a/Makefile \ src/spicelib/devices/bsim3v1s/Makefile \ src/spicelib/devices/bsim3/Makefile \ src/spicelib/devices/bsim4/Makefile \ +src/spicelib/devices/bsim4v4/Makefile \ src/spicelib/devices/bsim3soi/Makefile \ src/spicelib/devices/bsim3soi_pd/Makefile \ src/spicelib/devices/bsim3soi_fd/Makefile \ diff --git a/src/Makefile.am b/src/Makefile.am index 2c31ab9f2..f3827a4b8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,6 +34,7 @@ DYNAMIC_DEVICELIBS = \ spicelib/devices/bsim3v1s/libbsim3v1s.a \ spicelib/devices/bsim3v1a/libbsim3v1a.a \ spicelib/devices/bsim4/libbsim4.a \ + spicelib/devices/bsim4v4/libbsim4v4.a \ spicelib/devices/cap/libcap.a \ spicelib/devices/bsim3soi/libbsim3soi.a \ spicelib/devices/bsim3soi_pd/libbsim3soipd.a \ diff --git a/src/spicelib/devices/Makefile.am b/src/spicelib/devices/Makefile.am index 05d1417f8..82120051a 100644 --- a/src/spicelib/devices/Makefile.am +++ b/src/spicelib/devices/Makefile.am @@ -9,6 +9,7 @@ SUBDIRS = \ bsim3 \ bsim3soi \ bsim4 \ + bsim4v4 \ bsim3v0 \ bsim3v1 \ bsim3v1s \ @@ -61,6 +62,7 @@ DIST_SUBDIRS = \ bsim3 \ bsim3soi \ bsim4 \ + bsim4v4 \ bsim3v0 \ bsim3v1 \ bsim3v1s \ diff --git a/src/spicelib/devices/bsim4v4/ChangeLog b/src/spicelib/devices/bsim4v4/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/src/spicelib/devices/bsim4v4/Makefile.am b/src/spicelib/devices/bsim4v4/Makefile.am new file mode 100644 index 000000000..57180eb55 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/Makefile.am @@ -0,0 +1,35 @@ +## Process this file with automake to produce Makefile.in + +pkglib_LIBRARIES = libbsim4v4.a + +libbsim4v4_a_SOURCES = \ + b4v4.c \ + b4v4acld.c \ + b4v4ask.c \ + b4v4check.c \ + b4v4cvtest.c \ + b4v4del.c \ + b4v4dest.c \ + b4v4geo.c \ + b4v4getic.c \ + b4v4ld.c \ + b4v4mask.c \ + b4v4mdel.c \ + b4v4mpar.c \ + b4v4noi.c \ + b4v4par.c \ + b4v4pzld.c \ + b4v4set.c \ + b4v4temp.c \ + b4v4trunc.c \ + bsim4v4def.h \ + bsim4v4ext.h \ + bsim4v4init.c \ + bsim4v4init.h \ + bsim4v4itf.h + + + +INCLUDES = -I$(top_srcdir)/src/include + +MAINTAINERCLEANFILES = Makefile.in diff --git a/src/spicelib/devices/bsim4v4/b4v4.c b/src/spicelib/devices/bsim4v4/b4v4.c new file mode 100644 index 000000000..71ae71d6b --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4.c @@ -0,0 +1,824 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 11/15/2002. + * Modified by Xuemei Xi, 05/09/2003. + * Modified by Xuemei Xi, 03/04/2004. + **********/ + +#include "ngspice.h" +#include "devdefs.h" +#include "bsim4v4def.h" +#include "suffix.h" + +IFparm BSIM4V4pTable[] = { /* parameters */ +IOP( "l", BSIM4V4_L, IF_REAL , "Length"), +IOP( "w", BSIM4V4_W, IF_REAL , "Width"), +IOP( "m", BSIM4V4_M, IF_REAL , "Separate Parallel multiplier"), +IOP( "nf", BSIM4V4_NF, IF_REAL , "Number of fingers"), +IOP( "sa", BSIM4V4_SA, IF_REAL , "distance between OD edge to poly of one side "), +IOP( "sb", BSIM4V4_SB, IF_REAL , "distance between OD edge to poly of the other side"), +IOP( "sd", BSIM4V4_SD, IF_REAL , "distance between neighbour fingers"), +IOP( "min", BSIM4V4_MIN, IF_INTEGER , "Minimize either D or S"), +IOP( "ad", BSIM4V4_AD, IF_REAL , "Drain area"), +IOP( "as", BSIM4V4_AS, IF_REAL , "Source area"), +IOP( "pd", BSIM4V4_PD, IF_REAL , "Drain perimeter"), +IOP( "ps", BSIM4V4_PS, IF_REAL , "Source perimeter"), +IOP( "nrd", BSIM4V4_NRD, IF_REAL , "Number of squares in drain"), +IOP( "nrs", BSIM4V4_NRS, IF_REAL , "Number of squares in source"), +IOP( "off", BSIM4V4_OFF, IF_FLAG , "Device is initially off"), +IOP( "rbdb", BSIM4V4_RBDB, IF_REAL , "Body resistance"), +IOP( "rbsb", BSIM4V4_RBSB, IF_REAL , "Body resistance"), +IOP( "rbpb", BSIM4V4_RBPB, IF_REAL , "Body resistance"), +IOP( "rbps", BSIM4V4_RBPS, IF_REAL , "Body resistance"), +IOP( "rbpd", BSIM4V4_RBPD, IF_REAL , "Body resistance"), +IOP( "trnqsmod", BSIM4V4_TRNQSMOD, IF_INTEGER, "Transient NQS model selector"), +IOP( "acnqsmod", BSIM4V4_ACNQSMOD, IF_INTEGER, "AC NQS model selector"), +IOP( "rbodymod", BSIM4V4_RBODYMOD, IF_INTEGER, "Distributed body R model selector"), +IOP( "rgatemod", BSIM4V4_RGATEMOD, IF_INTEGER, "Gate resistance model selector"), +IOP( "geomod", BSIM4V4_GEOMOD, IF_INTEGER, "Geometry dependent parasitics model selector"), +IOP( "rgeomod", BSIM4V4_RGEOMOD, IF_INTEGER, "S/D resistance and contact model selector"), +IP( "ic", BSIM4V4_IC, IF_REALVEC , "Vector of DS,GS,BS initial voltages"), +OP( "gmbs", BSIM4V4_GMBS, IF_REAL, "Gmb"), +OP( "gm", BSIM4V4_GM, IF_REAL, "Gm"), +OP( "gds", BSIM4V4_GDS, IF_REAL, "Gds"), +OP( "vdsat", BSIM4V4_VDSAT, IF_REAL, "Vdsat"), +OP( "vth", BSIM4V4_VON, IF_REAL, "Vth"), +OP( "id", BSIM4V4_CD, IF_REAL, "Ids"), +OP( "ibd", BSIM4V4_CBD, IF_REAL, "Ibd"), +OP( "ibs", BSIM4V4_CBS, IF_REAL, "Ibs"), +OP( "gbd", BSIM4V4_GBD, IF_REAL, "gbd"), +OP( "gbs", BSIM4V4_GBS, IF_REAL, "gbs"), +OP( "isub", BSIM4V4_CSUB, IF_REAL, "Isub"), +OP( "igidl", BSIM4V4_IGIDL, IF_REAL, "Igidl"), +OP( "igisl", BSIM4V4_IGISL, IF_REAL, "Igisl"), +OP( "igs", BSIM4V4_IGS, IF_REAL, "Igs"), +OP( "igd", BSIM4V4_IGD, IF_REAL, "Igd"), +OP( "igb", BSIM4V4_IGB, IF_REAL, "Igb"), +OP( "igcs", BSIM4V4_IGCS, IF_REAL, "Igcs"), +OP( "igcd", BSIM4V4_IGCD, IF_REAL, "Igcd"), +OP( "vbs", BSIM4V4_VBS, IF_REAL, "Vbs"), +OP( "vgs", BSIM4V4_VGS, IF_REAL, "Vgs"), +OP( "vds", BSIM4V4_VDS, IF_REAL, "Vds"), +OP( "cgg", BSIM4V4_CGGB, IF_REAL, "Cggb"), +OP( "cgs", BSIM4V4_CGSB, IF_REAL, "Cgsb"), +OP( "cgd", BSIM4V4_CGDB, IF_REAL, "Cgdb"), +OP( "cbg", BSIM4V4_CBGB, IF_REAL, "Cbgb"), +OP( "cbd", BSIM4V4_CBDB, IF_REAL, "Cbdb"), +OP( "cbs", BSIM4V4_CBSB, IF_REAL, "Cbsb"), +OP( "cdg", BSIM4V4_CDGB, IF_REAL, "Cdgb"), +OP( "cdd", BSIM4V4_CDDB, IF_REAL, "Cddb"), +OP( "cds", BSIM4V4_CDSB, IF_REAL, "Cdsb"), +OP( "csg", BSIM4V4_CSGB, IF_REAL, "Csgb"), +OP( "csd", BSIM4V4_CSDB, IF_REAL, "Csdb"), +OP( "css", BSIM4V4_CSSB, IF_REAL, "Cssb"), +OP( "cgb", BSIM4V4_CGBB, IF_REAL, "Cgbb"), +OP( "cdb", BSIM4V4_CDBB, IF_REAL, "Cdbb"), +OP( "csb", BSIM4V4_CSBB, IF_REAL, "Csbb"), +OP( "cbb", BSIM4V4_CBBB, IF_REAL, "Cbbb"), +OP( "capbd", BSIM4V4_CAPBD, IF_REAL, "Capbd"), +OP( "capbs", BSIM4V4_CAPBS, IF_REAL, "Capbs"), +OP( "qg", BSIM4V4_QG, IF_REAL, "Qgate"), +OP( "qb", BSIM4V4_QB, IF_REAL, "Qbulk"), +OP( "qd", BSIM4V4_QD, IF_REAL, "Qdrain"), +OP( "qs", BSIM4V4_QS, IF_REAL, "Qsource"), +OP( "qinv", BSIM4V4_QINV, IF_REAL, "Qinversion"), +}; + +IFparm BSIM4V4mPTable[] = { /* model parameters */ +IOP( "rgeomod", BSIM4V4_MOD_RGEOMOD, IF_INTEGER, "S/D resistance and contact model selector"), +IOP( "capmod", BSIM4V4_MOD_CAPMOD, IF_INTEGER, "Capacitance model selector"), +IOP( "diomod", BSIM4V4_MOD_DIOMOD, IF_INTEGER, "Diode IV model selector"), +IOP( "rdsmod", BSIM4V4_MOD_RDSMOD, IF_INTEGER, "Bias-dependent S/D resistance model selector"), +IOP( "trnqsmod", BSIM4V4_MOD_TRNQSMOD, IF_INTEGER, "Transient NQS model selector"), +IOP( "acnqsmod", BSIM4V4_MOD_ACNQSMOD, IF_INTEGER, "AC NQS model selector"), +IOP( "mobmod", BSIM4V4_MOD_MOBMOD, IF_INTEGER, "Mobility model selector"), +IOP( "rbodymod", BSIM4V4_MOD_RBODYMOD, IF_INTEGER, "Distributed body R model selector"), +IOP( "rgatemod", BSIM4V4_MOD_RGATEMOD, IF_INTEGER, "Gate R model selector"), +IOP( "permod", BSIM4V4_MOD_PERMOD, IF_INTEGER, "Pd and Ps model selector"), +IOP( "geomod", BSIM4V4_MOD_GEOMOD, IF_INTEGER, "Geometry dependent parasitics model selector"), +IOP( "fnoimod", BSIM4V4_MOD_FNOIMOD, IF_INTEGER, "Flicker noise model selector"), +IOP( "tnoimod", BSIM4V4_MOD_TNOIMOD, IF_INTEGER, "Thermal noise model selector"), +IOP( "igcmod", BSIM4V4_MOD_IGCMOD, IF_INTEGER, "Gate-to-channel Ig model selector"), +IOP( "igbmod", BSIM4V4_MOD_IGBMOD, IF_INTEGER, "Gate-to-body Ig model selector"), +IOP( "tempmod", BSIM4V4_MOD_TEMPMOD, IF_INTEGER, "Temperature model selector"), +IOP( "paramchk", BSIM4V4_MOD_PARAMCHK, IF_INTEGER, "Model parameter checking selector"), +IOP( "binunit", BSIM4V4_MOD_BINUNIT, IF_INTEGER, "Bin unit selector"), +IOP( "version", BSIM4V4_MOD_VERSION, IF_STRING, "parameter for model version"), +IOP( "toxe", BSIM4V4_MOD_TOXE, IF_REAL, "Electrical gate oxide thickness in meters"), +IOP( "toxp", BSIM4V4_MOD_TOXP, IF_REAL, "Physical gate oxide thickness in meters"), +IOP( "toxm", BSIM4V4_MOD_TOXM, IF_REAL, "Gate oxide thickness at which parameters are extracted"), +IOP( "toxref", BSIM4V4_MOD_TOXREF, IF_REAL, "Target tox value"), +IOP( "dtox", BSIM4V4_MOD_DTOX, IF_REAL, "Defined as (toxe - toxp) "), +IOP( "epsrox", BSIM4V4_MOD_EPSROX, IF_REAL, "Dielectric constant of the gate oxide relative to vacuum"), +IOP( "cdsc", BSIM4V4_MOD_CDSC, IF_REAL, "Drain/Source and channel coupling capacitance"), +IOP( "cdscb", BSIM4V4_MOD_CDSCB, IF_REAL, "Body-bias dependence of cdsc"), +IOP( "cdscd", BSIM4V4_MOD_CDSCD, IF_REAL, "Drain-bias dependence of cdsc"), +IOP( "cit", BSIM4V4_MOD_CIT, IF_REAL, "Interface state capacitance"), +IOP( "nfactor", BSIM4V4_MOD_NFACTOR, IF_REAL, "Subthreshold swing Coefficient"), +IOP( "xj", BSIM4V4_MOD_XJ, IF_REAL, "Junction depth in meters"), +IOP( "vsat", BSIM4V4_MOD_VSAT, IF_REAL, "Saturation velocity at tnom"), +IOP( "at", BSIM4V4_MOD_AT, IF_REAL, "Temperature coefficient of vsat"), +IOP( "a0", BSIM4V4_MOD_A0, IF_REAL, "Non-uniform depletion width effect coefficient."), +IOP( "ags", BSIM4V4_MOD_AGS, IF_REAL, "Gate bias coefficient of Abulk."), +IOP( "a1", BSIM4V4_MOD_A1, IF_REAL, "Non-saturation effect coefficient"), +IOP( "a2", BSIM4V4_MOD_A2, IF_REAL, "Non-saturation effect coefficient"), +IOP( "keta", BSIM4V4_MOD_KETA, IF_REAL, "Body-bias coefficient of non-uniform depletion width effect."), +IOP( "nsub", BSIM4V4_MOD_NSUB, IF_REAL, "Substrate doping concentration"), +IOP( "ndep", BSIM4V4_MOD_NDEP, IF_REAL, "Channel doping concentration at the depletion edge"), +IOP( "nsd", BSIM4V4_MOD_NSD, IF_REAL, "S/D doping concentration"), +IOP( "phin", BSIM4V4_MOD_PHIN, IF_REAL, "Adjusting parameter for surface potential due to non-uniform vertical doping"), +IOP( "ngate", BSIM4V4_MOD_NGATE, IF_REAL, "Poly-gate doping concentration"), +IOP( "gamma1", BSIM4V4_MOD_GAMMA1, IF_REAL, "Vth body coefficient"), +IOP( "gamma2", BSIM4V4_MOD_GAMMA2, IF_REAL, "Vth body coefficient"), +IOP( "vbx", BSIM4V4_MOD_VBX, IF_REAL, "Vth transition body Voltage"), +IOP( "vbm", BSIM4V4_MOD_VBM, IF_REAL, "Maximum body voltage"), + +IOP( "xt", BSIM4V4_MOD_XT, IF_REAL, "Doping depth"), +IOP( "k1", BSIM4V4_MOD_K1, IF_REAL, "Bulk effect coefficient 1"), +IOP( "kt1", BSIM4V4_MOD_KT1, IF_REAL, "Temperature coefficient of Vth"), +IOP( "kt1l", BSIM4V4_MOD_KT1L, IF_REAL, "Temperature coefficient of Vth"), +IOP( "kt2", BSIM4V4_MOD_KT2, IF_REAL, "Body-coefficient of kt1"), +IOP( "k2", BSIM4V4_MOD_K2, IF_REAL, "Bulk effect coefficient 2"), +IOP( "k3", BSIM4V4_MOD_K3, IF_REAL, "Narrow width effect coefficient"), +IOP( "k3b", BSIM4V4_MOD_K3B, IF_REAL, "Body effect coefficient of k3"), +IOP( "w0", BSIM4V4_MOD_W0, IF_REAL, "Narrow width effect parameter"), +IOP( "dvtp0", BSIM4V4_MOD_DVTP0, IF_REAL, "First parameter for Vth shift due to pocket"), +IOP( "dvtp1", BSIM4V4_MOD_DVTP1, IF_REAL, "Second parameter for Vth shift due to pocket"), +IOP( "lpe0", BSIM4V4_MOD_LPE0, IF_REAL, "Equivalent length of pocket region at zero bias"), +IOP( "lpeb", BSIM4V4_MOD_LPEB, IF_REAL, "Equivalent length of pocket region accounting for body bias"), +IOP( "dvt0", BSIM4V4_MOD_DVT0, IF_REAL, "Short channel effect coeff. 0"), +IOP( "dvt1", BSIM4V4_MOD_DVT1, IF_REAL, "Short channel effect coeff. 1"), +IOP( "dvt2", BSIM4V4_MOD_DVT2, IF_REAL, "Short channel effect coeff. 2"), +IOP( "dvt0w", BSIM4V4_MOD_DVT0W, IF_REAL, "Narrow Width coeff. 0"), +IOP( "dvt1w", BSIM4V4_MOD_DVT1W, IF_REAL, "Narrow Width effect coeff. 1"), +IOP( "dvt2w", BSIM4V4_MOD_DVT2W, IF_REAL, "Narrow Width effect coeff. 2"), +IOP( "drout", BSIM4V4_MOD_DROUT, IF_REAL, "DIBL coefficient of output resistance"), +IOP( "dsub", BSIM4V4_MOD_DSUB, IF_REAL, "DIBL coefficient in the subthreshold region"), +IOP( "vth0", BSIM4V4_MOD_VTH0, IF_REAL,"Threshold voltage"), +IOP( "vtho", BSIM4V4_MOD_VTH0, IF_REAL,"Threshold voltage"), +IOP( "ua", BSIM4V4_MOD_UA, IF_REAL, "Linear gate dependence of mobility"), +IOP( "ua1", BSIM4V4_MOD_UA1, IF_REAL, "Temperature coefficient of ua"), +IOP( "ub", BSIM4V4_MOD_UB, IF_REAL, "Quadratic gate dependence of mobility"), +IOP( "ub1", BSIM4V4_MOD_UB1, IF_REAL, "Temperature coefficient of ub"), +IOP( "uc", BSIM4V4_MOD_UC, IF_REAL, "Body-bias dependence of mobility"), +IOP( "uc1", BSIM4V4_MOD_UC1, IF_REAL, "Temperature coefficient of uc"), +IOP( "u0", BSIM4V4_MOD_U0, IF_REAL, "Low-field mobility at Tnom"), +IOP( "eu", BSIM4V4_MOD_EU, IF_REAL, "Mobility exponent"), +IOP( "ute", BSIM4V4_MOD_UTE, IF_REAL, "Temperature coefficient of mobility"), +IOP( "voff", BSIM4V4_MOD_VOFF, IF_REAL, "Threshold voltage offset"), +IOP( "minv", BSIM4V4_MOD_MINV, IF_REAL, "Fitting parameter for moderate invversion in Vgsteff"), +IOP( "voffl", BSIM4V4_MOD_VOFFL, IF_REAL, "Length dependence parameter for Vth offset"), +IOP( "tnom", BSIM4V4_MOD_TNOM, IF_REAL, "Parameter measurement temperature"), +IOP( "cgso", BSIM4V4_MOD_CGSO, IF_REAL, "Gate-source overlap capacitance per width"), +IOP( "cgdo", BSIM4V4_MOD_CGDO, IF_REAL, "Gate-drain overlap capacitance per width"), +IOP( "cgbo", BSIM4V4_MOD_CGBO, IF_REAL, "Gate-bulk overlap capacitance per length"), +IOP( "xpart", BSIM4V4_MOD_XPART, IF_REAL, "Channel charge partitioning"), +IOP( "delta", BSIM4V4_MOD_DELTA, IF_REAL, "Effective Vds parameter"), +IOP( "rsh", BSIM4V4_MOD_RSH, IF_REAL, "Source-drain sheet resistance"), +IOP( "rdsw", BSIM4V4_MOD_RDSW, IF_REAL, "Source-drain resistance per width"), +IOP( "rdswmin", BSIM4V4_MOD_RDSWMIN, IF_REAL, "Source-drain resistance per width at high Vg"), +IOP( "rsw", BSIM4V4_MOD_RSW, IF_REAL, "Source resistance per width"), +IOP( "rdw", BSIM4V4_MOD_RDW, IF_REAL, "Drain resistance per width"), +IOP( "rdwmin", BSIM4V4_MOD_RDWMIN, IF_REAL, "Drain resistance per width at high Vg"), +IOP( "rswmin", BSIM4V4_MOD_RSWMIN, IF_REAL, "Source resistance per width at high Vg"), + +IOP( "prwg", BSIM4V4_MOD_PRWG, IF_REAL, "Gate-bias effect on parasitic resistance "), +IOP( "prwb", BSIM4V4_MOD_PRWB, IF_REAL, "Body-effect on parasitic resistance "), + +IOP( "prt", BSIM4V4_MOD_PRT, IF_REAL, "Temperature coefficient of parasitic resistance "), +IOP( "eta0", BSIM4V4_MOD_ETA0, IF_REAL, "Subthreshold region DIBL coefficient"), +IOP( "etab", BSIM4V4_MOD_ETAB, IF_REAL, "Subthreshold region DIBL coefficient"), +IOP( "pclm", BSIM4V4_MOD_PCLM, IF_REAL, "Channel length modulation Coefficient"), +IOP( "pdiblc1", BSIM4V4_MOD_PDIBL1, IF_REAL, "Drain-induced barrier lowering coefficient"), +IOP( "pdiblc2", BSIM4V4_MOD_PDIBL2, IF_REAL, "Drain-induced barrier lowering coefficient"), +IOP( "pdiblcb", BSIM4V4_MOD_PDIBLB, IF_REAL, "Body-effect on drain-induced barrier lowering"), +IOP( "fprout", BSIM4V4_MOD_FPROUT, IF_REAL, "Rout degradation coefficient for pocket devices"), +IOP( "pdits", BSIM4V4_MOD_PDITS, IF_REAL, "Coefficient for drain-induced Vth shifts"), +IOP( "pditsl", BSIM4V4_MOD_PDITSL, IF_REAL, "Length dependence of drain-induced Vth shifts"), +IOP( "pditsd", BSIM4V4_MOD_PDITSD, IF_REAL, "Vds dependence of drain-induced Vth shifts"), +IOP( "pscbe1", BSIM4V4_MOD_PSCBE1, IF_REAL, "Substrate current body-effect coefficient"), +IOP( "pscbe2", BSIM4V4_MOD_PSCBE2, IF_REAL, "Substrate current body-effect coefficient"), +IOP( "pvag", BSIM4V4_MOD_PVAG, IF_REAL, "Gate dependence of output resistance parameter"), + +IOP( "jss", BSIM4V4_MOD_JSS, IF_REAL, "Bottom source junction reverse saturation current density"), +IOP( "jsws", BSIM4V4_MOD_JSWS, IF_REAL, "Isolation edge sidewall source junction reverse saturation current density"), +IOP( "jswgs", BSIM4V4_MOD_JSWGS, IF_REAL, "Gate edge source junction reverse saturation current density"), +IOP( "pbs", BSIM4V4_MOD_PBS, IF_REAL, "Source junction built-in potential"), +IOP( "njs", BSIM4V4_MOD_NJS, IF_REAL, "Source junction emission coefficient"), +IOP( "xtis", BSIM4V4_MOD_XTIS, IF_REAL, "Source junction current temperature exponent"), +IOP( "mjs", BSIM4V4_MOD_MJS, IF_REAL, "Source bottom junction capacitance grading coefficient"), +IOP( "pbsws", BSIM4V4_MOD_PBSWS, IF_REAL, "Source sidewall junction capacitance built in potential"), +IOP( "mjsws", BSIM4V4_MOD_MJSWS, IF_REAL, "Source sidewall junction capacitance grading coefficient"), +IOP( "pbswgs", BSIM4V4_MOD_PBSWGS, IF_REAL, "Source (gate side) sidewall junction capacitance built in potential"), +IOP( "mjswgs", BSIM4V4_MOD_MJSWGS, IF_REAL, "Source (gate side) sidewall junction capacitance grading coefficient"), +IOP( "cjs", BSIM4V4_MOD_CJS, IF_REAL, "Source bottom junction capacitance per unit area"), +IOP( "cjsws", BSIM4V4_MOD_CJSWS, IF_REAL, "Source sidewall junction capacitance per unit periphery"), +IOP( "cjswgs", BSIM4V4_MOD_CJSWGS, IF_REAL, "Source (gate side) sidewall junction capacitance per unit width"), + +IOP( "jsd", BSIM4V4_MOD_JSD, IF_REAL, "Bottom drain junction reverse saturation current density"), +IOP( "jswd", BSIM4V4_MOD_JSWD, IF_REAL, "Isolation edge sidewall drain junction reverse saturation current density"), +IOP( "jswgd", BSIM4V4_MOD_JSWGD, IF_REAL, "Gate edge drain junction reverse saturation current density"), +IOP( "pbd", BSIM4V4_MOD_PBD, IF_REAL, "Drain junction built-in potential"), +IOP( "njd", BSIM4V4_MOD_NJD, IF_REAL, "Drain junction emission coefficient"), +IOP( "xtid", BSIM4V4_MOD_XTID, IF_REAL, "Drainjunction current temperature exponent"), +IOP( "mjd", BSIM4V4_MOD_MJD, IF_REAL, "Drain bottom junction capacitance grading coefficient"), +IOP( "pbswd", BSIM4V4_MOD_PBSWD, IF_REAL, "Drain sidewall junction capacitance built in potential"), +IOP( "mjswd", BSIM4V4_MOD_MJSWD, IF_REAL, "Drain sidewall junction capacitance grading coefficient"), +IOP( "pbswgd", BSIM4V4_MOD_PBSWGD, IF_REAL, "Drain (gate side) sidewall junction capacitance built in potential"), +IOP( "mjswgd", BSIM4V4_MOD_MJSWGD, IF_REAL, "Drain (gate side) sidewall junction capacitance grading coefficient"), +IOP( "cjd", BSIM4V4_MOD_CJD, IF_REAL, "Drain bottom junction capacitance per unit area"), +IOP( "cjswd", BSIM4V4_MOD_CJSWD, IF_REAL, "Drain sidewall junction capacitance per unit periphery"), +IOP( "cjswgd", BSIM4V4_MOD_CJSWGD, IF_REAL, "Drain (gate side) sidewall junction capacitance per unit width"), + +IOP( "vfbcv", BSIM4V4_MOD_VFBCV, IF_REAL, "Flat Band Voltage parameter for capmod=0 only"), +IOP( "vfb", BSIM4V4_MOD_VFB, IF_REAL, "Flat Band Voltage"), +IOP( "tpb", BSIM4V4_MOD_TPB, IF_REAL, "Temperature coefficient of pb"), +IOP( "tcj", BSIM4V4_MOD_TCJ, IF_REAL, "Temperature coefficient of cj"), +IOP( "tpbsw", BSIM4V4_MOD_TPBSW, IF_REAL, "Temperature coefficient of pbsw"), +IOP( "tcjsw", BSIM4V4_MOD_TCJSW, IF_REAL, "Temperature coefficient of cjsw"), +IOP( "tpbswg", BSIM4V4_MOD_TPBSWG, IF_REAL, "Temperature coefficient of pbswg"), +IOP( "tcjswg", BSIM4V4_MOD_TCJSWG, IF_REAL, "Temperature coefficient of cjswg"), +IOP( "acde", BSIM4V4_MOD_ACDE, IF_REAL, "Exponential coefficient for finite charge thickness"), +IOP( "moin", BSIM4V4_MOD_MOIN, IF_REAL, "Coefficient for gate-bias dependent surface potential"), +IOP( "noff", BSIM4V4_MOD_NOFF, IF_REAL, "C-V turn-on/off parameter"), +IOP( "voffcv", BSIM4V4_MOD_VOFFCV, IF_REAL, "C-V lateral-shift parameter"), +IOP( "dmcg", BSIM4V4_MOD_DMCG, IF_REAL, "Distance of Mid-Contact to Gate edge"), +IOP( "dmci", BSIM4V4_MOD_DMCI, IF_REAL, "Distance of Mid-Contact to Isolation"), +IOP( "dmdg", BSIM4V4_MOD_DMDG, IF_REAL, "Distance of Mid-Diffusion to Gate edge"), +IOP( "dmcgt", BSIM4V4_MOD_DMCGT, IF_REAL, "Distance of Mid-Contact to Gate edge in Test structures"), +IOP( "xgw", BSIM4V4_MOD_XGW, IF_REAL, "Distance from gate contact center to device edge"), +IOP( "xgl", BSIM4V4_MOD_XGL, IF_REAL, "Variation in Ldrawn"), +IOP( "rshg", BSIM4V4_MOD_RSHG, IF_REAL, "Gate sheet resistance"), +IOP( "ngcon", BSIM4V4_MOD_NGCON, IF_REAL, "Number of gate contacts"), +IOP( "xrcrg1", BSIM4V4_MOD_XRCRG1, IF_REAL, "First fitting parameter the bias-dependent Rg"), +IOP( "xrcrg2", BSIM4V4_MOD_XRCRG2, IF_REAL, "Second fitting parameter the bias-dependent Rg"), +IOP( "lambda", BSIM4V4_MOD_LAMBDA, IF_REAL, " Velocity overshoot parameter"), +IOP( "vtl", BSIM4V4_MOD_VTL, IF_REAL, " thermal velocity"), +IOP( "lc", BSIM4V4_MOD_LC, IF_REAL, " back scattering parameter"), +IOP( "xn", BSIM4V4_MOD_XN, IF_REAL, " back scattering parameter"), +IOP( "vfbsdoff", BSIM4V4_MOD_VFBSDOFF, IF_REAL, "S/D flatband voltage offset"), +IOP( "lintnoi", BSIM4V4_MOD_LINTNOI, IF_REAL, "lint offset for noise calculation"), +IOP( "lint", BSIM4V4_MOD_LINT, IF_REAL, "Length reduction parameter"), +IOP( "ll", BSIM4V4_MOD_LL, IF_REAL, "Length reduction parameter"), +IOP( "llc", BSIM4V4_MOD_LLC, IF_REAL, "Length reduction parameter for CV"), +IOP( "lln", BSIM4V4_MOD_LLN, IF_REAL, "Length reduction parameter"), +IOP( "lw", BSIM4V4_MOD_LW, IF_REAL, "Length reduction parameter"), +IOP( "lwc", BSIM4V4_MOD_LWC, IF_REAL, "Length reduction parameter for CV"), +IOP( "lwn", BSIM4V4_MOD_LWN, IF_REAL, "Length reduction parameter"), +IOP( "lwl", BSIM4V4_MOD_LWL, IF_REAL, "Length reduction parameter"), +IOP( "lwlc", BSIM4V4_MOD_LWLC, IF_REAL, "Length reduction parameter for CV"), +IOP( "lmin", BSIM4V4_MOD_LMIN, IF_REAL, "Minimum length for the model"), +IOP( "lmax", BSIM4V4_MOD_LMAX, IF_REAL, "Maximum length for the model"), + +IOP( "wr", BSIM4V4_MOD_WR, IF_REAL, "Width dependence of rds"), +IOP( "wint", BSIM4V4_MOD_WINT, IF_REAL, "Width reduction parameter"), +IOP( "dwg", BSIM4V4_MOD_DWG, IF_REAL, "Width reduction parameter"), +IOP( "dwb", BSIM4V4_MOD_DWB, IF_REAL, "Width reduction parameter"), + +IOP( "wl", BSIM4V4_MOD_WL, IF_REAL, "Width reduction parameter"), +IOP( "wlc", BSIM4V4_MOD_WLC, IF_REAL, "Width reduction parameter for CV"), +IOP( "wln", BSIM4V4_MOD_WLN, IF_REAL, "Width reduction parameter"), +IOP( "ww", BSIM4V4_MOD_WW, IF_REAL, "Width reduction parameter"), +IOP( "wwc", BSIM4V4_MOD_WWC, IF_REAL, "Width reduction parameter for CV"), +IOP( "wwn", BSIM4V4_MOD_WWN, IF_REAL, "Width reduction parameter"), +IOP( "wwl", BSIM4V4_MOD_WWL, IF_REAL, "Width reduction parameter"), +IOP( "wwlc", BSIM4V4_MOD_WWLC, IF_REAL, "Width reduction parameter for CV"), +IOP( "wmin", BSIM4V4_MOD_WMIN, IF_REAL, "Minimum width for the model"), +IOP( "wmax", BSIM4V4_MOD_WMAX, IF_REAL, "Maximum width for the model"), + +IOP( "b0", BSIM4V4_MOD_B0, IF_REAL, "Abulk narrow width parameter"), +IOP( "b1", BSIM4V4_MOD_B1, IF_REAL, "Abulk narrow width parameter"), + +IOP( "cgsl", BSIM4V4_MOD_CGSL, IF_REAL, "New C-V model parameter"), +IOP( "cgdl", BSIM4V4_MOD_CGDL, IF_REAL, "New C-V model parameter"), +IOP( "ckappas", BSIM4V4_MOD_CKAPPAS, IF_REAL, "S/G overlap C-V parameter "), +IOP( "ckappad", BSIM4V4_MOD_CKAPPAD, IF_REAL, "D/G overlap C-V parameter"), +IOP( "cf", BSIM4V4_MOD_CF, IF_REAL, "Fringe capacitance parameter"), +IOP( "clc", BSIM4V4_MOD_CLC, IF_REAL, "Vdsat parameter for C-V model"), +IOP( "cle", BSIM4V4_MOD_CLE, IF_REAL, "Vdsat parameter for C-V model"), +IOP( "dwc", BSIM4V4_MOD_DWC, IF_REAL, "Delta W for C-V model"), +IOP( "dlc", BSIM4V4_MOD_DLC, IF_REAL, "Delta L for C-V model"), +IOP( "xw", BSIM4V4_MOD_XW, IF_REAL, "W offset for channel width due to mask/etch effect"), +IOP( "xl", BSIM4V4_MOD_XL, IF_REAL, "L offset for channel length due to mask/etch effect"), +IOP( "dlcig", BSIM4V4_MOD_DLCIG, IF_REAL, "Delta L for Ig model"), +IOP( "dwj", BSIM4V4_MOD_DWJ, IF_REAL, "Delta W for S/D junctions"), + +IOP( "alpha0", BSIM4V4_MOD_ALPHA0, IF_REAL, "substrate current model parameter"), +IOP( "alpha1", BSIM4V4_MOD_ALPHA1, IF_REAL, "substrate current model parameter"), +IOP( "beta0", BSIM4V4_MOD_BETA0, IF_REAL, "substrate current model parameter"), +IOP( "agidl", BSIM4V4_MOD_AGIDL, IF_REAL, "Pre-exponential constant for GIDL"), +IOP( "bgidl", BSIM4V4_MOD_BGIDL, IF_REAL, "Exponential constant for GIDL"), +IOP( "cgidl", BSIM4V4_MOD_CGIDL, IF_REAL, "Parameter for body-bias dependence of GIDL"), +IOP( "egidl", BSIM4V4_MOD_EGIDL, IF_REAL, "Fitting parameter for Bandbending"), +IOP( "aigc", BSIM4V4_MOD_AIGC, IF_REAL, "Parameter for Igc"), +IOP( "bigc", BSIM4V4_MOD_BIGC, IF_REAL, "Parameter for Igc"), +IOP( "cigc", BSIM4V4_MOD_CIGC, IF_REAL, "Parameter for Igc"), +IOP( "aigsd", BSIM4V4_MOD_AIGSD, IF_REAL, "Parameter for Igs,d"), +IOP( "bigsd", BSIM4V4_MOD_BIGSD, IF_REAL, "Parameter for Igs,d"), +IOP( "cigsd", BSIM4V4_MOD_CIGSD, IF_REAL, "Parameter for Igs,d"), +IOP( "aigbacc", BSIM4V4_MOD_AIGBACC, IF_REAL, "Parameter for Igb"), +IOP( "bigbacc", BSIM4V4_MOD_BIGBACC, IF_REAL, "Parameter for Igb"), +IOP( "cigbacc", BSIM4V4_MOD_CIGBACC, IF_REAL, "Parameter for Igb"), +IOP( "aigbinv", BSIM4V4_MOD_AIGBINV, IF_REAL, "Parameter for Igb"), +IOP( "bigbinv", BSIM4V4_MOD_BIGBINV, IF_REAL, "Parameter for Igb"), +IOP( "cigbinv", BSIM4V4_MOD_CIGBINV, IF_REAL, "Parameter for Igb"), +IOP( "nigc", BSIM4V4_MOD_NIGC, IF_REAL, "Parameter for Igc slope"), +IOP( "nigbinv", BSIM4V4_MOD_NIGBINV, IF_REAL, "Parameter for Igbinv slope"), +IOP( "nigbacc", BSIM4V4_MOD_NIGBACC, IF_REAL, "Parameter for Igbacc slope"), +IOP( "ntox", BSIM4V4_MOD_NTOX, IF_REAL, "Exponent for Tox ratio"), +IOP( "eigbinv", BSIM4V4_MOD_EIGBINV, IF_REAL, "Parameter for the Si bandgap for Igbinv"), +IOP( "pigcd", BSIM4V4_MOD_PIGCD, IF_REAL, "Parameter for Igc partition"), +IOP( "poxedge", BSIM4V4_MOD_POXEDGE, IF_REAL, "Factor for the gate edge Tox"), + +IOP( "ijthdfwd", BSIM4V4_MOD_IJTHDFWD, IF_REAL, "Forward drain diode forward limiting current"), +IOP( "ijthsfwd", BSIM4V4_MOD_IJTHSFWD, IF_REAL, "Forward source diode forward limiting current"), +IOP( "ijthdrev", BSIM4V4_MOD_IJTHDREV, IF_REAL, "Reverse drain diode forward limiting current"), +IOP( "ijthsrev", BSIM4V4_MOD_IJTHSREV, IF_REAL, "Reverse source diode forward limiting current"), +IOP( "xjbvd", BSIM4V4_MOD_XJBVD, IF_REAL, "Fitting parameter for drain diode breakdown current"), +IOP( "xjbvs", BSIM4V4_MOD_XJBVS, IF_REAL, "Fitting parameter for source diode breakdown current"), +IOP( "bvd", BSIM4V4_MOD_BVD, IF_REAL, "Drain diode breakdown voltage"), +IOP( "bvs", BSIM4V4_MOD_BVS, IF_REAL, "Source diode breakdown voltage"), + +IOP( "jtss", BSIM4V4_MOD_JTSS, IF_REAL, "Source bottom trap-assisted saturation current density"), +IOP( "jtsd", BSIM4V4_MOD_JTSD, IF_REAL, "Drain bottom trap-assisted saturation current density"), +IOP( "jtssws", BSIM4V4_MOD_JTSSWS, IF_REAL, "Source STI sidewall trap-assisted saturation current density"), +IOP( "jtsswd", BSIM4V4_MOD_JTSSWD, IF_REAL, "Drain STI sidewall trap-assisted saturation current density"), +IOP( "jtsswgs", BSIM4V4_MOD_JTSSWGS, IF_REAL, "Source gate-edge sidewall trap-assisted saturation current density"), +IOP( "jtsswgd", BSIM4V4_MOD_JTSSWGD, IF_REAL, "Drain gate-edge sidewall trap-assisted saturation current density"), +IOP( "njts", BSIM4V4_MOD_NJTS, IF_REAL, "Non-ideality factor for bottom junction"), +IOP( "njtssw", BSIM4V4_MOD_NJTSSW, IF_REAL, "Non-ideality factor for STI sidewall junction"), +IOP( "njtsswg", BSIM4V4_MOD_NJTSSWG, IF_REAL, "Non-ideality factor for gate-edge sidewall junction"), +IOP( "xtss", BSIM4V4_MOD_XTSS, IF_REAL, "Power dependence of JTSS on temperature"), +IOP( "xtsd", BSIM4V4_MOD_XTSD, IF_REAL, "Power dependence of JTSD on temperature"), +IOP( "xtssws", BSIM4V4_MOD_XTSSWS, IF_REAL, "Power dependence of JTSSWS on temperature"), +IOP( "xtsswd", BSIM4V4_MOD_XTSSWD, IF_REAL, "Power dependence of JTSSWD on temperature"), +IOP( "xtsswgs", BSIM4V4_MOD_XTSSWGS, IF_REAL, "Power dependence of JTSSWGS on temperature"), +IOP( "xtsswgd", BSIM4V4_MOD_XTSSWGD, IF_REAL, "Power dependence of JTSSWGD on temperature"), +IOP( "tnjts", BSIM4V4_MOD_TNJTS, IF_REAL, "Temperature coefficient for NJTS"), +IOP( "tnjtssw", BSIM4V4_MOD_TNJTSSW, IF_REAL, "Temperature coefficient for NJTSSW"), +IOP( "tnjtsswg", BSIM4V4_MOD_TNJTSSWG, IF_REAL, "Temperature coefficient for NJTSSWG"), +IOP( "vtss", BSIM4V4_MOD_VTSS, IF_REAL, "Source bottom trap-assisted voltage dependent parameter"), +IOP( "vtsd", BSIM4V4_MOD_VTSD, IF_REAL, "Drain bottom trap-assisted voltage dependent parameter"), +IOP( "vtssws", BSIM4V4_MOD_VTSSWS, IF_REAL, "Source STI sidewall trap-assisted voltage dependent parameter"), +IOP( "vtsswd", BSIM4V4_MOD_VTSSWD, IF_REAL, "Drain STI sidewall trap-assisted voltage dependent parameter"), +IOP( "vtsswgs", BSIM4V4_MOD_VTSSWGS, IF_REAL, "Source gate-edge sidewall trap-assisted voltage dependent parameter"), +IOP( "vtsswgd", BSIM4V4_MOD_VTSSWGD, IF_REAL, "Drain gate-edge sidewall trap-assisted voltage dependent parameter"), + +IOP( "gbmin", BSIM4V4_MOD_GBMIN, IF_REAL, "Minimum body conductance"), +IOP( "rbdb", BSIM4V4_MOD_RBDB, IF_REAL, "Resistance between bNode and dbNode"), +IOP( "rbpb", BSIM4V4_MOD_RBPB, IF_REAL, "Resistance between bNodePrime and bNode"), +IOP( "rbsb", BSIM4V4_MOD_RBSB, IF_REAL, "Resistance between bNode and sbNode"), +IOP( "rbps", BSIM4V4_MOD_RBPS, IF_REAL, "Resistance between bNodePrime and sbNode"), +IOP( "rbpd", BSIM4V4_MOD_RBPD, IF_REAL, "Resistance between bNodePrime and bNode"), + +IOP( "lcdsc", BSIM4V4_MOD_LCDSC, IF_REAL, "Length dependence of cdsc"), +IOP( "lcdscb", BSIM4V4_MOD_LCDSCB, IF_REAL, "Length dependence of cdscb"), +IOP( "lcdscd", BSIM4V4_MOD_LCDSCD, IF_REAL, "Length dependence of cdscd"), +IOP( "lcit", BSIM4V4_MOD_LCIT, IF_REAL, "Length dependence of cit"), +IOP( "lnfactor", BSIM4V4_MOD_LNFACTOR, IF_REAL, "Length dependence of nfactor"), +IOP( "lxj", BSIM4V4_MOD_LXJ, IF_REAL, "Length dependence of xj"), +IOP( "lvsat", BSIM4V4_MOD_LVSAT, IF_REAL, "Length dependence of vsat"), +IOP( "lat", BSIM4V4_MOD_LAT, IF_REAL, "Length dependence of at"), +IOP( "la0", BSIM4V4_MOD_LA0, IF_REAL, "Length dependence of a0"), +IOP( "lags", BSIM4V4_MOD_LAGS, IF_REAL, "Length dependence of ags"), +IOP( "la1", BSIM4V4_MOD_LA1, IF_REAL, "Length dependence of a1"), +IOP( "la2", BSIM4V4_MOD_LA2, IF_REAL, "Length dependence of a2"), +IOP( "lketa", BSIM4V4_MOD_LKETA, IF_REAL, "Length dependence of keta"), +IOP( "lnsub", BSIM4V4_MOD_LNSUB, IF_REAL, "Length dependence of nsub"), +IOP( "lndep", BSIM4V4_MOD_LNDEP, IF_REAL, "Length dependence of ndep"), +IOP( "lnsd", BSIM4V4_MOD_LNSD, IF_REAL, "Length dependence of nsd"), +IOP( "lphin", BSIM4V4_MOD_LPHIN, IF_REAL, "Length dependence of phin"), +IOP( "lngate", BSIM4V4_MOD_LNGATE, IF_REAL, "Length dependence of ngate"), +IOP( "lgamma1", BSIM4V4_MOD_LGAMMA1, IF_REAL, "Length dependence of gamma1"), +IOP( "lgamma2", BSIM4V4_MOD_LGAMMA2, IF_REAL, "Length dependence of gamma2"), +IOP( "lvbx", BSIM4V4_MOD_LVBX, IF_REAL, "Length dependence of vbx"), +IOP( "lvbm", BSIM4V4_MOD_LVBM, IF_REAL, "Length dependence of vbm"), +IOP( "lxt", BSIM4V4_MOD_LXT, IF_REAL, "Length dependence of xt"), +IOP( "lk1", BSIM4V4_MOD_LK1, IF_REAL, "Length dependence of k1"), +IOP( "lkt1", BSIM4V4_MOD_LKT1, IF_REAL, "Length dependence of kt1"), +IOP( "lkt1l", BSIM4V4_MOD_LKT1L, IF_REAL, "Length dependence of kt1l"), +IOP( "lkt2", BSIM4V4_MOD_LKT2, IF_REAL, "Length dependence of kt2"), +IOP( "lk2", BSIM4V4_MOD_LK2, IF_REAL, "Length dependence of k2"), +IOP( "lk3", BSIM4V4_MOD_LK3, IF_REAL, "Length dependence of k3"), +IOP( "lk3b", BSIM4V4_MOD_LK3B, IF_REAL, "Length dependence of k3b"), +IOP( "lw0", BSIM4V4_MOD_LW0, IF_REAL, "Length dependence of w0"), +IOP( "ldvtp0", BSIM4V4_MOD_LDVTP0, IF_REAL, "Length dependence of dvtp0"), +IOP( "ldvtp1", BSIM4V4_MOD_LDVTP1, IF_REAL, "Length dependence of dvtp1"), +IOP( "llpe0", BSIM4V4_MOD_LLPE0, IF_REAL, "Length dependence of lpe0"), +IOP( "llpeb", BSIM4V4_MOD_LLPEB, IF_REAL, "Length dependence of lpeb"), +IOP( "ldvt0", BSIM4V4_MOD_LDVT0, IF_REAL, "Length dependence of dvt0"), +IOP( "ldvt1", BSIM4V4_MOD_LDVT1, IF_REAL, "Length dependence of dvt1"), +IOP( "ldvt2", BSIM4V4_MOD_LDVT2, IF_REAL, "Length dependence of dvt2"), +IOP( "ldvt0w", BSIM4V4_MOD_LDVT0W, IF_REAL, "Length dependence of dvt0w"), +IOP( "ldvt1w", BSIM4V4_MOD_LDVT1W, IF_REAL, "Length dependence of dvt1w"), +IOP( "ldvt2w", BSIM4V4_MOD_LDVT2W, IF_REAL, "Length dependence of dvt2w"), +IOP( "ldrout", BSIM4V4_MOD_LDROUT, IF_REAL, "Length dependence of drout"), +IOP( "ldsub", BSIM4V4_MOD_LDSUB, IF_REAL, "Length dependence of dsub"), +IOP( "lvth0", BSIM4V4_MOD_LVTH0, IF_REAL,"Length dependence of vto"), +IOP( "lvtho", BSIM4V4_MOD_LVTH0, IF_REAL,"Length dependence of vto"), +IOP( "lua", BSIM4V4_MOD_LUA, IF_REAL, "Length dependence of ua"), +IOP( "lua1", BSIM4V4_MOD_LUA1, IF_REAL, "Length dependence of ua1"), +IOP( "lub", BSIM4V4_MOD_LUB, IF_REAL, "Length dependence of ub"), +IOP( "lub1", BSIM4V4_MOD_LUB1, IF_REAL, "Length dependence of ub1"), +IOP( "luc", BSIM4V4_MOD_LUC, IF_REAL, "Length dependence of uc"), +IOP( "luc1", BSIM4V4_MOD_LUC1, IF_REAL, "Length dependence of uc1"), +IOP( "lu0", BSIM4V4_MOD_LU0, IF_REAL, "Length dependence of u0"), +IOP( "lute", BSIM4V4_MOD_LUTE, IF_REAL, "Length dependence of ute"), +IOP( "lvoff", BSIM4V4_MOD_LVOFF, IF_REAL, "Length dependence of voff"), +IOP( "lminv", BSIM4V4_MOD_LMINV, IF_REAL, "Length dependence of minv"), +IOP( "ldelta", BSIM4V4_MOD_LDELTA, IF_REAL, "Length dependence of delta"), +IOP( "lrdsw", BSIM4V4_MOD_LRDSW, IF_REAL, "Length dependence of rdsw "), +IOP( "lrsw", BSIM4V4_MOD_LRSW, IF_REAL, "Length dependence of rsw"), +IOP( "lrdw", BSIM4V4_MOD_LRDW, IF_REAL, "Length dependence of rdw"), + +IOP( "lprwg", BSIM4V4_MOD_LPRWG, IF_REAL, "Length dependence of prwg "), +IOP( "lprwb", BSIM4V4_MOD_LPRWB, IF_REAL, "Length dependence of prwb "), + +IOP( "lprt", BSIM4V4_MOD_LPRT, IF_REAL, "Length dependence of prt "), +IOP( "leta0", BSIM4V4_MOD_LETA0, IF_REAL, "Length dependence of eta0"), +IOP( "letab", BSIM4V4_MOD_LETAB, IF_REAL, "Length dependence of etab"), +IOP( "lpclm", BSIM4V4_MOD_LPCLM, IF_REAL, "Length dependence of pclm"), +IOP( "lpdiblc1", BSIM4V4_MOD_LPDIBL1, IF_REAL, "Length dependence of pdiblc1"), +IOP( "lpdiblc2", BSIM4V4_MOD_LPDIBL2, IF_REAL, "Length dependence of pdiblc2"), +IOP( "lpdiblcb", BSIM4V4_MOD_LPDIBLB, IF_REAL, "Length dependence of pdiblcb"), +IOP( "lfprout", BSIM4V4_MOD_LFPROUT, IF_REAL, "Length dependence of pdiblcb"), +IOP( "lpdits", BSIM4V4_MOD_LPDITS, IF_REAL, "Length dependence of pdits"), +IOP( "lpditsd", BSIM4V4_MOD_LPDITSD, IF_REAL, "Length dependence of pditsd"), +IOP( "lpscbe1", BSIM4V4_MOD_LPSCBE1, IF_REAL, "Length dependence of pscbe1"), +IOP( "lpscbe2", BSIM4V4_MOD_LPSCBE2, IF_REAL, "Length dependence of pscbe2"), +IOP( "lpvag", BSIM4V4_MOD_LPVAG, IF_REAL, "Length dependence of pvag"), +IOP( "lwr", BSIM4V4_MOD_LWR, IF_REAL, "Length dependence of wr"), +IOP( "ldwg", BSIM4V4_MOD_LDWG, IF_REAL, "Length dependence of dwg"), +IOP( "ldwb", BSIM4V4_MOD_LDWB, IF_REAL, "Length dependence of dwb"), +IOP( "lb0", BSIM4V4_MOD_LB0, IF_REAL, "Length dependence of b0"), +IOP( "lb1", BSIM4V4_MOD_LB1, IF_REAL, "Length dependence of b1"), +IOP( "lcgsl", BSIM4V4_MOD_LCGSL, IF_REAL, "Length dependence of cgsl"), +IOP( "lcgdl", BSIM4V4_MOD_LCGDL, IF_REAL, "Length dependence of cgdl"), +IOP( "lckappas", BSIM4V4_MOD_LCKAPPAS, IF_REAL, "Length dependence of ckappas"), +IOP( "lckappad", BSIM4V4_MOD_LCKAPPAD, IF_REAL, "Length dependence of ckappad"), +IOP( "lcf", BSIM4V4_MOD_LCF, IF_REAL, "Length dependence of cf"), +IOP( "lclc", BSIM4V4_MOD_LCLC, IF_REAL, "Length dependence of clc"), +IOP( "lcle", BSIM4V4_MOD_LCLE, IF_REAL, "Length dependence of cle"), +IOP( "lalpha0", BSIM4V4_MOD_LALPHA0, IF_REAL, "Length dependence of alpha0"), +IOP( "lalpha1", BSIM4V4_MOD_LALPHA1, IF_REAL, "Length dependence of alpha1"), +IOP( "lbeta0", BSIM4V4_MOD_LBETA0, IF_REAL, "Length dependence of beta0"), +IOP( "lagidl", BSIM4V4_MOD_LAGIDL, IF_REAL, "Length dependence of agidl"), +IOP( "lbgidl", BSIM4V4_MOD_LBGIDL, IF_REAL, "Length dependence of bgidl"), +IOP( "lcgidl", BSIM4V4_MOD_LCGIDL, IF_REAL, "Length dependence of cgidl"), +IOP( "legidl", BSIM4V4_MOD_LEGIDL, IF_REAL, "Length dependence of egidl"), +IOP( "laigc", BSIM4V4_MOD_LAIGC, IF_REAL, "Length dependence of aigc"), +IOP( "lbigc", BSIM4V4_MOD_LBIGC, IF_REAL, "Length dependence of bigc"), +IOP( "lcigc", BSIM4V4_MOD_LCIGC, IF_REAL, "Length dependence of cigc"), +IOP( "laigsd", BSIM4V4_MOD_LAIGSD, IF_REAL, "Length dependence of aigsd"), +IOP( "lbigsd", BSIM4V4_MOD_LBIGSD, IF_REAL, "Length dependence of bigsd"), +IOP( "lcigsd", BSIM4V4_MOD_LCIGSD, IF_REAL, "Length dependence of cigsd"), +IOP( "laigbacc", BSIM4V4_MOD_LAIGBACC, IF_REAL, "Length dependence of aigbacc"), +IOP( "lbigbacc", BSIM4V4_MOD_LBIGBACC, IF_REAL, "Length dependence of bigbacc"), +IOP( "lcigbacc", BSIM4V4_MOD_LCIGBACC, IF_REAL, "Length dependence of cigbacc"), +IOP( "laigbinv", BSIM4V4_MOD_LAIGBINV, IF_REAL, "Length dependence of aigbinv"), +IOP( "lbigbinv", BSIM4V4_MOD_LBIGBINV, IF_REAL, "Length dependence of bigbinv"), +IOP( "lcigbinv", BSIM4V4_MOD_LCIGBINV, IF_REAL, "Length dependence of cigbinv"), +IOP( "lnigc", BSIM4V4_MOD_LNIGC, IF_REAL, "Length dependence of nigc"), +IOP( "lnigbinv", BSIM4V4_MOD_LNIGBINV, IF_REAL, "Length dependence of nigbinv"), +IOP( "lnigbacc", BSIM4V4_MOD_LNIGBACC, IF_REAL, "Length dependence of nigbacc"), +IOP( "lntox", BSIM4V4_MOD_LNTOX, IF_REAL, "Length dependence of ntox"), +IOP( "leigbinv", BSIM4V4_MOD_LEIGBINV, IF_REAL, "Length dependence for eigbinv"), +IOP( "lpigcd", BSIM4V4_MOD_LPIGCD, IF_REAL, "Length dependence for pigcd"), +IOP( "lpoxedge", BSIM4V4_MOD_LPOXEDGE, IF_REAL, "Length dependence for poxedge"), + +IOP( "lvfbcv", BSIM4V4_MOD_LVFBCV, IF_REAL, "Length dependence of vfbcv"), +IOP( "lvfb", BSIM4V4_MOD_LVFB, IF_REAL, "Length dependence of vfb"), +IOP( "lacde", BSIM4V4_MOD_LACDE, IF_REAL, "Length dependence of acde"), +IOP( "lmoin", BSIM4V4_MOD_LMOIN, IF_REAL, "Length dependence of moin"), +IOP( "lnoff", BSIM4V4_MOD_LNOFF, IF_REAL, "Length dependence of noff"), +IOP( "lvoffcv", BSIM4V4_MOD_LVOFFCV, IF_REAL, "Length dependence of voffcv"), +IOP( "lxrcrg1", BSIM4V4_MOD_LXRCRG1, IF_REAL, "Length dependence of xrcrg1"), +IOP( "lxrcrg2", BSIM4V4_MOD_LXRCRG2, IF_REAL, "Length dependence of xrcrg2"), +IOP( "llambda", BSIM4V4_MOD_LLAMBDA, IF_REAL, "Length dependence of lambda"), +IOP( "lvtl", BSIM4V4_MOD_LVTL, IF_REAL, " Length dependence of vtl"), +IOP( "lxn", BSIM4V4_MOD_LXN, IF_REAL, " Length dependence of xn"), +IOP( "leu", BSIM4V4_MOD_LEU, IF_REAL, " Length dependence of eu"), +IOP( "lvfbsdoff", BSIM4V4_MOD_LVFBSDOFF, IF_REAL, "Length dependence of vfbsdoff"), + +IOP( "wcdsc", BSIM4V4_MOD_WCDSC, IF_REAL, "Width dependence of cdsc"), +IOP( "wcdscb", BSIM4V4_MOD_WCDSCB, IF_REAL, "Width dependence of cdscb"), +IOP( "wcdscd", BSIM4V4_MOD_WCDSCD, IF_REAL, "Width dependence of cdscd"), +IOP( "wcit", BSIM4V4_MOD_WCIT, IF_REAL, "Width dependence of cit"), +IOP( "wnfactor", BSIM4V4_MOD_WNFACTOR, IF_REAL, "Width dependence of nfactor"), +IOP( "wxj", BSIM4V4_MOD_WXJ, IF_REAL, "Width dependence of xj"), +IOP( "wvsat", BSIM4V4_MOD_WVSAT, IF_REAL, "Width dependence of vsat"), +IOP( "wat", BSIM4V4_MOD_WAT, IF_REAL, "Width dependence of at"), +IOP( "wa0", BSIM4V4_MOD_WA0, IF_REAL, "Width dependence of a0"), +IOP( "wags", BSIM4V4_MOD_WAGS, IF_REAL, "Width dependence of ags"), +IOP( "wa1", BSIM4V4_MOD_WA1, IF_REAL, "Width dependence of a1"), +IOP( "wa2", BSIM4V4_MOD_WA2, IF_REAL, "Width dependence of a2"), +IOP( "wketa", BSIM4V4_MOD_WKETA, IF_REAL, "Width dependence of keta"), +IOP( "wnsub", BSIM4V4_MOD_WNSUB, IF_REAL, "Width dependence of nsub"), +IOP( "wndep", BSIM4V4_MOD_WNDEP, IF_REAL, "Width dependence of ndep"), +IOP( "wnsd", BSIM4V4_MOD_WNSD, IF_REAL, "Width dependence of nsd"), +IOP( "wphin", BSIM4V4_MOD_WPHIN, IF_REAL, "Width dependence of phin"), +IOP( "wngate", BSIM4V4_MOD_WNGATE, IF_REAL, "Width dependence of ngate"), +IOP( "wgamma1", BSIM4V4_MOD_WGAMMA1, IF_REAL, "Width dependence of gamma1"), +IOP( "wgamma2", BSIM4V4_MOD_WGAMMA2, IF_REAL, "Width dependence of gamma2"), +IOP( "wvbx", BSIM4V4_MOD_WVBX, IF_REAL, "Width dependence of vbx"), +IOP( "wvbm", BSIM4V4_MOD_WVBM, IF_REAL, "Width dependence of vbm"), +IOP( "wxt", BSIM4V4_MOD_WXT, IF_REAL, "Width dependence of xt"), +IOP( "wk1", BSIM4V4_MOD_WK1, IF_REAL, "Width dependence of k1"), +IOP( "wkt1", BSIM4V4_MOD_WKT1, IF_REAL, "Width dependence of kt1"), +IOP( "wkt1l", BSIM4V4_MOD_WKT1L, IF_REAL, "Width dependence of kt1l"), +IOP( "wkt2", BSIM4V4_MOD_WKT2, IF_REAL, "Width dependence of kt2"), +IOP( "wk2", BSIM4V4_MOD_WK2, IF_REAL, "Width dependence of k2"), +IOP( "wk3", BSIM4V4_MOD_WK3, IF_REAL, "Width dependence of k3"), +IOP( "wk3b", BSIM4V4_MOD_WK3B, IF_REAL, "Width dependence of k3b"), +IOP( "ww0", BSIM4V4_MOD_WW0, IF_REAL, "Width dependence of w0"), +IOP( "wdvtp0", BSIM4V4_MOD_WDVTP0, IF_REAL, "Width dependence of dvtp0"), +IOP( "wdvtp1", BSIM4V4_MOD_WDVTP1, IF_REAL, "Width dependence of dvtp1"), +IOP( "wlpe0", BSIM4V4_MOD_WLPE0, IF_REAL, "Width dependence of lpe0"), +IOP( "wlpeb", BSIM4V4_MOD_WLPEB, IF_REAL, "Width dependence of lpeb"), +IOP( "wdvt0", BSIM4V4_MOD_WDVT0, IF_REAL, "Width dependence of dvt0"), +IOP( "wdvt1", BSIM4V4_MOD_WDVT1, IF_REAL, "Width dependence of dvt1"), +IOP( "wdvt2", BSIM4V4_MOD_WDVT2, IF_REAL, "Width dependence of dvt2"), +IOP( "wdvt0w", BSIM4V4_MOD_WDVT0W, IF_REAL, "Width dependence of dvt0w"), +IOP( "wdvt1w", BSIM4V4_MOD_WDVT1W, IF_REAL, "Width dependence of dvt1w"), +IOP( "wdvt2w", BSIM4V4_MOD_WDVT2W, IF_REAL, "Width dependence of dvt2w"), +IOP( "wdrout", BSIM4V4_MOD_WDROUT, IF_REAL, "Width dependence of drout"), +IOP( "wdsub", BSIM4V4_MOD_WDSUB, IF_REAL, "Width dependence of dsub"), +IOP( "wvth0", BSIM4V4_MOD_WVTH0, IF_REAL,"Width dependence of vto"), +IOP( "wvtho", BSIM4V4_MOD_WVTH0, IF_REAL,"Width dependence of vto"), +IOP( "wua", BSIM4V4_MOD_WUA, IF_REAL, "Width dependence of ua"), +IOP( "wua1", BSIM4V4_MOD_WUA1, IF_REAL, "Width dependence of ua1"), +IOP( "wub", BSIM4V4_MOD_WUB, IF_REAL, "Width dependence of ub"), +IOP( "wub1", BSIM4V4_MOD_WUB1, IF_REAL, "Width dependence of ub1"), +IOP( "wuc", BSIM4V4_MOD_WUC, IF_REAL, "Width dependence of uc"), +IOP( "wuc1", BSIM4V4_MOD_WUC1, IF_REAL, "Width dependence of uc1"), +IOP( "wu0", BSIM4V4_MOD_WU0, IF_REAL, "Width dependence of u0"), +IOP( "wute", BSIM4V4_MOD_WUTE, IF_REAL, "Width dependence of ute"), +IOP( "wvoff", BSIM4V4_MOD_WVOFF, IF_REAL, "Width dependence of voff"), +IOP( "wminv", BSIM4V4_MOD_WMINV, IF_REAL, "Width dependence of minv"), +IOP( "wdelta", BSIM4V4_MOD_WDELTA, IF_REAL, "Width dependence of delta"), +IOP( "wrdsw", BSIM4V4_MOD_WRDSW, IF_REAL, "Width dependence of rdsw "), +IOP( "wrsw", BSIM4V4_MOD_WRSW, IF_REAL, "Width dependence of rsw"), +IOP( "wrdw", BSIM4V4_MOD_WRDW, IF_REAL, "Width dependence of rdw"), + +IOP( "wprwg", BSIM4V4_MOD_WPRWG, IF_REAL, "Width dependence of prwg "), +IOP( "wprwb", BSIM4V4_MOD_WPRWB, IF_REAL, "Width dependence of prwb "), + +IOP( "wprt", BSIM4V4_MOD_WPRT, IF_REAL, "Width dependence of prt"), +IOP( "weta0", BSIM4V4_MOD_WETA0, IF_REAL, "Width dependence of eta0"), +IOP( "wetab", BSIM4V4_MOD_WETAB, IF_REAL, "Width dependence of etab"), +IOP( "wpclm", BSIM4V4_MOD_WPCLM, IF_REAL, "Width dependence of pclm"), +IOP( "wpdiblc1", BSIM4V4_MOD_WPDIBL1, IF_REAL, "Width dependence of pdiblc1"), +IOP( "wpdiblc2", BSIM4V4_MOD_WPDIBL2, IF_REAL, "Width dependence of pdiblc2"), +IOP( "wpdiblcb", BSIM4V4_MOD_WPDIBLB, IF_REAL, "Width dependence of pdiblcb"), +IOP( "wfprout", BSIM4V4_MOD_WFPROUT, IF_REAL, "Width dependence of pdiblcb"), +IOP( "wpdits", BSIM4V4_MOD_WPDITS, IF_REAL, "Width dependence of pdits"), +IOP( "wpditsd", BSIM4V4_MOD_WPDITSD, IF_REAL, "Width dependence of pditsd"), +IOP( "wpscbe1", BSIM4V4_MOD_WPSCBE1, IF_REAL, "Width dependence of pscbe1"), +IOP( "wpscbe2", BSIM4V4_MOD_WPSCBE2, IF_REAL, "Width dependence of pscbe2"), +IOP( "wpvag", BSIM4V4_MOD_WPVAG, IF_REAL, "Width dependence of pvag"), +IOP( "wwr", BSIM4V4_MOD_WWR, IF_REAL, "Width dependence of wr"), +IOP( "wdwg", BSIM4V4_MOD_WDWG, IF_REAL, "Width dependence of dwg"), +IOP( "wdwb", BSIM4V4_MOD_WDWB, IF_REAL, "Width dependence of dwb"), +IOP( "wb0", BSIM4V4_MOD_WB0, IF_REAL, "Width dependence of b0"), +IOP( "wb1", BSIM4V4_MOD_WB1, IF_REAL, "Width dependence of b1"), +IOP( "wcgsl", BSIM4V4_MOD_WCGSL, IF_REAL, "Width dependence of cgsl"), +IOP( "wcgdl", BSIM4V4_MOD_WCGDL, IF_REAL, "Width dependence of cgdl"), +IOP( "wckappas", BSIM4V4_MOD_WCKAPPAS, IF_REAL, "Width dependence of ckappas"), +IOP( "wckappad", BSIM4V4_MOD_WCKAPPAD, IF_REAL, "Width dependence of ckappad"), +IOP( "wcf", BSIM4V4_MOD_WCF, IF_REAL, "Width dependence of cf"), +IOP( "wclc", BSIM4V4_MOD_WCLC, IF_REAL, "Width dependence of clc"), +IOP( "wcle", BSIM4V4_MOD_WCLE, IF_REAL, "Width dependence of cle"), +IOP( "walpha0", BSIM4V4_MOD_WALPHA0, IF_REAL, "Width dependence of alpha0"), +IOP( "walpha1", BSIM4V4_MOD_WALPHA1, IF_REAL, "Width dependence of alpha1"), +IOP( "wbeta0", BSIM4V4_MOD_WBETA0, IF_REAL, "Width dependence of beta0"), +IOP( "wagidl", BSIM4V4_MOD_WAGIDL, IF_REAL, "Width dependence of agidl"), +IOP( "wbgidl", BSIM4V4_MOD_WBGIDL, IF_REAL, "Width dependence of bgidl"), +IOP( "wcgidl", BSIM4V4_MOD_WCGIDL, IF_REAL, "Width dependence of cgidl"), +IOP( "wegidl", BSIM4V4_MOD_WEGIDL, IF_REAL, "Width dependence of egidl"), +IOP( "waigc", BSIM4V4_MOD_WAIGC, IF_REAL, "Width dependence of aigc"), +IOP( "wbigc", BSIM4V4_MOD_WBIGC, IF_REAL, "Width dependence of bigc"), +IOP( "wcigc", BSIM4V4_MOD_WCIGC, IF_REAL, "Width dependence of cigc"), +IOP( "waigsd", BSIM4V4_MOD_WAIGSD, IF_REAL, "Width dependence of aigsd"), +IOP( "wbigsd", BSIM4V4_MOD_WBIGSD, IF_REAL, "Width dependence of bigsd"), +IOP( "wcigsd", BSIM4V4_MOD_WCIGSD, IF_REAL, "Width dependence of cigsd"), +IOP( "waigbacc", BSIM4V4_MOD_WAIGBACC, IF_REAL, "Width dependence of aigbacc"), +IOP( "wbigbacc", BSIM4V4_MOD_WBIGBACC, IF_REAL, "Width dependence of bigbacc"), +IOP( "wcigbacc", BSIM4V4_MOD_WCIGBACC, IF_REAL, "Width dependence of cigbacc"), +IOP( "waigbinv", BSIM4V4_MOD_WAIGBINV, IF_REAL, "Width dependence of aigbinv"), +IOP( "wbigbinv", BSIM4V4_MOD_WBIGBINV, IF_REAL, "Width dependence of bigbinv"), +IOP( "wcigbinv", BSIM4V4_MOD_WCIGBINV, IF_REAL, "Width dependence of cigbinv"), +IOP( "wnigc", BSIM4V4_MOD_WNIGC, IF_REAL, "Width dependence of nigc"), +IOP( "wnigbinv", BSIM4V4_MOD_WNIGBINV, IF_REAL, "Width dependence of nigbinv"), +IOP( "wnigbacc", BSIM4V4_MOD_WNIGBACC, IF_REAL, "Width dependence of nigbacc"), +IOP( "wntox", BSIM4V4_MOD_WNTOX, IF_REAL, "Width dependence of ntox"), +IOP( "weigbinv", BSIM4V4_MOD_WEIGBINV, IF_REAL, "Width dependence for eigbinv"), +IOP( "wpigcd", BSIM4V4_MOD_WPIGCD, IF_REAL, "Width dependence for pigcd"), +IOP( "wpoxedge", BSIM4V4_MOD_WPOXEDGE, IF_REAL, "Width dependence for poxedge"), +IOP( "wvfbcv", BSIM4V4_MOD_WVFBCV, IF_REAL, "Width dependence of vfbcv"), +IOP( "wvfb", BSIM4V4_MOD_WVFB, IF_REAL, "Width dependence of vfb"), +IOP( "wacde", BSIM4V4_MOD_WACDE, IF_REAL, "Width dependence of acde"), +IOP( "wmoin", BSIM4V4_MOD_WMOIN, IF_REAL, "Width dependence of moin"), +IOP( "wnoff", BSIM4V4_MOD_WNOFF, IF_REAL, "Width dependence of noff"), +IOP( "wvoffcv", BSIM4V4_MOD_WVOFFCV, IF_REAL, "Width dependence of voffcv"), +IOP( "wxrcrg1", BSIM4V4_MOD_WXRCRG1, IF_REAL, "Width dependence of xrcrg1"), +IOP( "wxrcrg2", BSIM4V4_MOD_WXRCRG2, IF_REAL, "Width dependence of xrcrg2"), +IOP( "wlambda", BSIM4V4_MOD_WLAMBDA, IF_REAL, "Width dependence of lambda"), +IOP( "wvtl", BSIM4V4_MOD_WVTL, IF_REAL, "Width dependence of vtl"), +IOP( "wxn", BSIM4V4_MOD_WXN, IF_REAL, "Width dependence of xn"), +IOP( "weu", BSIM4V4_MOD_WEU, IF_REAL, "Width dependence of eu"), +IOP( "wvfbsdoff", BSIM4V4_MOD_WVFBSDOFF, IF_REAL, "Width dependence of vfbsdoff"), + +IOP( "pcdsc", BSIM4V4_MOD_PCDSC, IF_REAL, "Cross-term dependence of cdsc"), +IOP( "pcdscb", BSIM4V4_MOD_PCDSCB, IF_REAL, "Cross-term dependence of cdscb"), +IOP( "pcdscd", BSIM4V4_MOD_PCDSCD, IF_REAL, "Cross-term dependence of cdscd"), +IOP( "pcit", BSIM4V4_MOD_PCIT, IF_REAL, "Cross-term dependence of cit"), +IOP( "pnfactor", BSIM4V4_MOD_PNFACTOR, IF_REAL, "Cross-term dependence of nfactor"), +IOP( "pxj", BSIM4V4_MOD_PXJ, IF_REAL, "Cross-term dependence of xj"), +IOP( "pvsat", BSIM4V4_MOD_PVSAT, IF_REAL, "Cross-term dependence of vsat"), +IOP( "pat", BSIM4V4_MOD_PAT, IF_REAL, "Cross-term dependence of at"), +IOP( "pa0", BSIM4V4_MOD_PA0, IF_REAL, "Cross-term dependence of a0"), +IOP( "pags", BSIM4V4_MOD_PAGS, IF_REAL, "Cross-term dependence of ags"), +IOP( "pa1", BSIM4V4_MOD_PA1, IF_REAL, "Cross-term dependence of a1"), +IOP( "pa2", BSIM4V4_MOD_PA2, IF_REAL, "Cross-term dependence of a2"), +IOP( "pketa", BSIM4V4_MOD_PKETA, IF_REAL, "Cross-term dependence of keta"), +IOP( "pnsub", BSIM4V4_MOD_PNSUB, IF_REAL, "Cross-term dependence of nsub"), +IOP( "pndep", BSIM4V4_MOD_PNDEP, IF_REAL, "Cross-term dependence of ndep"), +IOP( "pnsd", BSIM4V4_MOD_PNSD, IF_REAL, "Cross-term dependence of nsd"), +IOP( "pphin", BSIM4V4_MOD_PPHIN, IF_REAL, "Cross-term dependence of phin"), +IOP( "pngate", BSIM4V4_MOD_PNGATE, IF_REAL, "Cross-term dependence of ngate"), +IOP( "pgamma1", BSIM4V4_MOD_PGAMMA1, IF_REAL, "Cross-term dependence of gamma1"), +IOP( "pgamma2", BSIM4V4_MOD_PGAMMA2, IF_REAL, "Cross-term dependence of gamma2"), +IOP( "pvbx", BSIM4V4_MOD_PVBX, IF_REAL, "Cross-term dependence of vbx"), +IOP( "pvbm", BSIM4V4_MOD_PVBM, IF_REAL, "Cross-term dependence of vbm"), +IOP( "pxt", BSIM4V4_MOD_PXT, IF_REAL, "Cross-term dependence of xt"), +IOP( "pk1", BSIM4V4_MOD_PK1, IF_REAL, "Cross-term dependence of k1"), +IOP( "pkt1", BSIM4V4_MOD_PKT1, IF_REAL, "Cross-term dependence of kt1"), +IOP( "pkt1l", BSIM4V4_MOD_PKT1L, IF_REAL, "Cross-term dependence of kt1l"), +IOP( "pkt2", BSIM4V4_MOD_PKT2, IF_REAL, "Cross-term dependence of kt2"), +IOP( "pk2", BSIM4V4_MOD_PK2, IF_REAL, "Cross-term dependence of k2"), +IOP( "pk3", BSIM4V4_MOD_PK3, IF_REAL, "Cross-term dependence of k3"), +IOP( "pk3b", BSIM4V4_MOD_PK3B, IF_REAL, "Cross-term dependence of k3b"), +IOP( "pw0", BSIM4V4_MOD_PW0, IF_REAL, "Cross-term dependence of w0"), +IOP( "pdvtp0", BSIM4V4_MOD_PDVTP0, IF_REAL, "Cross-term dependence of dvtp0"), +IOP( "pdvtp1", BSIM4V4_MOD_PDVTP1, IF_REAL, "Cross-term dependence of dvtp1"), +IOP( "plpe0", BSIM4V4_MOD_PLPE0, IF_REAL, "Cross-term dependence of lpe0"), +IOP( "plpeb", BSIM4V4_MOD_PLPEB, IF_REAL, "Cross-term dependence of lpeb"), +IOP( "pdvt0", BSIM4V4_MOD_PDVT0, IF_REAL, "Cross-term dependence of dvt0"), +IOP( "pdvt1", BSIM4V4_MOD_PDVT1, IF_REAL, "Cross-term dependence of dvt1"), +IOP( "pdvt2", BSIM4V4_MOD_PDVT2, IF_REAL, "Cross-term dependence of dvt2"), +IOP( "pdvt0w", BSIM4V4_MOD_PDVT0W, IF_REAL, "Cross-term dependence of dvt0w"), +IOP( "pdvt1w", BSIM4V4_MOD_PDVT1W, IF_REAL, "Cross-term dependence of dvt1w"), +IOP( "pdvt2w", BSIM4V4_MOD_PDVT2W, IF_REAL, "Cross-term dependence of dvt2w"), +IOP( "pdrout", BSIM4V4_MOD_PDROUT, IF_REAL, "Cross-term dependence of drout"), +IOP( "pdsub", BSIM4V4_MOD_PDSUB, IF_REAL, "Cross-term dependence of dsub"), +IOP( "pvth0", BSIM4V4_MOD_PVTH0, IF_REAL,"Cross-term dependence of vto"), +IOP( "pvtho", BSIM4V4_MOD_PVTH0, IF_REAL,"Cross-term dependence of vto"), +IOP( "pua", BSIM4V4_MOD_PUA, IF_REAL, "Cross-term dependence of ua"), +IOP( "pua1", BSIM4V4_MOD_PUA1, IF_REAL, "Cross-term dependence of ua1"), +IOP( "pub", BSIM4V4_MOD_PUB, IF_REAL, "Cross-term dependence of ub"), +IOP( "pub1", BSIM4V4_MOD_PUB1, IF_REAL, "Cross-term dependence of ub1"), +IOP( "puc", BSIM4V4_MOD_PUC, IF_REAL, "Cross-term dependence of uc"), +IOP( "puc1", BSIM4V4_MOD_PUC1, IF_REAL, "Cross-term dependence of uc1"), +IOP( "pu0", BSIM4V4_MOD_PU0, IF_REAL, "Cross-term dependence of u0"), +IOP( "pute", BSIM4V4_MOD_PUTE, IF_REAL, "Cross-term dependence of ute"), +IOP( "pvoff", BSIM4V4_MOD_PVOFF, IF_REAL, "Cross-term dependence of voff"), +IOP( "pminv", BSIM4V4_MOD_PMINV, IF_REAL, "Cross-term dependence of minv"), +IOP( "pdelta", BSIM4V4_MOD_PDELTA, IF_REAL, "Cross-term dependence of delta"), +IOP( "prdsw", BSIM4V4_MOD_PRDSW, IF_REAL, "Cross-term dependence of rdsw "), +IOP( "prsw", BSIM4V4_MOD_PRSW, IF_REAL, "Cross-term dependence of rsw"), +IOP( "prdw", BSIM4V4_MOD_PRDW, IF_REAL, "Cross-term dependence of rdw"), + +IOP( "pprwg", BSIM4V4_MOD_PPRWG, IF_REAL, "Cross-term dependence of prwg "), +IOP( "pprwb", BSIM4V4_MOD_PPRWB, IF_REAL, "Cross-term dependence of prwb "), + +IOP( "pprt", BSIM4V4_MOD_PPRT, IF_REAL, "Cross-term dependence of prt "), +IOP( "peta0", BSIM4V4_MOD_PETA0, IF_REAL, "Cross-term dependence of eta0"), +IOP( "petab", BSIM4V4_MOD_PETAB, IF_REAL, "Cross-term dependence of etab"), +IOP( "ppclm", BSIM4V4_MOD_PPCLM, IF_REAL, "Cross-term dependence of pclm"), +IOP( "ppdiblc1", BSIM4V4_MOD_PPDIBL1, IF_REAL, "Cross-term dependence of pdiblc1"), +IOP( "ppdiblc2", BSIM4V4_MOD_PPDIBL2, IF_REAL, "Cross-term dependence of pdiblc2"), +IOP( "ppdiblcb", BSIM4V4_MOD_PPDIBLB, IF_REAL, "Cross-term dependence of pdiblcb"), +IOP( "pfprout", BSIM4V4_MOD_PFPROUT, IF_REAL, "Cross-term dependence of pdiblcb"), +IOP( "ppdits", BSIM4V4_MOD_PPDITS, IF_REAL, "Cross-term dependence of pdits"), +IOP( "ppditsd", BSIM4V4_MOD_PPDITSD, IF_REAL, "Cross-term dependence of pditsd"), +IOP( "ppscbe1", BSIM4V4_MOD_PPSCBE1, IF_REAL, "Cross-term dependence of pscbe1"), +IOP( "ppscbe2", BSIM4V4_MOD_PPSCBE2, IF_REAL, "Cross-term dependence of pscbe2"), +IOP( "ppvag", BSIM4V4_MOD_PPVAG, IF_REAL, "Cross-term dependence of pvag"), +IOP( "pwr", BSIM4V4_MOD_PWR, IF_REAL, "Cross-term dependence of wr"), +IOP( "pdwg", BSIM4V4_MOD_PDWG, IF_REAL, "Cross-term dependence of dwg"), +IOP( "pdwb", BSIM4V4_MOD_PDWB, IF_REAL, "Cross-term dependence of dwb"), +IOP( "pb0", BSIM4V4_MOD_PB0, IF_REAL, "Cross-term dependence of b0"), +IOP( "pb1", BSIM4V4_MOD_PB1, IF_REAL, "Cross-term dependence of b1"), +IOP( "pcgsl", BSIM4V4_MOD_PCGSL, IF_REAL, "Cross-term dependence of cgsl"), +IOP( "pcgdl", BSIM4V4_MOD_PCGDL, IF_REAL, "Cross-term dependence of cgdl"), +IOP( "pckappas", BSIM4V4_MOD_PCKAPPAS, IF_REAL, "Cross-term dependence of ckappas"), +IOP( "pckappad", BSIM4V4_MOD_PCKAPPAD, IF_REAL, "Cross-term dependence of ckappad"), +IOP( "pcf", BSIM4V4_MOD_PCF, IF_REAL, "Cross-term dependence of cf"), +IOP( "pclc", BSIM4V4_MOD_PCLC, IF_REAL, "Cross-term dependence of clc"), +IOP( "pcle", BSIM4V4_MOD_PCLE, IF_REAL, "Cross-term dependence of cle"), +IOP( "palpha0", BSIM4V4_MOD_PALPHA0, IF_REAL, "Cross-term dependence of alpha0"), +IOP( "palpha1", BSIM4V4_MOD_PALPHA1, IF_REAL, "Cross-term dependence of alpha1"), +IOP( "pbeta0", BSIM4V4_MOD_PBETA0, IF_REAL, "Cross-term dependence of beta0"), +IOP( "pagidl", BSIM4V4_MOD_PAGIDL, IF_REAL, "Cross-term dependence of agidl"), +IOP( "pbgidl", BSIM4V4_MOD_PBGIDL, IF_REAL, "Cross-term dependence of bgidl"), +IOP( "pcgidl", BSIM4V4_MOD_PCGIDL, IF_REAL, "Cross-term dependence of cgidl"), +IOP( "pegidl", BSIM4V4_MOD_PEGIDL, IF_REAL, "Cross-term dependence of egidl"), +IOP( "paigc", BSIM4V4_MOD_PAIGC, IF_REAL, "Cross-term dependence of aigc"), +IOP( "pbigc", BSIM4V4_MOD_PBIGC, IF_REAL, "Cross-term dependence of bigc"), +IOP( "pcigc", BSIM4V4_MOD_PCIGC, IF_REAL, "Cross-term dependence of cigc"), +IOP( "paigsd", BSIM4V4_MOD_PAIGSD, IF_REAL, "Cross-term dependence of aigsd"), +IOP( "pbigsd", BSIM4V4_MOD_PBIGSD, IF_REAL, "Cross-term dependence of bigsd"), +IOP( "pcigsd", BSIM4V4_MOD_PCIGSD, IF_REAL, "Cross-term dependence of cigsd"), +IOP( "paigbacc", BSIM4V4_MOD_PAIGBACC, IF_REAL, "Cross-term dependence of aigbacc"), +IOP( "pbigbacc", BSIM4V4_MOD_PBIGBACC, IF_REAL, "Cross-term dependence of bigbacc"), +IOP( "pcigbacc", BSIM4V4_MOD_PCIGBACC, IF_REAL, "Cross-term dependence of cigbacc"), +IOP( "paigbinv", BSIM4V4_MOD_PAIGBINV, IF_REAL, "Cross-term dependence of aigbinv"), +IOP( "pbigbinv", BSIM4V4_MOD_PBIGBINV, IF_REAL, "Cross-term dependence of bigbinv"), +IOP( "pcigbinv", BSIM4V4_MOD_PCIGBINV, IF_REAL, "Cross-term dependence of cigbinv"), +IOP( "pnigc", BSIM4V4_MOD_PNIGC, IF_REAL, "Cross-term dependence of nigc"), +IOP( "pnigbinv", BSIM4V4_MOD_PNIGBINV, IF_REAL, "Cross-term dependence of nigbinv"), +IOP( "pnigbacc", BSIM4V4_MOD_PNIGBACC, IF_REAL, "Cross-term dependence of nigbacc"), +IOP( "pntox", BSIM4V4_MOD_PNTOX, IF_REAL, "Cross-term dependence of ntox"), +IOP( "peigbinv", BSIM4V4_MOD_PEIGBINV, IF_REAL, "Cross-term dependence for eigbinv"), +IOP( "ppigcd", BSIM4V4_MOD_PPIGCD, IF_REAL, "Cross-term dependence for pigcd"), +IOP( "ppoxedge", BSIM4V4_MOD_PPOXEDGE, IF_REAL, "Cross-term dependence for poxedge"), +IOP( "pvfbcv", BSIM4V4_MOD_PVFBCV, IF_REAL, "Cross-term dependence of vfbcv"), +IOP( "pvfb", BSIM4V4_MOD_PVFB, IF_REAL, "Cross-term dependence of vfb"), +IOP( "pacde", BSIM4V4_MOD_PACDE, IF_REAL, "Cross-term dependence of acde"), +IOP( "pmoin", BSIM4V4_MOD_PMOIN, IF_REAL, "Cross-term dependence of moin"), +IOP( "pnoff", BSIM4V4_MOD_PNOFF, IF_REAL, "Cross-term dependence of noff"), +IOP( "pvoffcv", BSIM4V4_MOD_PVOFFCV, IF_REAL, "Cross-term dependence of voffcv"), +IOP( "pxrcrg1", BSIM4V4_MOD_PXRCRG1, IF_REAL, "Cross-term dependence of xrcrg1"), +IOP( "pxrcrg2", BSIM4V4_MOD_PXRCRG2, IF_REAL, "Cross-term dependence of xrcrg2"), +IOP( "plambda", BSIM4V4_MOD_PLAMBDA, IF_REAL, "Cross-term dependence of lambda"), +IOP( "pvtl", BSIM4V4_MOD_PVTL, IF_REAL, "Cross-term dependence of vtl"), +IOP( "pxn", BSIM4V4_MOD_PXN, IF_REAL, "Cross-term dependence of xn"), +IOP( "peu", BSIM4V4_MOD_PEU, IF_REAL, "Cross-term dependence of eu"), +IOP( "pvfbsdoff", BSIM4V4_MOD_PVFBSDOFF, IF_REAL, "Cross-term dependence of vfbsdoff"), + +/* stress effect*/ +IOP( "saref", BSIM4V4_MOD_SAREF, IF_REAL, "Reference distance between OD edge to poly of one side"), +IOP( "sbref", BSIM4V4_MOD_SBREF, IF_REAL, "Reference distance between OD edge to poly of the other side"), +IOP( "wlod", BSIM4V4_MOD_WLOD, IF_REAL, "Width parameter for stress effect"), +IOP( "ku0", BSIM4V4_MOD_KU0, IF_REAL, "Mobility degradation/enhancement coefficient for LOD"), +IOP( "kvsat", BSIM4V4_MOD_KVSAT, IF_REAL, "Saturation velocity degradation/enhancement parameter for LOD"), +IOP( "kvth0", BSIM4V4_MOD_KVTH0, IF_REAL, "Threshold degradation/enhancement parameter for LOD"), +IOP( "tku0", BSIM4V4_MOD_TKU0, IF_REAL, "Temperature coefficient of KU0"), +IOP( "llodku0", BSIM4V4_MOD_LLODKU0, IF_REAL, "Length parameter for u0 LOD effect"), +IOP( "wlodku0", BSIM4V4_MOD_WLODKU0, IF_REAL, "Width parameter for u0 LOD effect"), +IOP( "llodvth", BSIM4V4_MOD_LLODVTH, IF_REAL, "Length parameter for vth LOD effect"), +IOP( "wlodvth", BSIM4V4_MOD_WLODVTH, IF_REAL, "Width parameter for vth LOD effect"), +IOP( "lku0", BSIM4V4_MOD_LKU0, IF_REAL, "Length dependence of ku0"), +IOP( "wku0", BSIM4V4_MOD_WKU0, IF_REAL, "Width dependence of ku0"), +IOP( "pku0", BSIM4V4_MOD_PKU0, IF_REAL, "Cross-term dependence of ku0"), +IOP( "lkvth0", BSIM4V4_MOD_LKVTH0, IF_REAL, "Length dependence of kvth0"), +IOP( "wkvth0", BSIM4V4_MOD_WKVTH0, IF_REAL, "Width dependence of kvth0"), +IOP( "pkvth0", BSIM4V4_MOD_PKVTH0, IF_REAL, "Cross-term dependence of kvth0"), +IOP( "stk2", BSIM4V4_MOD_STK2, IF_REAL, "K2 shift factor related to stress effect on vth"), +IOP( "lodk2", BSIM4V4_MOD_LODK2, IF_REAL, "K2 shift modification factor for stress effect"), +IOP( "steta0", BSIM4V4_MOD_STETA0, IF_REAL, "eta0 shift factor related to stress effect on vth"), +IOP( "lodeta0", BSIM4V4_MOD_LODETA0, IF_REAL, "eta0 shift modification factor for stress effect"), + + +IOP( "noia", BSIM4V4_MOD_NOIA, IF_REAL, "Flicker noise parameter"), +IOP( "noib", BSIM4V4_MOD_NOIB, IF_REAL, "Flicker noise parameter"), +IOP( "noic", BSIM4V4_MOD_NOIC, IF_REAL, "Flicker noise parameter"), +IOP( "tnoia", BSIM4V4_MOD_TNOIA, IF_REAL, "Thermal noise parameter"), +IOP( "tnoib", BSIM4V4_MOD_TNOIB, IF_REAL, "Thermal noise parameter"), +IOP( "rnoia", BSIM4V4_MOD_RNOIA, IF_REAL, "Thermal noise coefficient"), +IOP( "rnoib", BSIM4V4_MOD_RNOIB, IF_REAL, "Thermal noise coefficient"), +IOP( "ntnoi", BSIM4V4_MOD_NTNOI, IF_REAL, "Thermal noise parameter"), +IOP( "em", BSIM4V4_MOD_EM, IF_REAL, "Flicker noise parameter"), +IOP( "ef", BSIM4V4_MOD_EF, IF_REAL, "Flicker noise frequency exponent"), +IOP( "af", BSIM4V4_MOD_AF, IF_REAL, "Flicker noise exponent"), +IOP( "kf", BSIM4V4_MOD_KF, IF_REAL, "Flicker noise coefficient"), + +IOP( "stimod", BSIM4V4_MOD_STIMOD, IF_REAL, "Stress effect model selector"), +IOP( "sa0", BSIM4V4_MOD_SA0, IF_REAL, "Distance between OD edge to poly of one side"), +IOP( "sb0", BSIM4V4_MOD_SB0, IF_REAL, "Distance between OD edge to poly of other side"), + +IP( "nmos", BSIM4V4_MOD_NMOS, IF_FLAG, "Flag to indicate NMOS"), +IP( "pmos", BSIM4V4_MOD_PMOS, IF_FLAG, "Flag to indicate PMOS"), +}; + +char *BSIM4V4names[] = { + "Drain", + "Gate", + "Source", + "Bulk", + "Charge" +}; + +int BSIM4V4nSize = NUMELEMS(BSIM4V4names); +int BSIM4V4pTSize = NUMELEMS(BSIM4V4pTable); +int BSIM4V4mPTSize = NUMELEMS(BSIM4V4mPTable); +int BSIM4V4iSize = sizeof(BSIM4V4instance); +int BSIM4V4mSize = sizeof(BSIM4V4model); diff --git a/src/spicelib/devices/bsim4v4/b4v4acld.c b/src/spicelib/devices/bsim4v4/b4v4acld.c new file mode 100644 index 000000000..6f85cc7de --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4acld.c @@ -0,0 +1,672 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4acld.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 10/05/2001. + **********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim4v4def.h" +#include "sperror.h" +#include "suffix.h" + + +int +BSIM4V4acLoad(inModel,ckt) +GENmodel *inModel; +CKTcircuit *ckt; +{ +BSIM4V4model *model = (BSIM4V4model*)inModel; +BSIM4V4instance *here; + +double gjbd, gjbs, geltd, gcrg, gcrgg, gcrgd, gcrgs, gcrgb; +double xcbgb, xcbdb, xcbsb, xcbbb; +double xcggbr, xcgdbr, xcgsbr, xcgbbr, xcggbi, xcgdbi, xcgsbi, xcgbbi; +double Cggr, Cgdr, Cgsr, Cgbr, Cggi, Cgdi, Cgsi, Cgbi; +double xcddbr, xcdgbr, xcdsbr, xcdbbr, xcsdbr, xcsgbr, xcssbr, xcsbbr; +double xcddbi, xcdgbi, xcdsbi, xcdbbi, xcsdbi, xcsgbi, xcssbi, xcsbbi; +double xcdbdb, xcsbsb=0.0, xcgmgmb=0.0, xcgmdb=0.0, xcgmsb=0.0, xcdgmb, xcsgmb; +double xcgmbb=0.0, xcbgmb; +double capbd, capbs, omega; +double gstot, gstotd, gstotg, gstots, gstotb, gspr; +double gdtot, gdtotd, gdtotg, gdtots, gdtotb, gdpr; +double gIstotg, gIstotd, gIstots, gIstotb; +double gIdtotg, gIdtotd, gIdtots, gIdtotb; +double gIbtotg, gIbtotd, gIbtots, gIbtotb; +double gIgtotg, gIgtotd, gIgtots, gIgtotb; +double cgso, cgdo, cgbo; +double gbspsp, gbbdp, gbbsp, gbspg, gbspb; +double gbspdp, gbdpdp, gbdpg, gbdpb, gbdpsp; +double T0=0.0, T1, T2, T3; +double Csg, Csd, Css; +double Cdgr, Cddr, Cdsr, Cdbr, Csgr, Csdr, Cssr, Csbr; +double Cdgi, Cddi, Cdsi, Cdbi, Csgi, Csdi, Cssi, Csbi; +double gmr, gmi, gmbsr, gmbsi, gdsr, gdsi; +double FwdSumr, RevSumr, Gmr, Gmbsr; +double FwdSumi, RevSumi, Gmi, Gmbsi; +struct bsim4SizeDependParam *pParam; +double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; + +double m; + + omega = ckt->CKTomega; + for (; model != NULL; model = model->BSIM4V4nextModel) + { for (here = model->BSIM4V4instances; here!= NULL; + here = here->BSIM4V4nextInstance) + { if (here->BSIM4V4owner != ARCHme) continue; + pParam = here->pParam; + capbd = here->BSIM4V4capbd; + capbs = here->BSIM4V4capbs; + cgso = here->BSIM4V4cgso; + cgdo = here->BSIM4V4cgdo; + cgbo = pParam->BSIM4V4cgbo; + + Csd = -(here->BSIM4V4cddb + here->BSIM4V4cgdb + here->BSIM4V4cbdb); + Csg = -(here->BSIM4V4cdgb + here->BSIM4V4cggb + here->BSIM4V4cbgb); + Css = -(here->BSIM4V4cdsb + here->BSIM4V4cgsb + here->BSIM4V4cbsb); + + if (here->BSIM4V4acnqsMod) + { T0 = omega * here->BSIM4V4taunet; + T1 = T0 * T0; + T2 = 1.0 / (1.0 + T1); + T3 = T0 * T2; + + gmr = here->BSIM4V4gm * T2; + gmbsr = here->BSIM4V4gmbs * T2; + gdsr = here->BSIM4V4gds * T2; + + gmi = -here->BSIM4V4gm * T3; + gmbsi = -here->BSIM4V4gmbs * T3; + gdsi = -here->BSIM4V4gds * T3; + + Cddr = here->BSIM4V4cddb * T2; + Cdgr = here->BSIM4V4cdgb * T2; + Cdsr = here->BSIM4V4cdsb * T2; + Cdbr = -(Cddr + Cdgr + Cdsr); + + /* WDLiu: Cxyi mulitplied by jomega below, and actually to be of conductance */ + Cddi = here->BSIM4V4cddb * T3 * omega; + Cdgi = here->BSIM4V4cdgb * T3 * omega; + Cdsi = here->BSIM4V4cdsb * T3 * omega; + Cdbi = -(Cddi + Cdgi + Cdsi); + + Csdr = Csd * T2; + Csgr = Csg * T2; + Cssr = Css * T2; + Csbr = -(Csdr + Csgr + Cssr); + + Csdi = Csd * T3 * omega; + Csgi = Csg * T3 * omega; + Cssi = Css * T3 * omega; + Csbi = -(Csdi + Csgi + Cssi); + + Cgdr = -(Cddr + Csdr + here->BSIM4V4cbdb); + Cggr = -(Cdgr + Csgr + here->BSIM4V4cbgb); + Cgsr = -(Cdsr + Cssr + here->BSIM4V4cbsb); + Cgbr = -(Cgdr + Cggr + Cgsr); + + Cgdi = -(Cddi + Csdi); + Cggi = -(Cdgi + Csgi); + Cgsi = -(Cdsi + Cssi); + Cgbi = -(Cgdi + Cggi + Cgsi); + } + else /* QS */ + { gmr = here->BSIM4V4gm; + gmbsr = here->BSIM4V4gmbs; + gdsr = here->BSIM4V4gds; + gmi = gmbsi = gdsi = 0.0; + + Cddr = here->BSIM4V4cddb; + Cdgr = here->BSIM4V4cdgb; + Cdsr = here->BSIM4V4cdsb; + Cdbr = -(Cddr + Cdgr + Cdsr); + Cddi = Cdgi = Cdsi = Cdbi = 0.0; + + Csdr = Csd; + Csgr = Csg; + Cssr = Css; + Csbr = -(Csdr + Csgr + Cssr); + Csdi = Csgi = Cssi = Csbi = 0.0; + + Cgdr = here->BSIM4V4cgdb; + Cggr = here->BSIM4V4cggb; + Cgsr = here->BSIM4V4cgsb; + Cgbr = -(Cgdr + Cggr + Cgsr); + Cgdi = Cggi = Cgsi = Cgbi = 0.0; + } + + + if (here->BSIM4V4mode >= 0) + { Gmr = gmr; + Gmbsr = gmbsr; + FwdSumr = Gmr + Gmbsr; + RevSumr = 0.0; + Gmi = gmi; + Gmbsi = gmbsi; + FwdSumi = Gmi + Gmbsi; + RevSumi = 0.0; + + gbbdp = -(here->BSIM4V4gbds); + gbbsp = here->BSIM4V4gbds + here->BSIM4V4gbgs + here->BSIM4V4gbbs; + gbdpg = here->BSIM4V4gbgs; + gbdpdp = here->BSIM4V4gbds; + gbdpb = here->BSIM4V4gbbs; + gbdpsp = -(gbdpg + gbdpdp + gbdpb); + + gbspdp = 0.0; + gbspg = 0.0; + gbspb = 0.0; + gbspsp = 0.0; + + if (model->BSIM4V4igcMod) + { gIstotg = here->BSIM4V4gIgsg + here->BSIM4V4gIgcsg; + gIstotd = here->BSIM4V4gIgcsd; + gIstots = here->BSIM4V4gIgss + here->BSIM4V4gIgcss; + gIstotb = here->BSIM4V4gIgcsb; + + gIdtotg = here->BSIM4V4gIgdg + here->BSIM4V4gIgcdg; + gIdtotd = here->BSIM4V4gIgdd + here->BSIM4V4gIgcdd; + gIdtots = here->BSIM4V4gIgcds; + gIdtotb = here->BSIM4V4gIgcdb; + } + else + { gIstotg = gIstotd = gIstots = gIstotb = 0.0; + gIdtotg = gIdtotd = gIdtots = gIdtotb = 0.0; + } + + if (model->BSIM4V4igbMod) + { gIbtotg = here->BSIM4V4gIgbg; + gIbtotd = here->BSIM4V4gIgbd; + gIbtots = here->BSIM4V4gIgbs; + gIbtotb = here->BSIM4V4gIgbb; + } + else + gIbtotg = gIbtotd = gIbtots = gIbtotb = 0.0; + + if ((model->BSIM4V4igcMod != 0) || (model->BSIM4V4igbMod != 0)) + { gIgtotg = gIstotg + gIdtotg + gIbtotg; + gIgtotd = gIstotd + gIdtotd + gIbtotd ; + gIgtots = gIstots + gIdtots + gIbtots; + gIgtotb = gIstotb + gIdtotb + gIbtotb; + } + else + gIgtotg = gIgtotd = gIgtots = gIgtotb = 0.0; + + if (here->BSIM4V4rgateMod == 2) + T0 = *(ckt->CKTstates[0] + here->BSIM4V4vges) + - *(ckt->CKTstates[0] + here->BSIM4V4vgs); + else if (here->BSIM4V4rgateMod == 3) + T0 = *(ckt->CKTstates[0] + here->BSIM4V4vgms) + - *(ckt->CKTstates[0] + here->BSIM4V4vgs); + if (here->BSIM4V4rgateMod > 1) + { gcrgd = here->BSIM4V4gcrgd * T0; + gcrgg = here->BSIM4V4gcrgg * T0; + gcrgs = here->BSIM4V4gcrgs * T0; + gcrgb = here->BSIM4V4gcrgb * T0; + gcrgg -= here->BSIM4V4gcrg; + gcrg = here->BSIM4V4gcrg; + } + else + gcrg = gcrgd = gcrgg = gcrgs = gcrgb = 0.0; + + if (here->BSIM4V4rgateMod == 3) + { xcgmgmb = (cgdo + cgso + pParam->BSIM4V4cgbo) * omega; + xcgmdb = -cgdo * omega; + xcgmsb = -cgso * omega; + xcgmbb = -pParam->BSIM4V4cgbo * omega; + + xcdgmb = xcgmdb; + xcsgmb = xcgmsb; + xcbgmb = xcgmbb; + + xcggbr = Cggr * omega; + xcgdbr = Cgdr * omega; + xcgsbr = Cgsr * omega; + xcgbbr = -(xcggbr + xcgdbr + xcgsbr); + + xcdgbr = Cdgr * omega; + xcsgbr = Csgr * omega; + xcbgb = here->BSIM4V4cbgb * omega; + } + else + { xcggbr = (Cggr + cgdo + cgso + pParam->BSIM4V4cgbo ) * omega; + xcgdbr = (Cgdr - cgdo) * omega; + xcgsbr = (Cgsr - cgso) * omega; + xcgbbr = -(xcggbr + xcgdbr + xcgsbr); + + xcdgbr = (Cdgr - cgdo) * omega; + xcsgbr = (Csgr - cgso) * omega; + xcbgb = (here->BSIM4V4cbgb - pParam->BSIM4V4cgbo) * omega; + + xcdgmb = xcsgmb = xcbgmb = 0.0; + } + xcddbr = (Cddr + here->BSIM4V4capbd + cgdo) * omega; + xcdsbr = Cdsr * omega; + xcsdbr = Csdr * omega; + xcssbr = (here->BSIM4V4capbs + cgso + Cssr) * omega; + + if (!here->BSIM4V4rbodyMod) + { xcdbbr = -(xcdgbr + xcddbr + xcdsbr + xcdgmb); + xcsbbr = -(xcsgbr + xcsdbr + xcssbr + xcsgmb); + + xcbdb = (here->BSIM4V4cbdb - here->BSIM4V4capbd) * omega; + xcbsb = (here->BSIM4V4cbsb - here->BSIM4V4capbs) * omega; + xcdbdb = 0.0; + } + else + { xcdbbr = Cdbr * omega; + xcsbbr = -(xcsgbr + xcsdbr + xcssbr + xcsgmb) + + here->BSIM4V4capbs * omega; + + xcbdb = here->BSIM4V4cbdb * omega; + xcbsb = here->BSIM4V4cbsb * omega; + + xcdbdb = -here->BSIM4V4capbd * omega; + xcsbsb = -here->BSIM4V4capbs * omega; + } + xcbbb = -(xcbdb + xcbgb + xcbsb + xcbgmb); + + xcdgbi = Cdgi; + xcsgbi = Csgi; + xcddbi = Cddi; + xcdsbi = Cdsi; + xcsdbi = Csdi; + xcssbi = Cssi; + xcdbbi = Cdbi; + xcsbbi = Csbi; + xcggbi = Cggi; + xcgdbi = Cgdi; + xcgsbi = Cgsi; + xcgbbi = Cgbi; + } + else /* Reverse mode */ + { Gmr = -gmr; + Gmbsr = -gmbsr; + FwdSumr = 0.0; + RevSumr = -(Gmr + Gmbsr); + Gmi = -gmi; + Gmbsi = -gmbsi; + FwdSumi = 0.0; + RevSumi = -(Gmi + Gmbsi); + + gbbsp = -(here->BSIM4V4gbds); + gbbdp = here->BSIM4V4gbds + here->BSIM4V4gbgs + here->BSIM4V4gbbs; + + gbdpg = 0.0; + gbdpsp = 0.0; + gbdpb = 0.0; + gbdpdp = 0.0; + + gbspg = here->BSIM4V4gbgs; + gbspsp = here->BSIM4V4gbds; + gbspb = here->BSIM4V4gbbs; + gbspdp = -(gbspg + gbspsp + gbspb); + + if (model->BSIM4V4igcMod) + { gIstotg = here->BSIM4V4gIgsg + here->BSIM4V4gIgcdg; + gIstotd = here->BSIM4V4gIgcds; + gIstots = here->BSIM4V4gIgss + here->BSIM4V4gIgcdd; + gIstotb = here->BSIM4V4gIgcdb; + + gIdtotg = here->BSIM4V4gIgdg + here->BSIM4V4gIgcsg; + gIdtotd = here->BSIM4V4gIgdd + here->BSIM4V4gIgcss; + gIdtots = here->BSIM4V4gIgcsd; + gIdtotb = here->BSIM4V4gIgcsb; + } + else + { gIstotg = gIstotd = gIstots = gIstotb = 0.0; + gIdtotg = gIdtotd = gIdtots = gIdtotb = 0.0; + } + + if (model->BSIM4V4igbMod) + { gIbtotg = here->BSIM4V4gIgbg; + gIbtotd = here->BSIM4V4gIgbs; + gIbtots = here->BSIM4V4gIgbd; + gIbtotb = here->BSIM4V4gIgbb; + } + else + gIbtotg = gIbtotd = gIbtots = gIbtotb = 0.0; + + if ((model->BSIM4V4igcMod != 0) || (model->BSIM4V4igbMod != 0)) + { gIgtotg = gIstotg + gIdtotg + gIbtotg; + gIgtotd = gIstotd + gIdtotd + gIbtotd ; + gIgtots = gIstots + gIdtots + gIbtots; + gIgtotb = gIstotb + gIdtotb + gIbtotb; + } + else + gIgtotg = gIgtotd = gIgtots = gIgtotb = 0.0; + + if (here->BSIM4V4rgateMod == 2) + T0 = *(ckt->CKTstates[0] + here->BSIM4V4vges) + - *(ckt->CKTstates[0] + here->BSIM4V4vgs); + else if (here->BSIM4V4rgateMod == 3) + T0 = *(ckt->CKTstates[0] + here->BSIM4V4vgms) + - *(ckt->CKTstates[0] + here->BSIM4V4vgs); + if (here->BSIM4V4rgateMod > 1) + { gcrgd = here->BSIM4V4gcrgs * T0; + gcrgg = here->BSIM4V4gcrgg * T0; + gcrgs = here->BSIM4V4gcrgd * T0; + gcrgb = here->BSIM4V4gcrgb * T0; + gcrgg -= here->BSIM4V4gcrg; + gcrg = here->BSIM4V4gcrg; + } + else + gcrg = gcrgd = gcrgg = gcrgs = gcrgb = 0.0; + + if (here->BSIM4V4rgateMod == 3) + { xcgmgmb = (cgdo + cgso + pParam->BSIM4V4cgbo) * omega; + xcgmdb = -cgdo * omega; + xcgmsb = -cgso * omega; + xcgmbb = -pParam->BSIM4V4cgbo * omega; + + xcdgmb = xcgmdb; + xcsgmb = xcgmsb; + xcbgmb = xcgmbb; + + xcggbr = Cggr * omega; + xcgdbr = Cgsr * omega; + xcgsbr = Cgdr * omega; + xcgbbr = -(xcggbr + xcgdbr + xcgsbr); + + xcdgbr = Csgr * omega; + xcsgbr = Cdgr * omega; + xcbgb = here->BSIM4V4cbgb * omega; + } + else + { xcggbr = (Cggr + cgdo + cgso + pParam->BSIM4V4cgbo ) * omega; + xcgdbr = (Cgsr - cgdo) * omega; + xcgsbr = (Cgdr - cgso) * omega; + xcgbbr = -(xcggbr + xcgdbr + xcgsbr); + + xcdgbr = (Csgr - cgdo) * omega; + xcsgbr = (Cdgr - cgso) * omega; + xcbgb = (here->BSIM4V4cbgb - pParam->BSIM4V4cgbo) * omega; + + xcdgmb = xcsgmb = xcbgmb = 0.0; + } + xcddbr = (here->BSIM4V4capbd + cgdo + Cssr) * omega; + xcdsbr = Csdr * omega; + xcsdbr = Cdsr * omega; + xcssbr = (Cddr + here->BSIM4V4capbs + cgso) * omega; + + if (!here->BSIM4V4rbodyMod) + { xcdbbr = -(xcdgbr + xcddbr + xcdsbr + xcdgmb); + xcsbbr = -(xcsgbr + xcsdbr + xcssbr + xcsgmb); + + xcbdb = (here->BSIM4V4cbsb - here->BSIM4V4capbd) * omega; + xcbsb = (here->BSIM4V4cbdb - here->BSIM4V4capbs) * omega; + xcdbdb = 0.0; + } + else + { xcdbbr = -(xcdgbr + xcddbr + xcdsbr + xcdgmb) + + here->BSIM4V4capbd * omega; + xcsbbr = Cdbr * omega; + + xcbdb = here->BSIM4V4cbsb * omega; + xcbsb = here->BSIM4V4cbdb * omega; + xcdbdb = -here->BSIM4V4capbd * omega; + xcsbsb = -here->BSIM4V4capbs * omega; + } + xcbbb = -(xcbgb + xcbdb + xcbsb + xcbgmb); + + xcdgbi = Csgi; + xcsgbi = Cdgi; + xcddbi = Cssi; + xcdsbi = Csdi; + xcsdbi = Cdsi; + xcssbi = Cddi; + xcdbbi = Csbi; + xcsbbi = Cdbi; + xcggbi = Cggi; + xcgdbi = Cgsi; + xcgsbi = Cgdi; + xcgbbi = Cgbi; + } + + if (model->BSIM4V4rdsMod == 1) + { gstot = here->BSIM4V4gstot; + gstotd = here->BSIM4V4gstotd; + gstotg = here->BSIM4V4gstotg; + gstots = here->BSIM4V4gstots - gstot; + gstotb = here->BSIM4V4gstotb; + + gdtot = here->BSIM4V4gdtot; + gdtotd = here->BSIM4V4gdtotd - gdtot; + gdtotg = here->BSIM4V4gdtotg; + gdtots = here->BSIM4V4gdtots; + gdtotb = here->BSIM4V4gdtotb; + } + else + { gstot = gstotd = gstotg = gstots = gstotb = 0.0; + gdtot = gdtotd = gdtotg = gdtots = gdtotb = 0.0; + } + + + /* + * Loading AC matrix + */ + + m = here->BSIM4V4m; + + if (!model->BSIM4V4rdsMod) + { gdpr = here->BSIM4V4drainConductance; + gspr = here->BSIM4V4sourceConductance; + } + else + gdpr = gspr = 0.0; + + if (!here->BSIM4V4rbodyMod) + { gjbd = here->BSIM4V4gbd; + gjbs = here->BSIM4V4gbs; + } + else + gjbd = gjbs = 0.0; + + geltd = here->BSIM4V4grgeltd; + + if (here->BSIM4V4rgateMod == 1) + { *(here->BSIM4V4GEgePtr) += m * geltd; + *(here->BSIM4V4GPgePtr) -= m * geltd; + *(here->BSIM4V4GEgpPtr) -= m * geltd; + + *(here->BSIM4V4GPgpPtr +1) += m * xcggbr; + *(here->BSIM4V4GPgpPtr) += m * (geltd + xcggbi + gIgtotg); + *(here->BSIM4V4GPdpPtr +1) += m * xcgdbr; + *(here->BSIM4V4GPdpPtr) += m * (xcgdbi + gIgtotd); + *(here->BSIM4V4GPspPtr +1) += m * xcgsbr; + *(here->BSIM4V4GPspPtr) += m * (xcgsbi + gIgtots); + *(here->BSIM4V4GPbpPtr +1) += m * xcgbbr; + *(here->BSIM4V4GPbpPtr) += m * (xcgbbi + gIgtotb); + } /* WDLiu: gcrg already subtracted from all gcrgg below */ + else if (here->BSIM4V4rgateMod == 2) + { *(here->BSIM4V4GEgePtr) += m * gcrg; + *(here->BSIM4V4GEgpPtr) += m * gcrgg; + *(here->BSIM4V4GEdpPtr) += m * gcrgd; + *(here->BSIM4V4GEspPtr) += m * gcrgs; + *(here->BSIM4V4GEbpPtr) += m * gcrgb; + + *(here->BSIM4V4GPgePtr) -= m * gcrg; + *(here->BSIM4V4GPgpPtr +1) += m * xcggbr; + *(here->BSIM4V4GPgpPtr) -= m * (gcrgg - xcggbi - gIgtotg); + *(here->BSIM4V4GPdpPtr +1) += m * xcgdbr; + *(here->BSIM4V4GPdpPtr) -= m * (gcrgd - xcgdbi - gIgtotd); + *(here->BSIM4V4GPspPtr +1) += m * xcgsbr; + *(here->BSIM4V4GPspPtr) -= m * (gcrgs - xcgsbi - gIgtots); + *(here->BSIM4V4GPbpPtr +1) += m * xcgbbr; + *(here->BSIM4V4GPbpPtr) -= m * (gcrgb - xcgbbi - gIgtotb); + } + else if (here->BSIM4V4rgateMod == 3) + { *(here->BSIM4V4GEgePtr) += m * geltd; + *(here->BSIM4V4GEgmPtr) -= m * geltd; + *(here->BSIM4V4GMgePtr) -= m * geltd; + *(here->BSIM4V4GMgmPtr) += m * (geltd + gcrg); + *(here->BSIM4V4GMgmPtr +1) += m * xcgmgmb; + + *(here->BSIM4V4GMdpPtr) += m * gcrgd; + *(here->BSIM4V4GMdpPtr +1) += m * xcgmdb; + *(here->BSIM4V4GMgpPtr) += m * gcrgg; + *(here->BSIM4V4GMspPtr) += m * gcrgs; + *(here->BSIM4V4GMspPtr +1) += m * xcgmsb; + *(here->BSIM4V4GMbpPtr) += m * gcrgb; + *(here->BSIM4V4GMbpPtr +1) += m * xcgmbb; + + *(here->BSIM4V4DPgmPtr +1) += m * xcdgmb; + *(here->BSIM4V4GPgmPtr) -= m * gcrg; + *(here->BSIM4V4SPgmPtr +1) += m * xcsgmb; + *(here->BSIM4V4BPgmPtr +1) += m * xcbgmb; + + *(here->BSIM4V4GPgpPtr) -= m * (gcrgg - xcggbi - gIgtotg); + *(here->BSIM4V4GPgpPtr +1) += m * xcggbr; + *(here->BSIM4V4GPdpPtr) -= m * (gcrgd - xcgdbi - gIgtotd); + *(here->BSIM4V4GPdpPtr +1) += m * xcgdbr; + *(here->BSIM4V4GPspPtr) -= m * (gcrgs - xcgsbi - gIgtots); + *(here->BSIM4V4GPspPtr +1) += m * xcgsbr; + *(here->BSIM4V4GPbpPtr) -= m * (gcrgb - xcgbbi - gIgtotb); + *(here->BSIM4V4GPbpPtr +1) += m * xcgbbr; + } + else + { *(here->BSIM4V4GPgpPtr +1) += m * xcggbr; + *(here->BSIM4V4GPgpPtr) += m * (xcggbi + gIgtotg); + *(here->BSIM4V4GPdpPtr +1) += m * xcgdbr; + *(here->BSIM4V4GPdpPtr) += m * (xcgdbi + gIgtotd); + *(here->BSIM4V4GPspPtr +1) += m * xcgsbr; + *(here->BSIM4V4GPspPtr) += m * (xcgsbi + gIgtots); + *(here->BSIM4V4GPbpPtr +1) += m * xcgbbr; + *(here->BSIM4V4GPbpPtr) += m * (xcgbbi + gIgtotb); + } + + if (model->BSIM4V4rdsMod) + { (*(here->BSIM4V4DgpPtr) += m * gdtotg); + (*(here->BSIM4V4DspPtr) += m * gdtots); + (*(here->BSIM4V4DbpPtr) += m * gdtotb); + (*(here->BSIM4V4SdpPtr) += m * gstotd); + (*(here->BSIM4V4SgpPtr) += m * gstotg); + (*(here->BSIM4V4SbpPtr) += m * gstotb); + } + + *(here->BSIM4V4DPdpPtr +1) += m * (xcddbr + gdsi + RevSumi); + *(here->BSIM4V4DPdpPtr) += m * (gdpr + xcddbi + gdsr + here->BSIM4V4gbd + - gdtotd + RevSumr + gbdpdp - gIdtotd); + *(here->BSIM4V4DPdPtr) -= m * (gdpr + gdtot); + *(here->BSIM4V4DPgpPtr +1) += m * (xcdgbr + Gmi); + *(here->BSIM4V4DPgpPtr) += m * (Gmr + xcdgbi - gdtotg + gbdpg - gIdtotg); + *(here->BSIM4V4DPspPtr +1) += m * (xcdsbr - gdsi - FwdSumi); + *(here->BSIM4V4DPspPtr) -= m * (gdsr - xcdsbi + FwdSumr + gdtots - gbdpsp + gIdtots); + *(here->BSIM4V4DPbpPtr +1) += m * (xcdbbr + Gmbsi); + *(here->BSIM4V4DPbpPtr) -= m * (gjbd + gdtotb - xcdbbi - Gmbsr - gbdpb + gIdtotb); + + *(here->BSIM4V4DdpPtr) -= m * (gdpr - gdtotd); + *(here->BSIM4V4DdPtr) += m * (gdpr + gdtot); + + *(here->BSIM4V4SPdpPtr +1) += m * (xcsdbr - gdsi - RevSumi); + *(here->BSIM4V4SPdpPtr) -= m * (gdsr - xcsdbi + gstotd + RevSumr - gbspdp + gIstotd); + *(here->BSIM4V4SPgpPtr +1) += m * (xcsgbr - Gmi); + *(here->BSIM4V4SPgpPtr) -= m * (Gmr - xcsgbi + gstotg - gbspg + gIstotg); + *(here->BSIM4V4SPspPtr +1) += m * (xcssbr + gdsi + FwdSumi); + *(here->BSIM4V4SPspPtr) += m * (gspr + xcssbi + gdsr + here->BSIM4V4gbs + - gstots + FwdSumr + gbspsp - gIstots); + *(here->BSIM4V4SPsPtr) -= m * (gspr + gstot); + *(here->BSIM4V4SPbpPtr +1) += m * (xcsbbr - Gmbsi); + *(here->BSIM4V4SPbpPtr) -= m * (gjbs + gstotb - xcsbbi + Gmbsr - gbspb + gIstotb); + + *(here->BSIM4V4SspPtr) -= m * (gspr - gstots); + *(here->BSIM4V4SsPtr) += m * (gspr + gstot); + + *(here->BSIM4V4BPdpPtr +1) += m * xcbdb; + *(here->BSIM4V4BPdpPtr) -= m * (gjbd - gbbdp + gIbtotd); + *(here->BSIM4V4BPgpPtr +1) += m * xcbgb; + *(here->BSIM4V4BPgpPtr) -= m * (here->BSIM4V4gbgs + gIbtotg); + *(here->BSIM4V4BPspPtr +1) += m * xcbsb; + *(here->BSIM4V4BPspPtr) -= m * (gjbs - gbbsp + gIbtots); + *(here->BSIM4V4BPbpPtr +1) += m * xcbbb; + *(here->BSIM4V4BPbpPtr) += m * (gjbd + gjbs - here->BSIM4V4gbbs + - gIbtotb); + ggidld = here->BSIM4V4ggidld; + ggidlg = here->BSIM4V4ggidlg; + ggidlb = here->BSIM4V4ggidlb; + ggislg = here->BSIM4V4ggislg; + ggisls = here->BSIM4V4ggisls; + ggislb = here->BSIM4V4ggislb; + + /* stamp gidl */ + (*(here->BSIM4V4DPdpPtr) += m * ggidld); + (*(here->BSIM4V4DPgpPtr) += m * ggidlg); + (*(here->BSIM4V4DPspPtr) -= m * ((ggidlg + ggidld) + ggidlb)); + (*(here->BSIM4V4DPbpPtr) += m * ggidlb); + (*(here->BSIM4V4BPdpPtr) -= m * ggidld); + (*(here->BSIM4V4BPgpPtr) -= m * ggidlg); + (*(here->BSIM4V4BPspPtr) += m * ((ggidlg + ggidld) + ggidlb)); + (*(here->BSIM4V4BPbpPtr) -= m * ggidlb); + /* stamp gisl */ + (*(here->BSIM4V4SPdpPtr) -= m * ((ggisls + ggislg) + ggislb)); + (*(here->BSIM4V4SPgpPtr) += m * ggislg); + (*(here->BSIM4V4SPspPtr) += m * ggisls); + (*(here->BSIM4V4SPbpPtr) += m * ggislb); + (*(here->BSIM4V4BPdpPtr) += m * ((ggislg + ggisls) + ggislb)); + (*(here->BSIM4V4BPgpPtr) -= m * ggislg); + (*(here->BSIM4V4BPspPtr) -= m * ggisls); + (*(here->BSIM4V4BPbpPtr) -= m * ggislb); + + if (here->BSIM4V4rbodyMod) + { (*(here->BSIM4V4DPdbPtr +1) += m * xcdbdb); + (*(here->BSIM4V4DPdbPtr) -= m * here->BSIM4V4gbd); + (*(here->BSIM4V4SPsbPtr +1) += m * xcsbsb); + (*(here->BSIM4V4SPsbPtr) -= m * here->BSIM4V4gbs); + + (*(here->BSIM4V4DBdpPtr +1) += m * xcdbdb); + (*(here->BSIM4V4DBdpPtr) -= m * here->BSIM4V4gbd); + (*(here->BSIM4V4DBdbPtr +1) -= m * xcdbdb); + (*(here->BSIM4V4DBdbPtr) += m * (here->BSIM4V4gbd + here->BSIM4V4grbpd + + here->BSIM4V4grbdb)); + (*(here->BSIM4V4DBbpPtr) -= m * here->BSIM4V4grbpd); + (*(here->BSIM4V4DBbPtr) -= m * here->BSIM4V4grbdb); + + (*(here->BSIM4V4BPdbPtr) -= m * here->BSIM4V4grbpd); + (*(here->BSIM4V4BPbPtr) -= m * here->BSIM4V4grbpb); + (*(here->BSIM4V4BPsbPtr) -= m * here->BSIM4V4grbps); + (*(here->BSIM4V4BPbpPtr) += m * (here->BSIM4V4grbpd + here->BSIM4V4grbps + + here->BSIM4V4grbpb)); + /* WDLiu: (-here->BSIM4V4gbbs) already added to BPbpPtr */ + + (*(here->BSIM4V4SBspPtr +1) += m * xcsbsb); + (*(here->BSIM4V4SBspPtr) -= m * here->BSIM4V4gbs); + (*(here->BSIM4V4SBbpPtr) -= m * here->BSIM4V4grbps); + (*(here->BSIM4V4SBbPtr) -= m * here->BSIM4V4grbsb); + (*(here->BSIM4V4SBsbPtr +1) -= m * xcsbsb); + (*(here->BSIM4V4SBsbPtr) += m * (here->BSIM4V4gbs + + here->BSIM4V4grbps + here->BSIM4V4grbsb)); + + (*(here->BSIM4V4BdbPtr) -= m * here->BSIM4V4grbdb); + (*(here->BSIM4V4BbpPtr) -= m * here->BSIM4V4grbpb); + (*(here->BSIM4V4BsbPtr) -= m * here->BSIM4V4grbsb); + (*(here->BSIM4V4BbPtr) += m * (here->BSIM4V4grbsb + here->BSIM4V4grbdb + + here->BSIM4V4grbpb)); + } + + + /* + * WDLiu: The internal charge node generated for transient NQS is not needed for + * AC NQS. The following is not doing a real job, but we have to keep it; + * otherwise a singular AC NQS matrix may occur if the transient NQS is on. + * The charge node is isolated from the instance. + */ + if (here->BSIM4V4trnqsMod) + { (*(here->BSIM4V4QqPtr) += m * 1.0); + (*(here->BSIM4V4QgpPtr) += 0.0); + (*(here->BSIM4V4QdpPtr) += 0.0); + (*(here->BSIM4V4QspPtr) += 0.0); + (*(here->BSIM4V4QbpPtr) += 0.0); + + (*(here->BSIM4V4DPqPtr) += 0.0); + (*(here->BSIM4V4SPqPtr) += 0.0); + (*(here->BSIM4V4GPqPtr) += 0.0); + } + } + } + return(OK); +} diff --git a/src/spicelib/devices/bsim4v4/b4v4ask.c b/src/spicelib/devices/bsim4v4/b4v4ask.c new file mode 100644 index 000000000..34cb0afa7 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4ask.c @@ -0,0 +1,323 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4ask.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 05/09/2003. + **********/ + +#include "ngspice.h" +#include "ifsim.h" +#include "cktdefs.h" +#include "devdefs.h" +#include "bsim4v4def.h" +#include "sperror.h" +#include "suffix.h" + +int +BSIM4V4ask(ckt,inst,which,value,select) +CKTcircuit *ckt; +GENinstance *inst; +int which; +IFvalue *value; +IFvalue *select; +{ +BSIM4V4instance *here = (BSIM4V4instance*)inst; + + switch(which) + { case BSIM4V4_L: + value->rValue = here->BSIM4V4l; + return(OK); + case BSIM4V4_W: + value->rValue = here->BSIM4V4w; + return(OK); + case BSIM4V4_M: + value->rValue = here->BSIM4V4m; + return(OK); + case BSIM4V4_NF: + value->rValue = here->BSIM4V4nf; + return(OK); + case BSIM4V4_MIN: + value->iValue = here->BSIM4V4min; + return(OK); + case BSIM4V4_AS: + value->rValue = here->BSIM4V4sourceArea; + return(OK); + case BSIM4V4_AD: + value->rValue = here->BSIM4V4drainArea; + return(OK); + case BSIM4V4_PS: + value->rValue = here->BSIM4V4sourcePerimeter; + return(OK); + case BSIM4V4_PD: + value->rValue = here->BSIM4V4drainPerimeter; + return(OK); + case BSIM4V4_NRS: + value->rValue = here->BSIM4V4sourceSquares; + return(OK); + case BSIM4V4_NRD: + value->rValue = here->BSIM4V4drainSquares; + return(OK); + case BSIM4V4_OFF: + value->rValue = here->BSIM4V4off; + return(OK); + case BSIM4V4_SA: + value->rValue = here->BSIM4V4sa ; + return(OK); + case BSIM4V4_SB: + value->rValue = here->BSIM4V4sb ; + return(OK); + case BSIM4V4_SD: + value->rValue = here->BSIM4V4sd ; + return(OK); + case BSIM4V4_RBSB: + value->rValue = here->BSIM4V4rbsb; + return(OK); + case BSIM4V4_RBDB: + value->rValue = here->BSIM4V4rbdb; + return(OK); + case BSIM4V4_RBPB: + value->rValue = here->BSIM4V4rbpb; + return(OK); + case BSIM4V4_RBPS: + value->rValue = here->BSIM4V4rbps; + return(OK); + case BSIM4V4_RBPD: + value->rValue = here->BSIM4V4rbpd; + return(OK); + case BSIM4V4_TRNQSMOD: + value->iValue = here->BSIM4V4trnqsMod; + return(OK); + case BSIM4V4_ACNQSMOD: + value->iValue = here->BSIM4V4acnqsMod; + return(OK); + case BSIM4V4_RBODYMOD: + value->iValue = here->BSIM4V4rbodyMod; + return(OK); + case BSIM4V4_RGATEMOD: + value->iValue = here->BSIM4V4rgateMod; + return(OK); + case BSIM4V4_GEOMOD: + value->iValue = here->BSIM4V4geoMod; + return(OK); + case BSIM4V4_RGEOMOD: + value->iValue = here->BSIM4V4rgeoMod; + return(OK); + case BSIM4V4_IC_VDS: + value->rValue = here->BSIM4V4icVDS; + return(OK); + case BSIM4V4_IC_VGS: + value->rValue = here->BSIM4V4icVGS; + return(OK); + case BSIM4V4_IC_VBS: + value->rValue = here->BSIM4V4icVBS; + return(OK); + case BSIM4V4_DNODE: + value->iValue = here->BSIM4V4dNode; + return(OK); + case BSIM4V4_GNODEEXT: + value->iValue = here->BSIM4V4gNodeExt; + return(OK); + case BSIM4V4_SNODE: + value->iValue = here->BSIM4V4sNode; + return(OK); + case BSIM4V4_BNODE: + value->iValue = here->BSIM4V4bNode; + return(OK); + case BSIM4V4_DNODEPRIME: + value->iValue = here->BSIM4V4dNodePrime; + return(OK); + case BSIM4V4_GNODEPRIME: + value->iValue = here->BSIM4V4gNodePrime; + return(OK); + case BSIM4V4_GNODEMID: + value->iValue = here->BSIM4V4gNodeMid; + return(OK); + case BSIM4V4_SNODEPRIME: + value->iValue = here->BSIM4V4sNodePrime; + return(OK); + case BSIM4V4_DBNODE: + value->iValue = here->BSIM4V4dbNode; + return(OK); + case BSIM4V4_BNODEPRIME: + value->iValue = here->BSIM4V4bNodePrime; + return(OK); + case BSIM4V4_SBNODE: + value->iValue = here->BSIM4V4sbNode; + return(OK); + case BSIM4V4_SOURCECONDUCT: + value->rValue = here->BSIM4V4sourceConductance; + return(OK); + case BSIM4V4_DRAINCONDUCT: + value->rValue = here->BSIM4V4drainConductance; + return(OK); + case BSIM4V4_VBD: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4vbd); + return(OK); + case BSIM4V4_VBS: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4vbs); + return(OK); + case BSIM4V4_VGS: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4vgs); + return(OK); + case BSIM4V4_VDS: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4vds); + return(OK); + case BSIM4V4_CD: + value->rValue = here->BSIM4V4cd; + return(OK); + case BSIM4V4_CBS: + value->rValue = here->BSIM4V4cbs; + return(OK); + case BSIM4V4_CBD: + value->rValue = here->BSIM4V4cbd; + return(OK); + case BSIM4V4_CSUB: + value->rValue = here->BSIM4V4csub; + return(OK); + case BSIM4V4_IGIDL: + value->rValue = here->BSIM4V4Igidl; + return(OK); + case BSIM4V4_IGISL: + value->rValue = here->BSIM4V4Igisl; + return(OK); + case BSIM4V4_IGS: + value->rValue = here->BSIM4V4Igs; + return(OK); + case BSIM4V4_IGD: + value->rValue = here->BSIM4V4Igd; + return(OK); + case BSIM4V4_IGB: + value->rValue = here->BSIM4V4Igb; + return(OK); + case BSIM4V4_IGCS: + value->rValue = here->BSIM4V4Igcs; + return(OK); + case BSIM4V4_IGCD: + value->rValue = here->BSIM4V4Igcd; + return(OK); + case BSIM4V4_GM: + value->rValue = here->BSIM4V4gm; + return(OK); + case BSIM4V4_GDS: + value->rValue = here->BSIM4V4gds; + return(OK); + case BSIM4V4_GMBS: + value->rValue = here->BSIM4V4gmbs; + return(OK); + case BSIM4V4_GBD: + value->rValue = here->BSIM4V4gbd; + return(OK); + case BSIM4V4_GBS: + value->rValue = here->BSIM4V4gbs; + return(OK); +/* case BSIM4V4_QB: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4qb); + return(OK); */ + case BSIM4V4_CQB: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4cqb); + return(OK); +/* case BSIM4V4_QG: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4qg); + return(OK); */ + case BSIM4V4_CQG: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4cqg); + return(OK); +/* case BSIM4V4_QD: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4qd); + return(OK); */ + case BSIM4V4_CQD: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4cqd); + return(OK); +/* case BSIM4V4_QS: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4qs); + return(OK); */ + case BSIM4V4_QB: + value->rValue = here->BSIM4V4qbulk; + return(OK); + case BSIM4V4_QG: + value->rValue = here->BSIM4V4qgate; + return(OK); + case BSIM4V4_QS: + value->rValue = here->BSIM4V4qsrc; + return(OK); + case BSIM4V4_QD: + value->rValue = here->BSIM4V4qdrn; + return(OK); + case BSIM4V4_CGGB: + value->rValue = here->BSIM4V4cggb; + return(OK); + case BSIM4V4_CGDB: + value->rValue = here->BSIM4V4cgdb; + return(OK); + case BSIM4V4_CGSB: + value->rValue = here->BSIM4V4cgsb; + return(OK); + case BSIM4V4_CDGB: + value->rValue = here->BSIM4V4cdgb; + return(OK); + case BSIM4V4_CDDB: + value->rValue = here->BSIM4V4cddb; + return(OK); + case BSIM4V4_CDSB: + value->rValue = here->BSIM4V4cdsb; + return(OK); + case BSIM4V4_CBGB: + value->rValue = here->BSIM4V4cbgb; + return(OK); + case BSIM4V4_CBDB: + value->rValue = here->BSIM4V4cbdb; + return(OK); + case BSIM4V4_CBSB: + value->rValue = here->BSIM4V4cbsb; + return(OK); + case BSIM4V4_CSGB: + value->rValue = here->BSIM4V4csgb; + return(OK); + case BSIM4V4_CSDB: + value->rValue = here->BSIM4V4csdb; + return(OK); + case BSIM4V4_CSSB: + value->rValue = here->BSIM4V4cssb; + return(OK); + case BSIM4V4_CGBB: + value->rValue = here->BSIM4V4cgbb; + return(OK); + case BSIM4V4_CDBB: + value->rValue = here->BSIM4V4cdbb; + return(OK); + case BSIM4V4_CSBB: + value->rValue = here->BSIM4V4csbb; + return(OK); + case BSIM4V4_CBBB: + value->rValue = here->BSIM4V4cbbb; + return(OK); + case BSIM4V4_CAPBD: + value->rValue = here->BSIM4V4capbd; + return(OK); + case BSIM4V4_CAPBS: + value->rValue = here->BSIM4V4capbs; + return(OK); + case BSIM4V4_VON: + value->rValue = here->BSIM4V4von; + return(OK); + case BSIM4V4_VDSAT: + value->rValue = here->BSIM4V4vdsat; + return(OK); + case BSIM4V4_QBS: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4qbs); + return(OK); + case BSIM4V4_QBD: + value->rValue = *(ckt->CKTstate0 + here->BSIM4V4qbd); + return(OK); + default: + return(E_BADPARM); + } + /* NOTREACHED */ +} + diff --git a/src/spicelib/devices/bsim4v4/b4v4check.c b/src/spicelib/devices/bsim4v4/b4v4check.c new file mode 100644 index 000000000..631a53074 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4check.c @@ -0,0 +1,747 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4check.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 11/15/2002. + * Modified by Xuemei Xi, 05/09/2003. + * Modified by Xuemei Xi, 03/04/2004. + **********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim4v4def.h" +#include "trandefs.h" +#include "const.h" +#include "sperror.h" +#include "devdefs.h" +#include "suffix.h" + +int +BSIM4V4checkModel(model, here, ckt) +BSIM4V4model *model; +BSIM4V4instance *here; +CKTcircuit *ckt; +{ +struct bsim4SizeDependParam *pParam; +int Fatal_Flag = 0; +FILE *fplog; +double model_version = atof(model->BSIM4V4version); + + if ((fplog = fopen("bsim4.out", "w")) != NULL) + { pParam = here->pParam; + fprintf(fplog, "BSIM4V4: Berkeley Short Channel IGFET Model-4\n"); + fprintf(fplog, "Developed by Xuemei (Jane) Xi, Jin He, Mohan Dunga, Prof. Ali Niknejad and Prof. Chenming Hu in 2003.\n"); + fprintf(fplog, "\n"); + fprintf(fplog, "++++++++++ BSIM4V4 PARAMETER CHECKING BELOW ++++++++++\n"); + + if ( !strstr( model->BSIM4V4version, "4.4" ) ) + { fprintf(fplog, "Warning: This model is BSIM4V4.4.0; you specified a wrong version number '%s'.\n",model->BSIM4V4version); + printf("Warning: This model is BSIM4V4.4.0; you specified a wrong version number '%s'.\n",model->BSIM4V4version); + } + fprintf(fplog, "Model = %s\n", model->BSIM4V4modName); + + + if ((here->BSIM4V4rgateMod == 2) || (here->BSIM4V4rgateMod == 3)) + { if ((here->BSIM4V4trnqsMod == 1) || (here->BSIM4V4acnqsMod == 1)) + { fprintf(fplog, "Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); + printf("Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); + } + } + + if (model->BSIM4V4toxe <= 0.0) + { fprintf(fplog, "Fatal: Toxe = %g is not positive.\n", + model->BSIM4V4toxe); + printf("Fatal: Toxe = %g is not positive.\n", model->BSIM4V4toxe); + Fatal_Flag = 1; + } + if (model->BSIM4V4toxp <= 0.0) + { fprintf(fplog, "Fatal: Toxp = %g is not positive.\n", + model->BSIM4V4toxp); + printf("Fatal: Toxp = %g is not positive.\n", model->BSIM4V4toxp); + Fatal_Flag = 1; + } + + if (model->BSIM4V4toxm <= 0.0) + { fprintf(fplog, "Fatal: Toxm = %g is not positive.\n", + model->BSIM4V4toxm); + printf("Fatal: Toxm = %g is not positive.\n", model->BSIM4V4toxm); + Fatal_Flag = 1; + } + + if (model->BSIM4V4toxref <= 0.0) + { fprintf(fplog, "Fatal: Toxref = %g is not positive.\n", + model->BSIM4V4toxref); + printf("Fatal: Toxref = %g is not positive.\n", model->BSIM4V4toxref); + Fatal_Flag = 1; + } + + if (pParam->BSIM4V4lpe0 < -pParam->BSIM4V4leff) + { fprintf(fplog, "Fatal: Lpe0 = %g is less than -Leff.\n", + pParam->BSIM4V4lpe0); + printf("Fatal: Lpe0 = %g is less than -Leff.\n", + pParam->BSIM4V4lpe0); + Fatal_Flag = 1; + } + if (model->BSIM4V4lintnoi > pParam->BSIM4V4leff/2) + { fprintf(fplog, "Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", + model->BSIM4V4lintnoi); + printf("Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", + model->BSIM4V4lintnoi); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4lpeb < -pParam->BSIM4V4leff) + { fprintf(fplog, "Fatal: Lpeb = %g is less than -Leff.\n", + pParam->BSIM4V4lpeb); + printf("Fatal: Lpeb = %g is less than -Leff.\n", + pParam->BSIM4V4lpeb); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4ndep <= 0.0) + { fprintf(fplog, "Fatal: Ndep = %g is not positive.\n", + pParam->BSIM4V4ndep); + printf("Fatal: Ndep = %g is not positive.\n", + pParam->BSIM4V4ndep); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4phi <= 0.0) + { fprintf(fplog, "Fatal: Phi = %g is not positive. Please check Phin and Ndep\n", + pParam->BSIM4V4phi); + fprintf(fplog, " Phin = %g Ndep = %g \n", + pParam->BSIM4V4phin, pParam->BSIM4V4ndep); + printf("Fatal: Phi = %g is not positive. Please check Phin and Ndep\n", + pParam->BSIM4V4phi); + printf(" Phin = %g Ndep = %g \n", + pParam->BSIM4V4phin, pParam->BSIM4V4ndep); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4nsub <= 0.0) + { fprintf(fplog, "Fatal: Nsub = %g is not positive.\n", + pParam->BSIM4V4nsub); + printf("Fatal: Nsub = %g is not positive.\n", + pParam->BSIM4V4nsub); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4ngate < 0.0) + { fprintf(fplog, "Fatal: Ngate = %g is not positive.\n", + pParam->BSIM4V4ngate); + printf("Fatal: Ngate = %g Ngate is not positive.\n", + pParam->BSIM4V4ngate); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4ngate > 1.e25) + { fprintf(fplog, "Fatal: Ngate = %g is too high.\n", + pParam->BSIM4V4ngate); + printf("Fatal: Ngate = %g Ngate is too high\n", + pParam->BSIM4V4ngate); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4xj <= 0.0) + { fprintf(fplog, "Fatal: Xj = %g is not positive.\n", + pParam->BSIM4V4xj); + printf("Fatal: Xj = %g is not positive.\n", pParam->BSIM4V4xj); + Fatal_Flag = 1; + } + + if (pParam->BSIM4V4dvt1 < 0.0) + { fprintf(fplog, "Fatal: Dvt1 = %g is negative.\n", + pParam->BSIM4V4dvt1); + printf("Fatal: Dvt1 = %g is negative.\n", pParam->BSIM4V4dvt1); + Fatal_Flag = 1; + } + + if (pParam->BSIM4V4dvt1w < 0.0) + { fprintf(fplog, "Fatal: Dvt1w = %g is negative.\n", + pParam->BSIM4V4dvt1w); + printf("Fatal: Dvt1w = %g is negative.\n", pParam->BSIM4V4dvt1w); + Fatal_Flag = 1; + } + + if (pParam->BSIM4V4w0 == -pParam->BSIM4V4weff) + { fprintf(fplog, "Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n"); + printf("Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n"); + Fatal_Flag = 1; + } + + if (pParam->BSIM4V4dsub < 0.0) + { fprintf(fplog, "Fatal: Dsub = %g is negative.\n", pParam->BSIM4V4dsub); + printf("Fatal: Dsub = %g is negative.\n", pParam->BSIM4V4dsub); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4b1 == -pParam->BSIM4V4weff) + { fprintf(fplog, "Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n"); + printf("Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n"); + Fatal_Flag = 1; + } + if (here->BSIM4V4u0temp <= 0.0) + { fprintf(fplog, "Fatal: u0 at current temperature = %g is not positive.\n", here->BSIM4V4u0temp); + printf("Fatal: u0 at current temperature = %g is not positive.\n", + here->BSIM4V4u0temp); + Fatal_Flag = 1; + } + + if (pParam->BSIM4V4delta < 0.0) + { fprintf(fplog, "Fatal: Delta = %g is less than zero.\n", + pParam->BSIM4V4delta); + printf("Fatal: Delta = %g is less than zero.\n", pParam->BSIM4V4delta); + Fatal_Flag = 1; + } + + if (here->BSIM4V4vsattemp <= 0.0) + { fprintf(fplog, "Fatal: Vsat at current temperature = %g is not positive.\n", here->BSIM4V4vsattemp); + printf("Fatal: Vsat at current temperature = %g is not positive.\n", + here->BSIM4V4vsattemp); + Fatal_Flag = 1; + } + + if (pParam->BSIM4V4pclm <= 0.0) + { fprintf(fplog, "Fatal: Pclm = %g is not positive.\n", pParam->BSIM4V4pclm); + printf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM4V4pclm); + Fatal_Flag = 1; + } + + if (pParam->BSIM4V4drout < 0.0) + { fprintf(fplog, "Fatal: Drout = %g is negative.\n", pParam->BSIM4V4drout); + printf("Fatal: Drout = %g is negative.\n", pParam->BSIM4V4drout); + Fatal_Flag = 1; + } + + if (here->BSIM4V4m <= 0.0) + { fprintf(fplog, "Fatal: multiplier = %g is not positive.\n", here->BSIM4V4m); + printf("Fatal: multiplier = %g is not positive.\n", here->BSIM4V4m); + Fatal_Flag = 1; + } + if (here->BSIM4V4nf < 1.0) + { fprintf(fplog, "Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4V4nf); + printf("Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4V4nf); + Fatal_Flag = 1; + } + + if((here->BSIM4V4sa > 0.0) && (here->BSIM4V4sb > 0.0) && + ((here->BSIM4V4nf == 1.0) || ((here->BSIM4V4nf > 1.0) && (here->BSIM4V4sd > 0.0))) ) + { if (model->BSIM4V4saref <= 0.0) + { fprintf(fplog, "Fatal: SAref = %g is not positive.\n",model->BSIM4V4saref); + printf("Fatal: SAref = %g is not positive.\n",model->BSIM4V4saref); + Fatal_Flag = 1; + } + if (model->BSIM4V4sbref <= 0.0) + { fprintf(fplog, "Fatal: SBref = %g is not positive.\n",model->BSIM4V4sbref); + printf("Fatal: SBref = %g is not positive.\n",model->BSIM4V4sbref); + Fatal_Flag = 1; + } + } + + if ((here->BSIM4V4l + model->BSIM4V4xl) <= model->BSIM4V4xgl) + { fprintf(fplog, "Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n"); + printf("Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n"); + Fatal_Flag = 1; + } + if (model->BSIM4V4ngcon < 1.0) + { fprintf(fplog, "Fatal: The parameter ngcon cannot be smaller than one.\n"); + printf("Fatal: The parameter ngcon cannot be smaller than one.\n"); + Fatal_Flag = 1; + } + if ((model->BSIM4V4ngcon != 1.0) && (model->BSIM4V4ngcon != 2.0)) + { model->BSIM4V4ngcon = 1.0; + fprintf(fplog, "Warning: Ngcon must be equal to one or two; reset to 1.0.\n"); + printf("Warning: Ngcon must be equal to one or two; reset to 1.0.\n"); + } + + if (model->BSIM4V4gbmin < 1.0e-20) + { fprintf(fplog, "Warning: Gbmin = %g is too small.\n", + model->BSIM4V4gbmin); + printf("Warning: Gbmin = %g is too small.\n", model->BSIM4V4gbmin); + } + + /* Check saturation parameters */ + if (pParam->BSIM4V4fprout < 0.0) + { fprintf(fplog, "Fatal: fprout = %g is negative.\n", + pParam->BSIM4V4fprout); + printf("Fatal: fprout = %g is negative.\n", pParam->BSIM4V4fprout); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4pdits < 0.0) + { fprintf(fplog, "Fatal: pdits = %g is negative.\n", + pParam->BSIM4V4pdits); + printf("Fatal: pdits = %g is negative.\n", pParam->BSIM4V4pdits); + Fatal_Flag = 1; + } + if (model->BSIM4V4pditsl < 0.0) + { fprintf(fplog, "Fatal: pditsl = %g is negative.\n", + model->BSIM4V4pditsl); + printf("Fatal: pditsl = %g is negative.\n", model->BSIM4V4pditsl); + Fatal_Flag = 1; + } + + /* Check gate current parameters */ + if (model->BSIM4V4igbMod) { + if (pParam->BSIM4V4nigbinv <= 0.0) + { fprintf(fplog, "Fatal: nigbinv = %g is non-positive.\n", + pParam->BSIM4V4nigbinv); + printf("Fatal: nigbinv = %g is non-positive.\n", pParam->BSIM4V4nigbinv); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4nigbacc <= 0.0) + { fprintf(fplog, "Fatal: nigbacc = %g is non-positive.\n", + pParam->BSIM4V4nigbacc); + printf("Fatal: nigbacc = %g is non-positive.\n", pParam->BSIM4V4nigbacc); + Fatal_Flag = 1; + } + } + if (model->BSIM4V4igcMod) { + if (pParam->BSIM4V4nigc <= 0.0) + { fprintf(fplog, "Fatal: nigc = %g is non-positive.\n", + pParam->BSIM4V4nigc); + printf("Fatal: nigc = %g is non-positive.\n", pParam->BSIM4V4nigc); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4poxedge <= 0.0) + { fprintf(fplog, "Fatal: poxedge = %g is non-positive.\n", + pParam->BSIM4V4poxedge); + printf("Fatal: poxedge = %g is non-positive.\n", pParam->BSIM4V4poxedge); + Fatal_Flag = 1; + } + if (pParam->BSIM4V4pigcd <= 0.0) + { fprintf(fplog, "Fatal: pigcd = %g is non-positive.\n", + pParam->BSIM4V4pigcd); + printf("Fatal: pigcd = %g is non-positive.\n", pParam->BSIM4V4pigcd); + Fatal_Flag = 1; + } + } + + /* Check capacitance parameters */ + if (pParam->BSIM4V4clc < 0.0) + { fprintf(fplog, "Fatal: Clc = %g is negative.\n", pParam->BSIM4V4clc); + printf("Fatal: Clc = %g is negative.\n", pParam->BSIM4V4clc); + Fatal_Flag = 1; + } + + /* Check overlap capacitance parameters */ + if (pParam->BSIM4V4ckappas < 0.02) + { fprintf(fplog, "Warning: ckappas = %g is too small. Set to 0.02\n", + pParam->BSIM4V4ckappas); + printf("Warning: ckappas = %g is too small.\n", pParam->BSIM4V4ckappas); + pParam->BSIM4V4ckappas = 0.02; + } + if (pParam->BSIM4V4ckappad < 0.02) + { fprintf(fplog, "Warning: ckappad = %g is too small. Set to 0.02\n", + pParam->BSIM4V4ckappad); + printf("Warning: ckappad = %g is too small.\n", pParam->BSIM4V4ckappad); + pParam->BSIM4V4ckappad = 0.02; + } + + if (model->BSIM4V4paramChk ==1) + { +/* Check L and W parameters */ + if (pParam->BSIM4V4leff <= 1.0e-9) + { fprintf(fplog, "Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", + pParam->BSIM4V4leff); + printf("Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", + pParam->BSIM4V4leff); + } + + if (pParam->BSIM4V4leffCV <= 1.0e-9) + { fprintf(fplog, "Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", + pParam->BSIM4V4leffCV); + printf("Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", + pParam->BSIM4V4leffCV); + } + + if (pParam->BSIM4V4weff <= 1.0e-9) + { fprintf(fplog, "Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", + pParam->BSIM4V4weff); + printf("Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", + pParam->BSIM4V4weff); + } + + if (pParam->BSIM4V4weffCV <= 1.0e-9) + { fprintf(fplog, "Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", + pParam->BSIM4V4weffCV); + printf("Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", + pParam->BSIM4V4weffCV); + } + + /* Check threshold voltage parameters */ + if (model->BSIM4V4toxe < 1.0e-10) + { fprintf(fplog, "Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", + model->BSIM4V4toxe); + printf("Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", model->BSIM4V4toxe); + } + if (model->BSIM4V4toxp < 1.0e-10) + { fprintf(fplog, "Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", + model->BSIM4V4toxp); + printf("Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", model->BSIM4V4toxp); + } + if (model->BSIM4V4toxm < 1.0e-10) + { fprintf(fplog, "Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", + model->BSIM4V4toxm); + printf("Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", model->BSIM4V4toxm); + } + + if (pParam->BSIM4V4ndep <= 1.0e12) + { fprintf(fplog, "Warning: Ndep = %g may be too small.\n", + pParam->BSIM4V4ndep); + printf("Warning: Ndep = %g may be too small.\n", + pParam->BSIM4V4ndep); + } + else if (pParam->BSIM4V4ndep >= 1.0e21) + { fprintf(fplog, "Warning: Ndep = %g may be too large.\n", + pParam->BSIM4V4ndep); + printf("Warning: Ndep = %g may be too large.\n", + pParam->BSIM4V4ndep); + } + + if (pParam->BSIM4V4nsub <= 1.0e14) + { fprintf(fplog, "Warning: Nsub = %g may be too small.\n", + pParam->BSIM4V4nsub); + printf("Warning: Nsub = %g may be too small.\n", + pParam->BSIM4V4nsub); + } + else if (pParam->BSIM4V4nsub >= 1.0e21) + { fprintf(fplog, "Warning: Nsub = %g may be too large.\n", + pParam->BSIM4V4nsub); + printf("Warning: Nsub = %g may be too large.\n", + pParam->BSIM4V4nsub); + } + + if ((pParam->BSIM4V4ngate > 0.0) && + (pParam->BSIM4V4ngate <= 1.e18)) + { fprintf(fplog, "Warning: Ngate = %g is less than 1.E18cm^-3.\n", + pParam->BSIM4V4ngate); + printf("Warning: Ngate = %g is less than 1.E18cm^-3.\n", + pParam->BSIM4V4ngate); + } + + if (pParam->BSIM4V4dvt0 < 0.0) + { fprintf(fplog, "Warning: Dvt0 = %g is negative.\n", + pParam->BSIM4V4dvt0); + printf("Warning: Dvt0 = %g is negative.\n", pParam->BSIM4V4dvt0); + } + + if (fabs(1.0e-8 / (pParam->BSIM4V4w0 + pParam->BSIM4V4weff)) > 10.0) + { fprintf(fplog, "Warning: (W0 + Weff) may be too small.\n"); + printf("Warning: (W0 + Weff) may be too small.\n"); + } + +/* Check subthreshold parameters */ + if (pParam->BSIM4V4nfactor < 0.0) + { fprintf(fplog, "Warning: Nfactor = %g is negative.\n", + pParam->BSIM4V4nfactor); + printf("Warning: Nfactor = %g is negative.\n", pParam->BSIM4V4nfactor); + } + if (pParam->BSIM4V4cdsc < 0.0) + { fprintf(fplog, "Warning: Cdsc = %g is negative.\n", + pParam->BSIM4V4cdsc); + printf("Warning: Cdsc = %g is negative.\n", pParam->BSIM4V4cdsc); + } + if (pParam->BSIM4V4cdscd < 0.0) + { fprintf(fplog, "Warning: Cdscd = %g is negative.\n", + pParam->BSIM4V4cdscd); + printf("Warning: Cdscd = %g is negative.\n", pParam->BSIM4V4cdscd); + } +/* Check DIBL parameters */ +/* if (here->BSIM4V4eta0 < 0.0) + { fprintf(fplog, "Warning: Eta0 = %g is negative.\n", + here->BSIM4V4eta0); + printf("Warning: Eta0 = %g is negative.\n", here->BSIM4V4eta0); + } +*/ + +/* Check Abulk parameters */ + if (fabs(1.0e-8 / (pParam->BSIM4V4b1 + pParam->BSIM4V4weff)) > 10.0) + { fprintf(fplog, "Warning: (B1 + Weff) may be too small.\n"); + printf("Warning: (B1 + Weff) may be too small.\n"); + } + + +/* Check Saturation parameters */ + if (pParam->BSIM4V4a2 < 0.01) + { fprintf(fplog, "Warning: A2 = %g is too small. Set to 0.01.\n", pParam->BSIM4V4a2); + printf("Warning: A2 = %g is too small. Set to 0.01.\n", + pParam->BSIM4V4a2); + pParam->BSIM4V4a2 = 0.01; + } + else if (pParam->BSIM4V4a2 > 1.0) + { fprintf(fplog, "Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n", + pParam->BSIM4V4a2); + printf("Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n", + pParam->BSIM4V4a2); + pParam->BSIM4V4a2 = 1.0; + pParam->BSIM4V4a1 = 0.0; + } + + if (pParam->BSIM4V4prwg < 0.0) + { fprintf(fplog, "Warning: Prwg = %g is negative. Set to zero.\n", + pParam->BSIM4V4prwg); + printf("Warning: Prwg = %g is negative. Set to zero.\n", + pParam->BSIM4V4prwg); + pParam->BSIM4V4prwg = 0.0; + } + + if (pParam->BSIM4V4rdsw < 0.0) + { fprintf(fplog, "Warning: Rdsw = %g is negative. Set to zero.\n", + pParam->BSIM4V4rdsw); + printf("Warning: Rdsw = %g is negative. Set to zero.\n", + pParam->BSIM4V4rdsw); + pParam->BSIM4V4rdsw = 0.0; + pParam->BSIM4V4rds0 = 0.0; + } + + if (pParam->BSIM4V4rds0 < 0.0) + { fprintf(fplog, "Warning: Rds at current temperature = %g is negative. Set to zero.\n", + pParam->BSIM4V4rds0); + printf("Warning: Rds at current temperature = %g is negative. Set to zero.\n", + pParam->BSIM4V4rds0); + pParam->BSIM4V4rds0 = 0.0; + } + + if (pParam->BSIM4V4rdswmin < 0.0) + { fprintf(fplog, "Warning: Rdswmin at current temperature = %g is negative. Set to zero.\n", + pParam->BSIM4V4rdswmin); + printf("Warning: Rdswmin at current temperature = %g is negative. Set to zero.\n", + pParam->BSIM4V4rdswmin); + pParam->BSIM4V4rdswmin = 0.0; + } + + if (pParam->BSIM4V4pscbe2 <= 0.0) + { fprintf(fplog, "Warning: Pscbe2 = %g is not positive.\n", + pParam->BSIM4V4pscbe2); + printf("Warning: Pscbe2 = %g is not positive.\n", pParam->BSIM4V4pscbe2); + } + + if (pParam->BSIM4V4vsattemp < 1.0e3) + { fprintf(fplog, "Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM4V4vsattemp); + printf("Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM4V4vsattemp); + } + + if((model->BSIM4V4lambdaGiven) && (pParam->BSIM4V4lambda > 0.0) ) + { + if (pParam->BSIM4V4lambda > 1.0e-9) + { fprintf(fplog, "Warning: Lambda = %g may be too large.\n", pParam->BSIM4V4lambda); + printf("Warning: Lambda = %g may be too large.\n", pParam->BSIM4V4lambda); + } + } + + if((model->BSIM4V4vtlGiven) && (pParam->BSIM4V4vtl > 0.0) ) + { + if (pParam->BSIM4V4vtl < 6.0e4) + { fprintf(fplog, "Warning: Thermal velocity vtl = %g may be too small.\n", pParam->BSIM4V4vtl); + printf("Warning: Thermal velocity vtl = %g may be too small.\n", pParam->BSIM4V4vtl); + } + + if (pParam->BSIM4V4xn < 3.0) + { fprintf(fplog, "Warning: back scattering coeff xn = %g is too small.\n", pParam->BSIM4V4xn); + printf("Warning: back scattering coeff xn = %g is too small. Reset to 3.0 \n", pParam->BSIM4V4xn); + pParam->BSIM4V4xn = 3.0; + } + + if (model->BSIM4V4lc < 0.0) + { fprintf(fplog, "Warning: back scattering coeff lc = %g is too small.\n", model->BSIM4V4lc); + printf("Warning: back scattering coeff lc = %g is too small. Reset to 0.0\n", model->BSIM4V4lc); + pParam->BSIM4V4lc = 0.0; + } + } + + if (pParam->BSIM4V4pdibl1 < 0.0) + { fprintf(fplog, "Warning: Pdibl1 = %g is negative.\n", + pParam->BSIM4V4pdibl1); + printf("Warning: Pdibl1 = %g is negative.\n", pParam->BSIM4V4pdibl1); + } +/* if (pParam->BSIM4V4pdibl2 < 0.0) + { fprintf(fplog, "Warning: Pdibl2 = %g is negative.\n", + pParam->BSIM4V4pdibl2); + printf("Warning: Pdibl2 = %g is negative.\n", pParam->BSIM4V4pdibl2); + } +*/ + +/* Check stress effect parameters */ + if((here->BSIM4V4sa > 0.0) && (here->BSIM4V4sb > 0.0) && + ((here->BSIM4V4nf == 1.0) || ((here->BSIM4V4nf > 1.0) && (here->BSIM4V4sd > 0.0))) ) + { if (model->BSIM4V4lodk2 <= 0.0) + { fprintf(fplog, "Warning: LODK2 = %g is not positive.\n",model->BSIM4V4lodk2); + printf("Warning: LODK2 = %g is not positive.\n",model->BSIM4V4lodk2); + } + if (model->BSIM4V4lodeta0 <= 0.0) + { fprintf(fplog, "Warning: LODETA0 = %g is not positive.\n",model->BSIM4V4lodeta0); + printf("Warning: LODETA0 = %g is not positive.\n",model->BSIM4V4lodeta0); + } + } + +/* Check gate resistance parameters */ + if (here->BSIM4V4rgateMod == 1) + { if (model->BSIM4V4rshg <= 0.0) + printf("Warning: rshg should be positive for rgateMod = 1.\n"); + } + else if (here->BSIM4V4rgateMod == 2) + { if (model->BSIM4V4rshg <= 0.0) + printf("Warning: rshg <= 0.0 for rgateMod = 2.\n"); + else if (pParam->BSIM4V4xrcrg1 <= 0.0) + printf("Warning: xrcrg1 <= 0.0 for rgateMod = 2.\n"); + } + if (here->BSIM4V4rgateMod == 3) + { if (model->BSIM4V4rshg <= 0.0) + printf("Warning: rshg should be positive for rgateMod = 3.\n"); + else if (pParam->BSIM4V4xrcrg1 <= 0.0) + printf("Warning: xrcrg1 should be positive for rgateMod = 3.\n"); + } + +/* Check capacitance parameters */ + if (pParam->BSIM4V4noff < 0.1) + { fprintf(fplog, "Warning: Noff = %g is too small.\n", + pParam->BSIM4V4noff); + printf("Warning: Noff = %g is too small.\n", pParam->BSIM4V4noff); + } + + if (pParam->BSIM4V4voffcv < -0.5) + { fprintf(fplog, "Warning: Voffcv = %g is too small.\n", + pParam->BSIM4V4voffcv); + printf("Warning: Voffcv = %g is too small.\n", pParam->BSIM4V4voffcv); + } + + if (pParam->BSIM4V4moin < 5.0) + { fprintf(fplog, "Warning: Moin = %g is too small.\n", + pParam->BSIM4V4moin); + printf("Warning: Moin = %g is too small.\n", pParam->BSIM4V4moin); + } + if (pParam->BSIM4V4moin > 25.0) + { fprintf(fplog, "Warning: Moin = %g is too large.\n", + pParam->BSIM4V4moin); + printf("Warning: Moin = %g is too large.\n", pParam->BSIM4V4moin); + } + if(model->BSIM4V4capMod ==2) { + if (pParam->BSIM4V4acde < 0.1) + { fprintf(fplog, "Warning: Acde = %g is too small.\n", + pParam->BSIM4V4acde); + printf("Warning: Acde = %g is too small.\n", pParam->BSIM4V4acde); + } + if (pParam->BSIM4V4acde > 1.6) + { fprintf(fplog, "Warning: Acde = %g is too large.\n", + pParam->BSIM4V4acde); + printf("Warning: Acde = %g is too large.\n", pParam->BSIM4V4acde); + } + } + +/* Check overlap capacitance parameters */ + if (model->BSIM4V4cgdo < 0.0) + { fprintf(fplog, "Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM4V4cgdo); + printf("Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM4V4cgdo); + model->BSIM4V4cgdo = 0.0; + } + if (model->BSIM4V4cgso < 0.0) + { fprintf(fplog, "Warning: cgso = %g is negative. Set to zero.\n", model->BSIM4V4cgso); + printf("Warning: cgso = %g is negative. Set to zero.\n", model->BSIM4V4cgso); + model->BSIM4V4cgso = 0.0; + } + + if (model->BSIM4V4tnoiMod == 1) { + if (model->BSIM4V4tnoia < 0.0) + { fprintf(fplog, "Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4V4tnoia); + printf("Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4V4tnoia); + model->BSIM4V4tnoia = 0.0; + } + if (model->BSIM4V4tnoib < 0.0) + { fprintf(fplog, "Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4V4tnoib); + printf("Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4V4tnoib); + model->BSIM4V4tnoib = 0.0; + } + + if (model->BSIM4V4rnoia < 0.0) + { fprintf(fplog, "Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4V4rnoia); + printf("Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4V4rnoia); + model->BSIM4V4rnoia = 0.0; + } + if (model->BSIM4V4rnoib < 0.0) + { fprintf(fplog, "Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4V4rnoib); + printf("Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4V4rnoib); + model->BSIM4V4rnoib = 0.0; + } + } + + if (model->BSIM4V4SjctEmissionCoeff < 0.0) + { fprintf(fplog, "Warning: Njs = %g is negative.\n", + model->BSIM4V4SjctEmissionCoeff); + printf("Warning: Njs = %g is negative.\n", + model->BSIM4V4SjctEmissionCoeff); + } + if (model->BSIM4V4DjctEmissionCoeff < 0.0) + { fprintf(fplog, "Warning: Njd = %g is negative.\n", + model->BSIM4V4DjctEmissionCoeff); + printf("Warning: Njd = %g is negative.\n", + model->BSIM4V4DjctEmissionCoeff); + } + if (model->BSIM4V4njtstemp < 0.0) + { fprintf(fplog, "Warning: Njts = %g is negative at temperature = %g.\n", + model->BSIM4V4njtstemp, ckt->CKTtemp); + printf("Warning: Njts = %g is negative at temperature = %g.\n", + model->BSIM4V4njtstemp, ckt->CKTtemp); + } + if (model->BSIM4V4njtsswtemp < 0.0) + { fprintf(fplog, "Warning: Njtssw = %g is negative at temperature = %g.\n", + model->BSIM4V4njtsswtemp, ckt->CKTtemp); + printf("Warning: Njtssw = %g is negative at temperature = %g.\n", + model->BSIM4V4njtsswtemp, ckt->CKTtemp); + } + if (model->BSIM4V4njtsswgtemp < 0.0) + { fprintf(fplog, "Warning: Njtsswg = %g is negative at temperature = %g.\n", + model->BSIM4V4njtsswgtemp, ckt->CKTtemp); + printf("Warning: Njtsswg = %g is negative at temperature = %g.\n", + model->BSIM4V4njtsswgtemp, ckt->CKTtemp); + } + if (model->BSIM4V4vtss < 0.0) + { fprintf(fplog, "Warning: Vtss = %g is negative.\n", + model->BSIM4V4vtss); + printf("Warning: Vtss = %g is negative.\n", + model->BSIM4V4vtss); + } + if (model->BSIM4V4vtsd < 0.0) + { fprintf(fplog, "Warning: Vtsd = %g is negative.\n", + model->BSIM4V4vtsd); + printf("Warning: Vtsd = %g is negative.\n", + model->BSIM4V4vtsd); + } + if (model->BSIM4V4vtssws < 0.0) + { fprintf(fplog, "Warning: Vtssws = %g is negative.\n", + model->BSIM4V4vtssws); + printf("Warning: Vtssws = %g is negative.\n", + model->BSIM4V4vtssws); + } + if (model->BSIM4V4vtsswd < 0.0) + { fprintf(fplog, "Warning: Vtsswd = %g is negative.\n", + model->BSIM4V4vtsswd); + printf("Warning: Vtsswd = %g is negative.\n", + model->BSIM4V4vtsswd); + } + if (model->BSIM4V4vtsswgs < 0.0) + { fprintf(fplog, "Warning: Vtsswgs = %g is negative.\n", + model->BSIM4V4vtsswgs); + printf("Warning: Vtsswgs = %g is negative.\n", + model->BSIM4V4vtsswgs); + } + if (model->BSIM4V4vtsswgd < 0.0) + { fprintf(fplog, "Warning: Vtsswgd = %g is negative.\n", + model->BSIM4V4vtsswgd); + printf("Warning: Vtsswgd = %g is negative.\n", + model->BSIM4V4vtsswgd); + } + + if (model->BSIM4V4ntnoi < 0.0) + { fprintf(fplog, "Warning: ntnoi = %g is negative. Set to zero.\n", model->BSIM4V4ntnoi); + printf("Warning: ntnoi = %g is negative. Set to zero.\n", model->BSIM4V4ntnoi); + model->BSIM4V4ntnoi = 0.0; + } + + }/* loop for the parameter check for warning messages */ + fclose(fplog); + } + else + { fprintf(stderr, "Warning: Can't open log file. Parameter checking skipped.\n"); + } + + return(Fatal_Flag); +} + diff --git a/src/spicelib/devices/bsim4v4/b4v4cvtest.c b/src/spicelib/devices/bsim4v4/b4v4cvtest.c new file mode 100644 index 000000000..c62598cc9 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4cvtest.c @@ -0,0 +1,199 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4cvtest.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 05/09/2003. + **********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim4v4def.h" +#include "trandefs.h" +#include "const.h" +#include "devdefs.h" +#include "sperror.h" +#include "suffix.h" + + +int +BSIM4V4convTest(inModel,ckt) +GENmodel *inModel; +CKTcircuit *ckt; +{ +BSIM4V4model *model = (BSIM4V4model*)inModel; +BSIM4V4instance *here; +double delvbd, delvbs, delvds, delvgd, delvgs; +double delvdbd, delvsbs; +double delvbd_jct, delvbs_jct; +double vds, vgs, vgd, vgdo, vbs, vbd; +double vdbd, vdbs, vsbs; +double cbhat, cdhat, Idtot, Ibtot; +double vses, vdes, vdedo, delvses, delvded, delvdes; +double Isestot, cseshat, Idedtot, cdedhat; +double Igstot, cgshat, Igdtot, cgdhat, Igbtot, cgbhat; +double tol0, tol1, tol2, tol3, tol4, tol5, tol6; + + for (; model != NULL; model = model->BSIM4V4nextModel) + { for (here = model->BSIM4V4instances; here != NULL ; + here=here->BSIM4V4nextInstance) + { + if (here->BSIM4V4owner != ARCHme) continue; + vds = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4dNodePrime) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vgs = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4gNodePrime) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vbs = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4bNodePrime) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vdbs = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4dbNode) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vsbs = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4sbNode) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vses = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4sNode) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vdes = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4dNode) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + + vgdo = *(ckt->CKTstate0 + here->BSIM4V4vgs) + - *(ckt->CKTstate0 + here->BSIM4V4vds); + vbd = vbs - vds; + vdbd = vdbs - vds; + vgd = vgs - vds; + + delvbd = vbd - *(ckt->CKTstate0 + here->BSIM4V4vbd); + delvdbd = vdbd - *(ckt->CKTstate0 + here->BSIM4V4vdbd); + delvgd = vgd - vgdo; + + delvds = vds - *(ckt->CKTstate0 + here->BSIM4V4vds); + delvgs = vgs - *(ckt->CKTstate0 + here->BSIM4V4vgs); + delvbs = vbs - *(ckt->CKTstate0 + here->BSIM4V4vbs); + delvsbs = vsbs - *(ckt->CKTstate0 + here->BSIM4V4vsbs); + + delvses = vses - (*(ckt->CKTstate0 + here->BSIM4V4vses)); + vdedo = *(ckt->CKTstate0 + here->BSIM4V4vdes) + - *(ckt->CKTstate0 + here->BSIM4V4vds); + delvdes = vdes - *(ckt->CKTstate0 + here->BSIM4V4vdes); + delvded = vdes - vds - vdedo; + + delvbd_jct = (!here->BSIM4V4rbodyMod) ? delvbd : delvdbd; + delvbs_jct = (!here->BSIM4V4rbodyMod) ? delvbs : delvsbs; + + if (here->BSIM4V4mode >= 0) + { Idtot = here->BSIM4V4cd + here->BSIM4V4csub - here->BSIM4V4cbd + + here->BSIM4V4Igidl; + cdhat = Idtot - here->BSIM4V4gbd * delvbd_jct + + (here->BSIM4V4gmbs + here->BSIM4V4gbbs + here->BSIM4V4ggidlb) * delvbs + + (here->BSIM4V4gm + here->BSIM4V4gbgs + here->BSIM4V4ggidlg) * delvgs + + (here->BSIM4V4gds + here->BSIM4V4gbds + here->BSIM4V4ggidld) * delvds; + + Igstot = here->BSIM4V4Igs + here->BSIM4V4Igcs; + cgshat = Igstot + (here->BSIM4V4gIgsg + here->BSIM4V4gIgcsg) * delvgs + + here->BSIM4V4gIgcsd * delvds + here->BSIM4V4gIgcsb * delvbs; + + Igdtot = here->BSIM4V4Igd + here->BSIM4V4Igcd; + cgdhat = Igdtot + here->BSIM4V4gIgdg * delvgd + here->BSIM4V4gIgcdg * delvgs + + here->BSIM4V4gIgcdd * delvds + here->BSIM4V4gIgcdb * delvbs; + + Igbtot = here->BSIM4V4Igb; + cgbhat = here->BSIM4V4Igb + here->BSIM4V4gIgbg * delvgs + here->BSIM4V4gIgbd + * delvds + here->BSIM4V4gIgbb * delvbs; + } + else + { Idtot = here->BSIM4V4cd + here->BSIM4V4cbd - here->BSIM4V4Igidl; /* bugfix */ + cdhat = Idtot + here->BSIM4V4gbd * delvbd_jct + here->BSIM4V4gmbs + * delvbd + here->BSIM4V4gm * delvgd + - (here->BSIM4V4gds + here->BSIM4V4ggidls) * delvds + - here->BSIM4V4ggidlg * delvgs - here->BSIM4V4ggidlb * delvbs; + + Igstot = here->BSIM4V4Igs + here->BSIM4V4Igcd; + cgshat = Igstot + here->BSIM4V4gIgsg * delvgs + here->BSIM4V4gIgcdg * delvgd + - here->BSIM4V4gIgcdd * delvds + here->BSIM4V4gIgcdb * delvbd; + + Igdtot = here->BSIM4V4Igd + here->BSIM4V4Igcs; + cgdhat = Igdtot + (here->BSIM4V4gIgdg + here->BSIM4V4gIgcsg) * delvgd + - here->BSIM4V4gIgcsd * delvds + here->BSIM4V4gIgcsb * delvbd; + + Igbtot = here->BSIM4V4Igb; + cgbhat = here->BSIM4V4Igb + here->BSIM4V4gIgbg * delvgd - here->BSIM4V4gIgbd + * delvds + here->BSIM4V4gIgbb * delvbd; + } + + Isestot = here->BSIM4V4gstot * (*(ckt->CKTstate0 + here->BSIM4V4vses)); + cseshat = Isestot + here->BSIM4V4gstot * delvses + + here->BSIM4V4gstotd * delvds + here->BSIM4V4gstotg * delvgs + + here->BSIM4V4gstotb * delvbs; + + Idedtot = here->BSIM4V4gdtot * vdedo; + cdedhat = Idedtot + here->BSIM4V4gdtot * delvded + + here->BSIM4V4gdtotd * delvds + here->BSIM4V4gdtotg * delvgs + + here->BSIM4V4gdtotb * delvbs; + + /* + * Check convergence + */ + + if ((here->BSIM4V4off == 0) || (!(ckt->CKTmode & MODEINITFIX))) + { tol0 = ckt->CKTreltol * MAX(fabs(cdhat), fabs(Idtot)) + + ckt->CKTabstol; + tol1 = ckt->CKTreltol * MAX(fabs(cseshat), fabs(Isestot)) + + ckt->CKTabstol; + tol2 = ckt->CKTreltol * MAX(fabs(cdedhat), fabs(Idedtot)) + + ckt->CKTabstol; + tol3 = ckt->CKTreltol * MAX(fabs(cgshat), fabs(Igstot)) + + ckt->CKTabstol; + tol4 = ckt->CKTreltol * MAX(fabs(cgdhat), fabs(Igdtot)) + + ckt->CKTabstol; + tol5 = ckt->CKTreltol * MAX(fabs(cgbhat), fabs(Igbtot)) + + ckt->CKTabstol; + + if ((fabs(cdhat - Idtot) >= tol0) || (fabs(cseshat - Isestot) >= tol1) + || (fabs(cdedhat - Idedtot) >= tol2)) + { ckt->CKTnoncon++; + return(OK); + } + + if ((fabs(cgshat - Igstot) >= tol3) || (fabs(cgdhat - Igdtot) >= tol4) + || (fabs(cgbhat - Igbtot) >= tol5)) + { ckt->CKTnoncon++; + return(OK); + } + + Ibtot = here->BSIM4V4cbs + here->BSIM4V4cbd + - here->BSIM4V4Igidl - here->BSIM4V4Igisl - here->BSIM4V4csub; + if (here->BSIM4V4mode >= 0) + { cbhat = Ibtot + here->BSIM4V4gbd * delvbd_jct + + here->BSIM4V4gbs * delvbs_jct - (here->BSIM4V4gbbs + here->BSIM4V4ggidlb) + * delvbs - (here->BSIM4V4gbgs + here->BSIM4V4ggidlg) * delvgs + - (here->BSIM4V4gbds + here->BSIM4V4ggidld) * delvds + - here->BSIM4V4ggislg * delvgd - here->BSIM4V4ggislb* delvbd + here->BSIM4V4ggisls * delvds ; + } + else + { cbhat = Ibtot + here->BSIM4V4gbs * delvbs_jct + here->BSIM4V4gbd + * delvbd_jct - (here->BSIM4V4gbbs + here->BSIM4V4ggislb) * delvbd + - (here->BSIM4V4gbgs + here->BSIM4V4ggislg) * delvgd + + (here->BSIM4V4gbds + here->BSIM4V4ggisld - here->BSIM4V4ggidls) * delvds + - here->BSIM4V4ggidlg * delvgs - here->BSIM4V4ggidlb * delvbs; + } + tol6 = ckt->CKTreltol * MAX(fabs(cbhat), + fabs(Ibtot)) + ckt->CKTabstol; + if (fabs(cbhat - Ibtot) > tol6) + { ckt->CKTnoncon++; + return(OK); + } + } + } + } + return(OK); +} diff --git a/src/spicelib/devices/bsim4v4/b4v4del.c b/src/spicelib/devices/bsim4v4/b4v4del.c new file mode 100644 index 000000000..914e21cbc --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4del.c @@ -0,0 +1,41 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4del.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + **********/ + +#include "ngspice.h" +#include "bsim4v4def.h" +#include "sperror.h" +#include "gendefs.h" +#include "suffix.h" + + +int +BSIM4V4delete(inModel,name,inInst) +GENmodel *inModel; +IFuid name; +GENinstance **inInst; +{ +BSIM4V4instance **fast = (BSIM4V4instance**)inInst; +BSIM4V4model *model = (BSIM4V4model*)inModel; +BSIM4V4instance **prev = NULL; +BSIM4V4instance *here; + + for (; model ; model = model->BSIM4V4nextModel) + { prev = &(model->BSIM4V4instances); + for (here = *prev; here ; here = *prev) + { if (here->BSIM4V4name == name || (fast && here==*fast)) + { *prev= here->BSIM4V4nextInstance; + FREE(here); + return(OK); + } + prev = &(here->BSIM4V4nextInstance); + } + } + return(E_NODEV); +} diff --git a/src/spicelib/devices/bsim4v4/b4v4dest.c b/src/spicelib/devices/bsim4v4/b4v4dest.c new file mode 100644 index 000000000..1b8cfb59b --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4dest.c @@ -0,0 +1,38 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4dest.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + **********/ + +#include "ngspice.h" +#include "bsim4v4def.h" +#include "suffix.h" + +void +BSIM4V4destroy(inModel) +GENmodel **inModel; +{ +BSIM4V4model **model = (BSIM4V4model**)inModel; +BSIM4V4instance *here; +BSIM4V4instance *prev = NULL; +BSIM4V4model *mod = *model; +BSIM4V4model *oldmod = NULL; + + for (; mod ; mod = mod->BSIM4V4nextModel) + { if(oldmod) FREE(oldmod); + oldmod = mod; + prev = (BSIM4V4instance *)NULL; + for (here = mod->BSIM4V4instances; here; here = here->BSIM4V4nextInstance) + { if(prev) FREE(prev); + prev = here; + } + if(prev) FREE(prev); + } + if(oldmod) FREE(oldmod); + *model = NULL; + return; +} diff --git a/src/spicelib/devices/bsim4v4/b4v4geo.c b/src/spicelib/devices/bsim4v4/b4v4geo.c new file mode 100644 index 000000000..e5050c37d --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4geo.c @@ -0,0 +1,385 @@ +/**** BSIM4.4.0 Released by Xuemei(Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2003 Regents of the University of California. All rights reserved. + * File: b4geo.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + **********/ + +#include "ngspice.h" + +/* + * WDLiu: + * This subrutine is a special module to process the geometry dependent + * parasitics for BSIM4V4, which calculates Ps, Pd, As, Ad, and Rs and Rd + * for multi-fingers and varous GEO and RGEO options. + */ + +int +BSIM4V4RdsEndIso(double, double, double, double, double, double, int, int, double *); +int +BSIM4V4RdsEndSha(double, double, double, double, double, double, int, int, double *); + +int +BSIM4V4NumFingerDiff(nf, minSD, nuIntD, nuEndD, nuIntS, nuEndS) +int minSD; +double nf, *nuIntD, *nuEndD, *nuIntS, *nuEndS; +{ +int NF; + NF = (int)nf; + if ((NF%2) != 0) + { *nuEndD = *nuEndS = 1.0; + *nuIntD = *nuIntS = 2.0 * MAX((nf - 1.0) / 2.0, 0.0); + } + else + { if (minSD == 1) /* minimize # of source */ + { *nuEndD = 2.0; + *nuIntD = 2.0 * MAX((nf / 2.0 - 1.0), 0.0); + *nuEndS = 0.0; + *nuIntS = nf; + } + else + { *nuEndD = 0.0; + *nuIntD = nf; + *nuEndS = 2.0; + *nuIntS = 2.0 * MAX((nf / 2.0 - 1.0), 0.0); + } + } +return 0; +} + + +int +BSIM4V4PAeffGeo(nf, geo, minSD, Weffcj, DMCG, DMCI, DMDG, Ps, Pd, As, Ad) +int geo, minSD; +double Weffcj, DMCG, DMCI, DMDG; +double nf, *Ps, *Pd, *As, *Ad; +{ +double T0, T1, T2; +double ADiso, ADsha, ADmer, ASiso, ASsha, ASmer; +double PDiso, PDsha, PDmer, PSiso, PSsha, PSmer; +double nuIntD = 0.0, nuEndD = 0.0, nuIntS = 0.0, nuEndS = 0.0; + + if (geo < 9) /* For geo = 9 and 10, the numbers of S/D diffusions already known */ + BSIM4V4NumFingerDiff(nf, minSD, &nuIntD, &nuEndD, &nuIntS, &nuEndS); + + T0 = DMCG + DMCI; + T1 = DMCG + DMCG; + T2 = DMDG + DMDG; + + PSiso = PDiso = T0 + T0 + Weffcj; + PSsha = PDsha = T1; + PSmer = PDmer = T2; + + ASiso = ADiso = T0 * Weffcj; + ASsha = ADsha = DMCG * Weffcj; + ASmer = ADmer = DMDG * Weffcj; + + switch(geo) + { case 0: + *Ps = nuEndS * PSiso + nuIntS * PSsha; + *Pd = nuEndD * PDiso + nuIntD * PDsha; + *As = nuEndS * ASiso + nuIntS * ASsha; + *Ad = nuEndD * ADiso + nuIntD * ADsha; + break; + case 1: + *Ps = nuEndS * PSiso + nuIntS * PSsha; + *Pd = (nuEndD + nuIntD) * PDsha; + *As = nuEndS * ASiso + nuIntS * ASsha; + *Ad = (nuEndD + nuIntD) * ADsha; + break; + case 2: + *Ps = (nuEndS + nuIntS) * PSsha; + *Pd = nuEndD * PDiso + nuIntD * PDsha; + *As = (nuEndS + nuIntS) * ASsha; + *Ad = nuEndD * ADiso + nuIntD * ADsha; + break; + case 3: + *Ps = (nuEndS + nuIntS) * PSsha; + *Pd = (nuEndD + nuIntD) * PDsha; + *As = (nuEndS + nuIntS) * ASsha; + *Ad = (nuEndD + nuIntD) * ADsha; + break; + case 4: + *Ps = nuEndS * PSiso + nuIntS * PSsha; + *Pd = nuEndD * PDmer + nuIntD * PDsha; + *As = nuEndS * ASiso + nuIntS * ASsha; + *Ad = nuEndD * ADmer + nuIntD * ADsha; + break; + case 5: + *Ps = (nuEndS + nuIntS) * PSsha; + *Pd = nuEndD * PDmer + nuIntD * PDsha; + *As = (nuEndS + nuIntS) * ASsha; + *Ad = nuEndD * ADmer + nuIntD * ADsha; + break; + case 6: + *Ps = nuEndS * PSmer + nuIntS * PSsha; + *Pd = nuEndD * PDiso + nuIntD * PDsha; + *As = nuEndS * ASmer + nuIntS * ASsha; + *Ad = nuEndD * ADiso + nuIntD * ADsha; + break; + case 7: + *Ps = nuEndS * PSmer + nuIntS * PSsha; + *Pd = (nuEndD + nuIntD) * PDsha; + *As = nuEndS * ASmer + nuIntS * ASsha; + *Ad = (nuEndD + nuIntD) * ADsha; + break; + case 8: + *Ps = nuEndS * PSmer + nuIntS * PSsha; + *Pd = nuEndD * PDmer + nuIntD * PDsha; + *As = nuEndS * ASmer + nuIntS * ASsha; + *Ad = nuEndD * ADmer + nuIntD * ADsha; + break; + case 9: /* geo = 9 and 10 happen only when nf = even */ + *Ps = PSiso + (nf - 1.0) * PSsha; + *Pd = nf * PDsha; + *As = ASiso + (nf - 1.0) * ASsha; + *Ad = nf * ADsha; + break; + case 10: + *Ps = nf * PSsha; + *Pd = PDiso + (nf - 1.0) * PDsha; + *As = nf * ASsha; + *Ad = ADiso + (nf - 1.0) * ADsha; + break; + default: + printf("Warning: Specified GEO = %d not matched\n", geo); + } +return 0; +} + + +int +BSIM4V4RdseffGeo(nf, geo, rgeo, minSD, Weffcj, Rsh, DMCG, DMCI, DMDG, Type, Rtot) +int geo, rgeo, minSD, Type; +double nf, Weffcj, Rsh, DMCG, DMCI, DMDG; +double *Rtot; +{ +double Rint=0.0, Rend = 0.0; +double nuIntD = 0.0, nuEndD = 0.0, nuIntS = 0.0, nuEndS = 0.0; + + if (geo < 9) /* since geo = 9 and 10 only happen when nf = even */ + { BSIM4V4NumFingerDiff(nf, minSD, &nuIntD, &nuEndD, &nuIntS, &nuEndS); + + /* Internal S/D resistance -- assume shared S or D and all wide contacts */ + if (Type == 1) + { if (nuIntS == 0.0) + Rint = 0.0; + else + Rint = Rsh * DMCG / ( Weffcj * nuIntS); + } + else + { if (nuIntD == 0.0) + Rint = 0.0; + else + Rint = Rsh * DMCG / ( Weffcj * nuIntD); + } + } + + /* End S/D resistance -- geo dependent */ + switch(geo) + { case 0: + if (Type == 1) BSIM4V4RdsEndIso(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndS, rgeo, 1, &Rend); + else BSIM4V4RdsEndIso(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndD, rgeo, 0, &Rend); + break; + case 1: + if (Type == 1) BSIM4V4RdsEndIso(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndS, rgeo, 1, &Rend); + else BSIM4V4RdsEndSha(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndD, rgeo, 0, &Rend); + break; + case 2: + if (Type == 1) BSIM4V4RdsEndSha(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndS, rgeo, 1, &Rend); + else BSIM4V4RdsEndIso(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndD, rgeo, 0, &Rend); + break; + case 3: + if (Type == 1) BSIM4V4RdsEndSha(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndS, rgeo, 1, &Rend); + else BSIM4V4RdsEndSha(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndD, rgeo, 0, &Rend); + break; + case 4: + if (Type == 1) BSIM4V4RdsEndIso(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndS, rgeo, 1, &Rend); + else Rend = Rsh * DMDG / Weffcj; + break; + case 5: + if (Type == 1) BSIM4V4RdsEndSha(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndS, rgeo, 1, &Rend); + else Rend = Rsh * DMDG / (Weffcj * nuEndD); + break; + case 6: + if (Type == 1) Rend = Rsh * DMDG / Weffcj; + else BSIM4V4RdsEndIso(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndD, rgeo, 0, &Rend); + break; + case 7: + if (Type == 1) Rend = Rsh * DMDG / (Weffcj * nuEndS); + else BSIM4V4RdsEndSha(Weffcj, Rsh, DMCG, DMCI, DMDG, + nuEndD, rgeo, 0, &Rend); + break; + case 8: + Rend = Rsh * DMDG / Weffcj; + break; + case 9: /* all wide contacts assumed for geo = 9 and 10 */ + if (Type == 1) + { Rend = 0.5 * Rsh * DMCG / Weffcj; + if (nf == 2.0) + Rint = 0.0; + else + Rint = Rsh * DMCG / (Weffcj * (nf - 2.0)); + } + else + { Rend = 0.0; + Rint = Rsh * DMCG / (Weffcj * nf); + } + break; + case 10: + if (Type == 1) + { Rend = 0.0; + Rint = Rsh * DMCG / (Weffcj * nf); + } + else + { Rend = 0.5 * Rsh * DMCG / Weffcj;; + if (nf == 2.0) + Rint = 0.0; + else + Rint = Rsh * DMCG / (Weffcj * (nf - 2.0)); + } + break; + default: + printf("Warning: Specified GEO = %d not matched\n", geo); + } + + if (Rint <= 0.0) + *Rtot = Rend; + else if (Rend <= 0.0) + *Rtot = Rint; + else + *Rtot = Rint * Rend / (Rint + Rend); +if(*Rtot==0.0) + printf("Warning: Zero resistance returned from RdseffGeo\n"); +return 0; +} + + +int +BSIM4V4RdsEndIso(Weffcj, Rsh, DMCG, DMCI, DMDG, nuEnd, rgeo, Type, Rend) +double Weffcj, Rsh, DMCG, DMCI, DMDG; +int rgeo, Type; +double nuEnd, *Rend; +{ + if (Type == 1) + { switch(rgeo) + { case 1: + case 2: + case 5: + if (nuEnd == 0.0) + *Rend = 0.0; + else + *Rend = Rsh * DMCG / (Weffcj * nuEnd); + break; + case 3: + case 4: + case 6: + if ((DMCG + DMCI) == 0.0) + printf("(DMCG + DMCI) can not be equal to zero\n"); + if (nuEnd == 0.0) + *Rend = 0.0; + else + *Rend = Rsh * Weffcj / (3.0 * nuEnd * (DMCG + DMCI)); + break; + default: + printf("Warning: Specified RGEO = %d not matched\n", rgeo); + } + } + else + { switch(rgeo) + { case 1: + case 3: + case 7: + if (nuEnd == 0.0) + *Rend = 0.0; + else + *Rend = Rsh * DMCG / (Weffcj * nuEnd); + break; + case 2: + case 4: + case 8: + if ((DMCG + DMCI) == 0.0) + printf("(DMCG + DMCI) can not be equal to zero\n"); + if (nuEnd == 0.0) + *Rend = 0.0; + else + *Rend = Rsh * Weffcj / (3.0 * nuEnd * (DMCG + DMCI)); + break; + default: + printf("Warning: Specified RGEO = %d not matched\n", rgeo); + } + } +return 0; +} + + +int +BSIM4V4RdsEndSha(Weffcj, Rsh, DMCG, DMCI, DMDG, nuEnd, rgeo, Type, Rend) +double Weffcj, Rsh, DMCG, DMCI, DMDG; +int rgeo, Type; +double nuEnd, *Rend; +{ + if (Type == 1) + { switch(rgeo) + { case 1: + case 2: + case 5: + if (nuEnd == 0.0) + *Rend = 0.0; + else + *Rend = Rsh * DMCG / (Weffcj * nuEnd); + break; + case 3: + case 4: + case 6: + if (DMCG == 0.0) + printf("DMCG can not be equal to zero\n"); + if (nuEnd == 0.0) + *Rend = 0.0; + else + *Rend = Rsh * Weffcj / (6.0 * nuEnd * DMCG); + break; + default: + printf("Warning: Specified RGEO = %d not matched\n", rgeo); + } + } + else + { switch(rgeo) + { case 1: + case 3: + case 7: + if (nuEnd == 0.0) + *Rend = 0.0; + else + *Rend = Rsh * DMCG / (Weffcj * nuEnd); + break; + case 2: + case 4: + case 8: + if (DMCG == 0.0) + printf("DMCG can not be equal to zero\n"); + if (nuEnd == 0.0) + *Rend = 0.0; + else + *Rend = Rsh * Weffcj / (6.0 * nuEnd * DMCG); + break; + default: + printf("Warning: Specified RGEO = %d not matched\n", rgeo); + } + } +return 0; +} diff --git a/src/spicelib/devices/bsim4v4/b4v4getic.c b/src/spicelib/devices/bsim4v4/b4v4getic.c new file mode 100644 index 000000000..681711726 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4getic.c @@ -0,0 +1,44 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4getic.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + **********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim4v4def.h" +#include "sperror.h" +#include "suffix.h" + + +int +BSIM4V4getic(inModel,ckt) +GENmodel *inModel; +CKTcircuit *ckt; +{ +BSIM4V4model *model = (BSIM4V4model*)inModel; +BSIM4V4instance *here; + + for (; model ; model = model->BSIM4V4nextModel) + { for (here = model->BSIM4V4instances; here; here = here->BSIM4V4nextInstance) + { if (here->BSIM4V4owner != ARCHme) continue; + if (!here->BSIM4V4icVDSGiven) + { here->BSIM4V4icVDS = *(ckt->CKTrhs + here->BSIM4V4dNode) + - *(ckt->CKTrhs + here->BSIM4V4sNode); + } + if (!here->BSIM4V4icVGSGiven) + { here->BSIM4V4icVGS = *(ckt->CKTrhs + here->BSIM4V4gNodeExt) + - *(ckt->CKTrhs + here->BSIM4V4sNode); + } + if(!here->BSIM4V4icVBSGiven) + { here->BSIM4V4icVBS = *(ckt->CKTrhs + here->BSIM4V4bNode) + - *(ckt->CKTrhs + here->BSIM4V4sNode); + } + } + } + return(OK); +} diff --git a/src/spicelib/devices/bsim4v4/b4v4ld.c b/src/spicelib/devices/bsim4v4/b4v4ld.c new file mode 100644 index 000000000..98a4ac3a7 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4ld.c @@ -0,0 +1,4743 @@ +/**** + BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 + $Id$ +****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4ld.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 11/15/2002. + * Modified by Xuemei Xi, 05/09/2003. + * Modified by Xuemei Xi, 03/04/2004. + **********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim4v4def.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 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 +#define MM 3 /* smooth coeff */ +#define DEXP(A,B,C) { \ + if (A > EXP_THRESHOLD) { \ + B = MAX_EXP*(1.0+(A)-EXP_THRESHOLD); \ + C = MAX_EXP; \ + } else if (A < -EXP_THRESHOLD) { \ + B = MIN_EXP; \ + C = 0; \ + } else { \ + B = exp(A); \ + C = B; \ + } \ + } + +int BSIM4V4polyDepletion(double phi, double ngate,double coxe, double Vgs, double *Vgs_eff, double *dVgs_eff_dVg); + +int +BSIM4V4load(inModel,ckt) +GENmodel *inModel; +CKTcircuit *ckt; +{ +BSIM4V4model *model = (BSIM4V4model*)inModel; +BSIM4V4instance *here; + +double ceqgstot, dgstot_dvd, dgstot_dvg, dgstot_dvs, dgstot_dvb; +double ceqgdtot, dgdtot_dvd, dgdtot_dvg, dgdtot_dvs, dgdtot_dvb; +double gstot, gstotd, gstotg, gstots, gstotb, gspr, Rs, Rd; +double gdtot, gdtotd, gdtotg, gdtots, gdtotb, gdpr; +double vgs_eff, vgd_eff, dvgs_eff_dvg, dvgd_eff_dvg; +double dRs_dvg, dRd_dvg, dRs_dvb, dRd_dvb; +double dT0_dvg, dT1_dvb, dT3_dvg, dT3_dvb; +double vses, vdes, vdedo, delvses, delvded, delvdes; +double Isestot=0.0, cseshat=0.0, Idedtot=0.0, cdedhat=0.0; +//#ifndef NEWCONV +//double tol0, tol1, tol2, tol3, tol4, tol5, tol6; +//#endif + +double geltd, gcrg, gcrgg, gcrgd, gcrgs, gcrgb, ceqgcrg; +double vges, vgms, vgedo, vgmdo, vged, vgmd, delvged, delvgmd; +double delvges, delvgms, vgmb; +double gcgmgmb=0.0, gcgmdb=0.0, gcgmsb=0.0, gcdgmb, gcsgmb; +double gcgmbb=0.0, gcbgmb, qgmb, qgmid=0.0, ceqqgmid; + +double vbd, vbs, vds, vgb, vgd, vgs, vgdo, xfact; +double vdbs, vdbd, vsbs, vsbdo, vsbd; +double delvdbs, delvdbd, delvsbs; +double delvbd_jct, delvbs_jct, vbs_jct, vbd_jct; + +double SourceSatCurrent, DrainSatCurrent; +double ag0, qgb, von, cbhat=0.0, VgstNVt, ExpVgst; +double ceqqb, ceqqd, ceqqg, ceqqjd=0.0, ceqqjs=0.0, ceq, geq; +double cdrain, cdhat=0.0, ceqdrn, ceqbd, ceqbs, ceqjd, ceqjs, gjbd, gjbs; +double czbd, czbdsw, czbdswg, czbs, czbssw, czbsswg, evbd, evbs, arg, sarg; +double delvbd, delvbs, delvds, delvgd, delvgs; +double Vfbeff, dVfbeff_dVg, dVfbeff_dVb, V3, V4; +double gcbdb, gcbgb, gcbsb, gcddb, gcdgb, gcdsb, gcgdb, gcggb, gcgsb, gcsdb; +double gcgbb, gcdbb, gcsbb, gcbbb; +double gcdbdb, gcsbsb; +double gcsgb, gcssb, MJD, MJSWD, MJSWGD, MJS, MJSWS, MJSWGS; +double qgate=0.0, qbulk=0.0, qdrn=0.0, qsrc, cqgate, cqbody, cqdrn; +double Vdb, Vds, Vgs, Vbs, Gmbs, FwdSum, RevSum; +double Igidl, Ggidld, Ggidlg, Ggidlb; +double Voxacc=0.0, dVoxacc_dVg=0.0, dVoxacc_dVb=0.0; +double Voxdepinv=0.0, dVoxdepinv_dVg=0.0, dVoxdepinv_dVd=0.0, dVoxdepinv_dVb=0.0; +double VxNVt, ExpVxNVt, Vaux, dVaux_dVg, dVaux_dVd, dVaux_dVb; +double Igc, dIgc_dVg, dIgc_dVd, dIgc_dVb; +double Igcs, dIgcs_dVg, dIgcs_dVd, dIgcs_dVb; +double Igcd, dIgcd_dVg, dIgcd_dVd, dIgcd_dVb; +double Igs, dIgs_dVg, dIgs_dVs, Igd, dIgd_dVg, dIgd_dVd; +double Igbacc, dIgbacc_dVg, dIgbacc_dVb; +double Igbinv, dIgbinv_dVg, dIgbinv_dVd, dIgbinv_dVb; +double Pigcd, dPigcd_dVg, dPigcd_dVd, dPigcd_dVb; +double Istoteq, gIstotg, gIstotd, gIstots, gIstotb; +double Idtoteq, gIdtotg, gIdtotd, gIdtots, gIdtotb; +double Ibtoteq, gIbtotg, gIbtotd, gIbtots, gIbtotb; +double Igtoteq, gIgtotg, gIgtotd, gIgtots, gIgtotb; +double Igstot=0.0, cgshat=0.0, Igdtot=0.0, cgdhat=0.0, Igbtot=0.0, cgbhat=0.0; +double Vgs_eff, Vfb=0.0, Vth_NarrowW; +double Phis, dPhis_dVb, sqrtPhis, dsqrtPhis_dVb, Vth, dVth_dVb, dVth_dVd; +double Vgst, dVgst_dVg, dVgst_dVb, dVgs_eff_dVg, Nvtms, Nvtmd; +double Vtm; +double n, dn_dVb, dn_dVd, voffcv, noff, dnoff_dVd, dnoff_dVb; +double V0, CoxWLcen, QovCox, LINK; +double DeltaPhi, dDeltaPhi_dVg; +double Cox, Tox, Tcen, dTcen_dVg, dTcen_dVd, dTcen_dVb; +double Ccen, Coxeff, dCoxeff_dVd, dCoxeff_dVg, dCoxeff_dVb; +double Denomi, dDenomi_dVg, dDenomi_dVd, dDenomi_dVb; +double ueff, dueff_dVg, dueff_dVd, dueff_dVb; +double Esat, Vdsat; +double EsatL, dEsatL_dVg, dEsatL_dVd, dEsatL_dVb; +double dVdsat_dVg, dVdsat_dVb, dVdsat_dVd, Vasat, dAlphaz_dVg, dAlphaz_dVb; +double dVasat_dVg, dVasat_dVb, dVasat_dVd, Va, dVa_dVd, dVa_dVg, dVa_dVb; +double Vbseff, dVbseff_dVb, VbseffCV, dVbseffCV_dVb; +double Arg1, One_Third_CoxWL, Two_Third_CoxWL, Alphaz, CoxWL; +double T0=0.0, 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_dVd, dT4_dVb; +double T5, dT5_dVg, dT5_dVd, dT5_dVb; +double T6=0.0, 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 T11, T12, T13, T14; +double tmp, Abulk, dAbulk_dVb, Abulk0, dAbulk0_dVb; +double Cclm, dCclm_dVg, dCclm_dVd, dCclm_dVb; +double FP, dFP_dVg, PvagTerm, dPvagTerm_dVg, dPvagTerm_dVd, dPvagTerm_dVb; +double VADITS, dVADITS_dVg, dVADITS_dVd; +double Lpe_Vb, dDITS_Sft_dVb, dDITS_Sft_dVd; +double VACLM, dVACLM_dVg, dVACLM_dVd, dVACLM_dVb; +double VADIBL, dVADIBL_dVg, dVADIBL_dVd, dVADIBL_dVb; +double Xdep, dXdep_dVb, lt1, dlt1_dVb, ltw, dltw_dVb, Delt_vth, dDelt_vth_dVb; +double Theta0, dTheta0_dVb; +double TempRatio, tmp1, tmp2, tmp3, tmp4; +double DIBL_Sft, dDIBL_Sft_dVd, Lambda, dLambda_dVg; +double Idtot, Ibtot, a1, ScalingFactor; + +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, dAbulk_dVg; +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, devbs_dvb, devbd_dvb; +double Isub, Gbd, Gbg, Gbb; +double VASCBE, dVASCBE_dVg, dVASCBE_dVd, dVASCBE_dVb; +double CoxeffWovL; +double Rds, dRds_dVg, dRds_dVb, WVCox, WVCoxRds; +double Vgst2Vtm, VdsatCV; +double Leff, Weff, dWeff_dVg, dWeff_dVb; +double AbulkCV, dAbulkCV_dVb; +double qcheq=0.0, qdef, gqdef=0.0, cqdef=0.0, cqcheq=0.0; +double gcqdb=0.0, gcqsb=0.0, gcqgb=0.0, gcqbb=0.0; +double dxpart, sxpart, ggtg, ggtd, ggts, ggtb; +double ddxpart_dVd, ddxpart_dVg, ddxpart_dVb, ddxpart_dVs; +double dsxpart_dVd, dsxpart_dVg, dsxpart_dVb, dsxpart_dVs; +double gbspsp, gbbdp, gbbsp, gbspg, gbspb, gbspdp; +double gbdpdp, gbdpg, gbdpb, gbdpsp; +double qgdo, qgso, cgdo, cgso; +double Cgg, Cgd, Cgb, Cdg, Cdd, Cds; +double Csg, Csd, Css, Csb, Cbg, Cbd, Cbb; +double Cgg1, Cgb1, Cgd1, Cbg1, Cbb1, Cbd1, Qac0, Qsub0; +double dQac0_dVg, dQac0_dVb, dQsub0_dVg, dQsub0_dVd, dQsub0_dVb; +double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; +double Igisl, Ggislg, Ggislb, Ggisls; +double Nvtmrs, Nvtmrssw, Nvtmrsswg; + + +double vs, Fsevl, dvs_dVg, dvs_dVd, dvs_dVb, dFsevl_dVg, dFsevl_dVd, dFsevl_dVb; +double vgdx, vgsx; +struct bsim4SizeDependParam *pParam; +int ByPass, ChargeComputationNeeded, error, Check, Check1, Check2; + +double m; + +ScalingFactor = 1.0e-9; +ChargeComputationNeeded = + ((ckt->CKTmode & (MODEAC | MODETRAN | MODEINITSMSIG)) || + ((ckt->CKTmode & MODETRANOP) && (ckt->CKTmode & MODEUIC))) + ? 1 : 0; + +for (; model != NULL; model = model->BSIM4V4nextModel) +{ for (here = model->BSIM4V4instances; here != NULL; + here = here->BSIM4V4nextInstance) + { if (here->BSIM4V4owner != ARCHme) continue; + Check = Check1 = Check2 = 1; + ByPass = 0; + pParam = here->pParam; + + if ((ckt->CKTmode & MODEINITSMSIG)) + { vds = *(ckt->CKTstate0 + here->BSIM4V4vds); + vgs = *(ckt->CKTstate0 + here->BSIM4V4vgs); + vbs = *(ckt->CKTstate0 + here->BSIM4V4vbs); + vges = *(ckt->CKTstate0 + here->BSIM4V4vges); + vgms = *(ckt->CKTstate0 + here->BSIM4V4vgms); + vdbs = *(ckt->CKTstate0 + here->BSIM4V4vdbs); + vsbs = *(ckt->CKTstate0 + here->BSIM4V4vsbs); + vses = *(ckt->CKTstate0 + here->BSIM4V4vses); + vdes = *(ckt->CKTstate0 + here->BSIM4V4vdes); + + qdef = *(ckt->CKTstate0 + here->BSIM4V4qdef); + } + else if ((ckt->CKTmode & MODEINITTRAN)) + { vds = *(ckt->CKTstate1 + here->BSIM4V4vds); + vgs = *(ckt->CKTstate1 + here->BSIM4V4vgs); + vbs = *(ckt->CKTstate1 + here->BSIM4V4vbs); + vges = *(ckt->CKTstate1 + here->BSIM4V4vges); + vgms = *(ckt->CKTstate1 + here->BSIM4V4vgms); + vdbs = *(ckt->CKTstate1 + here->BSIM4V4vdbs); + vsbs = *(ckt->CKTstate1 + here->BSIM4V4vsbs); + vses = *(ckt->CKTstate1 + here->BSIM4V4vses); + vdes = *(ckt->CKTstate1 + here->BSIM4V4vdes); + + qdef = *(ckt->CKTstate1 + here->BSIM4V4qdef); + } + else if ((ckt->CKTmode & MODEINITJCT) && !here->BSIM4V4off) + { vds = model->BSIM4V4type * here->BSIM4V4icVDS; + vgs = vges = vgms = model->BSIM4V4type * here->BSIM4V4icVGS; + vbs = vdbs = vsbs = model->BSIM4V4type * here->BSIM4V4icVBS; + if (vds > 0.0) + { vdes = vds + 0.01; + vses = -0.01; + } + else if (vds < 0.0) + { vdes = vds - 0.01; + vses = 0.01; + } + else + vdes = vses = 0.0; + + qdef = 0.0; + + if ((vds == 0.0) && (vgs == 0.0) && (vbs == 0.0) && + ((ckt->CKTmode & (MODETRAN | MODEAC|MODEDCOP | + MODEDCTRANCURVE)) || (!(ckt->CKTmode & MODEUIC)))) + { vds = 0.1; + vdes = 0.11; + vses = -0.01; + vgs = vges = vgms = model->BSIM4V4type + * here->BSIM4V4vth0 + 0.1; + vbs = vdbs = vsbs = 0.0; + } + } + else if ((ckt->CKTmode & (MODEINITJCT | MODEINITFIX)) && + (here->BSIM4V4off)) + { vds = vgs = vbs = vges = vgms = 0.0; + vdbs = vsbs = vdes = vses = qdef = 0.0; + } + else + { +#ifndef PREDICTOR + if ((ckt->CKTmode & MODEINITPRED)) + { xfact = ckt->CKTdelta / ckt->CKTdeltaOld[1]; + *(ckt->CKTstate0 + here->BSIM4V4vds) = + *(ckt->CKTstate1 + here->BSIM4V4vds); + vds = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4vds)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM4V4vds))); + *(ckt->CKTstate0 + here->BSIM4V4vgs) = + *(ckt->CKTstate1 + here->BSIM4V4vgs); + vgs = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4vgs)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM4V4vgs))); + *(ckt->CKTstate0 + here->BSIM4V4vges) = + *(ckt->CKTstate1 + here->BSIM4V4vges); + vges = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4vges)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM4V4vges))); + *(ckt->CKTstate0 + here->BSIM4V4vgms) = + *(ckt->CKTstate1 + here->BSIM4V4vgms); + vgms = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4vgms)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM4V4vgms))); + *(ckt->CKTstate0 + here->BSIM4V4vbs) = + *(ckt->CKTstate1 + here->BSIM4V4vbs); + vbs = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4vbs)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM4V4vbs))); + *(ckt->CKTstate0 + here->BSIM4V4vbd) = + *(ckt->CKTstate0 + here->BSIM4V4vbs) + - *(ckt->CKTstate0 + here->BSIM4V4vds); + *(ckt->CKTstate0 + here->BSIM4V4vdbs) = + *(ckt->CKTstate1 + here->BSIM4V4vdbs); + vdbs = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4vdbs)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM4V4vdbs))); + *(ckt->CKTstate0 + here->BSIM4V4vdbd) = + *(ckt->CKTstate0 + here->BSIM4V4vdbs) + - *(ckt->CKTstate0 + here->BSIM4V4vds); + *(ckt->CKTstate0 + here->BSIM4V4vsbs) = + *(ckt->CKTstate1 + here->BSIM4V4vsbs); + vsbs = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4vsbs)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM4V4vsbs))); + *(ckt->CKTstate0 + here->BSIM4V4vses) = + *(ckt->CKTstate1 + here->BSIM4V4vses); + vses = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4vses)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM4V4vses))); + *(ckt->CKTstate0 + here->BSIM4V4vdes) = + *(ckt->CKTstate1 + here->BSIM4V4vdes); + vdes = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4vdes)) + - (xfact * (*(ckt->CKTstate2 + here->BSIM4V4vdes))); + + *(ckt->CKTstate0 + here->BSIM4V4qdef) = + *(ckt->CKTstate1 + here->BSIM4V4qdef); + qdef = (1.0 + xfact)* (*(ckt->CKTstate1 + here->BSIM4V4qdef)) + -(xfact * (*(ckt->CKTstate2 + here->BSIM4V4qdef))); + } + else + { +#endif /* PREDICTOR */ + vds = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4dNodePrime) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vgs = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4gNodePrime) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vbs = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4bNodePrime) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vges = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4gNodeExt) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vgms = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4gNodeMid) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vdbs = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4dbNode) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vsbs = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4sbNode) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vses = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4sNode) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + vdes = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4dNode) + - *(ckt->CKTrhsOld + here->BSIM4V4sNodePrime)); + qdef = model->BSIM4V4type + * (*(ckt->CKTrhsOld + here->BSIM4V4qNode)); +#ifndef PREDICTOR + } +#endif /* PREDICTOR */ + + vgdo = *(ckt->CKTstate0 + here->BSIM4V4vgs) + - *(ckt->CKTstate0 + here->BSIM4V4vds); + vgedo = *(ckt->CKTstate0 + here->BSIM4V4vges) + - *(ckt->CKTstate0 + here->BSIM4V4vds); + vgmdo = *(ckt->CKTstate0 + here->BSIM4V4vgms) + - *(ckt->CKTstate0 + here->BSIM4V4vds); + + vbd = vbs - vds; + vdbd = vdbs - vds; + vgd = vgs - vds; + vged = vges - vds; + vgmd = vgms - vds; + + delvbd = vbd - *(ckt->CKTstate0 + here->BSIM4V4vbd); + delvdbd = vdbd - *(ckt->CKTstate0 + here->BSIM4V4vdbd); + delvgd = vgd - vgdo; + delvged = vged - vgedo; + delvgmd = vgmd - vgmdo; + + delvds = vds - *(ckt->CKTstate0 + here->BSIM4V4vds); + delvgs = vgs - *(ckt->CKTstate0 + here->BSIM4V4vgs); + delvges = vges - *(ckt->CKTstate0 + here->BSIM4V4vges); + delvgms = vgms - *(ckt->CKTstate0 + here->BSIM4V4vgms); + delvbs = vbs - *(ckt->CKTstate0 + here->BSIM4V4vbs); + delvdbs = vdbs - *(ckt->CKTstate0 + here->BSIM4V4vdbs); + delvsbs = vsbs - *(ckt->CKTstate0 + here->BSIM4V4vsbs); + + delvses = vses - (*(ckt->CKTstate0 + here->BSIM4V4vses)); + vdedo = *(ckt->CKTstate0 + here->BSIM4V4vdes) + - *(ckt->CKTstate0 + here->BSIM4V4vds); + delvdes = vdes - *(ckt->CKTstate0 + here->BSIM4V4vdes); + delvded = vdes - vds - vdedo; + + delvbd_jct = (!here->BSIM4V4rbodyMod) ? delvbd : delvdbd; + delvbs_jct = (!here->BSIM4V4rbodyMod) ? delvbs : delvsbs; + if (here->BSIM4V4mode >= 0) + { Idtot = here->BSIM4V4cd + here->BSIM4V4csub - here->BSIM4V4cbd + + here->BSIM4V4Igidl; + cdhat = Idtot - here->BSIM4V4gbd * delvbd_jct + + (here->BSIM4V4gmbs + here->BSIM4V4gbbs + here->BSIM4V4ggidlb) * delvbs + + (here->BSIM4V4gm + here->BSIM4V4gbgs + here->BSIM4V4ggidlg) * delvgs + + (here->BSIM4V4gds + here->BSIM4V4gbds + here->BSIM4V4ggidld) * delvds; + Ibtot = here->BSIM4V4cbs + here->BSIM4V4cbd + - here->BSIM4V4Igidl - here->BSIM4V4Igisl - here->BSIM4V4csub; + cbhat = Ibtot + here->BSIM4V4gbd * delvbd_jct + + here->BSIM4V4gbs * delvbs_jct - (here->BSIM4V4gbbs + here->BSIM4V4ggidlb) + * delvbs - (here->BSIM4V4gbgs + here->BSIM4V4ggidlg) * delvgs + - (here->BSIM4V4gbds + here->BSIM4V4ggidld - here->BSIM4V4ggisls) * delvds + - here->BSIM4V4ggislg * delvgd - here->BSIM4V4ggislb* delvbd; + + Igstot = here->BSIM4V4Igs + here->BSIM4V4Igcs; + cgshat = Igstot + (here->BSIM4V4gIgsg + here->BSIM4V4gIgcsg) * delvgs + + here->BSIM4V4gIgcsd * delvds + here->BSIM4V4gIgcsb * delvbs; + + Igdtot = here->BSIM4V4Igd + here->BSIM4V4Igcd; + cgdhat = Igdtot + here->BSIM4V4gIgdg * delvgd + here->BSIM4V4gIgcdg * delvgs + + here->BSIM4V4gIgcdd * delvds + here->BSIM4V4gIgcdb * delvbs; + + Igbtot = here->BSIM4V4Igb; + cgbhat = here->BSIM4V4Igb + here->BSIM4V4gIgbg * delvgs + here->BSIM4V4gIgbd + * delvds + here->BSIM4V4gIgbb * delvbs; + } + else + { Idtot = here->BSIM4V4cd + here->BSIM4V4cbd - here->BSIM4V4Igidl; /* bugfix */ + cdhat = Idtot + here->BSIM4V4gbd * delvbd_jct + here->BSIM4V4gmbs + * delvbd + here->BSIM4V4gm * delvgd + - (here->BSIM4V4gds + here->BSIM4V4ggidls) * delvds + - here->BSIM4V4ggidlg * delvgs - here->BSIM4V4ggidlb * delvbs; + Ibtot = here->BSIM4V4cbs + here->BSIM4V4cbd + - here->BSIM4V4Igidl - here->BSIM4V4Igisl - here->BSIM4V4csub; + cbhat = Ibtot + here->BSIM4V4gbs * delvbs_jct + here->BSIM4V4gbd + * delvbd_jct - (here->BSIM4V4gbbs + here->BSIM4V4ggislb) * delvbd + - (here->BSIM4V4gbgs + here->BSIM4V4ggislg) * delvgd + + (here->BSIM4V4gbds + here->BSIM4V4ggisld - here->BSIM4V4ggidls) * delvds + - here->BSIM4V4ggidlg * delvgs - here->BSIM4V4ggidlb * delvbs; + + Igstot = here->BSIM4V4Igs + here->BSIM4V4Igcd; + cgshat = Igstot + here->BSIM4V4gIgsg * delvgs + here->BSIM4V4gIgcdg * delvgd + - here->BSIM4V4gIgcdd * delvds + here->BSIM4V4gIgcdb * delvbd; + + Igdtot = here->BSIM4V4Igd + here->BSIM4V4Igcs; + cgdhat = Igdtot + (here->BSIM4V4gIgdg + here->BSIM4V4gIgcsg) * delvgd + - here->BSIM4V4gIgcsd * delvds + here->BSIM4V4gIgcsb * delvbd; + + Igbtot = here->BSIM4V4Igb; + cgbhat = here->BSIM4V4Igb + here->BSIM4V4gIgbg * delvgd - here->BSIM4V4gIgbd + * delvds + here->BSIM4V4gIgbb * delvbd; + } + + Isestot = here->BSIM4V4gstot * (*(ckt->CKTstate0 + here->BSIM4V4vses)); + cseshat = Isestot + here->BSIM4V4gstot * delvses + + here->BSIM4V4gstotd * delvds + here->BSIM4V4gstotg * delvgs + + here->BSIM4V4gstotb * delvbs; + + Idedtot = here->BSIM4V4gdtot * vdedo; + cdedhat = Idedtot + here->BSIM4V4gdtot * delvded + + here->BSIM4V4gdtotd * delvds + here->BSIM4V4gdtotg * delvgs + + here->BSIM4V4gdtotb * delvbs; + + +#ifndef NOBYPASS + /* Following should be one IF statement, but some C compilers + * can't handle that all at once, so we split it into several + * successive IF's */ + + if ((!(ckt->CKTmode & MODEINITPRED)) && (ckt->CKTbypass)) + if ((fabs(delvds) < (ckt->CKTreltol * MAX(fabs(vds), + fabs(*(ckt->CKTstate0 + here->BSIM4V4vds))) + ckt->CKTvoltTol))) + if ((fabs(delvgs) < (ckt->CKTreltol * MAX(fabs(vgs), + fabs(*(ckt->CKTstate0 + here->BSIM4V4vgs))) + ckt->CKTvoltTol))) + if ((fabs(delvbs) < (ckt->CKTreltol * MAX(fabs(vbs), + fabs(*(ckt->CKTstate0 + here->BSIM4V4vbs))) + ckt->CKTvoltTol))) + if ((fabs(delvbd) < (ckt->CKTreltol * MAX(fabs(vbd), + fabs(*(ckt->CKTstate0 + here->BSIM4V4vbd))) + ckt->CKTvoltTol))) + if ((here->BSIM4V4rgateMod == 0) || (here->BSIM4V4rgateMod == 1) + || (fabs(delvges) < (ckt->CKTreltol * MAX(fabs(vges), + fabs(*(ckt->CKTstate0 + here->BSIM4V4vges))) + ckt->CKTvoltTol))) + if ((here->BSIM4V4rgateMod != 3) || (fabs(delvgms) < (ckt->CKTreltol + * MAX(fabs(vgms), fabs(*(ckt->CKTstate0 + here->BSIM4V4vgms))) + + ckt->CKTvoltTol))) + if ((!here->BSIM4V4rbodyMod) || (fabs(delvdbs) < (ckt->CKTreltol + * MAX(fabs(vdbs), fabs(*(ckt->CKTstate0 + here->BSIM4V4vdbs))) + + ckt->CKTvoltTol))) + if ((!here->BSIM4V4rbodyMod) || (fabs(delvdbd) < (ckt->CKTreltol + * MAX(fabs(vdbd), fabs(*(ckt->CKTstate0 + here->BSIM4V4vdbd))) + + ckt->CKTvoltTol))) + if ((!here->BSIM4V4rbodyMod) || (fabs(delvsbs) < (ckt->CKTreltol + * MAX(fabs(vsbs), fabs(*(ckt->CKTstate0 + here->BSIM4V4vsbs))) + + ckt->CKTvoltTol))) + if ((!model->BSIM4V4rdsMod) || (fabs(delvses) < (ckt->CKTreltol + * MAX(fabs(vses), fabs(*(ckt->CKTstate0 + here->BSIM4V4vses))) + + ckt->CKTvoltTol))) + if ((!model->BSIM4V4rdsMod) || (fabs(delvdes) < (ckt->CKTreltol + * MAX(fabs(vdes), fabs(*(ckt->CKTstate0 + here->BSIM4V4vdes))) + + ckt->CKTvoltTol))) + if ((fabs(cdhat - Idtot) < ckt->CKTreltol + * MAX(fabs(cdhat), fabs(Idtot)) + ckt->CKTabstol)) + if ((fabs(cbhat - Ibtot) < ckt->CKTreltol + * MAX(fabs(cbhat), fabs(Ibtot)) + ckt->CKTabstol)) + if ((!model->BSIM4V4igcMod) || ((fabs(cgshat - Igstot) < ckt->CKTreltol + * MAX(fabs(cgshat), fabs(Igstot)) + ckt->CKTabstol))) + if ((!model->BSIM4V4igcMod) || ((fabs(cgdhat - Igdtot) < ckt->CKTreltol + * MAX(fabs(cgdhat), fabs(Igdtot)) + ckt->CKTabstol))) + if ((!model->BSIM4V4igbMod) || ((fabs(cgbhat - Igbtot) < ckt->CKTreltol + * MAX(fabs(cgbhat), fabs(Igbtot)) + ckt->CKTabstol))) + if ((!model->BSIM4V4rdsMod) || ((fabs(cseshat - Isestot) < ckt->CKTreltol + * MAX(fabs(cseshat), fabs(Isestot)) + ckt->CKTabstol))) + if ((!model->BSIM4V4rdsMod) || ((fabs(cdedhat - Idedtot) < ckt->CKTreltol + * MAX(fabs(cdedhat), fabs(Idedtot)) + ckt->CKTabstol))) + { vds = *(ckt->CKTstate0 + here->BSIM4V4vds); + vgs = *(ckt->CKTstate0 + here->BSIM4V4vgs); + vbs = *(ckt->CKTstate0 + here->BSIM4V4vbs); + vges = *(ckt->CKTstate0 + here->BSIM4V4vges); + vgms = *(ckt->CKTstate0 + here->BSIM4V4vgms); + + vbd = *(ckt->CKTstate0 + here->BSIM4V4vbd); + vdbs = *(ckt->CKTstate0 + here->BSIM4V4vdbs); + vdbd = *(ckt->CKTstate0 + here->BSIM4V4vdbd); + vsbs = *(ckt->CKTstate0 + here->BSIM4V4vsbs); + vses = *(ckt->CKTstate0 + here->BSIM4V4vses); + vdes = *(ckt->CKTstate0 + here->BSIM4V4vdes); + + vgd = vgs - vds; + vgb = vgs - vbs; + vged = vges - vds; + vgmd = vgms - vds; + vgmb = vgms - vbs; + + vbs_jct = (!here->BSIM4V4rbodyMod) ? vbs : vsbs; + vbd_jct = (!here->BSIM4V4rbodyMod) ? vbd : vdbd; + +/*** qdef should not be kept fixed even if vgs, vds & vbs has converged +**** qdef = *(ckt->CKTstate0 + here->BSIM4V4qdef); +***/ + cdrain = here->BSIM4V4cd; + + if ((ckt->CKTmode & (MODETRAN | MODEAC)) || + ((ckt->CKTmode & MODETRANOP) && + (ckt->CKTmode & MODEUIC))) + { ByPass = 1; + + qgate = here->BSIM4V4qgate; + qbulk = here->BSIM4V4qbulk; + qdrn = here->BSIM4V4qdrn; + cgdo = here->BSIM4V4cgdo; + qgdo = here->BSIM4V4qgdo; + cgso = here->BSIM4V4cgso; + qgso = here->BSIM4V4qgso; + + goto line755; + } + else + goto line850; + } +#endif /*NOBYPASS*/ + + von = here->BSIM4V4von; + if (*(ckt->CKTstate0 + here->BSIM4V4vds) >= 0.0) + { vgs = DEVfetlim(vgs, *(ckt->CKTstate0 + here->BSIM4V4vgs), von); + vds = vgs - vgd; + vds = DEVlimvds(vds, *(ckt->CKTstate0 + here->BSIM4V4vds)); + vgd = vgs - vds; + if (here->BSIM4V4rgateMod == 3) + { vges = DEVfetlim(vges, *(ckt->CKTstate0 + here->BSIM4V4vges), von); + vgms = DEVfetlim(vgms, *(ckt->CKTstate0 + here->BSIM4V4vgms), von); + vged = vges - vds; + vgmd = vgms - vds; + } + else if ((here->BSIM4V4rgateMod == 1) || (here->BSIM4V4rgateMod == 2)) + { vges = DEVfetlim(vges, *(ckt->CKTstate0 + here->BSIM4V4vges), von); + vged = vges - vds; + } + + if (model->BSIM4V4rdsMod) + { vdes = DEVlimvds(vdes, *(ckt->CKTstate0 + here->BSIM4V4vdes)); + vses = -DEVlimvds(-vses, -(*(ckt->CKTstate0 + here->BSIM4V4vses))); + } + + } + else + { vgd = DEVfetlim(vgd, vgdo, von); + vds = vgs - vgd; + vds = -DEVlimvds(-vds, -(*(ckt->CKTstate0 + here->BSIM4V4vds))); + vgs = vgd + vds; + + if (here->BSIM4V4rgateMod == 3) + { vged = DEVfetlim(vged, vgedo, von); + vges = vged + vds; + vgmd = DEVfetlim(vgmd, vgmdo, von); + vgms = vgmd + vds; + } + if ((here->BSIM4V4rgateMod == 1) || (here->BSIM4V4rgateMod == 2)) + { vged = DEVfetlim(vged, vgedo, von); + vges = vged + vds; + } + + if (model->BSIM4V4rdsMod) + { vdes = -DEVlimvds(-vdes, -(*(ckt->CKTstate0 + here->BSIM4V4vdes))); + vses = DEVlimvds(vses, *(ckt->CKTstate0 + here->BSIM4V4vses)); + } + } + + if (vds >= 0.0) + { vbs = DEVpnjlim(vbs, *(ckt->CKTstate0 + here->BSIM4V4vbs), + CONSTvt0, model->BSIM4V4vcrit, &Check); + vbd = vbs - vds; + if (here->BSIM4V4rbodyMod) + { vdbs = DEVpnjlim(vdbs, *(ckt->CKTstate0 + here->BSIM4V4vdbs), + CONSTvt0, model->BSIM4V4vcrit, &Check1); + vdbd = vdbs - vds; + vsbs = DEVpnjlim(vsbs, *(ckt->CKTstate0 + here->BSIM4V4vsbs), + CONSTvt0, model->BSIM4V4vcrit, &Check2); + if ((Check1 == 0) && (Check2 == 0)) + Check = 0; + else + Check = 1; + } + } + else + { vbd = DEVpnjlim(vbd, *(ckt->CKTstate0 + here->BSIM4V4vbd), + CONSTvt0, model->BSIM4V4vcrit, &Check); + vbs = vbd + vds; + if (here->BSIM4V4rbodyMod) + { vdbd = DEVpnjlim(vdbd, *(ckt->CKTstate0 + here->BSIM4V4vdbd), + CONSTvt0, model->BSIM4V4vcrit, &Check1); + vdbs = vdbd + vds; + vsbdo = *(ckt->CKTstate0 + here->BSIM4V4vsbs) + - *(ckt->CKTstate0 + here->BSIM4V4vds); + vsbd = vsbs - vds; + vsbd = DEVpnjlim(vsbd, vsbdo, CONSTvt0, model->BSIM4V4vcrit, &Check2); + vsbs = vsbd + vds; + if ((Check1 == 0) && (Check2 == 0)) + Check = 0; + else + Check = 1; + } + } + } + + /* Calculate DC currents and their derivatives */ + vbd = vbs - vds; + vgd = vgs - vds; + vgb = vgs - vbs; + vged = vges - vds; + vgmd = vgms - vds; + vgmb = vgms - vbs; + vdbd = vdbs - vds; + + vbs_jct = (!here->BSIM4V4rbodyMod) ? vbs : vsbs; + vbd_jct = (!here->BSIM4V4rbodyMod) ? vbd : vdbd; + + /* Source/drain junction diode DC model begins */ + Nvtms = model->BSIM4V4vtm * model->BSIM4V4SjctEmissionCoeff; + if ((here->BSIM4V4Aseff <= 0.0) && (here->BSIM4V4Pseff <= 0.0)) + { SourceSatCurrent = 1.0e-14; + } + else + { SourceSatCurrent = here->BSIM4V4Aseff * model->BSIM4V4SjctTempSatCurDensity + + here->BSIM4V4Pseff * model->BSIM4V4SjctSidewallTempSatCurDensity + + pParam->BSIM4V4weffCJ * here->BSIM4V4nf + * model->BSIM4V4SjctGateSidewallTempSatCurDensity; + } + + if (SourceSatCurrent <= 0.0) + { here->BSIM4V4gbs = ckt->CKTgmin; + here->BSIM4V4cbs = here->BSIM4V4gbs * vbs_jct; + } + else + { switch(model->BSIM4V4dioMod) + { case 0: + evbs = exp(vbs_jct / Nvtms); + T1 = model->BSIM4V4xjbvs * exp(-(model->BSIM4V4bvs + vbs_jct) / Nvtms); + /* WDLiu: Magic T1 in this form; different from BSIM4V4 beta. */ + here->BSIM4V4gbs = SourceSatCurrent * (evbs + T1) / Nvtms + ckt->CKTgmin; + here->BSIM4V4cbs = SourceSatCurrent * (evbs + here->BSIM4V4XExpBVS + - T1 - 1.0) + ckt->CKTgmin * vbs_jct; + break; + case 1: + T2 = vbs_jct / Nvtms; + if (T2 < -EXP_THRESHOLD) + { here->BSIM4V4gbs = ckt->CKTgmin; + here->BSIM4V4cbs = SourceSatCurrent * (MIN_EXP - 1.0) + + ckt->CKTgmin * vbs_jct; + } + else if (vbs_jct <= here->BSIM4V4vjsmFwd) + { evbs = exp(T2); + here->BSIM4V4gbs = SourceSatCurrent * evbs / Nvtms + ckt->CKTgmin; + here->BSIM4V4cbs = SourceSatCurrent * (evbs - 1.0) + + ckt->CKTgmin * vbs_jct; + } + else + { T0 = here->BSIM4V4IVjsmFwd / Nvtms; + here->BSIM4V4gbs = T0 + ckt->CKTgmin; + here->BSIM4V4cbs = here->BSIM4V4IVjsmFwd - SourceSatCurrent + T0 + * (vbs_jct - here->BSIM4V4vjsmFwd) + ckt->CKTgmin * vbs_jct; + } + break; + case 2: + if (vbs_jct < here->BSIM4V4vjsmRev) + { T0 = vbs_jct / Nvtms; + if (T0 < -EXP_THRESHOLD) + { evbs = MIN_EXP; + devbs_dvb = 0.0; + } + else + { evbs = exp(T0); + devbs_dvb = evbs / Nvtms; + } + + T1 = evbs - 1.0; + T2 = here->BSIM4V4IVjsmRev + here->BSIM4V4SslpRev + * (vbs_jct - here->BSIM4V4vjsmRev); + here->BSIM4V4gbs = devbs_dvb * T2 + T1 * here->BSIM4V4SslpRev + ckt->CKTgmin; + here->BSIM4V4cbs = T1 * T2 + ckt->CKTgmin * vbs_jct; + } + else if (vbs_jct <= here->BSIM4V4vjsmFwd) + { T0 = vbs_jct / Nvtms; + if (T0 < -EXP_THRESHOLD) + { evbs = MIN_EXP; + devbs_dvb = 0.0; + } + else + { evbs = exp(T0); + devbs_dvb = evbs / Nvtms; + } + + T1 = (model->BSIM4V4bvs + vbs_jct) / Nvtms; + if (T1 > EXP_THRESHOLD) + { T2 = MIN_EXP; + T3 = 0.0; + } + else + { T2 = exp(-T1); + T3 = -T2 /Nvtms; + } + here->BSIM4V4gbs = SourceSatCurrent * (devbs_dvb - model->BSIM4V4xjbvs * T3) + + ckt->CKTgmin; + here->BSIM4V4cbs = SourceSatCurrent * (evbs + here->BSIM4V4XExpBVS - 1.0 + - model->BSIM4V4xjbvs * T2) + ckt->CKTgmin * vbs_jct; + } + else + { here->BSIM4V4gbs = here->BSIM4V4SslpFwd + ckt->CKTgmin; + here->BSIM4V4cbs = here->BSIM4V4IVjsmFwd + here->BSIM4V4SslpFwd * (vbs_jct + - here->BSIM4V4vjsmFwd) + ckt->CKTgmin * vbs_jct; + } + break; + default: break; + } + } + + Nvtmd = model->BSIM4V4vtm * model->BSIM4V4DjctEmissionCoeff; + if ((here->BSIM4V4Adeff <= 0.0) && (here->BSIM4V4Pdeff <= 0.0)) + { DrainSatCurrent = 1.0e-14; + } + else + { DrainSatCurrent = here->BSIM4V4Adeff * model->BSIM4V4DjctTempSatCurDensity + + here->BSIM4V4Pdeff * model->BSIM4V4DjctSidewallTempSatCurDensity + + pParam->BSIM4V4weffCJ * here->BSIM4V4nf + * model->BSIM4V4DjctGateSidewallTempSatCurDensity; + } + + if (DrainSatCurrent <= 0.0) + { here->BSIM4V4gbd = ckt->CKTgmin; + here->BSIM4V4cbd = here->BSIM4V4gbd * vbd_jct; + } + else + { switch(model->BSIM4V4dioMod) + { case 0: + evbd = exp(vbd_jct / Nvtmd); + T1 = model->BSIM4V4xjbvd * exp(-(model->BSIM4V4bvd + vbd_jct) / Nvtmd); + /* WDLiu: Magic T1 in this form; different from BSIM4V4 beta. */ + here->BSIM4V4gbd = DrainSatCurrent * (evbd + T1) / Nvtmd + ckt->CKTgmin; + here->BSIM4V4cbd = DrainSatCurrent * (evbd + here->BSIM4V4XExpBVD + - T1 - 1.0) + ckt->CKTgmin * vbd_jct; + break; + case 1: + T2 = vbd_jct / Nvtmd; + if (T2 < -EXP_THRESHOLD) + { here->BSIM4V4gbd = ckt->CKTgmin; + here->BSIM4V4cbd = DrainSatCurrent * (MIN_EXP - 1.0) + + ckt->CKTgmin * vbd_jct; + } + else if (vbd_jct <= here->BSIM4V4vjdmFwd) + { evbd = exp(T2); + here->BSIM4V4gbd = DrainSatCurrent * evbd / Nvtmd + ckt->CKTgmin; + here->BSIM4V4cbd = DrainSatCurrent * (evbd - 1.0) + + ckt->CKTgmin * vbd_jct; + } + else + { T0 = here->BSIM4V4IVjdmFwd / Nvtmd; + here->BSIM4V4gbd = T0 + ckt->CKTgmin; + here->BSIM4V4cbd = here->BSIM4V4IVjdmFwd - DrainSatCurrent + T0 + * (vbd_jct - here->BSIM4V4vjdmFwd) + ckt->CKTgmin * vbd_jct; + } + break; + case 2: + if (vbd_jct < here->BSIM4V4vjdmRev) + { T0 = vbd_jct / Nvtmd; + if (T0 < -EXP_THRESHOLD) + { evbd = MIN_EXP; + devbd_dvb = 0.0; + } + else + { evbd = exp(T0); + devbd_dvb = evbd / Nvtmd; + } + + T1 = evbd - 1.0; + T2 = here->BSIM4V4IVjdmRev + here->BSIM4V4DslpRev + * (vbd_jct - here->BSIM4V4vjdmRev); + here->BSIM4V4gbd = devbd_dvb * T2 + T1 * here->BSIM4V4DslpRev + ckt->CKTgmin; + here->BSIM4V4cbd = T1 * T2 + ckt->CKTgmin * vbd_jct; + } + else if (vbd_jct <= here->BSIM4V4vjdmFwd) + { T0 = vbd_jct / Nvtmd; + if (T0 < -EXP_THRESHOLD) + { evbd = MIN_EXP; + devbd_dvb = 0.0; + } + else + { evbd = exp(T0); + devbd_dvb = evbd / Nvtmd; + } + + T1 = (model->BSIM4V4bvd + vbd_jct) / Nvtmd; + if (T1 > EXP_THRESHOLD) + { T2 = MIN_EXP; + T3 = 0.0; + } + else + { T2 = exp(-T1); + T3 = -T2 /Nvtmd; + } + here->BSIM4V4gbd = DrainSatCurrent * (devbd_dvb - model->BSIM4V4xjbvd * T3) + + ckt->CKTgmin; + here->BSIM4V4cbd = DrainSatCurrent * (evbd + here->BSIM4V4XExpBVD - 1.0 + - model->BSIM4V4xjbvd * T2) + ckt->CKTgmin * vbd_jct; + } + else + { here->BSIM4V4gbd = here->BSIM4V4DslpFwd + ckt->CKTgmin; + here->BSIM4V4cbd = here->BSIM4V4IVjdmFwd + here->BSIM4V4DslpFwd * (vbd_jct + - here->BSIM4V4vjdmFwd) + ckt->CKTgmin * vbd_jct; + } + break; + default: break; + } + } + + /* trap-assisted tunneling and recombination current for reverse bias */ + Nvtmrssw = model->BSIM4V4vtm0 * model->BSIM4V4njtsswtemp; + Nvtmrsswg = model->BSIM4V4vtm0 * model->BSIM4V4njtsswgtemp; + Nvtmrs = model->BSIM4V4vtm0 * model->BSIM4V4njtstemp; + + if ((model->BSIM4V4vtss - vbs) < 1e-3) + { T9 = 1.0e3; + T0 = - vbs / Nvtmrs * T9; + DEXP(T0, T1, T10); + dT1_dVb = T10 / Nvtmrs * T9; + } else { + T9 = 1.0 / (model->BSIM4V4vtss - vbs); + T0 = -vbs / Nvtmrs * model->BSIM4V4vtss * T9; + dT0_dVb = model->BSIM4V4vtss / Nvtmrs * (T9 + vbs * T9 * T9) ; + DEXP(T0, T1, T10); + dT1_dVb = T10 * dT0_dVb; + } + + if ((model->BSIM4V4vtsd - vbd) < 1e-3) + { T9 = 1.0e3; + T0 = -vbd / Nvtmrs * T9; + DEXP(T0, T2, T10); + dT2_dVb = T10 / Nvtmrs * T9; + } else { + T9 = 1.0 / (model->BSIM4V4vtsd - vbd); + T0 = -vbd / Nvtmrs * model->BSIM4V4vtsd * T9; + dT0_dVb = model->BSIM4V4vtsd / Nvtmrs * (T9 + vbd * T9 * T9) ; + DEXP(T0, T2, T10); + dT2_dVb = T10 * dT0_dVb; + } + + if ((model->BSIM4V4vtssws - vbs) < 1e-3) + { T9 = 1.0e3; + T0 = -vbs / Nvtmrssw * T9; + DEXP(T0, T3, T10); + dT3_dVb = T10 / Nvtmrssw * T9; + } else { + T9 = 1.0 / (model->BSIM4V4vtssws - vbs); + T0 = -vbs / Nvtmrssw * model->BSIM4V4vtssws * T9; + dT0_dVb = model->BSIM4V4vtssws / Nvtmrssw * (T9 + vbs * T9 * T9) ; + DEXP(T0, T3, T10); + dT3_dVb = T10 * dT0_dVb; + } + if ((model->BSIM4V4vtsswd - vbd) < 1e-3) + { T9 = 1.0e3; + T0 = -vbd / Nvtmrssw * T9; + DEXP(T0, T4, T10); + dT4_dVb = T10 / Nvtmrssw * T9; + } else { + T9 = 1.0 / (model->BSIM4V4vtsswd - vbd); + T0 = -vbd / Nvtmrssw * model->BSIM4V4vtsswd * T9; + dT0_dVb = model->BSIM4V4vtsswd / Nvtmrssw * (T9 + vbd * T9 * T9) ; + DEXP(T0, T4, T10); + dT4_dVb = T10 * dT0_dVb; + } + + if ((model->BSIM4V4vtsswgs - vbs) < 1e-3) + { T9 = 1.0e3; + T0 = -vbs / Nvtmrsswg * T9; + DEXP(T0, T5, T10); + dT5_dVb = T10 / Nvtmrsswg * T9; + } else { + T9 = 1.0 / (model->BSIM4V4vtsswgs - vbs); + T0 = -vbs / Nvtmrsswg * model->BSIM4V4vtsswgs * T9; + dT0_dVb = model->BSIM4V4vtsswgs / Nvtmrsswg * (T9 + vbs * T9 * T9) ; + DEXP(T0, T5, T10); + dT5_dVb = T10 * dT0_dVb; + } + if ((model->BSIM4V4vtsswgd - vbd) < 1e-3) + { T9 = 1.0e3; + T0 = -vbd / Nvtmrsswg * T9; + DEXP(T0, T4, T10); + dT6_dVb = T10 / Nvtmrsswg * T9; + } else { + T9 = 1.0 / (model->BSIM4V4vtsswgd - vbd); + T0 = -vbd / Nvtmrsswg * model->BSIM4V4vtsswgd * T9; + dT0_dVb = model->BSIM4V4vtsswgd / Nvtmrsswg * (T9 + vbd * T9 * T9) ; + DEXP(T0, T6, T10); + dT6_dVb = T10 * dT0_dVb; + } + + here->BSIM4V4gbs += here->BSIM4V4SjctTempRevSatCur * dT1_dVb + + here->BSIM4V4SswTempRevSatCur * dT3_dVb + + here->BSIM4V4SswgTempRevSatCur * dT5_dVb; + here->BSIM4V4cbs -= here->BSIM4V4SjctTempRevSatCur * (T1 - 1.0) + + here->BSIM4V4SswTempRevSatCur * (T3 - 1.0) + + here->BSIM4V4SswgTempRevSatCur * (T5 - 1.0); + here->BSIM4V4gbd += here->BSIM4V4DjctTempRevSatCur * dT2_dVb + + here->BSIM4V4DswTempRevSatCur * dT4_dVb + + here->BSIM4V4DswgTempRevSatCur * dT6_dVb; + here->BSIM4V4cbd -= here->BSIM4V4DjctTempRevSatCur * (T2 - 1.0) + + here->BSIM4V4DswTempRevSatCur * (T4 - 1.0) + + here->BSIM4V4DswgTempRevSatCur * (T6 - 1.0); + + /* End of diode DC model */ + + if (vds >= 0.0) + { here->BSIM4V4mode = 1; + Vds = vds; + Vgs = vgs; + Vbs = vbs; + Vdb = vds - vbs; /* WDLiu: for GIDL */ + } + else + { here->BSIM4V4mode = -1; + Vds = -vds; + Vgs = vgd; + Vbs = vbd; + Vdb = -vbs; + } + + T0 = Vbs - here->BSIM4V4vbsc - 0.001; + T1 = sqrt(T0 * T0 - 0.004 * here->BSIM4V4vbsc); + if (T0 >= 0.0) + { Vbseff = here->BSIM4V4vbsc + 0.5 * (T0 + T1); + dVbseff_dVb = 0.5 * (1.0 + T0 / T1); + } + else + { T2 = -0.002 / (T1 - T0); + Vbseff = here->BSIM4V4vbsc * (1.0 + T2); + dVbseff_dVb = T2 * here->BSIM4V4vbsc / T1; + } + + /* JX: Correction to forward body bias */ + T9 = 0.95 * pParam->BSIM4V4phi; + T0 = T9 - Vbseff - 0.001; + T1 = sqrt(T0 * T0 + 0.004 * T9); + Vbseff = T9 - 0.5 * (T0 + T1); + dVbseff_dVb *= 0.5 * (1.0 + T0 / T1); + + Phis = pParam->BSIM4V4phi - Vbseff; + dPhis_dVb = -1.0; + sqrtPhis = sqrt(Phis); + dsqrtPhis_dVb = -0.5 / sqrtPhis; + + + Xdep = pParam->BSIM4V4Xdep0 * sqrtPhis / pParam->BSIM4V4sqrtPhi; + dXdep_dVb = (pParam->BSIM4V4Xdep0 / pParam->BSIM4V4sqrtPhi) + * dsqrtPhis_dVb; + + Leff = pParam->BSIM4V4leff; + Vtm = model->BSIM4V4vtm; + + /* Vth Calculation */ + T3 = sqrt(Xdep); + V0 = pParam->BSIM4V4vbi - pParam->BSIM4V4phi; + + T0 = pParam->BSIM4V4dvt2 * Vbseff; + if (T0 >= - 0.5) + { T1 = 1.0 + T0; + T2 = pParam->BSIM4V4dvt2; + } + else + { T4 = 1.0 / (3.0 + 8.0 * T0); + T1 = (1.0 + 3.0 * T0) * T4; + T2 = pParam->BSIM4V4dvt2 * T4 * T4; + } + lt1 = model->BSIM4V4factor1 * T3 * T1; + dlt1_dVb = model->BSIM4V4factor1 * (0.5 / T3 * T1 * dXdep_dVb + T3 * T2); + + T0 = pParam->BSIM4V4dvt2w * Vbseff; + if (T0 >= - 0.5) + { T1 = 1.0 + T0; + T2 = pParam->BSIM4V4dvt2w; + } + else + { T4 = 1.0 / (3.0 + 8.0 * T0); + T1 = (1.0 + 3.0 * T0) * T4; + T2 = pParam->BSIM4V4dvt2w * T4 * T4; + } + ltw = model->BSIM4V4factor1 * T3 * T1; + dltw_dVb = model->BSIM4V4factor1 * (0.5 / T3 * T1 * dXdep_dVb + T3 * T2); + + T0 = pParam->BSIM4V4dvt1 * Leff / lt1; + if (T0 < EXP_THRESHOLD) + { T1 = exp(T0); + T2 = T1 - 1.0; + T3 = T2 * T2; + T4 = T3 + 2.0 * T1 * MIN_EXP; + Theta0 = T1 / T4; + dT1_dVb = -T0 * T1 * dlt1_dVb / lt1; + dTheta0_dVb = dT1_dVb * (T4 - 2.0 * T1 * (T2 + MIN_EXP)) / T4 / T4; + } + else + { Theta0 = 1.0 / (MAX_EXP - 2.0); /* 3.0 * MIN_EXP omitted */ + dTheta0_dVb = 0.0; + } + here->BSIM4V4thetavth = pParam->BSIM4V4dvt0 * Theta0; + Delt_vth = here->BSIM4V4thetavth * V0; + dDelt_vth_dVb = pParam->BSIM4V4dvt0 * dTheta0_dVb * V0; + + T0 = pParam->BSIM4V4dvt1w * pParam->BSIM4V4weff * Leff / ltw; + if (T0 < EXP_THRESHOLD) + { T1 = exp(T0); + T2 = T1 - 1.0; + T3 = T2 * T2; + T4 = T3 + 2.0 * T1 * MIN_EXP; + T5 = T1 / T4; + dT1_dVb = -T0 * T1 * dltw_dVb / ltw; + dT5_dVb = dT1_dVb * (T4 - 2.0 * T1 * (T2 + MIN_EXP)) / T4 / T4; + } + else + { T5 = 1.0 / (MAX_EXP - 2.0); /* 3.0 * MIN_EXP omitted */ + dT5_dVb = 0.0; + } + T0 = pParam->BSIM4V4dvt0w * T5; + T2 = T0 * V0; + dT2_dVb = pParam->BSIM4V4dvt0w * dT5_dVb * V0; + + TempRatio = ckt->CKTtemp / model->BSIM4V4tnom - 1.0; + T0 = sqrt(1.0 + pParam->BSIM4V4lpe0 / Leff); + T1 = pParam->BSIM4V4k1ox * (T0 - 1.0) * pParam->BSIM4V4sqrtPhi + + (pParam->BSIM4V4kt1 + pParam->BSIM4V4kt1l / Leff + + pParam->BSIM4V4kt2 * Vbseff) * TempRatio; + Vth_NarrowW = model->BSIM4V4toxe * pParam->BSIM4V4phi + / (pParam->BSIM4V4weff + pParam->BSIM4V4w0); + + T3 = here->BSIM4V4eta0 + pParam->BSIM4V4etab * Vbseff; + if (T3 < 1.0e-4) + { T9 = 1.0 / (3.0 - 2.0e4 * T3); + T3 = (2.0e-4 - T3) * T9; + T4 = T9 * T9; + } + else + { T4 = 1.0; + } + dDIBL_Sft_dVd = T3 * pParam->BSIM4V4theta0vb0; + DIBL_Sft = dDIBL_Sft_dVd * Vds; + + Lpe_Vb = sqrt(1.0 + pParam->BSIM4V4lpeb / Leff); + + Vth = model->BSIM4V4type * here->BSIM4V4vth0 + (pParam->BSIM4V4k1ox * sqrtPhis + - pParam->BSIM4V4k1 * pParam->BSIM4V4sqrtPhi) * Lpe_Vb + - here->BSIM4V4k2ox * Vbseff - Delt_vth - T2 + (pParam->BSIM4V4k3 + + pParam->BSIM4V4k3b * Vbseff) * Vth_NarrowW + T1 - DIBL_Sft; + + dVth_dVb = Lpe_Vb * pParam->BSIM4V4k1ox * dsqrtPhis_dVb - here->BSIM4V4k2ox + - dDelt_vth_dVb - dT2_dVb + pParam->BSIM4V4k3b * Vth_NarrowW + - pParam->BSIM4V4etab * Vds * pParam->BSIM4V4theta0vb0 * T4 + + pParam->BSIM4V4kt2 * TempRatio; + dVth_dVd = -dDIBL_Sft_dVd; + + + /* Calculate n */ + tmp1 = EPSSI / Xdep; + here->BSIM4V4nstar = model->BSIM4V4vtm / Charge_q * (model->BSIM4V4coxe + + tmp1 + pParam->BSIM4V4cit); + tmp2 = pParam->BSIM4V4nfactor * tmp1; + tmp3 = pParam->BSIM4V4cdsc + pParam->BSIM4V4cdscb * Vbseff + + pParam->BSIM4V4cdscd * Vds; + tmp4 = (tmp2 + tmp3 * Theta0 + pParam->BSIM4V4cit) / model->BSIM4V4coxe; + if (tmp4 >= -0.5) + { n = 1.0 + tmp4; + dn_dVb = (-tmp2 / Xdep * dXdep_dVb + tmp3 * dTheta0_dVb + + pParam->BSIM4V4cdscb * Theta0) / model->BSIM4V4coxe; + dn_dVd = pParam->BSIM4V4cdscd * Theta0 / model->BSIM4V4coxe; + } + else + { T0 = 1.0 / (3.0 + 8.0 * tmp4); + n = (1.0 + 3.0 * tmp4) * T0; + T0 *= T0; + dn_dVb = (-tmp2 / Xdep * dXdep_dVb + tmp3 * dTheta0_dVb + + pParam->BSIM4V4cdscb * Theta0) / model->BSIM4V4coxe * T0; + dn_dVd = pParam->BSIM4V4cdscd * Theta0 / model->BSIM4V4coxe * T0; + } + + + /* Vth correction for Pocket implant */ + if (pParam->BSIM4V4dvtp0 > 0.0) + { T0 = -pParam->BSIM4V4dvtp1 * Vds; + if (T0 < -EXP_THRESHOLD) + { T2 = MIN_EXP; + dT2_dVd = 0.0; + } + else + { T2 = exp(T0); + dT2_dVd = -pParam->BSIM4V4dvtp1 * T2; + } + + T3 = Leff + pParam->BSIM4V4dvtp0 * (1.0 + T2); + dT3_dVd = pParam->BSIM4V4dvtp0 * dT2_dVd; + T4 = Vtm * log(Leff / T3); + dT4_dVd = -Vtm * dT3_dVd / T3; + dDITS_Sft_dVd = dn_dVd * T4 + n * dT4_dVd; + dDITS_Sft_dVb = T4 * dn_dVb; + + Vth -= n * T4; + dVth_dVd -= dDITS_Sft_dVd; + dVth_dVb -= dDITS_Sft_dVb; + } + here->BSIM4V4von = Vth; + + + /* Poly Gate Si Depletion Effect */ + T0 = here->BSIM4V4vfb + pParam->BSIM4V4phi; + + BSIM4V4polyDepletion(T0, pParam->BSIM4V4ngate, model->BSIM4V4coxe, vgs, &vgs_eff, &dvgs_eff_dvg); + + BSIM4V4polyDepletion(T0, pParam->BSIM4V4ngate, model->BSIM4V4coxe, vgd, &vgd_eff, &dvgd_eff_dvg); + + if(here->BSIM4V4mode>0) { + Vgs_eff = vgs_eff; + dVgs_eff_dVg = dvgs_eff_dvg; + } else { + Vgs_eff = vgd_eff; + dVgs_eff_dVg = dvgd_eff_dvg; + } + here->BSIM4V4vgs_eff = vgs_eff; + here->BSIM4V4vgd_eff = vgd_eff; + here->BSIM4V4dvgs_eff_dvg = dvgs_eff_dvg; + here->BSIM4V4dvgd_eff_dvg = dvgd_eff_dvg; + + + Vgst = Vgs_eff - Vth; + + /* Calculate Vgsteff */ + T0 = n * Vtm; + T1 = pParam->BSIM4V4mstar * Vgst; + T2 = T1 / T0; + if (T2 > EXP_THRESHOLD) + { T10 = T1; + dT10_dVg = pParam->BSIM4V4mstar * dVgs_eff_dVg; + dT10_dVd = -dVth_dVd * pParam->BSIM4V4mstar; + dT10_dVb = -dVth_dVb * pParam->BSIM4V4mstar; + } + else if (T2 < -EXP_THRESHOLD) + { T10 = Vtm * log(1.0 + MIN_EXP); + dT10_dVg = 0.0; + dT10_dVd = T10 * dn_dVd; + dT10_dVb = T10 * dn_dVb; + T10 *= n; + } + else + { ExpVgst = exp(T2); + T3 = Vtm * log(1.0 + ExpVgst); + T10 = n * T3; + dT10_dVg = pParam->BSIM4V4mstar * ExpVgst / (1.0 + ExpVgst); + dT10_dVb = T3 * dn_dVb - dT10_dVg * (dVth_dVb + Vgst * dn_dVb / n); + dT10_dVd = T3 * dn_dVd - dT10_dVg * (dVth_dVd + Vgst * dn_dVd / n); + dT10_dVg *= dVgs_eff_dVg; + } + + T1 = pParam->BSIM4V4voffcbn - (1.0 - pParam->BSIM4V4mstar) * Vgst; + T2 = T1 / T0; + if (T2 < -EXP_THRESHOLD) + { T3 = model->BSIM4V4coxe * MIN_EXP / pParam->BSIM4V4cdep0; + T9 = pParam->BSIM4V4mstar + T3 * n; + dT9_dVg = 0.0; + dT9_dVd = dn_dVd * T3; + dT9_dVb = dn_dVb * T3; + } + else if (T2 > EXP_THRESHOLD) + { T3 = model->BSIM4V4coxe * MAX_EXP / pParam->BSIM4V4cdep0; + T9 = pParam->BSIM4V4mstar + T3 * n; + dT9_dVg = 0.0; + dT9_dVd = dn_dVd * T3; + dT9_dVb = dn_dVb * T3; + } + else + { ExpVgst = exp(T2); + T3 = model->BSIM4V4coxe / pParam->BSIM4V4cdep0; + T4 = T3 * ExpVgst; + T5 = T1 * T4 / T0; + T9 = pParam->BSIM4V4mstar + n * T4; + dT9_dVg = T3 * (pParam->BSIM4V4mstar - 1.0) * ExpVgst / Vtm; + dT9_dVb = T4 * dn_dVb - dT9_dVg * dVth_dVb - T5 * dn_dVb; + dT9_dVd = T4 * dn_dVd - dT9_dVg * dVth_dVd - T5 * dn_dVd; + dT9_dVg *= dVgs_eff_dVg; + } + + here->BSIM4V4Vgsteff = Vgsteff = T10 / T9; + T11 = T9 * T9; + dVgsteff_dVg = (T9 * dT10_dVg - T10 * dT9_dVg) / T11; + dVgsteff_dVd = (T9 * dT10_dVd - T10 * dT9_dVd) / T11; + dVgsteff_dVb = (T9 * dT10_dVb - T10 * dT9_dVb) / T11; + + /* Calculate Effective Channel Geometry */ + T9 = sqrtPhis - pParam->BSIM4V4sqrtPhi; + Weff = pParam->BSIM4V4weff - 2.0 * (pParam->BSIM4V4dwg * Vgsteff + + pParam->BSIM4V4dwb * T9); + dWeff_dVg = -2.0 * pParam->BSIM4V4dwg; + dWeff_dVb = -2.0 * pParam->BSIM4V4dwb * dsqrtPhis_dVb; + + if (Weff < 2.0e-8) /* to avoid the discontinuity problem due to Weff*/ + { T0 = 1.0 / (6.0e-8 - 2.0 * Weff); + Weff = 2.0e-8 * (4.0e-8 - Weff) * T0; + T0 *= T0 * 4.0e-16; + dWeff_dVg *= T0; + dWeff_dVb *= T0; + } + + if (model->BSIM4V4rdsMod == 1) + Rds = dRds_dVg = dRds_dVb = 0.0; + else + { T0 = 1.0 + pParam->BSIM4V4prwg * Vgsteff; + dT0_dVg = -pParam->BSIM4V4prwg / T0 / T0; + T1 = pParam->BSIM4V4prwb * T9; + dT1_dVb = pParam->BSIM4V4prwb * dsqrtPhis_dVb; + + T2 = 1.0 / T0 + T1; + T3 = T2 + sqrt(T2 * T2 + 0.01); /* 0.01 = 4.0 * 0.05 * 0.05 */ + dT3_dVg = 1.0 + T2 / (T3 - T2); + dT3_dVb = dT3_dVg * dT1_dVb; + dT3_dVg *= dT0_dVg; + + T4 = pParam->BSIM4V4rds0 * 0.5; + Rds = pParam->BSIM4V4rdswmin + T3 * T4; + dRds_dVg = T4 * dT3_dVg; + dRds_dVb = T4 * dT3_dVb; + + if (Rds > 0.0) + here->BSIM4V4grdsw = 1.0 / Rds; + else + here->BSIM4V4grdsw = 0.0; + } + + /* Calculate Abulk */ + T9 = 0.5 * pParam->BSIM4V4k1ox * Lpe_Vb / sqrtPhis; + T1 = T9 + here->BSIM4V4k2ox - pParam->BSIM4V4k3b * Vth_NarrowW; + dT1_dVb = -T9 / sqrtPhis * dsqrtPhis_dVb; + + T9 = sqrt(pParam->BSIM4V4xj * Xdep); + tmp1 = Leff + 2.0 * T9; + T5 = Leff / tmp1; + tmp2 = pParam->BSIM4V4a0 * T5; + tmp3 = pParam->BSIM4V4weff + pParam->BSIM4V4b1; + tmp4 = pParam->BSIM4V4b0 / tmp3; + T2 = tmp2 + tmp4; + dT2_dVb = -T9 / tmp1 / Xdep * dXdep_dVb; + T6 = T5 * T5; + T7 = T5 * T6; + + Abulk0 = 1.0 + T1 * T2; + dAbulk0_dVb = T1 * tmp2 * dT2_dVb + T2 * dT1_dVb; + + T8 = pParam->BSIM4V4ags * pParam->BSIM4V4a0 * T7; + dAbulk_dVg = -T1 * T8; + Abulk = Abulk0 + dAbulk_dVg * Vgsteff; + dAbulk_dVb = dAbulk0_dVb - T8 * Vgsteff * (dT1_dVb + + 3.0 * T1 * dT2_dVb); + + if (Abulk0 < 0.1) /* added to avoid the problems caused by Abulk0 */ + { T9 = 1.0 / (3.0 - 20.0 * Abulk0); + Abulk0 = (0.2 - Abulk0) * T9; + dAbulk0_dVb *= T9 * T9; + } + + if (Abulk < 0.1) + { T9 = 1.0 / (3.0 - 20.0 * Abulk); + Abulk = (0.2 - Abulk) * T9; + T10 = T9 * T9; + dAbulk_dVb *= T10; + dAbulk_dVg *= T10; + } + here->BSIM4V4Abulk = Abulk; + + T2 = pParam->BSIM4V4keta * Vbseff; + if (T2 >= -0.9) + { T0 = 1.0 / (1.0 + T2); + dT0_dVb = -pParam->BSIM4V4keta * T0 * T0; + } + else + { T1 = 1.0 / (0.8 + T2); + T0 = (17.0 + 20.0 * T2) * T1; + dT0_dVb = -pParam->BSIM4V4keta * T1 * T1; + } + dAbulk_dVg *= T0; + dAbulk_dVb = dAbulk_dVb * T0 + Abulk * dT0_dVb; + dAbulk0_dVb = dAbulk0_dVb * T0 + Abulk0 * dT0_dVb; + Abulk *= T0; + Abulk0 *= T0; + + /* Mobility calculation */ + if (model->BSIM4V4mobMod == 0) + { T0 = Vgsteff + Vth + Vth; + T2 = pParam->BSIM4V4ua + pParam->BSIM4V4uc * Vbseff; + T3 = T0 / model->BSIM4V4toxe; + T5 = T3 * (T2 + pParam->BSIM4V4ub * T3); + dDenomi_dVg = (T2 + 2.0 * pParam->BSIM4V4ub * T3) / model->BSIM4V4toxe; + dDenomi_dVd = dDenomi_dVg * 2.0 * dVth_dVd; + dDenomi_dVb = dDenomi_dVg * 2.0 * dVth_dVb + pParam->BSIM4V4uc * T3; + } + else if (model->BSIM4V4mobMod == 1) + { T0 = Vgsteff + Vth + Vth; + T2 = 1.0 + pParam->BSIM4V4uc * Vbseff; + T3 = T0 / model->BSIM4V4toxe; + T4 = T3 * (pParam->BSIM4V4ua + pParam->BSIM4V4ub * T3); + T5 = T4 * T2; + dDenomi_dVg = (pParam->BSIM4V4ua + 2.0 * pParam->BSIM4V4ub * T3) * T2 + / model->BSIM4V4toxe; + dDenomi_dVd = dDenomi_dVg * 2.0 * dVth_dVd; + dDenomi_dVb = dDenomi_dVg * 2.0 * dVth_dVb + pParam->BSIM4V4uc * T4; + } + else + { T0 = (Vgsteff + here->BSIM4V4vtfbphi1) / model->BSIM4V4toxe; + T1 = exp(pParam->BSIM4V4eu * log(T0)); + dT1_dVg = T1 * pParam->BSIM4V4eu / T0 / model->BSIM4V4toxe; + T2 = pParam->BSIM4V4ua + pParam->BSIM4V4uc * Vbseff; + T5 = T1 * T2; + dDenomi_dVg = T2 * dT1_dVg; + dDenomi_dVd = 0.0; + dDenomi_dVb = T1 * pParam->BSIM4V4uc; + } + + if (T5 >= -0.8) + { Denomi = 1.0 + T5; + } + else + { T9 = 1.0 / (7.0 + 10.0 * T5); + Denomi = (0.6 + T5) * T9; + T9 *= T9; + dDenomi_dVg *= T9; + dDenomi_dVd *= T9; + dDenomi_dVb *= T9; + } + + here->BSIM4V4ueff = ueff = here->BSIM4V4u0temp / Denomi; + T9 = -ueff / Denomi; + dueff_dVg = T9 * dDenomi_dVg; + dueff_dVd = T9 * dDenomi_dVd; + dueff_dVb = T9 * dDenomi_dVb; + + /* Saturation Drain Voltage Vdsat */ + WVCox = Weff * here->BSIM4V4vsattemp * model->BSIM4V4coxe; + WVCoxRds = WVCox * Rds; + + Esat = 2.0 * here->BSIM4V4vsattemp / ueff; + here->BSIM4V4EsatL = EsatL = Esat * Leff; + T0 = -EsatL /ueff; + dEsatL_dVg = T0 * dueff_dVg; + dEsatL_dVd = T0 * dueff_dVd; + dEsatL_dVb = T0 * dueff_dVb; + + /* Sqrt() */ + a1 = pParam->BSIM4V4a1; + if (a1 == 0.0) + { Lambda = pParam->BSIM4V4a2; + dLambda_dVg = 0.0; + } + else if (a1 > 0.0) + { T0 = 1.0 - pParam->BSIM4V4a2; + T1 = T0 - pParam->BSIM4V4a1 * Vgsteff - 0.0001; + T2 = sqrt(T1 * T1 + 0.0004 * T0); + Lambda = pParam->BSIM4V4a2 + T0 - 0.5 * (T1 + T2); + dLambda_dVg = 0.5 * pParam->BSIM4V4a1 * (1.0 + T1 / T2); + } + else + { T1 = pParam->BSIM4V4a2 + pParam->BSIM4V4a1 * Vgsteff - 0.0001; + T2 = sqrt(T1 * T1 + 0.0004 * pParam->BSIM4V4a2); + Lambda = 0.5 * (T1 + T2); + dLambda_dVg = 0.5 * pParam->BSIM4V4a1 * (1.0 + T1 / T2); + } + + Vgst2Vtm = Vgsteff + 2.0 * Vtm; + 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; + } + if ((Rds == 0.0) && (Lambda == 1.0)) + { T0 = 1.0 / (Abulk * EsatL + Vgst2Vtm); + tmp1 = 0.0; + T1 = T0 * T0; + T2 = Vgst2Vtm * T0; + T3 = EsatL * Vgst2Vtm; + Vdsat = T3 * T0; + + dT0_dVg = -(Abulk * dEsatL_dVg + EsatL * dAbulk_dVg + 1.0) * T1; + dT0_dVd = -(Abulk * dEsatL_dVd) * T1; + dT0_dVb = -(Abulk * dEsatL_dVb + dAbulk_dVb * EsatL) * T1; + + dVdsat_dVg = T3 * dT0_dVg + T2 * dEsatL_dVg + EsatL * T0; + dVdsat_dVd = T3 * dT0_dVd + T2 * dEsatL_dVd; + dVdsat_dVb = T3 * dT0_dVb + T2 * dEsatL_dVb; + } + else + { tmp1 = dLambda_dVg / (Lambda * Lambda); + T9 = Abulk * WVCoxRds; + T8 = Abulk * T9; + T7 = Vgst2Vtm * T9; + T6 = Vgst2Vtm * WVCoxRds; + T0 = 2.0 * Abulk * (T9 - 1.0 + 1.0 / Lambda); + dT0_dVg = 2.0 * (T8 * tmp2 - Abulk * tmp1 + + (2.0 * T9 + 1.0 / Lambda - 1.0) * dAbulk_dVg); + + dT0_dVb = 2.0 * (T8 * (2.0 / Abulk * dAbulk_dVb + tmp3) + + (1.0 / Lambda - 1.0) * dAbulk_dVb); + dT0_dVd = 0.0; + T1 = Vgst2Vtm * (2.0 / Lambda - 1.0) + Abulk * EsatL + 3.0 * T7; + + dT1_dVg = (2.0 / Lambda - 1.0) - 2.0 * Vgst2Vtm * tmp1 + + Abulk * dEsatL_dVg + EsatL * dAbulk_dVg + 3.0 * (T9 + + T7 * tmp2 + T6 * dAbulk_dVg); + dT1_dVb = Abulk * dEsatL_dVb + EsatL * dAbulk_dVb + + 3.0 * (T6 * dAbulk_dVb + T7 * tmp3); + dT1_dVd = Abulk * dEsatL_dVd; + + T2 = Vgst2Vtm * (EsatL + 2.0 * T6); + dT2_dVg = EsatL + Vgst2Vtm * dEsatL_dVg + + T6 * (4.0 + 2.0 * Vgst2Vtm * tmp2); + dT2_dVb = Vgst2Vtm * (dEsatL_dVb + 2.0 * T6 * tmp3); + dT2_dVd = Vgst2Vtm * dEsatL_dVd; + + T3 = sqrt(T1 * T1 - 2.0 * T0 * T2); + 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; + + 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; + } + here->BSIM4V4vdsat = Vdsat; + + /* Calculate Vdseff */ + T1 = Vdsat - Vds - pParam->BSIM4V4delta; + dT1_dVg = dVdsat_dVg; + dT1_dVd = dVdsat_dVd - 1.0; + dT1_dVb = dVdsat_dVb; + + T2 = sqrt(T1 * T1 + 4.0 * pParam->BSIM4V4delta * Vdsat); + T0 = T1 / T2; + T9 = 2.0 * pParam->BSIM4V4delta; + T3 = T9 / 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; + + if (T1 >= 0.0) + { 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); + } + else + { T4 = T9 / (T2 - T1); + T5 = 1.0 - T4; + T6 = Vdsat * T4 / (T2 - T1); + Vdseff = Vdsat * T5; + dVdseff_dVg = dVdsat_dVg * T5 + T6 * (dT2_dVg - dT1_dVg); + dVdseff_dVd = dVdsat_dVd * T5 + T6 * (dT2_dVd - dT1_dVd); + dVdseff_dVb = dVdsat_dVb * T5 + T6 * (dT2_dVb - dT1_dVb); + } + + if (Vds == 0.0) + { Vdseff = 0.0; + dVdseff_dVg = 0.0; + dVdseff_dVb = 0.0; + } + + if (Vdseff > Vds) + Vdseff = Vds; + diffVds = Vds - Vdseff; + here->BSIM4V4Vdseff = Vdseff; + + /* Velocity Overshoot */ + if((model->BSIM4V4lambdaGiven) && (model->BSIM4V4lambda > 0.0) ) + { + T1 = Leff * ueff; + T2 = pParam->BSIM4V4lambda / T1; + T3 = -T2 / T1 * Leff; + dT2_dVd = T3 * dueff_dVd; + dT2_dVg = T3 * dueff_dVg; + dT2_dVb = T3 * dueff_dVb; + T5 = 1.0 / (Esat * pParam->BSIM4V4litl); + T4 = -T5 / EsatL; + dT5_dVg = dEsatL_dVg * T4; + dT5_dVd = dEsatL_dVd * T4; + dT5_dVb = dEsatL_dVb * T4; + T6 = 1.0 + diffVds * T5; + dT6_dVg = dT5_dVg * diffVds - dVdseff_dVg * T5; + dT6_dVd = dT5_dVd * diffVds + (1.0 - dVdseff_dVd) * T5; + dT6_dVb = dT5_dVb * diffVds - dVdseff_dVb * T5; + T7 = 2.0 / (T6 * T6 + 1.0); + T8 = 1.0 - T7; + T9 = T6 * T7 * T7; + dT8_dVg = T9 * dT6_dVg; + dT8_dVd = T9 * dT6_dVd; + dT8_dVb = T9 * dT6_dVb; + T10 = 1.0 + T2 * T8; + dT10_dVg = dT2_dVg * T8 + T2 * dT8_dVg; + dT10_dVd = dT2_dVd * T8 + T2 * dT8_dVd; + dT10_dVb = dT2_dVb * T8 + T2 * dT8_dVb; + if(T10 == 1.0) + dT10_dVg = dT10_dVd = dT10_dVb = 0.0; + + dEsatL_dVg *= T10; + dEsatL_dVg += EsatL * dT10_dVg; + dEsatL_dVd *= T10; + dEsatL_dVd += EsatL * dT10_dVd; + dEsatL_dVb *= T10; + dEsatL_dVb += EsatL * dT10_dVb; + EsatL *= T10; + here->BSIM4V4EsatL = EsatL; + } + + /* Calculate Vasat */ + tmp4 = 1.0 - 0.5 * Abulk * Vdsat / Vgst2Vtm; + T9 = WVCoxRds * Vgsteff; + T8 = T9 / Vgst2Vtm; + T0 = EsatL + Vdsat + 2.0 * T9 * tmp4; + + T7 = 2.0 * WVCoxRds * tmp4; + dT0_dVg = dEsatL_dVg + dVdsat_dVg + T7 * (1.0 + tmp2 * Vgsteff) + - T8 * (Abulk * dVdsat_dVg - Abulk * Vdsat / Vgst2Vtm + + Vdsat * dAbulk_dVg); + + dT0_dVb = dEsatL_dVb + dVdsat_dVb + T7 * tmp3 * Vgsteff + - T8 * (dAbulk_dVb * Vdsat + Abulk * dVdsat_dVb); + dT0_dVd = dEsatL_dVd + dVdsat_dVd - T8 * Abulk * dVdsat_dVd; + + T9 = WVCoxRds * Abulk; + T1 = 2.0 / Lambda - 1.0 + T9; + dT1_dVg = -2.0 * tmp1 + WVCoxRds * (Abulk * tmp2 + dAbulk_dVg); + dT1_dVb = dAbulk_dVb * WVCoxRds + T9 * tmp3; + + Vasat = T0 / T1; + dVasat_dVg = (dT0_dVg - Vasat * dT1_dVg) / T1; + dVasat_dVb = (dT0_dVb - Vasat * dT1_dVb) / T1; + dVasat_dVd = dT0_dVd / T1; + + /* Calculate Idl first */ + tmp1 = here->BSIM4V4vtfbphi2; + tmp2 = 2.0e8 * model->BSIM4V4toxp; + dT0_dVg = 1.0 / tmp2; + T0 = (Vgsteff + tmp1) * dT0_dVg; + + tmp3 = exp(0.7 * log(T0)); + T1 = 1.0 + tmp3; + T2 = 0.7 * tmp3 / T0; + Tcen = 1.9e-9 / T1; + dTcen_dVg = -Tcen * T2 * dT0_dVg / T1; + + Coxeff = EPSSI * model->BSIM4V4coxp + / (EPSSI + model->BSIM4V4coxp * Tcen); + dCoxeff_dVg = -Coxeff * Coxeff * dTcen_dVg / EPSSI; + + CoxeffWovL = Coxeff * Weff / Leff; + beta = ueff * CoxeffWovL; + T3 = ueff / Leff; + dbeta_dVg = CoxeffWovL * dueff_dVg + T3 + * (Weff * dCoxeff_dVg + Coxeff * dWeff_dVg); + dbeta_dVd = CoxeffWovL * dueff_dVd; + dbeta_dVb = CoxeffWovL * dueff_dVb + T3 * Coxeff * dWeff_dVb; + + here->BSIM4V4AbovVgst2Vtm = Abulk / Vgst2Vtm; + T0 = 1.0 - 0.5 * Vdseff * here->BSIM4V4AbovVgst2Vtm; + 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; + + T9 = Vdseff / EsatL; + fgche2 = 1.0 + T9; + dfgche2_dVg = (dVdseff_dVg - T9 * dEsatL_dVg) / EsatL; + dfgche2_dVd = (dVdseff_dVd - T9 * dEsatL_dVd) / EsatL; + dfgche2_dVb = (dVdseff_dVb - T9 * 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 / T0; + T1 = (1.0 - Idl * Rds) / T0; + T2 = Idl * Idl; + dIdl_dVg = T1 * dgche_dVg - T2 * dRds_dVg; + dIdl_dVd = T1 * dgche_dVd; + dIdl_dVb = T1 * dgche_dVb - T2 * dRds_dVb; + + /* Calculate degradation factor due to pocket implant */ + + if (pParam->BSIM4V4fprout <= 0.0) + { FP = 1.0; + dFP_dVg = 0.0; + } + else + { T9 = pParam->BSIM4V4fprout * sqrt(Leff) / Vgst2Vtm; + FP = 1.0 / (1.0 + T9); + dFP_dVg = FP * FP * T9 / Vgst2Vtm; + } + + /* Calculate VACLM */ + T8 = pParam->BSIM4V4pvag / EsatL; + T9 = T8 * Vgsteff; + if (T9 > -0.9) + { PvagTerm = 1.0 + T9; + dPvagTerm_dVg = T8 * (1.0 - Vgsteff * dEsatL_dVg / EsatL); + dPvagTerm_dVb = -T9 * dEsatL_dVb / EsatL; + dPvagTerm_dVd = -T9 * dEsatL_dVd / EsatL; + } + else + { T4 = 1.0 / (17.0 + 20.0 * T9); + PvagTerm = (0.8 + T9) * T4; + T4 *= T4; + dPvagTerm_dVg = T8 * (1.0 - Vgsteff * dEsatL_dVg / EsatL) * T4; + T9 *= T4 / EsatL; + dPvagTerm_dVb = -T9 * dEsatL_dVb; + dPvagTerm_dVd = -T9 * dEsatL_dVd; + } + + if ((pParam->BSIM4V4pclm > MIN_EXP) && (diffVds > 1.0e-10)) + { T0 = 1.0 + Rds * Idl; + dT0_dVg = dRds_dVg * Idl + Rds * dIdl_dVg; + dT0_dVd = Rds * dIdl_dVd; + dT0_dVb = dRds_dVb * Idl + Rds * dIdl_dVb; + + T2 = Vdsat / Esat; + T1 = Leff + T2; + dT1_dVg = (dVdsat_dVg - T2 * dEsatL_dVg / Leff) / Esat; + dT1_dVd = (dVdsat_dVd - T2 * dEsatL_dVd / Leff) / Esat; + dT1_dVb = (dVdsat_dVb - T2 * dEsatL_dVb / Leff) / Esat; + + Cclm = FP * PvagTerm * T0 * T1 / (pParam->BSIM4V4pclm * pParam->BSIM4V4litl); + dCclm_dVg = Cclm * (dFP_dVg / FP + dPvagTerm_dVg / PvagTerm + + dT0_dVg / T0 + dT1_dVg / T1); + dCclm_dVb = Cclm * (dPvagTerm_dVb / PvagTerm + dT0_dVb / T0 + + dT1_dVb / T1); + dCclm_dVd = Cclm * (dPvagTerm_dVd / PvagTerm + dT0_dVd / T0 + + dT1_dVd / T1); + VACLM = Cclm * diffVds; + + dVACLM_dVg = dCclm_dVg * diffVds - dVdseff_dVg * Cclm; + dVACLM_dVb = dCclm_dVb * diffVds - dVdseff_dVb * Cclm; + dVACLM_dVd = dCclm_dVd * diffVds + (1.0 - dVdseff_dVd) * Cclm; + } + else + { VACLM = Cclm = MAX_EXP; + dVACLM_dVd = dVACLM_dVg = dVACLM_dVb = 0.0; + dCclm_dVd = dCclm_dVg = dCclm_dVb = 0.0; + } + + /* Calculate VADIBL */ + if (pParam->BSIM4V4thetaRout > MIN_EXP) + { T8 = Abulk * Vdsat; + T0 = Vgst2Vtm * T8; + dT0_dVg = Vgst2Vtm * Abulk * dVdsat_dVg + T8 + + Vgst2Vtm * Vdsat * dAbulk_dVg; + dT0_dVb = Vgst2Vtm * (dAbulk_dVb * Vdsat + Abulk * dVdsat_dVb); + dT0_dVd = Vgst2Vtm * Abulk * dVdsat_dVd; + + T1 = Vgst2Vtm + T8; + dT1_dVg = 1.0 + Abulk * dVdsat_dVg + Vdsat * dAbulk_dVg; + dT1_dVb = Abulk * dVdsat_dVb + dAbulk_dVb * Vdsat; + dT1_dVd = Abulk * dVdsat_dVd; + + T9 = T1 * T1; + T2 = pParam->BSIM4V4thetaRout; + VADIBL = (Vgst2Vtm - T0 / T1) / T2; + dVADIBL_dVg = (1.0 - dT0_dVg / T1 + T0 * dT1_dVg / T9) / T2; + dVADIBL_dVb = (-dT0_dVb / T1 + T0 * dT1_dVb / T9) / T2; + dVADIBL_dVd = (-dT0_dVd / T1 + T0 * dT1_dVd / T9) / T2; + + T7 = pParam->BSIM4V4pdiblb * Vbseff; + if (T7 >= -0.9) + { T3 = 1.0 / (1.0 + T7); + VADIBL *= T3; + dVADIBL_dVg *= T3; + dVADIBL_dVb = (dVADIBL_dVb - VADIBL * pParam->BSIM4V4pdiblb) + * T3; + dVADIBL_dVd *= T3; + } + else + { T4 = 1.0 / (0.8 + T7); + T3 = (17.0 + 20.0 * T7) * T4; + dVADIBL_dVg *= T3; + dVADIBL_dVb = dVADIBL_dVb * T3 + - VADIBL * pParam->BSIM4V4pdiblb * T4 * T4; + dVADIBL_dVd *= T3; + VADIBL *= T3; + } + + dVADIBL_dVg = dVADIBL_dVg * PvagTerm + VADIBL * dPvagTerm_dVg; + dVADIBL_dVb = dVADIBL_dVb * PvagTerm + VADIBL * dPvagTerm_dVb; + dVADIBL_dVd = dVADIBL_dVd * PvagTerm + VADIBL * dPvagTerm_dVd; + VADIBL *= PvagTerm; + } + else + { VADIBL = MAX_EXP; + dVADIBL_dVd = dVADIBL_dVg = dVADIBL_dVb = 0.0; + } + + /* Calculate Va */ + Va = Vasat + VACLM; + dVa_dVg = dVasat_dVg + dVACLM_dVg; + dVa_dVb = dVasat_dVb + dVACLM_dVb; + dVa_dVd = dVasat_dVd + dVACLM_dVd; + + /* Calculate VADITS */ + T0 = pParam->BSIM4V4pditsd * Vds; + if (T0 > EXP_THRESHOLD) + { T1 = MAX_EXP; + dT1_dVd = 0; + } + else + { T1 = exp(T0); + dT1_dVd = T1 * pParam->BSIM4V4pditsd; + } + + if (pParam->BSIM4V4pdits > MIN_EXP) + { T2 = 1.0 + model->BSIM4V4pditsl * Leff; + VADITS = (1.0 + T2 * T1) / pParam->BSIM4V4pdits; + dVADITS_dVg = VADITS * dFP_dVg; + dVADITS_dVd = FP * T2 * dT1_dVd / pParam->BSIM4V4pdits; + VADITS *= FP; + } + else + { VADITS = MAX_EXP; + dVADITS_dVg = dVADITS_dVd = 0; + } + + /* Calculate VASCBE */ + if (pParam->BSIM4V4pscbe2 > 0.0) + { if (diffVds > pParam->BSIM4V4pscbe1 * pParam->BSIM4V4litl + / EXP_THRESHOLD) + { T0 = pParam->BSIM4V4pscbe1 * pParam->BSIM4V4litl / diffVds; + VASCBE = Leff * exp(T0) / pParam->BSIM4V4pscbe2; + 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->BSIM4V4pscbe2; + dVASCBE_dVg = dVASCBE_dVd = dVASCBE_dVb = 0.0; + } + } + else + { VASCBE = MAX_EXP; + dVASCBE_dVg = dVASCBE_dVd = dVASCBE_dVb = 0.0; + } + + /* Add DIBL to Ids */ + T9 = diffVds / VADIBL; + T0 = 1.0 + T9; + Idsa = Idl * T0; + dIdsa_dVg = T0 * dIdl_dVg - Idl * (dVdseff_dVg + T9 * dVADIBL_dVg) / VADIBL; + dIdsa_dVd = T0 * dIdl_dVd + Idl + * (1.0 - dVdseff_dVd - T9 * dVADIBL_dVd) / VADIBL; + dIdsa_dVb = T0 * dIdl_dVb - Idl * (dVdseff_dVb + T9 * dVADIBL_dVb) / VADIBL; + + /* Add DITS to Ids */ + T9 = diffVds / VADITS; + T0 = 1.0 + T9; + dIdsa_dVg = T0 * dIdsa_dVg - Idsa * (dVdseff_dVg + T9 * dVADITS_dVg) / VADITS; + dIdsa_dVd = T0 * dIdsa_dVd + Idsa + * (1.0 - dVdseff_dVd - T9 * dVADITS_dVd) / VADITS; + dIdsa_dVb = T0 * dIdsa_dVb - Idsa * dVdseff_dVb / VADITS; + Idsa *= T0; + + /* Add CLM to Ids */ + T0 = log(Va / Vasat); + dT0_dVg = dVa_dVg / Va - dVasat_dVg / Vasat; + dT0_dVb = dVa_dVb / Va - dVasat_dVb / Vasat; + dT0_dVd = dVa_dVd / Va - dVasat_dVd / Vasat; + T1 = T0 / Cclm; + T9 = 1.0 + T1; + dT9_dVg = (dT0_dVg - T1 * dCclm_dVg) / Cclm; + dT9_dVb = (dT0_dVb - T1 * dCclm_dVb) / Cclm; + dT9_dVd = (dT0_dVd - T1 * dCclm_dVd) / Cclm; + + dIdsa_dVg = dIdsa_dVg * T9 + Idsa * dT9_dVg; + dIdsa_dVb = dIdsa_dVb * T9 + Idsa * dT9_dVb; + dIdsa_dVd = dIdsa_dVd * T9 + Idsa * dT9_dVd; + Idsa *= T9; + + /* Substrate current begins */ + tmp = pParam->BSIM4V4alpha0 + pParam->BSIM4V4alpha1 * Leff; + if ((tmp <= 0.0) || (pParam->BSIM4V4beta0 <= 0.0)) + { Isub = Gbd = Gbb = Gbg = 0.0; + } + else + { T2 = tmp / Leff; + if (diffVds > pParam->BSIM4V4beta0 / EXP_THRESHOLD) + { T0 = -pParam->BSIM4V4beta0 / diffVds; + T1 = T2 * diffVds * exp(T0); + T3 = T1 / diffVds * (T0 - 1.0); + dT1_dVg = T3 * dVdseff_dVg; + dT1_dVd = T3 * (dVdseff_dVd - 1.0); + dT1_dVb = T3 * dVdseff_dVb; + } + else + { T3 = T2 * MIN_EXP; + T1 = T3 * diffVds; + dT1_dVg = -T3 * dVdseff_dVg; + dT1_dVd = T3 * (1.0 - dVdseff_dVd); + dT1_dVb = -T3 * dVdseff_dVb; + } + T4 = Idsa * Vdseff; + Isub = T1 * T4; + Gbg = T1 * (dIdsa_dVg * Vdseff + Idsa * dVdseff_dVg) + + T4 * dT1_dVg; + Gbd = T1 * (dIdsa_dVd * Vdseff + Idsa * dVdseff_dVd) + + T4 * dT1_dVd; + Gbb = T1 * (dIdsa_dVb * Vdseff + Idsa * dVdseff_dVb) + + T4 * dT1_dVb; + + Gbd += Gbg * dVgsteff_dVd; + Gbb += Gbg * dVgsteff_dVb; + Gbg *= dVgsteff_dVg; + Gbb *= dVbseff_dVb; + } + here->BSIM4V4csub = Isub; + here->BSIM4V4gbbs = Gbb; + here->BSIM4V4gbgs = Gbg; + here->BSIM4V4gbds = Gbd; + + /* Add SCBE to Ids */ + T9 = diffVds / VASCBE; + T0 = 1.0 + T9; + Ids = Idsa * T0; + + Gm = T0 * dIdsa_dVg - Idsa + * (dVdseff_dVg + T9 * dVASCBE_dVg) / VASCBE; + Gds = T0 * dIdsa_dVd + Idsa + * (1.0 - dVdseff_dVd - T9 * dVASCBE_dVd) / VASCBE; + Gmb = T0 * dIdsa_dVb - Idsa + * (dVdseff_dVb + T9 * dVASCBE_dVb) / VASCBE; + + + tmp1 = Gds + Gm * dVgsteff_dVd; + tmp2 = Gmb + Gm * dVgsteff_dVb; + tmp3 = Gm; + + Gm = (Ids * dVdseff_dVg + Vdseff * tmp3) * dVgsteff_dVg; + Gds = Ids * (dVdseff_dVd + dVdseff_dVg * dVgsteff_dVd) + + Vdseff * tmp1; + Gmb = (Ids * (dVdseff_dVb + dVdseff_dVg * dVgsteff_dVb) + + Vdseff * tmp2) * dVbseff_dVb; + + cdrain = Ids * Vdseff; + + /* Source End Velocity Limit */ + if((model->BSIM4V4vtlGiven) && (model->BSIM4V4vtl > 0.0) ) { + T12 = 1.0 / Leff / CoxeffWovL; + T11 = T12 / Vgsteff; + T10 = -T11 / Vgsteff; + vs = cdrain * T11; /* vs */ + dvs_dVg = Gm * T11 + cdrain * T10 * dVgsteff_dVg; + dvs_dVd = Gds * T11 + cdrain * T10 * dVgsteff_dVd; + dvs_dVb = Gmb * T11 + cdrain * T10 * dVgsteff_dVb; + T0 = 2 * MM; + T1 = vs / (pParam->BSIM4V4vtl * pParam->BSIM4V4tfactor); + if(T1 > 0.0) + { T2 = 1.0 + exp(T0 * log(T1)); + T3 = (T2 - 1.0) * T0 / vs; + Fsevl = 1.0 / exp(log(T2)/ T0); + dT2_dVg = T3 * dvs_dVg; + dT2_dVd = T3 * dvs_dVd; + dT2_dVb = T3 * dvs_dVb; + T4 = -1.0 / T0 * Fsevl / T2; + dFsevl_dVg = T4 * dT2_dVg; + dFsevl_dVd = T4 * dT2_dVd; + dFsevl_dVb = T4 * dT2_dVb; + } else { + Fsevl = 1.0; + dFsevl_dVg = 0.0; + dFsevl_dVd = 0.0; + dFsevl_dVb = 0.0; + } + Gm *=Fsevl; + Gm += cdrain * dFsevl_dVg; + Gmb *=Fsevl; + Gmb += cdrain * dFsevl_dVb; + Gds *=Fsevl; + Gds += cdrain * dFsevl_dVd; + + cdrain *= Fsevl; + } + + here->BSIM4V4gds = Gds; + here->BSIM4V4gm = Gm; + here->BSIM4V4gmbs = Gmb; + here->BSIM4V4IdovVds = Ids; + if( here->BSIM4V4IdovVds <= 1.0e-9) here->BSIM4V4IdovVds = 1.0e-9; + + /* Calculate Rg */ + if ((here->BSIM4V4rgateMod > 1) || + (here->BSIM4V4trnqsMod != 0) || (here->BSIM4V4acnqsMod != 0)) + { T9 = pParam->BSIM4V4xrcrg2 * model->BSIM4V4vtm; + T0 = T9 * beta; + dT0_dVd = (dbeta_dVd + dbeta_dVg * dVgsteff_dVd) * T9; + dT0_dVb = (dbeta_dVb + dbeta_dVg * dVgsteff_dVb) * T9; + dT0_dVg = dbeta_dVg * T9; + + here->BSIM4V4gcrg = pParam->BSIM4V4xrcrg1 * ( T0 + Ids); + here->BSIM4V4gcrgd = pParam->BSIM4V4xrcrg1 * (dT0_dVd + tmp1); + here->BSIM4V4gcrgb = pParam->BSIM4V4xrcrg1 * (dT0_dVb + tmp2) + * dVbseff_dVb; + here->BSIM4V4gcrgg = pParam->BSIM4V4xrcrg1 * (dT0_dVg + tmp3) + * dVgsteff_dVg; + + if (here->BSIM4V4nf != 1.0) + { here->BSIM4V4gcrg *= here->BSIM4V4nf; + here->BSIM4V4gcrgg *= here->BSIM4V4nf; + here->BSIM4V4gcrgd *= here->BSIM4V4nf; + here->BSIM4V4gcrgb *= here->BSIM4V4nf; + } + + if (here->BSIM4V4rgateMod == 2) + { T10 = here->BSIM4V4grgeltd * here->BSIM4V4grgeltd; + T11 = here->BSIM4V4grgeltd + here->BSIM4V4gcrg; + here->BSIM4V4gcrg = here->BSIM4V4grgeltd * here->BSIM4V4gcrg / T11; + T12 = T10 / T11 / T11; + here->BSIM4V4gcrgg *= T12; + here->BSIM4V4gcrgd *= T12; + here->BSIM4V4gcrgb *= T12; + } + here->BSIM4V4gcrgs = -(here->BSIM4V4gcrgg + here->BSIM4V4gcrgd + + here->BSIM4V4gcrgb); + } + + + /* Calculate bias-dependent external S/D resistance */ + if (model->BSIM4V4rdsMod) + { /* Rs(V) */ + T0 = vgs - pParam->BSIM4V4vfbsd; + T1 = sqrt(T0 * T0 + 1.0e-4); + vgs_eff = 0.5 * (T0 + T1); + dvgs_eff_dvg = vgs_eff / T1; + + T0 = 1.0 + pParam->BSIM4V4prwg * vgs_eff; + dT0_dvg = -pParam->BSIM4V4prwg / T0 / T0 * dvgs_eff_dvg; + T1 = -pParam->BSIM4V4prwb * vbs; + dT1_dvb = -pParam->BSIM4V4prwb; + + T2 = 1.0 / T0 + T1; + T3 = T2 + sqrt(T2 * T2 + 0.01); + dT3_dvg = T3 / (T3 - T2); + dT3_dvb = dT3_dvg * dT1_dvb; + dT3_dvg *= dT0_dvg; + + T4 = pParam->BSIM4V4rs0 * 0.5; + Rs = pParam->BSIM4V4rswmin + T3 * T4; + dRs_dvg = T4 * dT3_dvg; + dRs_dvb = T4 * dT3_dvb; + + T0 = 1.0 + here->BSIM4V4sourceConductance * Rs; + here->BSIM4V4gstot = here->BSIM4V4sourceConductance / T0; + T0 = -here->BSIM4V4gstot * here->BSIM4V4gstot; + dgstot_dvd = 0.0; /* place holder */ + dgstot_dvg = T0 * dRs_dvg; + dgstot_dvb = T0 * dRs_dvb; + dgstot_dvs = -(dgstot_dvg + dgstot_dvb + dgstot_dvd); + + /* Rd(V) */ + T0 = vgd - pParam->BSIM4V4vfbsd; + T1 = sqrt(T0 * T0 + 1.0e-4); + vgd_eff = 0.5 * (T0 + T1); + dvgd_eff_dvg = vgd_eff / T1; + + T0 = 1.0 + pParam->BSIM4V4prwg * vgd_eff; + dT0_dvg = -pParam->BSIM4V4prwg / T0 / T0 * dvgd_eff_dvg; + T1 = -pParam->BSIM4V4prwb * vbd; + dT1_dvb = -pParam->BSIM4V4prwb; + + T2 = 1.0 / T0 + T1; + T3 = T2 + sqrt(T2 * T2 + 0.01); + dT3_dvg = T3 / (T3 - T2); + dT3_dvb = dT3_dvg * dT1_dvb; + dT3_dvg *= dT0_dvg; + + T4 = pParam->BSIM4V4rd0 * 0.5; + Rd = pParam->BSIM4V4rdwmin + T3 * T4; + dRd_dvg = T4 * dT3_dvg; + dRd_dvb = T4 * dT3_dvb; + + T0 = 1.0 + here->BSIM4V4drainConductance * Rd; + here->BSIM4V4gdtot = here->BSIM4V4drainConductance / T0; + T0 = -here->BSIM4V4gdtot * here->BSIM4V4gdtot; + dgdtot_dvs = 0.0; + dgdtot_dvg = T0 * dRd_dvg; + dgdtot_dvb = T0 * dRd_dvb; + dgdtot_dvd = -(dgdtot_dvg + dgdtot_dvb + dgdtot_dvs); + + here->BSIM4V4gstotd = vses * dgstot_dvd; + here->BSIM4V4gstotg = vses * dgstot_dvg; + here->BSIM4V4gstots = vses * dgstot_dvs; + here->BSIM4V4gstotb = vses * dgstot_dvb; + + T2 = vdes - vds; + here->BSIM4V4gdtotd = T2 * dgdtot_dvd; + here->BSIM4V4gdtotg = T2 * dgdtot_dvg; + here->BSIM4V4gdtots = T2 * dgdtot_dvs; + here->BSIM4V4gdtotb = T2 * dgdtot_dvb; + } + else /* WDLiu: for bypass */ + { here->BSIM4V4gstot = here->BSIM4V4gstotd = here->BSIM4V4gstotg = 0.0; + here->BSIM4V4gstots = here->BSIM4V4gstotb = 0.0; + here->BSIM4V4gdtot = here->BSIM4V4gdtotd = here->BSIM4V4gdtotg = 0.0; + here->BSIM4V4gdtots = here->BSIM4V4gdtotb = 0.0; + } + + /* Calculate GIDL current */ + vgs_eff = here->BSIM4V4vgs_eff; + dvgs_eff_dvg = here->BSIM4V4dvgs_eff_dvg; + T0 = 3.0 * model->BSIM4V4toxe; + + T1 = (vds - vgs_eff - pParam->BSIM4V4egidl ) / T0; + if ((pParam->BSIM4V4agidl <= 0.0) || (pParam->BSIM4V4bgidl <= 0.0) + || (T1 <= 0.0) || (pParam->BSIM4V4cgidl <= 0.0) || (vbd > 0.0)) + Igidl = Ggidld = Ggidlg = Ggidlb = 0.0; + else { + dT1_dVd = 1.0 / T0; + dT1_dVg = -dvgs_eff_dvg * dT1_dVd; + T2 = pParam->BSIM4V4bgidl / T1; + if (T2 < 100.0) + { Igidl = pParam->BSIM4V4agidl * pParam->BSIM4V4weffCJ * T1 * exp(-T2); + T3 = Igidl * (1.0 + T2) / T1; + Ggidld = T3 * dT1_dVd; + Ggidlg = T3 * dT1_dVg; + } + else + { Igidl = pParam->BSIM4V4agidl * pParam->BSIM4V4weffCJ * 3.720075976e-44; + Ggidld = Igidl * dT1_dVd; + Ggidlg = Igidl * dT1_dVg; + Igidl *= T1; + } + + T4 = vbd * vbd; + T5 = -vbd * T4; + T6 = pParam->BSIM4V4cgidl + T5; + T7 = T5 / T6; + T8 = 3.0 * pParam->BSIM4V4cgidl * T4 / T6 / T6; + Ggidld = Ggidld * T7 + Igidl * T8; + Ggidlg = Ggidlg * T7; + Ggidlb = -Igidl * T8; + Igidl *= T7; + } + here->BSIM4V4Igidl = Igidl; + here->BSIM4V4ggidld = Ggidld; + here->BSIM4V4ggidlg = Ggidlg; + here->BSIM4V4ggidlb = Ggidlb; + + /* Calculate GISL current */ + vgd_eff = here->BSIM4V4vgd_eff; + dvgd_eff_dvg = here->BSIM4V4dvgd_eff_dvg; + + T1 = (-vds - vgd_eff - pParam->BSIM4V4egidl ) / T0; + + if ((pParam->BSIM4V4agidl <= 0.0) || (pParam->BSIM4V4bgidl <= 0.0) + || (T1 <= 0.0) || (pParam->BSIM4V4cgidl <= 0.0) || (vbs > 0.0)) + Igisl = Ggisls = Ggislg = Ggislb = 0.0; + else { + dT1_dVd = 1.0 / T0; + dT1_dVg = -dvgd_eff_dvg * dT1_dVd; + T2 = pParam->BSIM4V4bgidl / T1; + if (T2 < 100.0) + { Igisl = pParam->BSIM4V4agidl * pParam->BSIM4V4weffCJ * T1 * exp(-T2); + T3 = Igisl * (1.0 + T2) / T1; + Ggisls = T3 * dT1_dVd; + Ggislg = T3 * dT1_dVg; + } + else + { Igisl = pParam->BSIM4V4agidl * pParam->BSIM4V4weffCJ * 3.720075976e-44; + Ggisls = Igisl * dT1_dVd; + Ggislg = Igisl * dT1_dVg; + Igisl *= T1; + } + + T4 = vbs * vbs; + T5 = -vbs * T4; + T6 = pParam->BSIM4V4cgidl + T5; + T7 = T5 / T6; + T8 = 3.0 * pParam->BSIM4V4cgidl * T4 / T6 / T6; + Ggisls = Ggisls * T7 + Igisl * T8; + Ggislg = Ggislg * T7; + Ggislb = -Igisl * T8; + Igisl *= T7; + } + here->BSIM4V4Igisl = Igisl; + here->BSIM4V4ggisls = Ggisls; + here->BSIM4V4ggislg = Ggislg; + here->BSIM4V4ggislb = Ggislb; + + + /* Calculate gate tunneling current */ + if ((model->BSIM4V4igcMod != 0) || (model->BSIM4V4igbMod != 0)) + { Vfb = here->BSIM4V4vfbzb; + V3 = Vfb - Vgs_eff + Vbseff - DELTA_3; + if (Vfb <= 0.0) + T0 = sqrt(V3 * V3 - 4.0 * DELTA_3 * Vfb); + else + T0 = sqrt(V3 * V3 + 4.0 * DELTA_3 * Vfb); + T1 = 0.5 * (1.0 + V3 / T0); + Vfbeff = Vfb - 0.5 * (V3 + T0); + dVfbeff_dVg = T1 * dVgs_eff_dVg; + dVfbeff_dVb = -T1; /* WDLiu: -No surprise? No. -Good! */ + + Voxacc = Vfb - Vfbeff; + dVoxacc_dVg = -dVfbeff_dVg; + dVoxacc_dVb = -dVfbeff_dVb; + if (Voxacc < 0.0) /* WDLiu: Avoiding numerical instability. */ + Voxacc = dVoxacc_dVg = dVoxacc_dVb = 0.0; + + T0 = 0.5 * pParam->BSIM4V4k1ox; + T3 = Vgs_eff - Vfbeff - Vbseff - Vgsteff; + if (pParam->BSIM4V4k1ox == 0.0) + Voxdepinv = dVoxdepinv_dVg = dVoxdepinv_dVd + = dVoxdepinv_dVb = 0.0; + else if (T3 < 0.0) + { Voxdepinv = -T3; + dVoxdepinv_dVg = -dVgs_eff_dVg + dVfbeff_dVg + + dVgsteff_dVg; + dVoxdepinv_dVd = dVgsteff_dVd; + dVoxdepinv_dVb = dVfbeff_dVb + 1.0 + dVgsteff_dVb; + } + else + { T1 = sqrt(T0 * T0 + T3); + T2 = T0 / T1; + Voxdepinv = pParam->BSIM4V4k1ox * (T1 - T0); + dVoxdepinv_dVg = T2 * (dVgs_eff_dVg - dVfbeff_dVg + - dVgsteff_dVg); + dVoxdepinv_dVd = -T2 * dVgsteff_dVd; + dVoxdepinv_dVb = -T2 * (dVfbeff_dVb + 1.0 + dVgsteff_dVb); + } + + Voxdepinv += Vgsteff; + dVoxdepinv_dVg += dVgsteff_dVg; + dVoxdepinv_dVd += dVgsteff_dVd; + dVoxdepinv_dVb += dVgsteff_dVb; + } + + if (model->BSIM4V4igcMod) + { T0 = Vtm * pParam->BSIM4V4nigc; + VxNVt = (Vgs_eff - model->BSIM4V4type * here->BSIM4V4vth0) / T0; + if (VxNVt > EXP_THRESHOLD) + { Vaux = Vgs_eff - model->BSIM4V4type * here->BSIM4V4vth0; + dVaux_dVg = dVgs_eff_dVg; + dVaux_dVd = 0.0; + dVaux_dVb = 0.0; + } + else if (VxNVt < -EXP_THRESHOLD) + { Vaux = T0 * log(1.0 + MIN_EXP); + dVaux_dVg = dVaux_dVd = dVaux_dVb = 0.0; + } + else + { ExpVxNVt = exp(VxNVt); + Vaux = T0 * log(1.0 + ExpVxNVt); + dVaux_dVg = ExpVxNVt / (1.0 + ExpVxNVt); + dVaux_dVd = 0.0; + dVaux_dVb = 0.0; + dVaux_dVg *= dVgs_eff_dVg; + } + + T2 = Vgs_eff * Vaux; + dT2_dVg = dVgs_eff_dVg * Vaux + Vgs_eff * dVaux_dVg; + dT2_dVd = Vgs_eff * dVaux_dVd; + dT2_dVb = Vgs_eff * dVaux_dVb; + + T11 = pParam->BSIM4V4Aechvb; + T12 = pParam->BSIM4V4Bechvb; + T3 = pParam->BSIM4V4aigc * pParam->BSIM4V4cigc + - pParam->BSIM4V4bigc; + T4 = pParam->BSIM4V4bigc * pParam->BSIM4V4cigc; + T5 = T12 * (pParam->BSIM4V4aigc + T3 * Voxdepinv + - T4 * Voxdepinv * Voxdepinv); + + if (T5 > EXP_THRESHOLD) + { T6 = MAX_EXP; + dT6_dVg = dT6_dVd = dT6_dVb = 0.0; + } + else if (T5 < -EXP_THRESHOLD) + { T6 = MIN_EXP; + dT6_dVg = dT6_dVd = dT6_dVb = 0.0; + } + else + { T6 = exp(T5); + dT6_dVg = T6 * T12 * (T3 - 2.0 * T4 * Voxdepinv); + dT6_dVd = dT6_dVg * dVoxdepinv_dVd; + dT6_dVb = dT6_dVg * dVoxdepinv_dVb; + dT6_dVg *= dVoxdepinv_dVg; + } + + Igc = T11 * T2 * T6; + dIgc_dVg = T11 * (T2 * dT6_dVg + T6 * dT2_dVg); + dIgc_dVd = T11 * (T2 * dT6_dVd + T6 * dT2_dVd); + dIgc_dVb = T11 * (T2 * dT6_dVb + T6 * dT2_dVb); + + if (model->BSIM4V4pigcdGiven) + { Pigcd = pParam->BSIM4V4pigcd; + dPigcd_dVg = dPigcd_dVd = dPigcd_dVb = 0.0; + } + else + { T11 = pParam->BSIM4V4Bechvb * model->BSIM4V4toxe; + T12 = Vgsteff + 1.0e-20; + T13 = T11 / T12 / T12; + T14 = -T13 / T12; + Pigcd = T13 * (1.0 - 0.5 * Vdseff / T12); + dPigcd_dVg = T14 * (2.0 + 0.5 * (dVdseff_dVg + * Vgsteff - 3.0 * Vdseff) / T12); + dPigcd_dVd = 0.5 * T14 * dVdseff_dVd + + dPigcd_dVg * dVgsteff_dVd; + dPigcd_dVb = 0.5 * T14 * dVdseff_dVb + + dPigcd_dVg * dVgsteff_dVb; + dPigcd_dVg *= dVgsteff_dVg; + } + + T7 = -Pigcd * Vdseff; /* bugfix */ + dT7_dVg = -Vdseff * dPigcd_dVg - Pigcd * dVdseff_dVg; + dT7_dVd = -Vdseff * dPigcd_dVd - Pigcd * dVdseff_dVd + dT7_dVg * dVgsteff_dVd; + dT7_dVb = -Vdseff * dPigcd_dVb - Pigcd * dVdseff_dVb + dT7_dVg * dVgsteff_dVb; + dT7_dVg *= dVgsteff_dVg; + dT7_dVb *= dVbseff_dVb; + T8 = T7 * T7 + 2.0e-4; + dT8_dVg = 2.0 * T7; + dT8_dVd = dT8_dVg * dT7_dVd; + dT8_dVb = dT8_dVg * dT7_dVb; + dT8_dVg *= dT7_dVg; + + if (T7 > EXP_THRESHOLD) + { T9 = MAX_EXP; + dT9_dVg = dT9_dVd = dT9_dVb = 0.0; + } + else if (T7 < -EXP_THRESHOLD) + { T9 = MIN_EXP; + dT9_dVg = dT9_dVd = dT9_dVb = 0.0; + } + else + { T9 = exp(T7); + dT9_dVg = T9 * dT7_dVg; + dT9_dVd = T9 * dT7_dVd; + dT9_dVb = T9 * dT7_dVb; + } + + T0 = T8 * T8; + T1 = T9 - 1.0 + 1.0e-4; + T10 = (T1 - T7) / T8; + dT10_dVg = (dT9_dVg - dT7_dVg - T10 * dT8_dVg) / T8; + dT10_dVd = (dT9_dVd - dT7_dVd - T10 * dT8_dVd) / T8; + dT10_dVb = (dT9_dVb - dT7_dVb - T10 * dT8_dVb) / T8; + + Igcs = Igc * T10; + dIgcs_dVg = dIgc_dVg * T10 + Igc * dT10_dVg; + dIgcs_dVd = dIgc_dVd * T10 + Igc * dT10_dVd; + dIgcs_dVb = dIgc_dVb * T10 + Igc * dT10_dVb; + + T1 = T9 - 1.0 - 1.0e-4; + T10 = (T7 * T9 - T1) / T8; + dT10_dVg = (dT7_dVg * T9 + (T7 - 1.0) * dT9_dVg + - T10 * dT8_dVg) / T8; + dT10_dVd = (dT7_dVd * T9 + (T7 - 1.0) * dT9_dVd + - T10 * dT8_dVd) / T8; + dT10_dVb = (dT7_dVb * T9 + (T7 - 1.0) * dT9_dVb + - T10 * dT8_dVb) / T8; + Igcd = Igc * T10; + dIgcd_dVg = dIgc_dVg * T10 + Igc * dT10_dVg; + dIgcd_dVd = dIgc_dVd * T10 + Igc * dT10_dVd; + dIgcd_dVb = dIgc_dVb * T10 + Igc * dT10_dVb; + + here->BSIM4V4Igcs = Igcs; + here->BSIM4V4gIgcsg = dIgcs_dVg; + here->BSIM4V4gIgcsd = dIgcs_dVd; + here->BSIM4V4gIgcsb = dIgcs_dVb * dVbseff_dVb; + here->BSIM4V4Igcd = Igcd; + here->BSIM4V4gIgcdg = dIgcd_dVg; + here->BSIM4V4gIgcdd = dIgcd_dVd; + here->BSIM4V4gIgcdb = dIgcd_dVb * dVbseff_dVb; + + T0 = vgs - (pParam->BSIM4V4vfbsd + pParam->BSIM4V4vfbsdoff); + vgs_eff = sqrt(T0 * T0 + 1.0e-4); + dvgs_eff_dvg = T0 / vgs_eff; + + T2 = vgs * vgs_eff; + dT2_dVg = vgs * dvgs_eff_dvg + vgs_eff; + T11 = pParam->BSIM4V4AechvbEdge; + T12 = pParam->BSIM4V4BechvbEdge; + T3 = pParam->BSIM4V4aigsd * pParam->BSIM4V4cigsd + - pParam->BSIM4V4bigsd; + T4 = pParam->BSIM4V4bigsd * pParam->BSIM4V4cigsd; + T5 = T12 * (pParam->BSIM4V4aigsd + T3 * vgs_eff + - T4 * vgs_eff * vgs_eff); + if (T5 > EXP_THRESHOLD) + { T6 = MAX_EXP; + dT6_dVg = 0.0; + } + else if (T5 < -EXP_THRESHOLD) + { T6 = MIN_EXP; + dT6_dVg = 0.0; + } + else + { T6 = exp(T5); + dT6_dVg = T6 * T12 * (T3 - 2.0 * T4 * vgs_eff) + * dvgs_eff_dvg; + } + Igs = T11 * T2 * T6; + dIgs_dVg = T11 * (T2 * dT6_dVg + T6 * dT2_dVg); + dIgs_dVs = -dIgs_dVg; + + + T0 = vgd - (pParam->BSIM4V4vfbsd + pParam->BSIM4V4vfbsdoff); + vgd_eff = sqrt(T0 * T0 + 1.0e-4); + dvgd_eff_dvg = T0 / vgd_eff; + + T2 = vgd * vgd_eff; + dT2_dVg = vgd * dvgd_eff_dvg + vgd_eff; + T5 = T12 * (pParam->BSIM4V4aigsd + T3 * vgd_eff + - T4 * vgd_eff * vgd_eff); + if (T5 > EXP_THRESHOLD) + { T6 = MAX_EXP; + dT6_dVg = 0.0; + } + else if (T5 < -EXP_THRESHOLD) + { T6 = MIN_EXP; + dT6_dVg = 0.0; + } + else + { T6 = exp(T5); + dT6_dVg = T6 * T12 * (T3 - 2.0 * T4 * vgd_eff) + * dvgd_eff_dvg; + } + Igd = T11 * T2 * T6; + dIgd_dVg = T11 * (T2 * dT6_dVg + T6 * dT2_dVg); + dIgd_dVd = -dIgd_dVg; + + here->BSIM4V4Igs = Igs; + here->BSIM4V4gIgsg = dIgs_dVg; + here->BSIM4V4gIgss = dIgs_dVs; + here->BSIM4V4Igd = Igd; + here->BSIM4V4gIgdg = dIgd_dVg; + here->BSIM4V4gIgdd = dIgd_dVd; + } + else + { here->BSIM4V4Igcs = here->BSIM4V4gIgcsg = here->BSIM4V4gIgcsd + = here->BSIM4V4gIgcsb = 0.0; + here->BSIM4V4Igcd = here->BSIM4V4gIgcdg = here->BSIM4V4gIgcdd + = here->BSIM4V4gIgcdb = 0.0; + here->BSIM4V4Igs = here->BSIM4V4gIgsg = here->BSIM4V4gIgss = 0.0; + here->BSIM4V4Igd = here->BSIM4V4gIgdg = here->BSIM4V4gIgdd = 0.0; + } + + if (model->BSIM4V4igbMod) + { T0 = Vtm * pParam->BSIM4V4nigbacc; + T1 = -Vgs_eff + Vbseff + Vfb; + VxNVt = T1 / T0; + if (VxNVt > EXP_THRESHOLD) + { Vaux = T1; + dVaux_dVg = -dVgs_eff_dVg; + dVaux_dVb = 1.0; + } + else if (VxNVt < -EXP_THRESHOLD) + { Vaux = T0 * log(1.0 + MIN_EXP); + dVaux_dVg = dVaux_dVb = 0.0; + } + else + { ExpVxNVt = exp(VxNVt); + Vaux = T0 * log(1.0 + ExpVxNVt); + dVaux_dVb = ExpVxNVt / (1.0 + ExpVxNVt); + dVaux_dVg = -dVaux_dVb * dVgs_eff_dVg; + } + + T2 = (Vgs_eff - Vbseff) * Vaux; + dT2_dVg = dVgs_eff_dVg * Vaux + (Vgs_eff - Vbseff) * dVaux_dVg; + dT2_dVb = -Vaux + (Vgs_eff - Vbseff) * dVaux_dVb; + + T11 = 4.97232e-7 * pParam->BSIM4V4weff + * pParam->BSIM4V4leff * pParam->BSIM4V4ToxRatio; + T12 = -7.45669e11 * model->BSIM4V4toxe; + T3 = pParam->BSIM4V4aigbacc * pParam->BSIM4V4cigbacc + - pParam->BSIM4V4bigbacc; + T4 = pParam->BSIM4V4bigbacc * pParam->BSIM4V4cigbacc; + T5 = T12 * (pParam->BSIM4V4aigbacc + T3 * Voxacc + - T4 * Voxacc * Voxacc); + + if (T5 > EXP_THRESHOLD) + { T6 = MAX_EXP; + dT6_dVg = dT6_dVb = 0.0; + } + else if (T5 < -EXP_THRESHOLD) + { T6 = MIN_EXP; + dT6_dVg = dT6_dVb = 0.0; + } + else + { T6 = exp(T5); + dT6_dVg = T6 * T12 * (T3 - 2.0 * T4 * Voxacc); + dT6_dVb = dT6_dVg * dVoxacc_dVb; + dT6_dVg *= dVoxacc_dVg; + } + + Igbacc = T11 * T2 * T6; + dIgbacc_dVg = T11 * (T2 * dT6_dVg + T6 * dT2_dVg); + dIgbacc_dVb = T11 * (T2 * dT6_dVb + T6 * dT2_dVb); + + + T0 = Vtm * pParam->BSIM4V4nigbinv; + T1 = Voxdepinv - pParam->BSIM4V4eigbinv; + VxNVt = T1 / T0; + if (VxNVt > EXP_THRESHOLD) + { Vaux = T1; + dVaux_dVg = dVoxdepinv_dVg; + dVaux_dVd = dVoxdepinv_dVd; + dVaux_dVb = dVoxdepinv_dVb; + } + else if (VxNVt < -EXP_THRESHOLD) + { Vaux = T0 * log(1.0 + MIN_EXP); + dVaux_dVg = dVaux_dVd = dVaux_dVb = 0.0; + } + else + { ExpVxNVt = exp(VxNVt); + Vaux = T0 * log(1.0 + ExpVxNVt); + dVaux_dVg = ExpVxNVt / (1.0 + ExpVxNVt); + dVaux_dVd = dVaux_dVg * dVoxdepinv_dVd; + dVaux_dVb = dVaux_dVg * dVoxdepinv_dVb; + dVaux_dVg *= dVoxdepinv_dVg; + } + + T2 = (Vgs_eff - Vbseff) * Vaux; + dT2_dVg = dVgs_eff_dVg * Vaux + (Vgs_eff - Vbseff) * dVaux_dVg; + dT2_dVd = (Vgs_eff - Vbseff) * dVaux_dVd; + dT2_dVb = -Vaux + (Vgs_eff - Vbseff) * dVaux_dVb; + + T11 *= 0.75610; + T12 *= 1.31724; + T3 = pParam->BSIM4V4aigbinv * pParam->BSIM4V4cigbinv + - pParam->BSIM4V4bigbinv; + T4 = pParam->BSIM4V4bigbinv * pParam->BSIM4V4cigbinv; + T5 = T12 * (pParam->BSIM4V4aigbinv + T3 * Voxdepinv + - T4 * Voxdepinv * Voxdepinv); + + if (T5 > EXP_THRESHOLD) + { T6 = MAX_EXP; + dT6_dVg = dT6_dVd = dT6_dVb = 0.0; + } + else if (T5 < -EXP_THRESHOLD) + { T6 = MIN_EXP; + dT6_dVg = dT6_dVd = dT6_dVb = 0.0; + } + else + { T6 = exp(T5); + dT6_dVg = T6 * T12 * (T3 - 2.0 * T4 * Voxdepinv); + dT6_dVd = dT6_dVg * dVoxdepinv_dVd; + dT6_dVb = dT6_dVg * dVoxdepinv_dVb; + dT6_dVg *= dVoxdepinv_dVg; + } + + Igbinv = T11 * T2 * T6; + dIgbinv_dVg = T11 * (T2 * dT6_dVg + T6 * dT2_dVg); + dIgbinv_dVd = T11 * (T2 * dT6_dVd + T6 * dT2_dVd); + dIgbinv_dVb = T11 * (T2 * dT6_dVb + T6 * dT2_dVb); + + here->BSIM4V4Igb = Igbinv + Igbacc; + here->BSIM4V4gIgbg = dIgbinv_dVg + dIgbacc_dVg; + here->BSIM4V4gIgbd = dIgbinv_dVd; + here->BSIM4V4gIgbb = (dIgbinv_dVb + dIgbacc_dVb) * dVbseff_dVb; + } + else + { here->BSIM4V4Igb = here->BSIM4V4gIgbg = here->BSIM4V4gIgbd + = here->BSIM4V4gIgbs = here->BSIM4V4gIgbb = 0.0; + } /* End of Gate current */ + + if (here->BSIM4V4nf != 1.0) + { cdrain *= here->BSIM4V4nf; + here->BSIM4V4gds *= here->BSIM4V4nf; + here->BSIM4V4gm *= here->BSIM4V4nf; + here->BSIM4V4gmbs *= here->BSIM4V4nf; + here->BSIM4V4IdovVds *= here->BSIM4V4nf; + + here->BSIM4V4gbbs *= here->BSIM4V4nf; + here->BSIM4V4gbgs *= here->BSIM4V4nf; + here->BSIM4V4gbds *= here->BSIM4V4nf; + here->BSIM4V4csub *= here->BSIM4V4nf; + + here->BSIM4V4Igidl *= here->BSIM4V4nf; + here->BSIM4V4ggidld *= here->BSIM4V4nf; + here->BSIM4V4ggidlg *= here->BSIM4V4nf; + here->BSIM4V4ggidlb *= here->BSIM4V4nf; + + here->BSIM4V4Igisl *= here->BSIM4V4nf; + here->BSIM4V4ggisls *= here->BSIM4V4nf; + here->BSIM4V4ggislg *= here->BSIM4V4nf; + here->BSIM4V4ggislb *= here->BSIM4V4nf; + + here->BSIM4V4Igcs *= here->BSIM4V4nf; + here->BSIM4V4gIgcsg *= here->BSIM4V4nf; + here->BSIM4V4gIgcsd *= here->BSIM4V4nf; + here->BSIM4V4gIgcsb *= here->BSIM4V4nf; + here->BSIM4V4Igcd *= here->BSIM4V4nf; + here->BSIM4V4gIgcdg *= here->BSIM4V4nf; + here->BSIM4V4gIgcdd *= here->BSIM4V4nf; + here->BSIM4V4gIgcdb *= here->BSIM4V4nf; + + here->BSIM4V4Igs *= here->BSIM4V4nf; + here->BSIM4V4gIgsg *= here->BSIM4V4nf; + here->BSIM4V4gIgss *= here->BSIM4V4nf; + here->BSIM4V4Igd *= here->BSIM4V4nf; + here->BSIM4V4gIgdg *= here->BSIM4V4nf; + here->BSIM4V4gIgdd *= here->BSIM4V4nf; + + here->BSIM4V4Igb *= here->BSIM4V4nf; + here->BSIM4V4gIgbg *= here->BSIM4V4nf; + here->BSIM4V4gIgbd *= here->BSIM4V4nf; + here->BSIM4V4gIgbb *= here->BSIM4V4nf; + } + + here->BSIM4V4ggidls = -(here->BSIM4V4ggidld + here->BSIM4V4ggidlg + + here->BSIM4V4ggidlb); + here->BSIM4V4ggisld = -(here->BSIM4V4ggisls + here->BSIM4V4ggislg + + here->BSIM4V4ggislb); + here->BSIM4V4gIgbs = -(here->BSIM4V4gIgbg + here->BSIM4V4gIgbd + + here->BSIM4V4gIgbb); + here->BSIM4V4gIgcss = -(here->BSIM4V4gIgcsg + here->BSIM4V4gIgcsd + + here->BSIM4V4gIgcsb); + here->BSIM4V4gIgcds = -(here->BSIM4V4gIgcdg + here->BSIM4V4gIgcdd + + here->BSIM4V4gIgcdb); + here->BSIM4V4cd = cdrain; + + + if (model->BSIM4V4tnoiMod == 0) + { Abulk = Abulk0 * pParam->BSIM4V4abulkCVfactor; + Vdsat = Vgsteff / Abulk; + T0 = Vdsat - Vds - DELTA_4; + T1 = sqrt(T0 * T0 + 4.0 * DELTA_4 * Vdsat); + if (T0 >= 0.0) + Vdseff = Vdsat - 0.5 * (T0 + T1); + else + { T3 = (DELTA_4 + DELTA_4) / (T1 - T0); + T4 = 1.0 - T3; + T5 = Vdsat * T3 / (T1 - T0); + Vdseff = Vdsat * T4; + } + if (Vds == 0.0) + Vdseff = 0.0; + + T0 = Abulk * Vdseff; + T1 = 12.0 * (Vgsteff - 0.5 * T0 + 1.0e-20); + T2 = Vdseff / T1; + T3 = T0 * T2; + here->BSIM4V4qinv = Coxeff * pParam->BSIM4V4weffCV * here->BSIM4V4nf + * pParam->BSIM4V4leffCV + * (Vgsteff - 0.5 * T0 + Abulk * T3); + } + + /* + * BSIM4V4 C-V begins + */ + + if ((model->BSIM4V4xpart < 0) || (!ChargeComputationNeeded)) + { qgate = qdrn = qsrc = qbulk = 0.0; + here->BSIM4V4cggb = here->BSIM4V4cgsb = here->BSIM4V4cgdb = 0.0; + here->BSIM4V4cdgb = here->BSIM4V4cdsb = here->BSIM4V4cddb = 0.0; + here->BSIM4V4cbgb = here->BSIM4V4cbsb = here->BSIM4V4cbdb = 0.0; + here->BSIM4V4csgb = here->BSIM4V4cssb = here->BSIM4V4csdb = 0.0; + here->BSIM4V4cgbb = here->BSIM4V4csbb = here->BSIM4V4cdbb = here->BSIM4V4cbbb = 0.0; + here->BSIM4V4cqdb = here->BSIM4V4cqsb = here->BSIM4V4cqgb + = here->BSIM4V4cqbb = 0.0; + here->BSIM4V4gtau = 0.0; + goto finished; + } + else if (model->BSIM4V4capMod == 0) + { + if (Vbseff < 0.0) + { Vbseff = Vbs; + dVbseff_dVb = 1.0; + } + else + { Vbseff = pParam->BSIM4V4phi - Phis; + dVbseff_dVb = -dPhis_dVb; + } + + Vfb = pParam->BSIM4V4vfbcv; + Vth = Vfb + pParam->BSIM4V4phi + pParam->BSIM4V4k1ox * sqrtPhis; + Vgst = Vgs_eff - Vth; + dVth_dVb = pParam->BSIM4V4k1ox * dsqrtPhis_dVb; + dVgst_dVb = -dVth_dVb; + dVgst_dVg = dVgs_eff_dVg; + + CoxWL = model->BSIM4V4coxe * pParam->BSIM4V4weffCV + * pParam->BSIM4V4leffCV * here->BSIM4V4nf; + Arg1 = Vgs_eff - Vbseff - Vfb; + + if (Arg1 <= 0.0) + { qgate = CoxWL * Arg1; + qbulk = -qgate; + qdrn = 0.0; + + here->BSIM4V4cggb = CoxWL * dVgs_eff_dVg; + here->BSIM4V4cgdb = 0.0; + here->BSIM4V4cgsb = CoxWL * (dVbseff_dVb - dVgs_eff_dVg); + + here->BSIM4V4cdgb = 0.0; + here->BSIM4V4cddb = 0.0; + here->BSIM4V4cdsb = 0.0; + + here->BSIM4V4cbgb = -CoxWL * dVgs_eff_dVg; + here->BSIM4V4cbdb = 0.0; + here->BSIM4V4cbsb = -here->BSIM4V4cgsb; + } /* Arg1 <= 0.0, end of accumulation */ + else if (Vgst <= 0.0) + { T1 = 0.5 * pParam->BSIM4V4k1ox; + T2 = sqrt(T1 * T1 + Arg1); + qgate = CoxWL * pParam->BSIM4V4k1ox * (T2 - T1); + qbulk = -qgate; + qdrn = 0.0; + + T0 = CoxWL * T1 / T2; + here->BSIM4V4cggb = T0 * dVgs_eff_dVg; + here->BSIM4V4cgdb = 0.0; + here->BSIM4V4cgsb = T0 * (dVbseff_dVb - dVgs_eff_dVg); + + here->BSIM4V4cdgb = 0.0; + here->BSIM4V4cddb = 0.0; + here->BSIM4V4cdsb = 0.0; + + here->BSIM4V4cbgb = -here->BSIM4V4cggb; + here->BSIM4V4cbdb = 0.0; + here->BSIM4V4cbsb = -here->BSIM4V4cgsb; + } /* Vgst <= 0.0, end of depletion */ + else + { One_Third_CoxWL = CoxWL / 3.0; + Two_Third_CoxWL = 2.0 * One_Third_CoxWL; + + AbulkCV = Abulk0 * pParam->BSIM4V4abulkCVfactor; + dAbulkCV_dVb = pParam->BSIM4V4abulkCVfactor * dAbulk0_dVb; + Vdsat = Vgst / AbulkCV; + dVdsat_dVg = dVgs_eff_dVg / AbulkCV; + dVdsat_dVb = - (Vdsat * dAbulkCV_dVb + dVth_dVb)/ AbulkCV; + + if (model->BSIM4V4xpart > 0.5) + { /* 0/100 Charge partition model */ + if (Vdsat <= Vds) + { /* saturation region */ + T1 = Vdsat / 3.0; + qgate = CoxWL * (Vgs_eff - Vfb + - pParam->BSIM4V4phi - T1); + T2 = -Two_Third_CoxWL * Vgst; + qbulk = -(qgate + T2); + qdrn = 0.0; + + here->BSIM4V4cggb = One_Third_CoxWL * (3.0 + - dVdsat_dVg) * dVgs_eff_dVg; + T2 = -One_Third_CoxWL * dVdsat_dVb; + here->BSIM4V4cgsb = -(here->BSIM4V4cggb + T2); + here->BSIM4V4cgdb = 0.0; + + here->BSIM4V4cdgb = 0.0; + here->BSIM4V4cddb = 0.0; + here->BSIM4V4cdsb = 0.0; + + here->BSIM4V4cbgb = -(here->BSIM4V4cggb + - Two_Third_CoxWL * dVgs_eff_dVg); + T3 = -(T2 + Two_Third_CoxWL * dVth_dVb); + here->BSIM4V4cbsb = -(here->BSIM4V4cbgb + T3); + here->BSIM4V4cbdb = 0.0; + } + else + { /* linear region */ + Alphaz = Vgst / Vdsat; + T1 = 2.0 * Vdsat - Vds; + T2 = Vds / (3.0 * T1); + T3 = T2 * Vds; + T9 = 0.25 * CoxWL; + T4 = T9 * Alphaz; + T7 = 2.0 * Vds - T1 - 3.0 * T3; + T8 = T3 - T1 - 2.0 * Vds; + qgate = CoxWL * (Vgs_eff - Vfb + - pParam->BSIM4V4phi - 0.5 * (Vds - T3)); + T10 = T4 * T8; + qdrn = T4 * T7; + qbulk = -(qgate + qdrn + T10); + + T5 = T3 / T1; + here->BSIM4V4cggb = CoxWL * (1.0 - T5 * dVdsat_dVg) + * dVgs_eff_dVg; + T11 = -CoxWL * T5 * dVdsat_dVb; + here->BSIM4V4cgdb = CoxWL * (T2 - 0.5 + 0.5 * T5); + here->BSIM4V4cgsb = -(here->BSIM4V4cggb + T11 + + here->BSIM4V4cgdb); + T6 = 1.0 / Vdsat; + dAlphaz_dVg = T6 * (1.0 - Alphaz * dVdsat_dVg); + dAlphaz_dVb = -T6 * (dVth_dVb + Alphaz * dVdsat_dVb); + T7 = T9 * T7; + T8 = T9 * T8; + T9 = 2.0 * T4 * (1.0 - 3.0 * T5); + here->BSIM4V4cdgb = (T7 * dAlphaz_dVg - T9 + * dVdsat_dVg) * dVgs_eff_dVg; + T12 = T7 * dAlphaz_dVb - T9 * dVdsat_dVb; + here->BSIM4V4cddb = T4 * (3.0 - 6.0 * T2 - 3.0 * T5); + here->BSIM4V4cdsb = -(here->BSIM4V4cdgb + T12 + + here->BSIM4V4cddb); + + T9 = 2.0 * T4 * (1.0 + T5); + T10 = (T8 * dAlphaz_dVg - T9 * dVdsat_dVg) + * dVgs_eff_dVg; + T11 = T8 * dAlphaz_dVb - T9 * dVdsat_dVb; + T12 = T4 * (2.0 * T2 + T5 - 1.0); + T0 = -(T10 + T11 + T12); + + here->BSIM4V4cbgb = -(here->BSIM4V4cggb + + here->BSIM4V4cdgb + T10); + here->BSIM4V4cbdb = -(here->BSIM4V4cgdb + + here->BSIM4V4cddb + T12); + here->BSIM4V4cbsb = -(here->BSIM4V4cgsb + + here->BSIM4V4cdsb + T0); + } + } + else if (model->BSIM4V4xpart < 0.5) + { /* 40/60 Charge partition model */ + if (Vds >= Vdsat) + { /* saturation region */ + T1 = Vdsat / 3.0; + qgate = CoxWL * (Vgs_eff - Vfb + - pParam->BSIM4V4phi - T1); + T2 = -Two_Third_CoxWL * Vgst; + qbulk = -(qgate + T2); + qdrn = 0.4 * T2; + + here->BSIM4V4cggb = One_Third_CoxWL * (3.0 + - dVdsat_dVg) * dVgs_eff_dVg; + T2 = -One_Third_CoxWL * dVdsat_dVb; + here->BSIM4V4cgsb = -(here->BSIM4V4cggb + T2); + here->BSIM4V4cgdb = 0.0; + + T3 = 0.4 * Two_Third_CoxWL; + here->BSIM4V4cdgb = -T3 * dVgs_eff_dVg; + here->BSIM4V4cddb = 0.0; + T4 = T3 * dVth_dVb; + here->BSIM4V4cdsb = -(T4 + here->BSIM4V4cdgb); + + here->BSIM4V4cbgb = -(here->BSIM4V4cggb + - Two_Third_CoxWL * dVgs_eff_dVg); + T3 = -(T2 + Two_Third_CoxWL * dVth_dVb); + here->BSIM4V4cbsb = -(here->BSIM4V4cbgb + T3); + here->BSIM4V4cbdb = 0.0; + } + else + { /* linear region */ + Alphaz = Vgst / Vdsat; + T1 = 2.0 * Vdsat - Vds; + T2 = Vds / (3.0 * T1); + T3 = T2 * Vds; + T9 = 0.25 * CoxWL; + T4 = T9 * Alphaz; + qgate = CoxWL * (Vgs_eff - Vfb - pParam->BSIM4V4phi + - 0.5 * (Vds - T3)); + + T5 = T3 / T1; + here->BSIM4V4cggb = CoxWL * (1.0 - T5 * dVdsat_dVg) + * dVgs_eff_dVg; + tmp = -CoxWL * T5 * dVdsat_dVb; + here->BSIM4V4cgdb = CoxWL * (T2 - 0.5 + 0.5 * T5); + here->BSIM4V4cgsb = -(here->BSIM4V4cggb + + here->BSIM4V4cgdb + tmp); + + T6 = 1.0 / Vdsat; + dAlphaz_dVg = T6 * (1.0 - Alphaz * dVdsat_dVg); + dAlphaz_dVb = -T6 * (dVth_dVb + Alphaz * dVdsat_dVb); + + T6 = 8.0 * Vdsat * Vdsat - 6.0 * Vdsat * Vds + + 1.2 * Vds * Vds; + T8 = T2 / T1; + T7 = Vds - T1 - T8 * T6; + qdrn = T4 * T7; + T7 *= T9; + tmp = T8 / T1; + tmp1 = T4 * (2.0 - 4.0 * tmp * T6 + + T8 * (16.0 * Vdsat - 6.0 * Vds)); + + here->BSIM4V4cdgb = (T7 * dAlphaz_dVg - tmp1 + * dVdsat_dVg) * dVgs_eff_dVg; + T10 = T7 * dAlphaz_dVb - tmp1 * dVdsat_dVb; + here->BSIM4V4cddb = T4 * (2.0 - (1.0 / (3.0 * T1 + * T1) + 2.0 * tmp) * T6 + T8 + * (6.0 * Vdsat - 2.4 * Vds)); + here->BSIM4V4cdsb = -(here->BSIM4V4cdgb + + T10 + here->BSIM4V4cddb); + + T7 = 2.0 * (T1 + T3); + qbulk = -(qgate - T4 * T7); + T7 *= T9; + T0 = 4.0 * T4 * (1.0 - T5); + T12 = (-T7 * dAlphaz_dVg - here->BSIM4V4cdgb + - T0 * dVdsat_dVg) * dVgs_eff_dVg; + T11 = -T7 * dAlphaz_dVb - T10 - T0 * dVdsat_dVb; + T10 = -4.0 * T4 * (T2 - 0.5 + 0.5 * T5) + - here->BSIM4V4cddb; + tmp = -(T10 + T11 + T12); + + here->BSIM4V4cbgb = -(here->BSIM4V4cggb + + here->BSIM4V4cdgb + T12); + here->BSIM4V4cbdb = -(here->BSIM4V4cgdb + + here->BSIM4V4cddb + T10); + here->BSIM4V4cbsb = -(here->BSIM4V4cgsb + + here->BSIM4V4cdsb + tmp); + } + } + else + { /* 50/50 partitioning */ + if (Vds >= Vdsat) + { /* saturation region */ + T1 = Vdsat / 3.0; + qgate = CoxWL * (Vgs_eff - Vfb + - pParam->BSIM4V4phi - T1); + T2 = -Two_Third_CoxWL * Vgst; + qbulk = -(qgate + T2); + qdrn = 0.5 * T2; + + here->BSIM4V4cggb = One_Third_CoxWL * (3.0 + - dVdsat_dVg) * dVgs_eff_dVg; + T2 = -One_Third_CoxWL * dVdsat_dVb; + here->BSIM4V4cgsb = -(here->BSIM4V4cggb + T2); + here->BSIM4V4cgdb = 0.0; + + here->BSIM4V4cdgb = -One_Third_CoxWL * dVgs_eff_dVg; + here->BSIM4V4cddb = 0.0; + T4 = One_Third_CoxWL * dVth_dVb; + here->BSIM4V4cdsb = -(T4 + here->BSIM4V4cdgb); + + here->BSIM4V4cbgb = -(here->BSIM4V4cggb + - Two_Third_CoxWL * dVgs_eff_dVg); + T3 = -(T2 + Two_Third_CoxWL * dVth_dVb); + here->BSIM4V4cbsb = -(here->BSIM4V4cbgb + T3); + here->BSIM4V4cbdb = 0.0; + } + else + { /* linear region */ + Alphaz = Vgst / Vdsat; + T1 = 2.0 * Vdsat - Vds; + T2 = Vds / (3.0 * T1); + T3 = T2 * Vds; + T9 = 0.25 * CoxWL; + T4 = T9 * Alphaz; + qgate = CoxWL * (Vgs_eff - Vfb - pParam->BSIM4V4phi + - 0.5 * (Vds - T3)); + + T5 = T3 / T1; + here->BSIM4V4cggb = CoxWL * (1.0 - T5 * dVdsat_dVg) + * dVgs_eff_dVg; + tmp = -CoxWL * T5 * dVdsat_dVb; + here->BSIM4V4cgdb = CoxWL * (T2 - 0.5 + 0.5 * T5); + here->BSIM4V4cgsb = -(here->BSIM4V4cggb + + here->BSIM4V4cgdb + tmp); + + T6 = 1.0 / Vdsat; + dAlphaz_dVg = T6 * (1.0 - Alphaz * dVdsat_dVg); + dAlphaz_dVb = -T6 * (dVth_dVb + Alphaz * dVdsat_dVb); + + T7 = T1 + T3; + qdrn = -T4 * T7; + qbulk = - (qgate + qdrn + qdrn); + T7 *= T9; + T0 = T4 * (2.0 * T5 - 2.0); + + here->BSIM4V4cdgb = (T0 * dVdsat_dVg - T7 + * dAlphaz_dVg) * dVgs_eff_dVg; + T12 = T0 * dVdsat_dVb - T7 * dAlphaz_dVb; + here->BSIM4V4cddb = T4 * (1.0 - 2.0 * T2 - T5); + here->BSIM4V4cdsb = -(here->BSIM4V4cdgb + T12 + + here->BSIM4V4cddb); + + here->BSIM4V4cbgb = -(here->BSIM4V4cggb + + 2.0 * here->BSIM4V4cdgb); + here->BSIM4V4cbdb = -(here->BSIM4V4cgdb + + 2.0 * here->BSIM4V4cddb); + here->BSIM4V4cbsb = -(here->BSIM4V4cgsb + + 2.0 * here->BSIM4V4cdsb); + } /* end of linear region */ + } /* end of 50/50 partition */ + } /* end of inversion */ + } /* end of capMod=0 */ + else + { if (Vbseff < 0.0) + { VbseffCV = Vbseff; + dVbseffCV_dVb = 1.0; + } + else + { VbseffCV = pParam->BSIM4V4phi - Phis; + dVbseffCV_dVb = -dPhis_dVb; + } + + CoxWL = model->BSIM4V4coxe * pParam->BSIM4V4weffCV + * pParam->BSIM4V4leffCV * here->BSIM4V4nf; + + /* Seperate VgsteffCV with noff and voffcv */ + noff = n * pParam->BSIM4V4noff; + dnoff_dVd = pParam->BSIM4V4noff * dn_dVd; + dnoff_dVb = pParam->BSIM4V4noff * dn_dVb; + T0 = Vtm * noff; + voffcv = pParam->BSIM4V4voffcv; + VgstNVt = (Vgst - voffcv) / T0; + + if (VgstNVt > EXP_THRESHOLD) + { Vgsteff = Vgst - voffcv; + dVgsteff_dVg = dVgs_eff_dVg; + dVgsteff_dVd = -dVth_dVd; + dVgsteff_dVb = -dVth_dVb; + } + else if (VgstNVt < -EXP_THRESHOLD) + { Vgsteff = T0 * log(1.0 + MIN_EXP); + dVgsteff_dVg = 0.0; + dVgsteff_dVd = Vgsteff / noff; + dVgsteff_dVb = dVgsteff_dVd * dnoff_dVb; + dVgsteff_dVd *= dnoff_dVd; + } + else + { ExpVgst = exp(VgstNVt); + Vgsteff = T0 * log(1.0 + ExpVgst); + dVgsteff_dVg = ExpVgst / (1.0 + ExpVgst); + dVgsteff_dVd = -dVgsteff_dVg * (dVth_dVd + (Vgst - voffcv) + / noff * dnoff_dVd) + Vgsteff / noff * dnoff_dVd; + dVgsteff_dVb = -dVgsteff_dVg * (dVth_dVb + (Vgst - voffcv) + / noff * dnoff_dVb) + Vgsteff / noff * dnoff_dVb; + dVgsteff_dVg *= dVgs_eff_dVg; + } /* End of VgsteffCV */ + + + if (model->BSIM4V4capMod == 1) + { Vfb = here->BSIM4V4vfbzb; + V3 = Vfb - Vgs_eff + VbseffCV - DELTA_3; + if (Vfb <= 0.0) + T0 = sqrt(V3 * V3 - 4.0 * DELTA_3 * Vfb); + else + T0 = sqrt(V3 * V3 + 4.0 * DELTA_3 * Vfb); + + T1 = 0.5 * (1.0 + V3 / T0); + Vfbeff = Vfb - 0.5 * (V3 + T0); + dVfbeff_dVg = T1 * dVgs_eff_dVg; + dVfbeff_dVb = -T1 * dVbseffCV_dVb; + Qac0 = CoxWL * (Vfbeff - Vfb); + dQac0_dVg = CoxWL * dVfbeff_dVg; + dQac0_dVb = CoxWL * dVfbeff_dVb; + + T0 = 0.5 * pParam->BSIM4V4k1ox; + T3 = Vgs_eff - Vfbeff - VbseffCV - Vgsteff; + if (pParam->BSIM4V4k1ox == 0.0) + { T1 = 0.0; + T2 = 0.0; + } + else if (T3 < 0.0) + { T1 = T0 + T3 / pParam->BSIM4V4k1ox; + T2 = CoxWL; + } + else + { T1 = sqrt(T0 * T0 + T3); + T2 = CoxWL * T0 / T1; + } + + Qsub0 = CoxWL * pParam->BSIM4V4k1ox * (T1 - T0); + + dQsub0_dVg = T2 * (dVgs_eff_dVg - dVfbeff_dVg - dVgsteff_dVg); + dQsub0_dVd = -T2 * dVgsteff_dVd; + dQsub0_dVb = -T2 * (dVfbeff_dVb + dVbseffCV_dVb + + dVgsteff_dVb); + + AbulkCV = Abulk0 * pParam->BSIM4V4abulkCVfactor; + dAbulkCV_dVb = pParam->BSIM4V4abulkCVfactor * dAbulk0_dVb; + VdsatCV = Vgsteff / AbulkCV; + + T0 = VdsatCV - Vds - DELTA_4; + dT0_dVg = 1.0 / AbulkCV; + dT0_dVb = -VdsatCV * dAbulkCV_dVb / AbulkCV; + T1 = sqrt(T0 * T0 + 4.0 * DELTA_4 * VdsatCV); + dT1_dVg = (T0 + DELTA_4 + DELTA_4) / T1; + dT1_dVd = -T0 / T1; + dT1_dVb = dT1_dVg * dT0_dVb; + dT1_dVg *= dT0_dVg; + if (T0 >= 0.0) + { VdseffCV = VdsatCV - 0.5 * (T0 + T1); + dVdseffCV_dVg = 0.5 * (dT0_dVg - dT1_dVg); + dVdseffCV_dVd = 0.5 * (1.0 - dT1_dVd); + dVdseffCV_dVb = 0.5 * (dT0_dVb - dT1_dVb); + } + else + { T3 = (DELTA_4 + DELTA_4) / (T1 - T0); + T4 = 1.0 - T3; + T5 = VdsatCV * T3 / (T1 - T0); + VdseffCV = VdsatCV * T4; + dVdseffCV_dVg = dT0_dVg * T4 + T5 * (dT1_dVg - dT0_dVg); + dVdseffCV_dVd = T5 * (dT1_dVd + 1.0); + dVdseffCV_dVb = dT0_dVb * (1.0 - T5) + T5 * dT1_dVb; + } + + if (Vds == 0.0) + { VdseffCV = 0.0; + dVdseffCV_dVg = 0.0; + dVdseffCV_dVb = 0.0; + } + + T0 = AbulkCV * VdseffCV; + T1 = 12.0 * (Vgsteff - 0.5 * T0 + 1.0e-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->BSIM4V4xpart > 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->BSIM4V4xpart < 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 = dQsub0_dVd + Cgd1; + Cgb = dQac0_dVb + dQsub0_dVb + Cgb1; + + Cbg = Cbg1 - dQac0_dVg - dQsub0_dVg; + Cbd = Cbd1 - dQsub0_dVd; + Cbb = Cbb1 - dQac0_dVb - dQsub0_dVb; + + Cgb *= dVbseff_dVb; + Cbb *= dVbseff_dVb; + Csb *= dVbseff_dVb; + + here->BSIM4V4cggb = Cgg; + here->BSIM4V4cgsb = -(Cgg + Cgd + Cgb); + here->BSIM4V4cgdb = Cgd; + here->BSIM4V4cdgb = -(Cgg + Cbg + Csg); + here->BSIM4V4cdsb = (Cgg + Cgd + Cgb + Cbg + Cbd + Cbb + + Csg + Csd + Csb); + here->BSIM4V4cddb = -(Cgd + Cbd + Csd); + here->BSIM4V4cbgb = Cbg; + here->BSIM4V4cbsb = -(Cbg + Cbd + Cbb); + here->BSIM4V4cbdb = Cbd; + } + + /* Charge-Thickness capMod (CTM) begins */ + else if (model->BSIM4V4capMod == 2) + { V3 = here->BSIM4V4vfbzb - Vgs_eff + VbseffCV - DELTA_3; + if (here->BSIM4V4vfbzb <= 0.0) + T0 = sqrt(V3 * V3 - 4.0 * DELTA_3 * here->BSIM4V4vfbzb); + else + T0 = sqrt(V3 * V3 + 4.0 * DELTA_3 * here->BSIM4V4vfbzb); + + T1 = 0.5 * (1.0 + V3 / T0); + Vfbeff = here->BSIM4V4vfbzb - 0.5 * (V3 + T0); + dVfbeff_dVg = T1 * dVgs_eff_dVg; + dVfbeff_dVb = -T1 * dVbseffCV_dVb; + + Cox = model->BSIM4V4coxp; + Tox = 1.0e8 * model->BSIM4V4toxp; + T0 = (Vgs_eff - VbseffCV - here->BSIM4V4vfbzb) / Tox; + dT0_dVg = dVgs_eff_dVg / Tox; + dT0_dVb = -dVbseffCV_dVb / Tox; + + tmp = T0 * pParam->BSIM4V4acde; + if ((-EXP_THRESHOLD < tmp) && (tmp < EXP_THRESHOLD)) + { Tcen = pParam->BSIM4V4ldeb * exp(tmp); + dTcen_dVg = pParam->BSIM4V4acde * Tcen; + dTcen_dVb = dTcen_dVg * dT0_dVb; + dTcen_dVg *= dT0_dVg; + } + else if (tmp <= -EXP_THRESHOLD) + { Tcen = pParam->BSIM4V4ldeb * MIN_EXP; + dTcen_dVg = dTcen_dVb = 0.0; + } + else + { Tcen = pParam->BSIM4V4ldeb * MAX_EXP; + dTcen_dVg = dTcen_dVb = 0.0; + } + + LINK = 1.0e-3 * model->BSIM4V4toxp; + V3 = pParam->BSIM4V4ldeb - Tcen - LINK; + V4 = sqrt(V3 * V3 + 4.0 * LINK * pParam->BSIM4V4ldeb); + Tcen = pParam->BSIM4V4ldeb - 0.5 * (V3 + V4); + T1 = 0.5 * (1.0 + V3 / V4); + dTcen_dVg *= T1; + dTcen_dVb *= T1; + + Ccen = EPSSI / Tcen; + T2 = Cox / (Cox + Ccen); + Coxeff = T2 * Ccen; + T3 = -Ccen / Tcen; + dCoxeff_dVg = T2 * T2 * T3; + dCoxeff_dVb = dCoxeff_dVg * dTcen_dVb; + dCoxeff_dVg *= dTcen_dVg; + CoxWLcen = CoxWL * Coxeff / model->BSIM4V4coxe; + + Qac0 = CoxWLcen * (Vfbeff - here->BSIM4V4vfbzb); + QovCox = Qac0 / Coxeff; + dQac0_dVg = CoxWLcen * dVfbeff_dVg + + QovCox * dCoxeff_dVg; + dQac0_dVb = CoxWLcen * dVfbeff_dVb + + QovCox * dCoxeff_dVb; + + T0 = 0.5 * pParam->BSIM4V4k1ox; + T3 = Vgs_eff - Vfbeff - VbseffCV - Vgsteff; + if (pParam->BSIM4V4k1ox == 0.0) + { T1 = 0.0; + T2 = 0.0; + } + else if (T3 < 0.0) + { T1 = T0 + T3 / pParam->BSIM4V4k1ox; + T2 = CoxWLcen; + } + else + { T1 = sqrt(T0 * T0 + T3); + T2 = CoxWLcen * T0 / T1; + } + + Qsub0 = CoxWLcen * pParam->BSIM4V4k1ox * (T1 - T0); + QovCox = Qsub0 / Coxeff; + dQsub0_dVg = T2 * (dVgs_eff_dVg - dVfbeff_dVg - dVgsteff_dVg) + + QovCox * dCoxeff_dVg; + dQsub0_dVd = -T2 * dVgsteff_dVd; + dQsub0_dVb = -T2 * (dVfbeff_dVb + dVbseffCV_dVb + dVgsteff_dVb) + + QovCox * dCoxeff_dVb; + + /* Gate-bias dependent delta Phis begins */ + if (pParam->BSIM4V4k1ox <= 0.0) + { Denomi = 0.25 * pParam->BSIM4V4moin * Vtm; + T0 = 0.5 * pParam->BSIM4V4sqrtPhi; + } + else + { Denomi = pParam->BSIM4V4moin * Vtm + * pParam->BSIM4V4k1ox * pParam->BSIM4V4k1ox; + T0 = pParam->BSIM4V4k1ox * pParam->BSIM4V4sqrtPhi; + } + T1 = 2.0 * T0 + Vgsteff; + + DeltaPhi = Vtm * log(1.0 + T1 * Vgsteff / Denomi); + dDeltaPhi_dVg = 2.0 * Vtm * (T1 -T0) / (Denomi + T1 * Vgsteff); + /* End of delta Phis */ + + Tox += Tox; /* WDLiu: Tcen reevaluated below due to different Vgsteff */ + T0 = (Vgsteff + here->BSIM4V4vtfbphi2) / Tox; + tmp = exp(0.7 * log(T0)); + T1 = 1.0 + tmp; + T2 = 0.7 * tmp / (T0 * Tox); + Tcen = 1.9e-9 / T1; + dTcen_dVg = -Tcen * T2 / T1; + dTcen_dVd = dTcen_dVg * dVgsteff_dVd; + dTcen_dVb = dTcen_dVg * dVgsteff_dVb; + dTcen_dVg *= dVgsteff_dVg; + + Ccen = EPSSI / Tcen; + T0 = Cox / (Cox + Ccen); + Coxeff = T0 * Ccen; + T1 = -Ccen / Tcen; + dCoxeff_dVg = T0 * T0 * T1; + dCoxeff_dVd = dCoxeff_dVg * dTcen_dVd; + dCoxeff_dVb = dCoxeff_dVg * dTcen_dVb; + dCoxeff_dVg *= dTcen_dVg; + CoxWLcen = CoxWL * Coxeff / model->BSIM4V4coxe; + + AbulkCV = Abulk0 * pParam->BSIM4V4abulkCVfactor; + dAbulkCV_dVb = pParam->BSIM4V4abulkCVfactor * dAbulk0_dVb; + VdsatCV = (Vgsteff - DeltaPhi) / AbulkCV; + + T0 = VdsatCV - Vds - DELTA_4; + dT0_dVg = (1.0 - dDeltaPhi_dVg) / AbulkCV; + dT0_dVb = -VdsatCV * dAbulkCV_dVb / AbulkCV; + T1 = sqrt(T0 * T0 + 4.0 * DELTA_4 * VdsatCV); + dT1_dVg = (T0 + DELTA_4 + DELTA_4) / T1; + dT1_dVd = -T0 / T1; + dT1_dVb = dT1_dVg * dT0_dVb; + dT1_dVg *= dT0_dVg; + if (T0 >= 0.0) + { VdseffCV = VdsatCV - 0.5 * (T0 + T1); + dVdseffCV_dVg = 0.5 * (dT0_dVg - dT1_dVg); + dVdseffCV_dVd = 0.5 * (1.0 - dT1_dVd); + dVdseffCV_dVb = 0.5 * (dT0_dVb - dT1_dVb); + } + else + { T3 = (DELTA_4 + DELTA_4) / (T1 - T0); + T4 = 1.0 - T3; + T5 = VdsatCV * T3 / (T1 - T0); + VdseffCV = VdsatCV * T4; + dVdseffCV_dVg = dT0_dVg * T4 + T5 * (dT1_dVg - dT0_dVg); + dVdseffCV_dVd = T5 * (dT1_dVd + 1.0); + dVdseffCV_dVb = dT0_dVb * (1.0 - T5) + T5 * dT1_dVb; + } + + if (Vds == 0.0) + { VdseffCV = 0.0; + dVdseffCV_dVg = 0.0; + dVdseffCV_dVb = 0.0; + } + + T0 = AbulkCV * VdseffCV; + T1 = Vgsteff - DeltaPhi; + T2 = 12.0 * (T1 - 0.5 * T0 + 1.0e-20); + T3 = T0 / T2; + T4 = 1.0 - 12.0 * T3 * T3; + T5 = AbulkCV * (6.0 * T0 * (4.0 * T1 - T0) / (T2 * T2) - 0.5); + T6 = T5 * VdseffCV / AbulkCV; + + qgate = CoxWLcen * (T1 - T0 * (0.5 - T3)); + QovCox = qgate / Coxeff; + Cgg1 = CoxWLcen * (T4 * (1.0 - dDeltaPhi_dVg) + + T5 * dVdseffCV_dVg); + Cgd1 = CoxWLcen * T5 * dVdseffCV_dVd + Cgg1 + * dVgsteff_dVd + QovCox * dCoxeff_dVd; + Cgb1 = CoxWLcen * (T5 * dVdseffCV_dVb + T6 * dAbulkCV_dVb) + + Cgg1 * dVgsteff_dVb + QovCox * dCoxeff_dVb; + Cgg1 = Cgg1 * dVgsteff_dVg + QovCox * dCoxeff_dVg; + + + T7 = 1.0 - AbulkCV; + T8 = T2 * T2; + T9 = 12.0 * T7 * T0 * T0 / (T8 * AbulkCV); + T10 = T9 * (1.0 - dDeltaPhi_dVg); + T11 = -T7 * T5 / AbulkCV; + T12 = -(T9 * T1 / AbulkCV + VdseffCV * (0.5 - T0 / T2)); + + qbulk = CoxWLcen * T7 * (0.5 * VdseffCV - T0 * VdseffCV / T2); + QovCox = qbulk / Coxeff; + Cbg1 = CoxWLcen * (T10 + T11 * dVdseffCV_dVg); + Cbd1 = CoxWLcen * T11 * dVdseffCV_dVd + Cbg1 + * dVgsteff_dVd + QovCox * dCoxeff_dVd; + Cbb1 = CoxWLcen * (T11 * dVdseffCV_dVb + T12 * dAbulkCV_dVb) + + Cbg1 * dVgsteff_dVb + QovCox * dCoxeff_dVb; + Cbg1 = Cbg1 * dVgsteff_dVg + QovCox * dCoxeff_dVg; + + if (model->BSIM4V4xpart > 0.5) + { /* 0/100 partition */ + qsrc = -CoxWLcen * (T1 / 2.0 + T0 / 4.0 + - 0.5 * T0 * T0 / T2); + QovCox = qsrc / Coxeff; + T2 += T2; + T3 = T2 * T2; + T7 = -(0.25 - 12.0 * T0 * (4.0 * T1 - T0) / T3); + T4 = -(0.5 + 24.0 * T0 * T0 / T3) * (1.0 - dDeltaPhi_dVg); + T5 = T7 * AbulkCV; + T6 = T7 * VdseffCV; + + Csg = CoxWLcen * (T4 + T5 * dVdseffCV_dVg); + Csd = CoxWLcen * T5 * dVdseffCV_dVd + Csg * dVgsteff_dVd + + QovCox * dCoxeff_dVd; + Csb = CoxWLcen * (T5 * dVdseffCV_dVb + T6 * dAbulkCV_dVb) + + Csg * dVgsteff_dVb + QovCox * dCoxeff_dVb; + Csg = Csg * dVgsteff_dVg + QovCox * dCoxeff_dVg; + } + else if (model->BSIM4V4xpart < 0.5) + { /* 40/60 partition */ + T2 = T2 / 12.0; + T3 = 0.5 * CoxWLcen / (T2 * T2); + T4 = T1 * (2.0 * T0 * T0 / 3.0 + T1 * (T1 - 4.0 + * T0 / 3.0)) - 2.0 * T0 * T0 * T0 / 15.0; + qsrc = -T3 * T4; + QovCox = qsrc / Coxeff; + T8 = 4.0 / 3.0 * T1 * (T1 - T0) + 0.4 * T0 * T0; + T5 = -2.0 * qsrc / T2 - T3 * (T1 * (3.0 * T1 - 8.0 + * T0 / 3.0) + 2.0 * T0 * T0 / 3.0); + T6 = AbulkCV * (qsrc / T2 + T3 * T8); + T7 = T6 * VdseffCV / AbulkCV; + + Csg = T5 * (1.0 - dDeltaPhi_dVg) + T6 * dVdseffCV_dVg; + Csd = Csg * dVgsteff_dVd + T6 * dVdseffCV_dVd + + QovCox * dCoxeff_dVd; + Csb = Csg * dVgsteff_dVb + T6 * dVdseffCV_dVb + + T7 * dAbulkCV_dVb + QovCox * dCoxeff_dVb; + Csg = Csg * dVgsteff_dVg + QovCox * dCoxeff_dVg; + } + else + { /* 50/50 partition */ + qsrc = -0.5 * qgate; + Csg = -0.5 * Cgg1; + Csd = -0.5 * Cgd1; + Csb = -0.5 * Cgb1; + } + + qgate += Qac0 + Qsub0 - qbulk; + qbulk -= (Qac0 + Qsub0); + qdrn = -(qgate + qbulk + qsrc); + + Cbg = Cbg1 - dQac0_dVg - dQsub0_dVg; + Cbd = Cbd1 - dQsub0_dVd; + Cbb = Cbb1 - dQac0_dVb - dQsub0_dVb; + + Cgg = Cgg1 - Cbg; + Cgd = Cgd1 - Cbd; + Cgb = Cgb1 - Cbb; + + Cgb *= dVbseff_dVb; + Cbb *= dVbseff_dVb; + Csb *= dVbseff_dVb; + + here->BSIM4V4cggb = Cgg; + here->BSIM4V4cgsb = -(Cgg + Cgd + Cgb); + here->BSIM4V4cgdb = Cgd; + here->BSIM4V4cdgb = -(Cgg + Cbg + Csg); + here->BSIM4V4cdsb = (Cgg + Cgd + Cgb + Cbg + Cbd + Cbb + + Csg + Csd + Csb); + here->BSIM4V4cddb = -(Cgd + Cbd + Csd); + here->BSIM4V4cbgb = Cbg; + here->BSIM4V4cbsb = -(Cbg + Cbd + Cbb); + here->BSIM4V4cbdb = Cbd; + } /* End of CTM */ + } + + here->BSIM4V4csgb = - here->BSIM4V4cggb - here->BSIM4V4cdgb - here->BSIM4V4cbgb; + here->BSIM4V4csdb = - here->BSIM4V4cgdb - here->BSIM4V4cddb - here->BSIM4V4cbdb; + here->BSIM4V4cssb = - here->BSIM4V4cgsb - here->BSIM4V4cdsb - here->BSIM4V4cbsb; + here->BSIM4V4cgbb = - here->BSIM4V4cgdb - here->BSIM4V4cggb - here->BSIM4V4cgsb; + here->BSIM4V4cdbb = - here->BSIM4V4cddb - here->BSIM4V4cdgb - here->BSIM4V4cdsb; + here->BSIM4V4cbbb = - here->BSIM4V4cbgb - here->BSIM4V4cbdb - here->BSIM4V4cbsb; + here->BSIM4V4csbb = - here->BSIM4V4cgbb - here->BSIM4V4cdbb - here->BSIM4V4cbbb; + here->BSIM4V4qgate = qgate; + here->BSIM4V4qbulk = qbulk; + here->BSIM4V4qdrn = qdrn; + here->BSIM4V4qsrc = -(qgate + qbulk + qdrn); + + /* NQS begins */ + if ((here->BSIM4V4trnqsMod) || (here->BSIM4V4acnqsMod)) + { here->BSIM4V4qchqs = qcheq = -(qbulk + qgate); + here->BSIM4V4cqgb = -(here->BSIM4V4cggb + here->BSIM4V4cbgb); + here->BSIM4V4cqdb = -(here->BSIM4V4cgdb + here->BSIM4V4cbdb); + here->BSIM4V4cqsb = -(here->BSIM4V4cgsb + here->BSIM4V4cbsb); + here->BSIM4V4cqbb = -(here->BSIM4V4cqgb + here->BSIM4V4cqdb + + here->BSIM4V4cqsb); + + CoxWL = model->BSIM4V4coxe * pParam->BSIM4V4weffCV * here->BSIM4V4nf + * pParam->BSIM4V4leffCV; + T1 = here->BSIM4V4gcrg / CoxWL; /* 1 / tau */ + here->BSIM4V4gtau = T1 * ScalingFactor; + + if (here->BSIM4V4acnqsMod) + here->BSIM4V4taunet = 1.0 / T1; + + *(ckt->CKTstate0 + here->BSIM4V4qcheq) = qcheq; + if (ckt->CKTmode & MODEINITTRAN) + *(ckt->CKTstate1 + here->BSIM4V4qcheq) = + *(ckt->CKTstate0 + here->BSIM4V4qcheq); + if (here->BSIM4V4trnqsMod) + { error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM4V4qcheq); + if (error) + return(error); + } + } + + +finished: + + /* Calculate junction C-V */ + if (ChargeComputationNeeded) + { czbd = model->BSIM4V4DunitAreaTempJctCap * here->BSIM4V4Adeff; /* bug fix */ + czbs = model->BSIM4V4SunitAreaTempJctCap * here->BSIM4V4Aseff; + czbdsw = model->BSIM4V4DunitLengthSidewallTempJctCap * here->BSIM4V4Pdeff; + czbdswg = model->BSIM4V4DunitLengthGateSidewallTempJctCap + * pParam->BSIM4V4weffCJ * here->BSIM4V4nf; + czbssw = model->BSIM4V4SunitLengthSidewallTempJctCap * here->BSIM4V4Pseff; + czbsswg = model->BSIM4V4SunitLengthGateSidewallTempJctCap + * pParam->BSIM4V4weffCJ * here->BSIM4V4nf; + + MJS = model->BSIM4V4SbulkJctBotGradingCoeff; + MJSWS = model->BSIM4V4SbulkJctSideGradingCoeff; + MJSWGS = model->BSIM4V4SbulkJctGateSideGradingCoeff; + + MJD = model->BSIM4V4DbulkJctBotGradingCoeff; + MJSWD = model->BSIM4V4DbulkJctSideGradingCoeff; + MJSWGD = model->BSIM4V4DbulkJctGateSideGradingCoeff; + + /* Source Bulk Junction */ + if (vbs_jct == 0.0) + { *(ckt->CKTstate0 + here->BSIM4V4qbs) = 0.0; + here->BSIM4V4capbs = czbs + czbssw + czbsswg; + } + else if (vbs_jct < 0.0) + { if (czbs > 0.0) + { arg = 1.0 - vbs_jct / model->BSIM4V4PhiBS; + if (MJS == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJS * log(arg)); + *(ckt->CKTstate0 + here->BSIM4V4qbs) = model->BSIM4V4PhiBS * czbs + * (1.0 - arg * sarg) / (1.0 - MJS); + here->BSIM4V4capbs = czbs * sarg; + } + else + { *(ckt->CKTstate0 + here->BSIM4V4qbs) = 0.0; + here->BSIM4V4capbs = 0.0; + } + if (czbssw > 0.0) + { arg = 1.0 - vbs_jct / model->BSIM4V4PhiBSWS; + if (MJSWS == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJSWS * log(arg)); + *(ckt->CKTstate0 + here->BSIM4V4qbs) += model->BSIM4V4PhiBSWS * czbssw + * (1.0 - arg * sarg) / (1.0 - MJSWS); + here->BSIM4V4capbs += czbssw * sarg; + } + if (czbsswg > 0.0) + { arg = 1.0 - vbs_jct / model->BSIM4V4PhiBSWGS; + if (MJSWGS == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJSWGS * log(arg)); + *(ckt->CKTstate0 + here->BSIM4V4qbs) += model->BSIM4V4PhiBSWGS * czbsswg + * (1.0 - arg * sarg) / (1.0 - MJSWGS); + here->BSIM4V4capbs += czbsswg * sarg; + } + + } + else + { T0 = czbs + czbssw + czbsswg; + T1 = vbs_jct * (czbs * MJS / model->BSIM4V4PhiBS + czbssw * MJSWS + / model->BSIM4V4PhiBSWS + czbsswg * MJSWGS / model->BSIM4V4PhiBSWGS); + *(ckt->CKTstate0 + here->BSIM4V4qbs) = vbs_jct * (T0 + 0.5 * T1); + here->BSIM4V4capbs = T0 + T1; + } + + /* Drain Bulk Junction */ + if (vbd_jct == 0.0) + { *(ckt->CKTstate0 + here->BSIM4V4qbd) = 0.0; + here->BSIM4V4capbd = czbd + czbdsw + czbdswg; + } + else if (vbd_jct < 0.0) + { if (czbd > 0.0) + { arg = 1.0 - vbd_jct / model->BSIM4V4PhiBD; + if (MJD == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJD * log(arg)); + *(ckt->CKTstate0 + here->BSIM4V4qbd) = model->BSIM4V4PhiBD* czbd + * (1.0 - arg * sarg) / (1.0 - MJD); + here->BSIM4V4capbd = czbd * sarg; + } + else + { *(ckt->CKTstate0 + here->BSIM4V4qbd) = 0.0; + here->BSIM4V4capbd = 0.0; + } + if (czbdsw > 0.0) + { arg = 1.0 - vbd_jct / model->BSIM4V4PhiBSWD; + if (MJSWD == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJSWD * log(arg)); + *(ckt->CKTstate0 + here->BSIM4V4qbd) += model->BSIM4V4PhiBSWD * czbdsw + * (1.0 - arg * sarg) / (1.0 - MJSWD); + here->BSIM4V4capbd += czbdsw * sarg; + } + if (czbdswg > 0.0) + { arg = 1.0 - vbd_jct / model->BSIM4V4PhiBSWGD; + if (MJSWGD == 0.5) + sarg = 1.0 / sqrt(arg); + else + sarg = exp(-MJSWGD * log(arg)); + *(ckt->CKTstate0 + here->BSIM4V4qbd) += model->BSIM4V4PhiBSWGD * czbdswg + * (1.0 - arg * sarg) / (1.0 - MJSWGD); + here->BSIM4V4capbd += czbdswg * sarg; + } + } + else + { T0 = czbd + czbdsw + czbdswg; + T1 = vbd_jct * (czbd * MJD / model->BSIM4V4PhiBD + czbdsw * MJSWD + / model->BSIM4V4PhiBSWD + czbdswg * MJSWGD / model->BSIM4V4PhiBSWGD); + *(ckt->CKTstate0 + here->BSIM4V4qbd) = vbd_jct * (T0 + 0.5 * T1); + here->BSIM4V4capbd = T0 + T1; + } + } + + + /* + * check convergence + */ + + if ((here->BSIM4V4off == 0) || (!(ckt->CKTmode & MODEINITFIX))) + { if (Check == 1) + { ckt->CKTnoncon++; +// #ifndef NEWCONV +// } +// else +// { if (here->BSIM4V4mode >= 0) +// { Idtot = here->BSIM4V4cd + here->BSIM4V4csub +// + here->BSIM4V4Igidl - here->BSIM4V4cbd; +// } +// else +// { Idtot = here->BSIM4V4cd + here->BSIM4V4cbd - here->BSIM4V4Igidl; /* bugfix */ +// } +// tol0 = ckt->CKTreltol * MAX(fabs(cdhat), fabs(Idtot)) +// + ckt->CKTabstol; +// tol1 = ckt->CKTreltol * MAX(fabs(cseshat), fabs(Isestot)) +// + ckt->CKTabstol; +// tol2 = ckt->CKTreltol * MAX(fabs(cdedhat), fabs(Idedtot)) +// + ckt->CKTabstol; +// tol3 = ckt->CKTreltol * MAX(fabs(cgshat), fabs(Igstot)) +// + ckt->CKTabstol; +// tol4 = ckt->CKTreltol * MAX(fabs(cgdhat), fabs(Igdtot)) +// + ckt->CKTabstol; +// tol5 = ckt->CKTreltol * MAX(fabs(cgbhat), fabs(Igbtot)) +// + ckt->CKTabstol; +// if ((fabs(cdhat - Idtot) >= tol0) || (fabs(cseshat - Isestot) >= tol1) +// || (fabs(cdedhat - Idedtot) >= tol2)) +// { ckt->CKTnoncon++; +// } +// else if ((fabs(cgshat - Igstot) >= tol3) || (fabs(cgdhat - Igdtot) >= tol4) +// || (fabs(cgbhat - Igbtot) >= tol5)) +// { ckt->CKTnoncon++; +// } +// else +// { Ibtot = here->BSIM4V4cbs + here->BSIM4V4cbd +// - here->BSIM4V4Igidl - here->BSIM4V4Igisl - here->BSIM4V4csub; +// tol6 = ckt->CKTreltol * MAX(fabs(cbhat), fabs(Ibtot)) +// + ckt->CKTabstol; +// if (fabs(cbhat - Ibtot) > tol6) +// { ckt->CKTnoncon++; +// } +// } +// #endif /* NEWCONV */ + } + } + *(ckt->CKTstate0 + here->BSIM4V4vds) = vds; + *(ckt->CKTstate0 + here->BSIM4V4vgs) = vgs; + *(ckt->CKTstate0 + here->BSIM4V4vbs) = vbs; + *(ckt->CKTstate0 + here->BSIM4V4vbd) = vbd; + *(ckt->CKTstate0 + here->BSIM4V4vges) = vges; + *(ckt->CKTstate0 + here->BSIM4V4vgms) = vgms; + *(ckt->CKTstate0 + here->BSIM4V4vdbs) = vdbs; + *(ckt->CKTstate0 + here->BSIM4V4vdbd) = vdbd; + *(ckt->CKTstate0 + here->BSIM4V4vsbs) = vsbs; + *(ckt->CKTstate0 + here->BSIM4V4vses) = vses; + *(ckt->CKTstate0 + here->BSIM4V4vdes) = vdes; + *(ckt->CKTstate0 + here->BSIM4V4qdef) = qdef; + + + if (!ChargeComputationNeeded) + goto line850; + + if (here->BSIM4V4rgateMod == 3) + { + vgdx = vgmd; + vgsx = vgms; + } + else /* For rgateMod == 0, 1 and 2 */ + { + vgdx = vgd; + vgsx = vgs; + } + if (model->BSIM4V4capMod == 0) + { + cgdo = pParam->BSIM4V4cgdo; + qgdo = pParam->BSIM4V4cgdo * vgdx; + cgso = pParam->BSIM4V4cgso; + qgso = pParam->BSIM4V4cgso * vgsx; + } + else /* For both capMod == 1 and 2 */ + { T0 = vgdx + DELTA_1; + T1 = sqrt(T0 * T0 + 4.0 * DELTA_1); + T2 = 0.5 * (T0 - T1); + + T3 = pParam->BSIM4V4weffCV * pParam->BSIM4V4cgdl; + T4 = sqrt(1.0 - 4.0 * T2 / pParam->BSIM4V4ckappad); + cgdo = pParam->BSIM4V4cgdo + T3 - T3 * (1.0 - 1.0 / T4) + * (0.5 - 0.5 * T0 / T1); + qgdo = (pParam->BSIM4V4cgdo + T3) * vgdx - T3 * (T2 + + 0.5 * pParam->BSIM4V4ckappad * (T4 - 1.0)); + + T0 = vgsx + DELTA_1; + T1 = sqrt(T0 * T0 + 4.0 * DELTA_1); + T2 = 0.5 * (T0 - T1); + T3 = pParam->BSIM4V4weffCV * pParam->BSIM4V4cgsl; + T4 = sqrt(1.0 - 4.0 * T2 / pParam->BSIM4V4ckappas); + cgso = pParam->BSIM4V4cgso + T3 - T3 * (1.0 - 1.0 / T4) + * (0.5 - 0.5 * T0 / T1); + qgso = (pParam->BSIM4V4cgso + T3) * vgsx - T3 * (T2 + + 0.5 * pParam->BSIM4V4ckappas * (T4 - 1.0)); + } + + if (here->BSIM4V4nf != 1.0) + { cgdo *= here->BSIM4V4nf; + cgso *= here->BSIM4V4nf; + qgdo *= here->BSIM4V4nf; + qgso *= here->BSIM4V4nf; + } + here->BSIM4V4cgdo = cgdo; + here->BSIM4V4qgdo = qgdo; + here->BSIM4V4cgso = cgso; + here->BSIM4V4qgso = qgso; + + +line755: + ag0 = ckt->CKTag[0]; + if (here->BSIM4V4mode > 0) + { if (here->BSIM4V4trnqsMod == 0) + { qdrn -= qgdo; + if (here->BSIM4V4rgateMod == 3) + { gcgmgmb = (cgdo + cgso + pParam->BSIM4V4cgbo) * ag0; + gcgmdb = -cgdo * ag0; + gcgmsb = -cgso * ag0; + gcgmbb = -pParam->BSIM4V4cgbo * ag0; + + gcdgmb = gcgmdb; + gcsgmb = gcgmsb; + gcbgmb = gcgmbb; + + gcggb = here->BSIM4V4cggb * ag0; + gcgdb = here->BSIM4V4cgdb * ag0; + gcgsb = here->BSIM4V4cgsb * ag0; + gcgbb = -(gcggb + gcgdb + gcgsb); + + gcdgb = here->BSIM4V4cdgb * ag0; + gcsgb = -(here->BSIM4V4cggb + here->BSIM4V4cbgb + + here->BSIM4V4cdgb) * ag0; + gcbgb = here->BSIM4V4cbgb * ag0; + + qgmb = pParam->BSIM4V4cgbo * vgmb; + qgmid = qgdo + qgso + qgmb; + qbulk -= qgmb; + qsrc = -(qgate + qgmid + qbulk + qdrn); + } + else + { gcggb = (here->BSIM4V4cggb + cgdo + cgso + + pParam->BSIM4V4cgbo ) * ag0; + gcgdb = (here->BSIM4V4cgdb - cgdo) * ag0; + gcgsb = (here->BSIM4V4cgsb - cgso) * ag0; + gcgbb = -(gcggb + gcgdb + gcgsb); + + gcdgb = (here->BSIM4V4cdgb - cgdo) * ag0; + gcsgb = -(here->BSIM4V4cggb + here->BSIM4V4cbgb + + here->BSIM4V4cdgb + cgso) * ag0; + gcbgb = (here->BSIM4V4cbgb - pParam->BSIM4V4cgbo) * ag0; + + gcdgmb = gcsgmb = gcbgmb = 0.0; + + qgb = pParam->BSIM4V4cgbo * vgb; + qgate += qgdo + qgso + qgb; + qbulk -= qgb; + qsrc = -(qgate + qbulk + qdrn); + } + gcddb = (here->BSIM4V4cddb + here->BSIM4V4capbd + cgdo) * ag0; + gcdsb = here->BSIM4V4cdsb * ag0; + + gcsdb = -(here->BSIM4V4cgdb + here->BSIM4V4cbdb + + here->BSIM4V4cddb) * ag0; + gcssb = (here->BSIM4V4capbs + cgso - (here->BSIM4V4cgsb + + here->BSIM4V4cbsb + here->BSIM4V4cdsb)) * ag0; + + if (!here->BSIM4V4rbodyMod) + { gcdbb = -(gcdgb + gcddb + gcdsb + gcdgmb); + gcsbb = -(gcsgb + gcsdb + gcssb + gcsgmb); + gcbdb = (here->BSIM4V4cbdb - here->BSIM4V4capbd) * ag0; + gcbsb = (here->BSIM4V4cbsb - here->BSIM4V4capbs) * ag0; + gcdbdb = 0.0; gcsbsb = 0.0; + } + else + { gcdbb = -(here->BSIM4V4cddb + here->BSIM4V4cdgb + + here->BSIM4V4cdsb) * ag0; + gcsbb = -(gcsgb + gcsdb + gcssb + gcsgmb) + + here->BSIM4V4capbs * ag0; + gcbdb = here->BSIM4V4cbdb * ag0; + gcbsb = here->BSIM4V4cbsb * ag0; + + gcdbdb = -here->BSIM4V4capbd * ag0; + gcsbsb = -here->BSIM4V4capbs * ag0; + } + gcbbb = -(gcbdb + gcbgb + gcbsb + gcbgmb); + + ggtg = ggtd = ggtb = ggts = 0.0; + sxpart = 0.6; + dxpart = 0.4; + ddxpart_dVd = ddxpart_dVg = ddxpart_dVb = ddxpart_dVs = 0.0; + dsxpart_dVd = dsxpart_dVg = dsxpart_dVb = dsxpart_dVs = 0.0; + } + else + { qcheq = here->BSIM4V4qchqs; + CoxWL = model->BSIM4V4coxe * pParam->BSIM4V4weffCV * here->BSIM4V4nf + * pParam->BSIM4V4leffCV; + T0 = qdef * ScalingFactor / CoxWL; + + ggtg = here->BSIM4V4gtg = T0 * here->BSIM4V4gcrgg; + ggtd = here->BSIM4V4gtd = T0 * here->BSIM4V4gcrgd; + ggts = here->BSIM4V4gts = T0 * here->BSIM4V4gcrgs; + ggtb = here->BSIM4V4gtb = T0 * here->BSIM4V4gcrgb; + gqdef = ScalingFactor * ag0; + + gcqgb = here->BSIM4V4cqgb * ag0; + gcqdb = here->BSIM4V4cqdb * ag0; + gcqsb = here->BSIM4V4cqsb * ag0; + gcqbb = here->BSIM4V4cqbb * ag0; + + if (fabs(qcheq) <= 1.0e-5 * CoxWL) + { if (model->BSIM4V4xpart < 0.5) + { dxpart = 0.4; + } + else if (model->BSIM4V4xpart > 0.5) + { dxpart = 0.0; + } + else + { dxpart = 0.5; + } + ddxpart_dVd = ddxpart_dVg = ddxpart_dVb + = ddxpart_dVs = 0.0; + } + else + { dxpart = qdrn / qcheq; + Cdd = here->BSIM4V4cddb; + Csd = -(here->BSIM4V4cgdb + here->BSIM4V4cddb + + here->BSIM4V4cbdb); + ddxpart_dVd = (Cdd - dxpart * (Cdd + Csd)) / qcheq; + Cdg = here->BSIM4V4cdgb; + Csg = -(here->BSIM4V4cggb + here->BSIM4V4cdgb + + here->BSIM4V4cbgb); + ddxpart_dVg = (Cdg - dxpart * (Cdg + Csg)) / qcheq; + + Cds = here->BSIM4V4cdsb; + Css = -(here->BSIM4V4cgsb + here->BSIM4V4cdsb + + here->BSIM4V4cbsb); + ddxpart_dVs = (Cds - dxpart * (Cds + Css)) / qcheq; + + ddxpart_dVb = -(ddxpart_dVd + ddxpart_dVg + ddxpart_dVs); + } + sxpart = 1.0 - dxpart; + dsxpart_dVd = -ddxpart_dVd; + dsxpart_dVg = -ddxpart_dVg; + dsxpart_dVs = -ddxpart_dVs; + dsxpart_dVb = -(dsxpart_dVd + dsxpart_dVg + dsxpart_dVs); + + if (here->BSIM4V4rgateMod == 3) + { gcgmgmb = (cgdo + cgso + pParam->BSIM4V4cgbo) * ag0; + gcgmdb = -cgdo * ag0; + gcgmsb = -cgso * ag0; + gcgmbb = -pParam->BSIM4V4cgbo * ag0; + + gcdgmb = gcgmdb; + gcsgmb = gcgmsb; + gcbgmb = gcgmbb; + + gcdgb = gcsgb = gcbgb = 0.0; + gcggb = gcgdb = gcgsb = gcgbb = 0.0; + + qgmb = pParam->BSIM4V4cgbo * vgmb; + qgmid = qgdo + qgso + qgmb; + qgate = 0.0; + qbulk = -qgmb; + qdrn = -qgdo; + qsrc = -(qgmid + qbulk + qdrn); + } + else + { gcggb = (cgdo + cgso + pParam->BSIM4V4cgbo ) * ag0; + gcgdb = -cgdo * ag0; + gcgsb = -cgso * ag0; + gcgbb = -pParam->BSIM4V4cgbo * ag0; + + gcdgb = gcgdb; + gcsgb = gcgsb; + gcbgb = gcgbb; + gcdgmb = gcsgmb = gcbgmb = 0.0; + + qgb = pParam->BSIM4V4cgbo * vgb; + qgate = qgdo + qgso + qgb; + qbulk = -qgb; + qdrn = -qgdo; + qsrc = -(qgate + qbulk + qdrn); + } + + gcddb = (here->BSIM4V4capbd + cgdo) * ag0; + gcdsb = gcsdb = 0.0; + gcssb = (here->BSIM4V4capbs + cgso) * ag0; + + if (!here->BSIM4V4rbodyMod) + { gcdbb = -(gcdgb + gcddb + gcdgmb); + gcsbb = -(gcsgb + gcssb + gcsgmb); + gcbdb = -here->BSIM4V4capbd * ag0; + gcbsb = -here->BSIM4V4capbs * ag0; + gcdbdb = 0.0; gcsbsb = 0.0; + } + else + { gcdbb = gcsbb = gcbdb = gcbsb = 0.0; + gcdbdb = -here->BSIM4V4capbd * ag0; + gcsbsb = -here->BSIM4V4capbs * ag0; + } + gcbbb = -(gcbdb + gcbgb + gcbsb + gcbgmb); + } + } + else + { if (here->BSIM4V4trnqsMod == 0) + { qsrc = qdrn - qgso; + if (here->BSIM4V4rgateMod == 3) + { gcgmgmb = (cgdo + cgso + pParam->BSIM4V4cgbo) * ag0; + gcgmdb = -cgdo * ag0; + gcgmsb = -cgso * ag0; + gcgmbb = -pParam->BSIM4V4cgbo * ag0; + + gcdgmb = gcgmdb; + gcsgmb = gcgmsb; + gcbgmb = gcgmbb; + + gcggb = here->BSIM4V4cggb * ag0; + gcgdb = here->BSIM4V4cgsb * ag0; + gcgsb = here->BSIM4V4cgdb * ag0; + gcgbb = -(gcggb + gcgdb + gcgsb); + + gcdgb = -(here->BSIM4V4cggb + here->BSIM4V4cbgb + + here->BSIM4V4cdgb) * ag0; + gcsgb = here->BSIM4V4cdgb * ag0; + gcbgb = here->BSIM4V4cbgb * ag0; + + qgmb = pParam->BSIM4V4cgbo * vgmb; + qgmid = qgdo + qgso + qgmb; + qbulk -= qgmb; + qdrn = -(qgate + qgmid + qbulk + qsrc); + } + else + { gcggb = (here->BSIM4V4cggb + cgdo + cgso + + pParam->BSIM4V4cgbo ) * ag0; + gcgdb = (here->BSIM4V4cgsb - cgdo) * ag0; + gcgsb = (here->BSIM4V4cgdb - cgso) * ag0; + gcgbb = -(gcggb + gcgdb + gcgsb); + + gcdgb = -(here->BSIM4V4cggb + here->BSIM4V4cbgb + + here->BSIM4V4cdgb + cgdo) * ag0; + gcsgb = (here->BSIM4V4cdgb - cgso) * ag0; + gcbgb = (here->BSIM4V4cbgb - pParam->BSIM4V4cgbo) * ag0; + + gcdgmb = gcsgmb = gcbgmb = 0.0; + + qgb = pParam->BSIM4V4cgbo * vgb; + qgate += qgdo + qgso + qgb; + qbulk -= qgb; + qdrn = -(qgate + qbulk + qsrc); + } + gcddb = (here->BSIM4V4capbd + cgdo - (here->BSIM4V4cgsb + + here->BSIM4V4cbsb + here->BSIM4V4cdsb)) * ag0; + gcdsb = -(here->BSIM4V4cgdb + here->BSIM4V4cbdb + + here->BSIM4V4cddb) * ag0; + + gcsdb = here->BSIM4V4cdsb * ag0; + gcssb = (here->BSIM4V4cddb + here->BSIM4V4capbs + cgso) * ag0; + + if (!here->BSIM4V4rbodyMod) + { gcdbb = -(gcdgb + gcddb + gcdsb + gcdgmb); + gcsbb = -(gcsgb + gcsdb + gcssb + gcsgmb); + gcbdb = (here->BSIM4V4cbsb - here->BSIM4V4capbd) * ag0; + gcbsb = (here->BSIM4V4cbdb - here->BSIM4V4capbs) * ag0; + gcdbdb = 0.0; gcsbsb = 0.0; + } + else + { gcdbb = -(gcdgb + gcddb + gcdsb + gcdgmb) + + here->BSIM4V4capbd * ag0; + gcsbb = -(here->BSIM4V4cddb + here->BSIM4V4cdgb + + here->BSIM4V4cdsb) * ag0; + gcbdb = here->BSIM4V4cbsb * ag0; + gcbsb = here->BSIM4V4cbdb * ag0; + gcdbdb = -here->BSIM4V4capbd * ag0; + gcsbsb = -here->BSIM4V4capbs * ag0; + } + gcbbb = -(gcbgb + gcbdb + gcbsb + gcbgmb); + + ggtg = ggtd = ggtb = ggts = 0.0; + sxpart = 0.4; + dxpart = 0.6; + ddxpart_dVd = ddxpart_dVg = ddxpart_dVb = ddxpart_dVs = 0.0; + dsxpart_dVd = dsxpart_dVg = dsxpart_dVb = dsxpart_dVs = 0.0; + } + else + { qcheq = here->BSIM4V4qchqs; + CoxWL = model->BSIM4V4coxe * pParam->BSIM4V4weffCV * here->BSIM4V4nf + * pParam->BSIM4V4leffCV; + T0 = qdef * ScalingFactor / CoxWL; + ggtg = here->BSIM4V4gtg = T0 * here->BSIM4V4gcrgg; + ggts = here->BSIM4V4gtd = T0 * here->BSIM4V4gcrgs; + ggtd = here->BSIM4V4gts = T0 * here->BSIM4V4gcrgd; + ggtb = here->BSIM4V4gtb = T0 * here->BSIM4V4gcrgb; + gqdef = ScalingFactor * ag0; + + gcqgb = here->BSIM4V4cqgb * ag0; + gcqdb = here->BSIM4V4cqsb * ag0; + gcqsb = here->BSIM4V4cqdb * ag0; + gcqbb = here->BSIM4V4cqbb * ag0; + + if (fabs(qcheq) <= 1.0e-5 * CoxWL) + { if (model->BSIM4V4xpart < 0.5) + { sxpart = 0.4; + } + else if (model->BSIM4V4xpart > 0.5) + { sxpart = 0.0; + } + else + { sxpart = 0.5; + } + dsxpart_dVd = dsxpart_dVg = dsxpart_dVb + = dsxpart_dVs = 0.0; + } + else + { sxpart = qdrn / qcheq; + Css = here->BSIM4V4cddb; + Cds = -(here->BSIM4V4cgdb + here->BSIM4V4cddb + + here->BSIM4V4cbdb); + dsxpart_dVs = (Css - sxpart * (Css + Cds)) / qcheq; + Csg = here->BSIM4V4cdgb; + Cdg = -(here->BSIM4V4cggb + here->BSIM4V4cdgb + + here->BSIM4V4cbgb); + dsxpart_dVg = (Csg - sxpart * (Csg + Cdg)) / qcheq; + + Csd = here->BSIM4V4cdsb; + Cdd = -(here->BSIM4V4cgsb + here->BSIM4V4cdsb + + here->BSIM4V4cbsb); + dsxpart_dVd = (Csd - sxpart * (Csd + Cdd)) / qcheq; + + dsxpart_dVb = -(dsxpart_dVd + dsxpart_dVg + dsxpart_dVs); + } + dxpart = 1.0 - sxpart; + ddxpart_dVd = -dsxpart_dVd; + ddxpart_dVg = -dsxpart_dVg; + ddxpart_dVs = -dsxpart_dVs; + ddxpart_dVb = -(ddxpart_dVd + ddxpart_dVg + ddxpart_dVs); + + if (here->BSIM4V4rgateMod == 3) + { gcgmgmb = (cgdo + cgso + pParam->BSIM4V4cgbo) * ag0; + gcgmdb = -cgdo * ag0; + gcgmsb = -cgso * ag0; + gcgmbb = -pParam->BSIM4V4cgbo * ag0; + + gcdgmb = gcgmdb; + gcsgmb = gcgmsb; + gcbgmb = gcgmbb; + + gcdgb = gcsgb = gcbgb = 0.0; + gcggb = gcgdb = gcgsb = gcgbb = 0.0; + + qgmb = pParam->BSIM4V4cgbo * vgmb; + qgmid = qgdo + qgso + qgmb; + qgate = 0.0; + qbulk = -qgmb; + qdrn = -qgdo; + qsrc = -qgso; + } + else + { gcggb = (cgdo + cgso + pParam->BSIM4V4cgbo ) * ag0; + gcgdb = -cgdo * ag0; + gcgsb = -cgso * ag0; + gcgbb = -pParam->BSIM4V4cgbo * ag0; + + gcdgb = gcgdb; + gcsgb = gcgsb; + gcbgb = gcgbb; + gcdgmb = gcsgmb = gcbgmb = 0.0; + + qgb = pParam->BSIM4V4cgbo * vgb; + qgate = qgdo + qgso + qgb; + qbulk = -qgb; + qdrn = -qgdo; + qsrc = -qgso; + } + + gcddb = (here->BSIM4V4capbd + cgdo) * ag0; + gcdsb = gcsdb = 0.0; + gcssb = (here->BSIM4V4capbs + cgso) * ag0; + if (!here->BSIM4V4rbodyMod) + { gcdbb = -(gcdgb + gcddb + gcdgmb); + gcsbb = -(gcsgb + gcssb + gcsgmb); + gcbdb = -here->BSIM4V4capbd * ag0; + gcbsb = -here->BSIM4V4capbs * ag0; + gcdbdb = 0.0; gcsbsb = 0.0; + } + else + { gcdbb = gcsbb = gcbdb = gcbsb = 0.0; + gcdbdb = -here->BSIM4V4capbd * ag0; + gcsbsb = -here->BSIM4V4capbs * ag0; + } + gcbbb = -(gcbdb + gcbgb + gcbsb + gcbgmb); + } + } + + + if (here->BSIM4V4trnqsMod) + { *(ckt->CKTstate0 + here->BSIM4V4qcdump) = qdef * ScalingFactor; + if (ckt->CKTmode & MODEINITTRAN) + *(ckt->CKTstate1 + here->BSIM4V4qcdump) = + *(ckt->CKTstate0 + here->BSIM4V4qcdump); + error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM4V4qcdump); + if (error) + return(error); + } + + if (ByPass) goto line860; + + *(ckt->CKTstate0 + here->BSIM4V4qg) = qgate; + *(ckt->CKTstate0 + here->BSIM4V4qd) = qdrn + - *(ckt->CKTstate0 + here->BSIM4V4qbd); + *(ckt->CKTstate0 + here->BSIM4V4qs) = qsrc + - *(ckt->CKTstate0 + here->BSIM4V4qbs); + if (here->BSIM4V4rgateMod == 3) + *(ckt->CKTstate0 + here->BSIM4V4qgmid) = qgmid; + + if (!here->BSIM4V4rbodyMod) + { *(ckt->CKTstate0 + here->BSIM4V4qb) = qbulk + + *(ckt->CKTstate0 + here->BSIM4V4qbd) + + *(ckt->CKTstate0 + here->BSIM4V4qbs); + } + else + *(ckt->CKTstate0 + here->BSIM4V4qb) = qbulk; + + + /* Store small signal parameters */ + if (ckt->CKTmode & MODEINITSMSIG) + { goto line1000; + } + + if (!ChargeComputationNeeded) + goto line850; + + if (ckt->CKTmode & MODEINITTRAN) + { *(ckt->CKTstate1 + here->BSIM4V4qb) = + *(ckt->CKTstate0 + here->BSIM4V4qb); + *(ckt->CKTstate1 + here->BSIM4V4qg) = + *(ckt->CKTstate0 + here->BSIM4V4qg); + *(ckt->CKTstate1 + here->BSIM4V4qd) = + *(ckt->CKTstate0 + here->BSIM4V4qd); + if (here->BSIM4V4rgateMod == 3) + *(ckt->CKTstate1 + here->BSIM4V4qgmid) = + *(ckt->CKTstate0 + here->BSIM4V4qgmid); + if (here->BSIM4V4rbodyMod) + { *(ckt->CKTstate1 + here->BSIM4V4qbs) = + *(ckt->CKTstate0 + here->BSIM4V4qbs); + *(ckt->CKTstate1 + here->BSIM4V4qbd) = + *(ckt->CKTstate0 + here->BSIM4V4qbd); + } + } + + error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM4V4qb); + if (error) + return(error); + error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM4V4qg); + if (error) + return(error); + error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM4V4qd); + if (error) + return(error); + + if (here->BSIM4V4rgateMod == 3) + { error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM4V4qgmid); + if (error) return(error); + } + + if (here->BSIM4V4rbodyMod) + { error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM4V4qbs); + if (error) + return(error); + error = NIintegrate(ckt, &geq, &ceq, 0.0, here->BSIM4V4qbd); + if (error) + return(error); + } + + goto line860; + + +line850: + /* Zero gcap and ceqcap if (!ChargeComputationNeeded) */ + ceqqg = ceqqb = ceqqd = 0.0; + ceqqjd = ceqqjs = 0.0; + cqcheq = cqdef = 0.0; + + gcdgb = gcddb = gcdsb = gcdbb = 0.0; + gcsgb = gcsdb = gcssb = gcsbb = 0.0; + gcggb = gcgdb = gcgsb = gcgbb = 0.0; + gcbdb = gcbgb = gcbsb = gcbbb = 0.0; + + gcgmgmb = gcgmdb = gcgmsb = gcgmbb = 0.0; + gcdgmb = gcsgmb = gcbgmb = ceqqgmid = 0.0; + gcdbdb = gcsbsb = 0.0; + + gqdef = gcqgb = gcqdb = gcqsb = gcqbb = 0.0; + ggtg = ggtd = ggtb = ggts = 0.0; + sxpart = (1.0 - (dxpart = (here->BSIM4V4mode > 0) ? 0.4 : 0.6)); + ddxpart_dVd = ddxpart_dVg = ddxpart_dVb = ddxpart_dVs = 0.0; + dsxpart_dVd = dsxpart_dVg = dsxpart_dVb = dsxpart_dVs = 0.0; + + if (here->BSIM4V4trnqsMod) + { CoxWL = model->BSIM4V4coxe * pParam->BSIM4V4weffCV * here->BSIM4V4nf + * pParam->BSIM4V4leffCV; + T1 = here->BSIM4V4gcrg / CoxWL; + here->BSIM4V4gtau = T1 * ScalingFactor; + } + else + here->BSIM4V4gtau = 0.0; + + goto line900; + + +line860: + /* Calculate equivalent charge current */ + + cqgate = *(ckt->CKTstate0 + here->BSIM4V4cqg); + cqbody = *(ckt->CKTstate0 + here->BSIM4V4cqb); + cqdrn = *(ckt->CKTstate0 + here->BSIM4V4cqd); + + ceqqg = cqgate - gcggb * vgb + gcgdb * vbd + gcgsb * vbs; + ceqqd = cqdrn - gcdgb * vgb - gcdgmb * vgmb + (gcddb + gcdbdb) + * vbd - gcdbdb * vbd_jct + gcdsb * vbs; + ceqqb = cqbody - gcbgb * vgb - gcbgmb * vgmb + + gcbdb * vbd + gcbsb * vbs; + + + if (here->BSIM4V4rgateMod == 3) + ceqqgmid = *(ckt->CKTstate0 + here->BSIM4V4cqgmid) + + gcgmdb * vbd + gcgmsb * vbs - gcgmgmb * vgmb; + else + ceqqgmid = 0.0; + + if (here->BSIM4V4rbodyMod) + { ceqqjs = *(ckt->CKTstate0 + here->BSIM4V4cqbs) + gcsbsb * vbs_jct; + ceqqjd = *(ckt->CKTstate0 + here->BSIM4V4cqbd) + gcdbdb * vbd_jct; + } + + if (here->BSIM4V4trnqsMod) + { T0 = ggtg * vgb - ggtd * vbd - ggts * vbs; + ceqqg += T0; + T1 = qdef * here->BSIM4V4gtau; + ceqqd -= dxpart * T0 + T1 * (ddxpart_dVg * vgb - ddxpart_dVd + * vbd - ddxpart_dVs * vbs); + cqdef = *(ckt->CKTstate0 + here->BSIM4V4cqcdump) - gqdef * qdef; + cqcheq = *(ckt->CKTstate0 + here->BSIM4V4cqcheq) + - (gcqgb * vgb - gcqdb * vbd - gcqsb * vbs) + T0; + } + + if (ckt->CKTmode & MODEINITTRAN) + { *(ckt->CKTstate1 + here->BSIM4V4cqb) = + *(ckt->CKTstate0 + here->BSIM4V4cqb); + *(ckt->CKTstate1 + here->BSIM4V4cqg) = + *(ckt->CKTstate0 + here->BSIM4V4cqg); + *(ckt->CKTstate1 + here->BSIM4V4cqd) = + *(ckt->CKTstate0 + here->BSIM4V4cqd); + + if (here->BSIM4V4rgateMod == 3) + *(ckt->CKTstate1 + here->BSIM4V4cqgmid) = + *(ckt->CKTstate0 + here->BSIM4V4cqgmid); + + if (here->BSIM4V4rbodyMod) + { *(ckt->CKTstate1 + here->BSIM4V4cqbs) = + *(ckt->CKTstate0 + here->BSIM4V4cqbs); + *(ckt->CKTstate1 + here->BSIM4V4cqbd) = + *(ckt->CKTstate0 + here->BSIM4V4cqbd); + } + } + + + /* + * Load current vector + */ + +line900: + if (here->BSIM4V4mode >= 0) + { Gm = here->BSIM4V4gm; + Gmbs = here->BSIM4V4gmbs; + FwdSum = Gm + Gmbs; + RevSum = 0.0; + + ceqdrn = model->BSIM4V4type * (cdrain - here->BSIM4V4gds * vds + - Gm * vgs - Gmbs * vbs); + ceqbd = model->BSIM4V4type * (here->BSIM4V4csub + here->BSIM4V4Igidl + - (here->BSIM4V4gbds + here->BSIM4V4ggidld) * vds + - (here->BSIM4V4gbgs + here->BSIM4V4ggidlg) * vgs + - (here->BSIM4V4gbbs + here->BSIM4V4ggidlb) * vbs); + ceqbs = model->BSIM4V4type * (here->BSIM4V4Igisl + here->BSIM4V4ggisls * vds + - here->BSIM4V4ggislg * vgd - here->BSIM4V4ggislb * vbd); + + gbbdp = -(here->BSIM4V4gbds); + gbbsp = here->BSIM4V4gbds + here->BSIM4V4gbgs + here->BSIM4V4gbbs; + + gbdpg = here->BSIM4V4gbgs; + gbdpdp = here->BSIM4V4gbds; + gbdpb = here->BSIM4V4gbbs; + gbdpsp = -(gbdpg + gbdpdp + gbdpb); + + gbspg = 0.0; + gbspdp = 0.0; + gbspb = 0.0; + gbspsp = 0.0; + + if (model->BSIM4V4igcMod) + { gIstotg = here->BSIM4V4gIgsg + here->BSIM4V4gIgcsg; + gIstotd = here->BSIM4V4gIgcsd; + gIstots = here->BSIM4V4gIgss + here->BSIM4V4gIgcss; + gIstotb = here->BSIM4V4gIgcsb; + Istoteq = model->BSIM4V4type * (here->BSIM4V4Igs + here->BSIM4V4Igcs + - gIstotg * vgs - here->BSIM4V4gIgcsd * vds + - here->BSIM4V4gIgcsb * vbs); + + gIdtotg = here->BSIM4V4gIgdg + here->BSIM4V4gIgcdg; + gIdtotd = here->BSIM4V4gIgdd + here->BSIM4V4gIgcdd; + gIdtots = here->BSIM4V4gIgcds; + gIdtotb = here->BSIM4V4gIgcdb; + Idtoteq = model->BSIM4V4type * (here->BSIM4V4Igd + here->BSIM4V4Igcd + - here->BSIM4V4gIgdg * vgd - here->BSIM4V4gIgcdg * vgs + - here->BSIM4V4gIgcdd * vds - here->BSIM4V4gIgcdb * vbs); + } + else + { gIstotg = gIstotd = gIstots = gIstotb = Istoteq = 0.0; + gIdtotg = gIdtotd = gIdtots = gIdtotb = Idtoteq = 0.0; + } + + if (model->BSIM4V4igbMod) + { gIbtotg = here->BSIM4V4gIgbg; + gIbtotd = here->BSIM4V4gIgbd; + gIbtots = here->BSIM4V4gIgbs; + gIbtotb = here->BSIM4V4gIgbb; + Ibtoteq = model->BSIM4V4type * (here->BSIM4V4Igb + - here->BSIM4V4gIgbg * vgs - here->BSIM4V4gIgbd * vds + - here->BSIM4V4gIgbb * vbs); + } + else + gIbtotg = gIbtotd = gIbtots = gIbtotb = Ibtoteq = 0.0; + + if ((model->BSIM4V4igcMod != 0) || (model->BSIM4V4igbMod != 0)) + { gIgtotg = gIstotg + gIdtotg + gIbtotg; + gIgtotd = gIstotd + gIdtotd + gIbtotd ; + gIgtots = gIstots + gIdtots + gIbtots; + gIgtotb = gIstotb + gIdtotb + gIbtotb; + Igtoteq = Istoteq + Idtoteq + Ibtoteq; + } + else + gIgtotg = gIgtotd = gIgtots = gIgtotb = Igtoteq = 0.0; + + + if (here->BSIM4V4rgateMod == 2) + T0 = vges - vgs; + else if (here->BSIM4V4rgateMod == 3) + T0 = vgms - vgs; + if (here->BSIM4V4rgateMod > 1) + { gcrgd = here->BSIM4V4gcrgd * T0; + gcrgg = here->BSIM4V4gcrgg * T0; + gcrgs = here->BSIM4V4gcrgs * T0; + gcrgb = here->BSIM4V4gcrgb * T0; + ceqgcrg = -(gcrgd * vds + gcrgg * vgs + + gcrgb * vbs); + gcrgg -= here->BSIM4V4gcrg; + gcrg = here->BSIM4V4gcrg; + } + else + ceqgcrg = gcrg = gcrgd = gcrgg = gcrgs = gcrgb = 0.0; + } + else + { Gm = -here->BSIM4V4gm; + Gmbs = -here->BSIM4V4gmbs; + FwdSum = 0.0; + RevSum = -(Gm + Gmbs); + + ceqdrn = -model->BSIM4V4type * (cdrain + here->BSIM4V4gds * vds + + Gm * vgd + Gmbs * vbd); + + ceqbs = model->BSIM4V4type * (here->BSIM4V4csub + here->BSIM4V4Igisl + + (here->BSIM4V4gbds + here->BSIM4V4ggisls) * vds + - (here->BSIM4V4gbgs + here->BSIM4V4ggislg) * vgd + - (here->BSIM4V4gbbs + here->BSIM4V4ggislb) * vbd); + ceqbd = model->BSIM4V4type * (here->BSIM4V4Igidl - here->BSIM4V4ggidld * vds + - here->BSIM4V4ggidlg * vgs - here->BSIM4V4ggidlb * vbs); + + gbbsp = -(here->BSIM4V4gbds); + gbbdp = here->BSIM4V4gbds + here->BSIM4V4gbgs + here->BSIM4V4gbbs; + + gbdpg = 0.0; + gbdpsp = 0.0; + gbdpb = 0.0; + gbdpdp = 0.0; + + gbspg = here->BSIM4V4gbgs; + gbspsp = here->BSIM4V4gbds; + gbspb = here->BSIM4V4gbbs; + gbspdp = -(gbspg + gbspsp + gbspb); + + if (model->BSIM4V4igcMod) + { gIstotg = here->BSIM4V4gIgsg + here->BSIM4V4gIgcdg; + gIstotd = here->BSIM4V4gIgcds; + gIstots = here->BSIM4V4gIgss + here->BSIM4V4gIgcdd; + gIstotb = here->BSIM4V4gIgcdb; + Istoteq = model->BSIM4V4type * (here->BSIM4V4Igs + here->BSIM4V4Igcd + - here->BSIM4V4gIgsg * vgs - here->BSIM4V4gIgcdg * vgd + + here->BSIM4V4gIgcdd * vds - here->BSIM4V4gIgcdb * vbd); + + gIdtotg = here->BSIM4V4gIgdg + here->BSIM4V4gIgcsg; + gIdtotd = here->BSIM4V4gIgdd + here->BSIM4V4gIgcss; + gIdtots = here->BSIM4V4gIgcsd; + gIdtotb = here->BSIM4V4gIgcsb; + Idtoteq = model->BSIM4V4type * (here->BSIM4V4Igd + here->BSIM4V4Igcs + - (here->BSIM4V4gIgdg + here->BSIM4V4gIgcsg) * vgd + + here->BSIM4V4gIgcsd * vds - here->BSIM4V4gIgcsb * vbd); + } + else + { gIstotg = gIstotd = gIstots = gIstotb = Istoteq = 0.0; + gIdtotg = gIdtotd = gIdtots = gIdtotb = Idtoteq = 0.0; + } + + if (model->BSIM4V4igbMod) + { gIbtotg = here->BSIM4V4gIgbg; + gIbtotd = here->BSIM4V4gIgbs; + gIbtots = here->BSIM4V4gIgbd; + gIbtotb = here->BSIM4V4gIgbb; + Ibtoteq = model->BSIM4V4type * (here->BSIM4V4Igb + - here->BSIM4V4gIgbg * vgd + here->BSIM4V4gIgbd * vds + - here->BSIM4V4gIgbb * vbd); + } + else + gIbtotg = gIbtotd = gIbtots = gIbtotb = Ibtoteq = 0.0; + + if ((model->BSIM4V4igcMod != 0) || (model->BSIM4V4igbMod != 0)) + { gIgtotg = gIstotg + gIdtotg + gIbtotg; + gIgtotd = gIstotd + gIdtotd + gIbtotd ; + gIgtots = gIstots + gIdtots + gIbtots; + gIgtotb = gIstotb + gIdtotb + gIbtotb; + Igtoteq = Istoteq + Idtoteq + Ibtoteq; + } + else + gIgtotg = gIgtotd = gIgtots = gIgtotb = Igtoteq = 0.0; + + + if (here->BSIM4V4rgateMod == 2) + T0 = vges - vgs; + else if (here->BSIM4V4rgateMod == 3) + T0 = vgms - vgs; + if (here->BSIM4V4rgateMod > 1) + { gcrgd = here->BSIM4V4gcrgs * T0; + gcrgg = here->BSIM4V4gcrgg * T0; + gcrgs = here->BSIM4V4gcrgd * T0; + gcrgb = here->BSIM4V4gcrgb * T0; + ceqgcrg = -(gcrgg * vgd - gcrgs * vds + + gcrgb * vbd); + gcrgg -= here->BSIM4V4gcrg; + gcrg = here->BSIM4V4gcrg; + } + else + ceqgcrg = gcrg = gcrgd = gcrgg = gcrgs = gcrgb = 0.0; + } + + if (model->BSIM4V4rdsMod == 1) + { ceqgstot = model->BSIM4V4type * (here->BSIM4V4gstotd * vds + + here->BSIM4V4gstotg * vgs + here->BSIM4V4gstotb * vbs); + /* WDLiu: ceqgstot flowing away from sNodePrime */ + gstot = here->BSIM4V4gstot; + gstotd = here->BSIM4V4gstotd; + gstotg = here->BSIM4V4gstotg; + gstots = here->BSIM4V4gstots - gstot; + gstotb = here->BSIM4V4gstotb; + + ceqgdtot = -model->BSIM4V4type * (here->BSIM4V4gdtotd * vds + + here->BSIM4V4gdtotg * vgs + here->BSIM4V4gdtotb * vbs); + /* WDLiu: ceqgdtot defined as flowing into dNodePrime */ + gdtot = here->BSIM4V4gdtot; + gdtotd = here->BSIM4V4gdtotd - gdtot; + gdtotg = here->BSIM4V4gdtotg; + gdtots = here->BSIM4V4gdtots; + gdtotb = here->BSIM4V4gdtotb; + } + else + { gstot = gstotd = gstotg = gstots = gstotb = ceqgstot = 0.0; + gdtot = gdtotd = gdtotg = gdtots = gdtotb = ceqgdtot = 0.0; + } + + if (model->BSIM4V4type > 0) + { ceqjs = (here->BSIM4V4cbs - here->BSIM4V4gbs * vbs_jct); + ceqjd = (here->BSIM4V4cbd - here->BSIM4V4gbd * vbd_jct); + } + else + { ceqjs = -(here->BSIM4V4cbs - here->BSIM4V4gbs * vbs_jct); + ceqjd = -(here->BSIM4V4cbd - here->BSIM4V4gbd * vbd_jct); + ceqqg = -ceqqg; + ceqqd = -ceqqd; + ceqqb = -ceqqb; + ceqgcrg = -ceqgcrg; + + if (here->BSIM4V4trnqsMod) + { cqdef = -cqdef; + cqcheq = -cqcheq; + } + + if (here->BSIM4V4rbodyMod) + { ceqqjs = -ceqqjs; + ceqqjd = -ceqqjd; + } + + if (here->BSIM4V4rgateMod == 3) + ceqqgmid = -ceqqgmid; + } + + + /* + * Loading RHS + */ + + m = here->BSIM4V4m; + + (*(ckt->CKTrhs + here->BSIM4V4dNodePrime) += m * (ceqjd - ceqbd + ceqgdtot + - ceqdrn - ceqqd + Idtoteq)); + (*(ckt->CKTrhs + here->BSIM4V4gNodePrime) -= m * (ceqqg - ceqgcrg + Igtoteq)); + + if (here->BSIM4V4rgateMod == 2) + (*(ckt->CKTrhs + here->BSIM4V4gNodeExt) -= m * ceqgcrg); + else if (here->BSIM4V4rgateMod == 3) + (*(ckt->CKTrhs + here->BSIM4V4gNodeMid) -= m * (ceqqgmid + ceqgcrg)); + + if (!here->BSIM4V4rbodyMod) + { (*(ckt->CKTrhs + here->BSIM4V4bNodePrime) += m * (ceqbd + ceqbs - ceqjd + - ceqjs - ceqqb + Ibtoteq)); + (*(ckt->CKTrhs + here->BSIM4V4sNodePrime) += m * (ceqdrn - ceqbs + ceqjs + + ceqqg + ceqqb + ceqqd + ceqqgmid - ceqgstot + Istoteq)); + } + else + { (*(ckt->CKTrhs + here->BSIM4V4dbNode) -= m * (ceqjd + ceqqjd)); + (*(ckt->CKTrhs + here->BSIM4V4bNodePrime) += m * (ceqbd + ceqbs - ceqqb + Ibtoteq)); + (*(ckt->CKTrhs + here->BSIM4V4sbNode) -= m * (ceqjs + ceqqjs)); + (*(ckt->CKTrhs + here->BSIM4V4sNodePrime) += m * (ceqdrn - ceqbs + ceqjs + ceqqd + + ceqqg + ceqqb + ceqqjd + ceqqjs + ceqqgmid - ceqgstot + Istoteq)); + } + + if (model->BSIM4V4rdsMod) + { (*(ckt->CKTrhs + here->BSIM4V4dNode) -= m * ceqgdtot); + (*(ckt->CKTrhs + here->BSIM4V4sNode) += m * ceqgstot); + } + + if (here->BSIM4V4trnqsMod) + *(ckt->CKTrhs + here->BSIM4V4qNode) += m * (cqcheq - cqdef); + + + /* + * Loading matrix + */ + + if (!here->BSIM4V4rbodyMod) + { gjbd = here->BSIM4V4gbd; + gjbs = here->BSIM4V4gbs; + } + else + gjbd = gjbs = 0.0; + + if (!model->BSIM4V4rdsMod) + { gdpr = here->BSIM4V4drainConductance; + gspr = here->BSIM4V4sourceConductance; + } + else + gdpr = gspr = 0.0; + + geltd = here->BSIM4V4grgeltd; + + T1 = qdef * here->BSIM4V4gtau; + + if (here->BSIM4V4rgateMod == 1) + { (*(here->BSIM4V4GEgePtr) += m * geltd); + (*(here->BSIM4V4GPgePtr) -= m * geltd); + (*(here->BSIM4V4GEgpPtr) -= m * geltd); + (*(here->BSIM4V4GPgpPtr) += m * (gcggb + geltd - ggtg + gIgtotg)); + (*(here->BSIM4V4GPdpPtr) += m * (gcgdb - ggtd + gIgtotd)); + (*(here->BSIM4V4GPspPtr) += m * (gcgsb - ggts + gIgtots)); + (*(here->BSIM4V4GPbpPtr) += m * (gcgbb - ggtb + gIgtotb)); + } /* WDLiu: gcrg already subtracted from all gcrgg below */ + else if (here->BSIM4V4rgateMod == 2) + { (*(here->BSIM4V4GEgePtr) += m * gcrg); + (*(here->BSIM4V4GEgpPtr) += m * gcrgg); + (*(here->BSIM4V4GEdpPtr) += m * gcrgd); + (*(here->BSIM4V4GEspPtr) += m * gcrgs); + (*(here->BSIM4V4GEbpPtr) += m * gcrgb); + + (*(here->BSIM4V4GPgePtr) -= m * gcrg); + (*(here->BSIM4V4GPgpPtr) += m * (gcggb - gcrgg - ggtg + gIgtotg)); + (*(here->BSIM4V4GPdpPtr) += m * (gcgdb - gcrgd - ggtd + gIgtotd)); + (*(here->BSIM4V4GPspPtr) += m * (gcgsb - gcrgs - ggts + gIgtots)); + (*(here->BSIM4V4GPbpPtr) += m * (gcgbb - gcrgb - ggtb + gIgtotb)); + } + else if (here->BSIM4V4rgateMod == 3) + { (*(here->BSIM4V4GEgePtr) += m * geltd); + (*(here->BSIM4V4GEgmPtr) -= m * geltd); + (*(here->BSIM4V4GMgePtr) -= m * geltd); + (*(here->BSIM4V4GMgmPtr) += m * (geltd + gcrg + gcgmgmb)); + + (*(here->BSIM4V4GMdpPtr) += m * (gcrgd + gcgmdb)); + (*(here->BSIM4V4GMgpPtr) += m * gcrgg); + (*(here->BSIM4V4GMspPtr) += m * (gcrgs + gcgmsb)); + (*(here->BSIM4V4GMbpPtr) += m * (gcrgb + gcgmbb)); + + (*(here->BSIM4V4DPgmPtr) += m * gcdgmb); + (*(here->BSIM4V4GPgmPtr) -= m * gcrg); + (*(here->BSIM4V4SPgmPtr) += m * gcsgmb); + (*(here->BSIM4V4BPgmPtr) += m * gcbgmb); + + (*(here->BSIM4V4GPgpPtr) += m * (gcggb - gcrgg - ggtg + gIgtotg)); + (*(here->BSIM4V4GPdpPtr) += m * (gcgdb - gcrgd - ggtd + gIgtotd)); + (*(here->BSIM4V4GPspPtr) += m * (gcgsb - gcrgs - ggts + gIgtots)); + (*(here->BSIM4V4GPbpPtr) += m * (gcgbb - gcrgb - ggtb + gIgtotb)); + } + else + { (*(here->BSIM4V4GPgpPtr) += m * (gcggb - ggtg + gIgtotg)); + (*(here->BSIM4V4GPdpPtr) += m * (gcgdb - ggtd + gIgtotd)); + (*(here->BSIM4V4GPspPtr) += m * (gcgsb - ggts + gIgtots)); + (*(here->BSIM4V4GPbpPtr) += m * (gcgbb - ggtb + gIgtotb)); + } + + if (model->BSIM4V4rdsMod) + { (*(here->BSIM4V4DgpPtr) += m * gdtotg); + (*(here->BSIM4V4DspPtr) += m * gdtots); + (*(here->BSIM4V4DbpPtr) += m * gdtotb); + (*(here->BSIM4V4SdpPtr) += m * gstotd); + (*(here->BSIM4V4SgpPtr) += m * gstotg); + (*(here->BSIM4V4SbpPtr) += m * gstotb); + } + + (*(here->BSIM4V4DPdpPtr) += m * (gdpr + here->BSIM4V4gds + here->BSIM4V4gbd + T1 * ddxpart_dVd + - gdtotd + RevSum + gcddb + gbdpdp + dxpart * ggtd - gIdtotd)); + (*(here->BSIM4V4DPdPtr) -= m * (gdpr + gdtot)); + (*(here->BSIM4V4DPgpPtr) += m * (Gm + gcdgb - gdtotg + gbdpg - gIdtotg + + dxpart * ggtg + T1 * ddxpart_dVg)); + (*(here->BSIM4V4DPspPtr) -= m * (here->BSIM4V4gds + gdtots - dxpart * ggts + gIdtots + - T1 * ddxpart_dVs + FwdSum - gcdsb - gbdpsp)); + (*(here->BSIM4V4DPbpPtr) -= m * (gjbd + gdtotb - Gmbs - gcdbb - gbdpb + gIdtotb + - T1 * ddxpart_dVb - dxpart * ggtb)); + + (*(here->BSIM4V4DdpPtr) -= m * (gdpr - gdtotd)); + (*(here->BSIM4V4DdPtr) += m * (gdpr + gdtot)); + + (*(here->BSIM4V4SPdpPtr) -= m * (here->BSIM4V4gds + gstotd + RevSum - gcsdb - gbspdp + - T1 * dsxpart_dVd - sxpart * ggtd + gIstotd)); + (*(here->BSIM4V4SPgpPtr) += m * (gcsgb - Gm - gstotg + gbspg + sxpart * ggtg + + T1 * dsxpart_dVg - gIstotg)); + (*(here->BSIM4V4SPspPtr) += m * (gspr + here->BSIM4V4gds + here->BSIM4V4gbs + T1 * dsxpart_dVs + - gstots + FwdSum + gcssb + gbspsp + sxpart * ggts - gIstots)); + (*(here->BSIM4V4SPsPtr) -= m * (gspr + gstot)); + (*(here->BSIM4V4SPbpPtr) -= m * (gjbs + gstotb + Gmbs - gcsbb - gbspb - sxpart * ggtb + - T1 * dsxpart_dVb + gIstotb)); + + (*(here->BSIM4V4SspPtr) -= m * (gspr - gstots)); + (*(here->BSIM4V4SsPtr) += m * (gspr + gstot)); + + (*(here->BSIM4V4BPdpPtr) += m * (gcbdb - gjbd + gbbdp - gIbtotd)); + (*(here->BSIM4V4BPgpPtr) += m * (gcbgb - here->BSIM4V4gbgs - gIbtotg)); + (*(here->BSIM4V4BPspPtr) += m * (gcbsb - gjbs + gbbsp - gIbtots)); + (*(here->BSIM4V4BPbpPtr) += m * (gjbd + gjbs + gcbbb - here->BSIM4V4gbbs + - gIbtotb)); + + ggidld = here->BSIM4V4ggidld; + ggidlg = here->BSIM4V4ggidlg; + ggidlb = here->BSIM4V4ggidlb; + ggislg = here->BSIM4V4ggislg; + ggisls = here->BSIM4V4ggisls; + ggislb = here->BSIM4V4ggislb; + + /* stamp gidl */ + (*(here->BSIM4V4DPdpPtr) += m * ggidld); + (*(here->BSIM4V4DPgpPtr) += m * ggidlg); + (*(here->BSIM4V4DPspPtr) -= m * (ggidlg + ggidld + ggidlb)); + (*(here->BSIM4V4DPbpPtr) += m * ggidlb); + (*(here->BSIM4V4BPdpPtr) -= m * ggidld); + (*(here->BSIM4V4BPgpPtr) -= m * ggidlg); + (*(here->BSIM4V4BPspPtr) += m * (ggidlg + ggidld + ggidlb)); + (*(here->BSIM4V4BPbpPtr) -= m * ggidlb); + /* stamp gisl */ + (*(here->BSIM4V4SPdpPtr) -= m * (ggisls + ggislg + ggislb)); + (*(here->BSIM4V4SPgpPtr) += m * ggislg); + (*(here->BSIM4V4SPspPtr) += m * ggisls); + (*(here->BSIM4V4SPbpPtr) += m * ggislb); + (*(here->BSIM4V4BPdpPtr) += m * (ggislg + ggisls + ggislb)); + (*(here->BSIM4V4BPgpPtr) -= m * ggislg); + (*(here->BSIM4V4BPspPtr) -= m * ggisls); + (*(here->BSIM4V4BPbpPtr) -= m * ggislb); + + + if (here->BSIM4V4rbodyMod) + { (*(here->BSIM4V4DPdbPtr) += m * (gcdbdb - here->BSIM4V4gbd)); + (*(here->BSIM4V4SPsbPtr) -= m * (here->BSIM4V4gbs - gcsbsb)); + + (*(here->BSIM4V4DBdpPtr) += m * (gcdbdb - here->BSIM4V4gbd)); + (*(here->BSIM4V4DBdbPtr) += m * (here->BSIM4V4gbd - gcdbdb + + here->BSIM4V4grbpd + here->BSIM4V4grbdb)); + (*(here->BSIM4V4DBbpPtr) -= m * here->BSIM4V4grbpd); + (*(here->BSIM4V4DBbPtr) -= m * here->BSIM4V4grbdb); + + (*(here->BSIM4V4BPdbPtr) -= m * here->BSIM4V4grbpd); + (*(here->BSIM4V4BPbPtr) -= m * here->BSIM4V4grbpb); + (*(here->BSIM4V4BPsbPtr) -= m * here->BSIM4V4grbps); + (*(here->BSIM4V4BPbpPtr) += m * (here->BSIM4V4grbpd + here->BSIM4V4grbps + + here->BSIM4V4grbpb)); + /* WDLiu: (gcbbb - here->BSIM4V4gbbs) already added to BPbpPtr */ + + (*(here->BSIM4V4SBspPtr) += m * (gcsbsb - here->BSIM4V4gbs)); + (*(here->BSIM4V4SBbpPtr) -= m * here->BSIM4V4grbps); + (*(here->BSIM4V4SBbPtr) -= m * here->BSIM4V4grbsb); + (*(here->BSIM4V4SBsbPtr) += m * (here->BSIM4V4gbs - gcsbsb + + here->BSIM4V4grbps + here->BSIM4V4grbsb)); + + (*(here->BSIM4V4BdbPtr) -= m * here->BSIM4V4grbdb); + (*(here->BSIM4V4BbpPtr) -= m * here->BSIM4V4grbpb); + (*(here->BSIM4V4BsbPtr) -= m * here->BSIM4V4grbsb); + (*(here->BSIM4V4BbPtr) += m * (here->BSIM4V4grbsb + here->BSIM4V4grbdb + + here->BSIM4V4grbpb)); + } + + if (here->BSIM4V4trnqsMod) + { (*(here->BSIM4V4QqPtr) += m * (gqdef + here->BSIM4V4gtau)); + (*(here->BSIM4V4QgpPtr) += m * (ggtg - gcqgb)); + (*(here->BSIM4V4QdpPtr) += m * (ggtd - gcqdb)); + (*(here->BSIM4V4QspPtr) += m * (ggts - gcqsb)); + (*(here->BSIM4V4QbpPtr) += m * (ggtb - gcqbb)); + + (*(here->BSIM4V4DPqPtr) += m * dxpart * here->BSIM4V4gtau); + (*(here->BSIM4V4SPqPtr) += m * sxpart * here->BSIM4V4gtau); + (*(here->BSIM4V4GPqPtr) -= m * here->BSIM4V4gtau); + } + +line1000: ; + + } /* End of MOSFET Instance */ +} /* End of Model Instance */ + +return(OK); +} + +/* function to compute poly depletion effect */ +int BSIM4V4polyDepletion( + double phi, + double ngate, + double coxe, + double Vgs, + double *Vgs_eff, + double *dVgs_eff_dVg) +{ + double T1, T2, T3, T4, T5, T6, T7, T8; + + /* Poly Gate Si Depletion Effect */ + if ((ngate > 1.0e18) && + (ngate < 1.0e25) && (Vgs > phi)) { + T1 = 1.0e6 * CHARGE * EPSSI * ngate / (coxe * coxe); + T8 = Vgs - phi; + T4 = sqrt(1.0 + 2.0 * T8 / T1); + T2 = 2.0 * T8 / (T4 + 1.0); + T3 = 0.5 * T2 * T2 / T1; /* T3 = Vpoly */ + T7 = 1.12 - T3 - 0.05; + T6 = sqrt(T7 * T7 + 0.224); + T5 = 1.12 - 0.5 * (T7 + T6); + *Vgs_eff = Vgs - T5; + *dVgs_eff_dVg = 1.0 - (0.5 - 0.5 / T4) * (1.0 + T7 / T6); + } + else { + *Vgs_eff = Vgs; + *dVgs_eff_dVg = 1.0; + } + return(0); +} diff --git a/src/spicelib/devices/bsim4v4/b4v4mask.c b/src/spicelib/devices/bsim4v4/b4v4mask.c new file mode 100644 index 000000000..68bc863f7 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4mask.c @@ -0,0 +1,1979 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4mask.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 11/15/2002. + * Modified by Xuemei Xi, 05/09/2003. + **********/ + + +#include "ngspice.h" +#include "ifsim.h" +#include "cktdefs.h" +#include "devdefs.h" +#include "bsim4v4def.h" +#include "sperror.h" +#include "suffix.h" + +int +BSIM4V4mAsk(ckt,inst,which,value) +CKTcircuit *ckt; +GENmodel *inst; +int which; +IFvalue *value; +{ + BSIM4V4model *model = (BSIM4V4model *)inst; + switch(which) + { case BSIM4V4_MOD_MOBMOD : + value->iValue = model->BSIM4V4mobMod; + return(OK); + case BSIM4V4_MOD_PARAMCHK : + value->iValue = model->BSIM4V4paramChk; + return(OK); + case BSIM4V4_MOD_BINUNIT : + value->iValue = model->BSIM4V4binUnit; + return(OK); + case BSIM4V4_MOD_CAPMOD : + value->iValue = model->BSIM4V4capMod; + return(OK); + case BSIM4V4_MOD_DIOMOD : + value->iValue = model->BSIM4V4dioMod; + return(OK); + case BSIM4V4_MOD_TRNQSMOD : + value->iValue = model->BSIM4V4trnqsMod; + return(OK); + case BSIM4V4_MOD_ACNQSMOD : + value->iValue = model->BSIM4V4acnqsMod; + return(OK); + case BSIM4V4_MOD_FNOIMOD : + value->iValue = model->BSIM4V4fnoiMod; + return(OK); + case BSIM4V4_MOD_TNOIMOD : + value->iValue = model->BSIM4V4tnoiMod; + return(OK); + case BSIM4V4_MOD_RDSMOD : + value->iValue = model->BSIM4V4rdsMod; + return(OK); + case BSIM4V4_MOD_RBODYMOD : + value->iValue = model->BSIM4V4rbodyMod; + return(OK); + case BSIM4V4_MOD_RGATEMOD : + value->iValue = model->BSIM4V4rgateMod; + return(OK); + case BSIM4V4_MOD_PERMOD : + value->iValue = model->BSIM4V4perMod; + return(OK); + case BSIM4V4_MOD_GEOMOD : + value->iValue = model->BSIM4V4geoMod; + return(OK); + case BSIM4V4_MOD_IGCMOD : + value->iValue = model->BSIM4V4igcMod; + return(OK); + case BSIM4V4_MOD_IGBMOD : + value->iValue = model->BSIM4V4igbMod; + return(OK); + case BSIM4V4_MOD_TEMPMOD : + value->iValue = model->BSIM4V4tempMod; + return(OK); + case BSIM4V4_MOD_VERSION : + value->sValue = model->BSIM4V4version; + return(OK); + case BSIM4V4_MOD_TOXREF : + value->rValue = model->BSIM4V4toxref; + return(OK); + case BSIM4V4_MOD_TOXE : + value->rValue = model->BSIM4V4toxe; + return(OK); + case BSIM4V4_MOD_TOXP : + value->rValue = model->BSIM4V4toxp; + return(OK); + case BSIM4V4_MOD_TOXM : + value->rValue = model->BSIM4V4toxm; + return(OK); + case BSIM4V4_MOD_DTOX : + value->rValue = model->BSIM4V4dtox; + return(OK); + case BSIM4V4_MOD_EPSROX : + value->rValue = model->BSIM4V4epsrox; + return(OK); + case BSIM4V4_MOD_CDSC : + value->rValue = model->BSIM4V4cdsc; + return(OK); + case BSIM4V4_MOD_CDSCB : + value->rValue = model->BSIM4V4cdscb; + return(OK); + + case BSIM4V4_MOD_CDSCD : + value->rValue = model->BSIM4V4cdscd; + return(OK); + + case BSIM4V4_MOD_CIT : + value->rValue = model->BSIM4V4cit; + return(OK); + case BSIM4V4_MOD_NFACTOR : + value->rValue = model->BSIM4V4nfactor; + return(OK); + case BSIM4V4_MOD_XJ: + value->rValue = model->BSIM4V4xj; + return(OK); + case BSIM4V4_MOD_VSAT: + value->rValue = model->BSIM4V4vsat; + return(OK); + case BSIM4V4_MOD_VTL: + value->rValue = model->BSIM4V4vtl; + return(OK); + case BSIM4V4_MOD_XN: + value->rValue = model->BSIM4V4xn; + return(OK); + case BSIM4V4_MOD_LC: + value->rValue = model->BSIM4V4lc; + return(OK); + case BSIM4V4_MOD_LAMBDA: + value->rValue = model->BSIM4V4lambda; + return(OK); + case BSIM4V4_MOD_AT: + value->rValue = model->BSIM4V4at; + return(OK); + case BSIM4V4_MOD_A0: + value->rValue = model->BSIM4V4a0; + return(OK); + + case BSIM4V4_MOD_AGS: + value->rValue = model->BSIM4V4ags; + return(OK); + + case BSIM4V4_MOD_A1: + value->rValue = model->BSIM4V4a1; + return(OK); + case BSIM4V4_MOD_A2: + value->rValue = model->BSIM4V4a2; + return(OK); + case BSIM4V4_MOD_KETA: + value->rValue = model->BSIM4V4keta; + return(OK); + case BSIM4V4_MOD_NSUB: + value->rValue = model->BSIM4V4nsub; + return(OK); + case BSIM4V4_MOD_NDEP: + value->rValue = model->BSIM4V4ndep; + return(OK); + case BSIM4V4_MOD_NSD: + value->rValue = model->BSIM4V4nsd; + return(OK); + case BSIM4V4_MOD_NGATE: + value->rValue = model->BSIM4V4ngate; + return(OK); + case BSIM4V4_MOD_GAMMA1: + value->rValue = model->BSIM4V4gamma1; + return(OK); + case BSIM4V4_MOD_GAMMA2: + value->rValue = model->BSIM4V4gamma2; + return(OK); + case BSIM4V4_MOD_VBX: + value->rValue = model->BSIM4V4vbx; + return(OK); + case BSIM4V4_MOD_VBM: + value->rValue = model->BSIM4V4vbm; + return(OK); + case BSIM4V4_MOD_XT: + value->rValue = model->BSIM4V4xt; + return(OK); + case BSIM4V4_MOD_K1: + value->rValue = model->BSIM4V4k1; + return(OK); + case BSIM4V4_MOD_KT1: + value->rValue = model->BSIM4V4kt1; + return(OK); + case BSIM4V4_MOD_KT1L: + value->rValue = model->BSIM4V4kt1l; + return(OK); + case BSIM4V4_MOD_KT2 : + value->rValue = model->BSIM4V4kt2; + return(OK); + case BSIM4V4_MOD_K2 : + value->rValue = model->BSIM4V4k2; + return(OK); + case BSIM4V4_MOD_K3: + value->rValue = model->BSIM4V4k3; + return(OK); + case BSIM4V4_MOD_K3B: + value->rValue = model->BSIM4V4k3b; + return(OK); + case BSIM4V4_MOD_W0: + value->rValue = model->BSIM4V4w0; + return(OK); + case BSIM4V4_MOD_LPE0: + value->rValue = model->BSIM4V4lpe0; + return(OK); + case BSIM4V4_MOD_LPEB: + value->rValue = model->BSIM4V4lpeb; + return(OK); + case BSIM4V4_MOD_DVTP0: + value->rValue = model->BSIM4V4dvtp0; + return(OK); + case BSIM4V4_MOD_DVTP1: + value->rValue = model->BSIM4V4dvtp1; + return(OK); + case BSIM4V4_MOD_DVT0 : + value->rValue = model->BSIM4V4dvt0; + return(OK); + case BSIM4V4_MOD_DVT1 : + value->rValue = model->BSIM4V4dvt1; + return(OK); + case BSIM4V4_MOD_DVT2 : + value->rValue = model->BSIM4V4dvt2; + return(OK); + case BSIM4V4_MOD_DVT0W : + value->rValue = model->BSIM4V4dvt0w; + return(OK); + case BSIM4V4_MOD_DVT1W : + value->rValue = model->BSIM4V4dvt1w; + return(OK); + case BSIM4V4_MOD_DVT2W : + value->rValue = model->BSIM4V4dvt2w; + return(OK); + case BSIM4V4_MOD_DROUT : + value->rValue = model->BSIM4V4drout; + return(OK); + case BSIM4V4_MOD_DSUB : + value->rValue = model->BSIM4V4dsub; + return(OK); + case BSIM4V4_MOD_VTH0: + value->rValue = model->BSIM4V4vth0; + return(OK); + case BSIM4V4_MOD_EU: + value->rValue = model->BSIM4V4eu; + return(OK); + case BSIM4V4_MOD_UA: + value->rValue = model->BSIM4V4ua; + return(OK); + case BSIM4V4_MOD_UA1: + value->rValue = model->BSIM4V4ua1; + return(OK); + case BSIM4V4_MOD_UB: + value->rValue = model->BSIM4V4ub; + return(OK); + case BSIM4V4_MOD_UB1: + value->rValue = model->BSIM4V4ub1; + return(OK); + case BSIM4V4_MOD_UC: + value->rValue = model->BSIM4V4uc; + return(OK); + case BSIM4V4_MOD_UC1: + value->rValue = model->BSIM4V4uc1; + return(OK); + case BSIM4V4_MOD_U0: + value->rValue = model->BSIM4V4u0; + return(OK); + case BSIM4V4_MOD_UTE: + value->rValue = model->BSIM4V4ute; + return(OK); + case BSIM4V4_MOD_VOFF: + value->rValue = model->BSIM4V4voff; + return(OK); + case BSIM4V4_MOD_VOFFL: + value->rValue = model->BSIM4V4voffl; + return(OK); + case BSIM4V4_MOD_MINV: + value->rValue = model->BSIM4V4minv; + return(OK); + case BSIM4V4_MOD_FPROUT: + value->rValue = model->BSIM4V4fprout; + return(OK); + case BSIM4V4_MOD_PDITS: + value->rValue = model->BSIM4V4pdits; + return(OK); + case BSIM4V4_MOD_PDITSD: + value->rValue = model->BSIM4V4pditsd; + return(OK); + case BSIM4V4_MOD_PDITSL: + value->rValue = model->BSIM4V4pditsl; + return(OK); + case BSIM4V4_MOD_DELTA: + value->rValue = model->BSIM4V4delta; + return(OK); + case BSIM4V4_MOD_RDSW: + value->rValue = model->BSIM4V4rdsw; + return(OK); + case BSIM4V4_MOD_RDSWMIN: + value->rValue = model->BSIM4V4rdswmin; + return(OK); + case BSIM4V4_MOD_RDWMIN: + value->rValue = model->BSIM4V4rdwmin; + return(OK); + case BSIM4V4_MOD_RSWMIN: + value->rValue = model->BSIM4V4rswmin; + return(OK); + case BSIM4V4_MOD_RDW: + value->rValue = model->BSIM4V4rdw; + return(OK); + case BSIM4V4_MOD_RSW: + value->rValue = model->BSIM4V4rsw; + return(OK); + case BSIM4V4_MOD_PRWG: + value->rValue = model->BSIM4V4prwg; + return(OK); + case BSIM4V4_MOD_PRWB: + value->rValue = model->BSIM4V4prwb; + return(OK); + case BSIM4V4_MOD_PRT: + value->rValue = model->BSIM4V4prt; + return(OK); + case BSIM4V4_MOD_ETA0: + value->rValue = model->BSIM4V4eta0; + return(OK); + case BSIM4V4_MOD_ETAB: + value->rValue = model->BSIM4V4etab; + return(OK); + case BSIM4V4_MOD_PCLM: + value->rValue = model->BSIM4V4pclm; + return(OK); + case BSIM4V4_MOD_PDIBL1: + value->rValue = model->BSIM4V4pdibl1; + return(OK); + case BSIM4V4_MOD_PDIBL2: + value->rValue = model->BSIM4V4pdibl2; + return(OK); + case BSIM4V4_MOD_PDIBLB: + value->rValue = model->BSIM4V4pdiblb; + return(OK); + case BSIM4V4_MOD_PSCBE1: + value->rValue = model->BSIM4V4pscbe1; + return(OK); + case BSIM4V4_MOD_PSCBE2: + value->rValue = model->BSIM4V4pscbe2; + return(OK); + case BSIM4V4_MOD_PVAG: + value->rValue = model->BSIM4V4pvag; + return(OK); + case BSIM4V4_MOD_WR: + value->rValue = model->BSIM4V4wr; + return(OK); + case BSIM4V4_MOD_DWG: + value->rValue = model->BSIM4V4dwg; + return(OK); + case BSIM4V4_MOD_DWB: + value->rValue = model->BSIM4V4dwb; + return(OK); + case BSIM4V4_MOD_B0: + value->rValue = model->BSIM4V4b0; + return(OK); + case BSIM4V4_MOD_B1: + value->rValue = model->BSIM4V4b1; + return(OK); + case BSIM4V4_MOD_ALPHA0: + value->rValue = model->BSIM4V4alpha0; + return(OK); + case BSIM4V4_MOD_ALPHA1: + value->rValue = model->BSIM4V4alpha1; + return(OK); + case BSIM4V4_MOD_BETA0: + value->rValue = model->BSIM4V4beta0; + return(OK); + case BSIM4V4_MOD_AGIDL: + value->rValue = model->BSIM4V4agidl; + return(OK); + case BSIM4V4_MOD_BGIDL: + value->rValue = model->BSIM4V4bgidl; + return(OK); + case BSIM4V4_MOD_CGIDL: + value->rValue = model->BSIM4V4cgidl; + return(OK); + case BSIM4V4_MOD_EGIDL: + value->rValue = model->BSIM4V4egidl; + return(OK); + case BSIM4V4_MOD_AIGC: + value->rValue = model->BSIM4V4aigc; + return(OK); + case BSIM4V4_MOD_BIGC: + value->rValue = model->BSIM4V4bigc; + return(OK); + case BSIM4V4_MOD_CIGC: + value->rValue = model->BSIM4V4cigc; + return(OK); + case BSIM4V4_MOD_AIGSD: + value->rValue = model->BSIM4V4aigsd; + return(OK); + case BSIM4V4_MOD_BIGSD: + value->rValue = model->BSIM4V4bigsd; + return(OK); + case BSIM4V4_MOD_CIGSD: + value->rValue = model->BSIM4V4cigsd; + return(OK); + case BSIM4V4_MOD_AIGBACC: + value->rValue = model->BSIM4V4aigbacc; + return(OK); + case BSIM4V4_MOD_BIGBACC: + value->rValue = model->BSIM4V4bigbacc; + return(OK); + case BSIM4V4_MOD_CIGBACC: + value->rValue = model->BSIM4V4cigbacc; + return(OK); + case BSIM4V4_MOD_AIGBINV: + value->rValue = model->BSIM4V4aigbinv; + return(OK); + case BSIM4V4_MOD_BIGBINV: + value->rValue = model->BSIM4V4bigbinv; + return(OK); + case BSIM4V4_MOD_CIGBINV: + value->rValue = model->BSIM4V4cigbinv; + return(OK); + case BSIM4V4_MOD_NIGC: + value->rValue = model->BSIM4V4nigc; + return(OK); + case BSIM4V4_MOD_NIGBACC: + value->rValue = model->BSIM4V4nigbacc; + return(OK); + case BSIM4V4_MOD_NIGBINV: + value->rValue = model->BSIM4V4nigbinv; + return(OK); + case BSIM4V4_MOD_NTOX: + value->rValue = model->BSIM4V4ntox; + return(OK); + case BSIM4V4_MOD_EIGBINV: + value->rValue = model->BSIM4V4eigbinv; + return(OK); + case BSIM4V4_MOD_PIGCD: + value->rValue = model->BSIM4V4pigcd; + return(OK); + case BSIM4V4_MOD_POXEDGE: + value->rValue = model->BSIM4V4poxedge; + return(OK); + case BSIM4V4_MOD_PHIN: + value->rValue = model->BSIM4V4phin; + return(OK); + case BSIM4V4_MOD_XRCRG1: + value->rValue = model->BSIM4V4xrcrg1; + return(OK); + case BSIM4V4_MOD_XRCRG2: + value->rValue = model->BSIM4V4xrcrg2; + return(OK); + case BSIM4V4_MOD_TNOIA: + value->rValue = model->BSIM4V4tnoia; + return(OK); + case BSIM4V4_MOD_TNOIB: + value->rValue = model->BSIM4V4tnoib; + return(OK); + case BSIM4V4_MOD_RNOIA: + value->rValue = model->BSIM4V4rnoia; + return(OK); + case BSIM4V4_MOD_RNOIB: + value->rValue = model->BSIM4V4rnoib; + return(OK); + case BSIM4V4_MOD_NTNOI: + value->rValue = model->BSIM4V4ntnoi; + return(OK); + case BSIM4V4_MOD_IJTHDFWD: + value->rValue = model->BSIM4V4ijthdfwd; + return(OK); + case BSIM4V4_MOD_IJTHSFWD: + value->rValue = model->BSIM4V4ijthsfwd; + return(OK); + case BSIM4V4_MOD_IJTHDREV: + value->rValue = model->BSIM4V4ijthdrev; + return(OK); + case BSIM4V4_MOD_IJTHSREV: + value->rValue = model->BSIM4V4ijthsrev; + return(OK); + case BSIM4V4_MOD_XJBVD: + value->rValue = model->BSIM4V4xjbvd; + return(OK); + case BSIM4V4_MOD_XJBVS: + value->rValue = model->BSIM4V4xjbvs; + return(OK); + case BSIM4V4_MOD_BVD: + value->rValue = model->BSIM4V4bvd; + return(OK); + case BSIM4V4_MOD_BVS: + value->rValue = model->BSIM4V4bvs; + return(OK); + case BSIM4V4_MOD_VFB: + value->rValue = model->BSIM4V4vfb; + return(OK); + + case BSIM4V4_MOD_GBMIN: + value->rValue = model->BSIM4V4gbmin; + return(OK); + case BSIM4V4_MOD_RBDB: + value->rValue = model->BSIM4V4rbdb; + return(OK); + case BSIM4V4_MOD_RBPB: + value->rValue = model->BSIM4V4rbpb; + return(OK); + case BSIM4V4_MOD_RBSB: + value->rValue = model->BSIM4V4rbsb; + return(OK); + case BSIM4V4_MOD_RBPS: + value->rValue = model->BSIM4V4rbps; + return(OK); + case BSIM4V4_MOD_RBPD: + value->rValue = model->BSIM4V4rbpd; + return(OK); + + case BSIM4V4_MOD_CGSL: + value->rValue = model->BSIM4V4cgsl; + return(OK); + case BSIM4V4_MOD_CGDL: + value->rValue = model->BSIM4V4cgdl; + return(OK); + case BSIM4V4_MOD_CKAPPAS: + value->rValue = model->BSIM4V4ckappas; + return(OK); + case BSIM4V4_MOD_CKAPPAD: + value->rValue = model->BSIM4V4ckappad; + return(OK); + case BSIM4V4_MOD_CF: + value->rValue = model->BSIM4V4cf; + return(OK); + case BSIM4V4_MOD_CLC: + value->rValue = model->BSIM4V4clc; + return(OK); + case BSIM4V4_MOD_CLE: + value->rValue = model->BSIM4V4cle; + return(OK); + case BSIM4V4_MOD_DWC: + value->rValue = model->BSIM4V4dwc; + return(OK); + case BSIM4V4_MOD_DLC: + value->rValue = model->BSIM4V4dlc; + return(OK); + case BSIM4V4_MOD_XW: + value->rValue = model->BSIM4V4xw; + return(OK); + case BSIM4V4_MOD_XL: + value->rValue = model->BSIM4V4xl; + return(OK); + case BSIM4V4_MOD_DLCIG: + value->rValue = model->BSIM4V4dlcig; + return(OK); + case BSIM4V4_MOD_DWJ: + value->rValue = model->BSIM4V4dwj; + return(OK); + case BSIM4V4_MOD_VFBCV: + value->rValue = model->BSIM4V4vfbcv; + return(OK); + case BSIM4V4_MOD_ACDE: + value->rValue = model->BSIM4V4acde; + return(OK); + case BSIM4V4_MOD_MOIN: + value->rValue = model->BSIM4V4moin; + return(OK); + case BSIM4V4_MOD_NOFF: + value->rValue = model->BSIM4V4noff; + return(OK); + case BSIM4V4_MOD_VOFFCV: + value->rValue = model->BSIM4V4voffcv; + return(OK); + case BSIM4V4_MOD_DMCG: + value->rValue = model->BSIM4V4dmcg; + return(OK); + case BSIM4V4_MOD_DMCI: + value->rValue = model->BSIM4V4dmci; + return(OK); + case BSIM4V4_MOD_DMDG: + value->rValue = model->BSIM4V4dmdg; + return(OK); + case BSIM4V4_MOD_DMCGT: + value->rValue = model->BSIM4V4dmcgt; + return(OK); + case BSIM4V4_MOD_XGW: + value->rValue = model->BSIM4V4xgw; + return(OK); + case BSIM4V4_MOD_XGL: + value->rValue = model->BSIM4V4xgl; + return(OK); + case BSIM4V4_MOD_RSHG: + value->rValue = model->BSIM4V4rshg; + return(OK); + case BSIM4V4_MOD_NGCON: + value->rValue = model->BSIM4V4ngcon; + return(OK); + case BSIM4V4_MOD_TCJ: + value->rValue = model->BSIM4V4tcj; + return(OK); + case BSIM4V4_MOD_TPB: + value->rValue = model->BSIM4V4tpb; + return(OK); + case BSIM4V4_MOD_TCJSW: + value->rValue = model->BSIM4V4tcjsw; + return(OK); + case BSIM4V4_MOD_TPBSW: + value->rValue = model->BSIM4V4tpbsw; + return(OK); + case BSIM4V4_MOD_TCJSWG: + value->rValue = model->BSIM4V4tcjswg; + return(OK); + case BSIM4V4_MOD_TPBSWG: + value->rValue = model->BSIM4V4tpbswg; + return(OK); + + /* Length dependence */ + case BSIM4V4_MOD_LCDSC : + value->rValue = model->BSIM4V4lcdsc; + return(OK); + case BSIM4V4_MOD_LCDSCB : + value->rValue = model->BSIM4V4lcdscb; + return(OK); + case BSIM4V4_MOD_LCDSCD : + value->rValue = model->BSIM4V4lcdscd; + return(OK); + case BSIM4V4_MOD_LCIT : + value->rValue = model->BSIM4V4lcit; + return(OK); + case BSIM4V4_MOD_LNFACTOR : + value->rValue = model->BSIM4V4lnfactor; + return(OK); + case BSIM4V4_MOD_LXJ: + value->rValue = model->BSIM4V4lxj; + return(OK); + case BSIM4V4_MOD_LVSAT: + value->rValue = model->BSIM4V4lvsat; + return(OK); + case BSIM4V4_MOD_LAT: + value->rValue = model->BSIM4V4lat; + return(OK); + case BSIM4V4_MOD_LA0: + value->rValue = model->BSIM4V4la0; + return(OK); + case BSIM4V4_MOD_LAGS: + value->rValue = model->BSIM4V4lags; + return(OK); + case BSIM4V4_MOD_LA1: + value->rValue = model->BSIM4V4la1; + return(OK); + case BSIM4V4_MOD_LA2: + value->rValue = model->BSIM4V4la2; + return(OK); + case BSIM4V4_MOD_LKETA: + value->rValue = model->BSIM4V4lketa; + return(OK); + case BSIM4V4_MOD_LNSUB: + value->rValue = model->BSIM4V4lnsub; + return(OK); + case BSIM4V4_MOD_LNDEP: + value->rValue = model->BSIM4V4lndep; + return(OK); + case BSIM4V4_MOD_LNSD: + value->rValue = model->BSIM4V4lnsd; + return(OK); + case BSIM4V4_MOD_LNGATE: + value->rValue = model->BSIM4V4lngate; + return(OK); + case BSIM4V4_MOD_LGAMMA1: + value->rValue = model->BSIM4V4lgamma1; + return(OK); + case BSIM4V4_MOD_LGAMMA2: + value->rValue = model->BSIM4V4lgamma2; + return(OK); + case BSIM4V4_MOD_LVBX: + value->rValue = model->BSIM4V4lvbx; + return(OK); + case BSIM4V4_MOD_LVBM: + value->rValue = model->BSIM4V4lvbm; + return(OK); + case BSIM4V4_MOD_LXT: + value->rValue = model->BSIM4V4lxt; + return(OK); + case BSIM4V4_MOD_LK1: + value->rValue = model->BSIM4V4lk1; + return(OK); + case BSIM4V4_MOD_LKT1: + value->rValue = model->BSIM4V4lkt1; + return(OK); + case BSIM4V4_MOD_LKT1L: + value->rValue = model->BSIM4V4lkt1l; + return(OK); + case BSIM4V4_MOD_LKT2 : + value->rValue = model->BSIM4V4lkt2; + return(OK); + case BSIM4V4_MOD_LK2 : + value->rValue = model->BSIM4V4lk2; + return(OK); + case BSIM4V4_MOD_LK3: + value->rValue = model->BSIM4V4lk3; + return(OK); + case BSIM4V4_MOD_LK3B: + value->rValue = model->BSIM4V4lk3b; + return(OK); + case BSIM4V4_MOD_LW0: + value->rValue = model->BSIM4V4lw0; + return(OK); + case BSIM4V4_MOD_LLPE0: + value->rValue = model->BSIM4V4llpe0; + return(OK); + case BSIM4V4_MOD_LLPEB: + value->rValue = model->BSIM4V4llpeb; + return(OK); + case BSIM4V4_MOD_LDVTP0: + value->rValue = model->BSIM4V4ldvtp0; + return(OK); + case BSIM4V4_MOD_LDVTP1: + value->rValue = model->BSIM4V4ldvtp1; + return(OK); + case BSIM4V4_MOD_LDVT0: + value->rValue = model->BSIM4V4ldvt0; + return(OK); + case BSIM4V4_MOD_LDVT1 : + value->rValue = model->BSIM4V4ldvt1; + return(OK); + case BSIM4V4_MOD_LDVT2 : + value->rValue = model->BSIM4V4ldvt2; + return(OK); + case BSIM4V4_MOD_LDVT0W : + value->rValue = model->BSIM4V4ldvt0w; + return(OK); + case BSIM4V4_MOD_LDVT1W : + value->rValue = model->BSIM4V4ldvt1w; + return(OK); + case BSIM4V4_MOD_LDVT2W : + value->rValue = model->BSIM4V4ldvt2w; + return(OK); + case BSIM4V4_MOD_LDROUT : + value->rValue = model->BSIM4V4ldrout; + return(OK); + case BSIM4V4_MOD_LDSUB : + value->rValue = model->BSIM4V4ldsub; + return(OK); + case BSIM4V4_MOD_LVTH0: + value->rValue = model->BSIM4V4lvth0; + return(OK); + case BSIM4V4_MOD_LUA: + value->rValue = model->BSIM4V4lua; + return(OK); + case BSIM4V4_MOD_LUA1: + value->rValue = model->BSIM4V4lua1; + return(OK); + case BSIM4V4_MOD_LUB: + value->rValue = model->BSIM4V4lub; + return(OK); + case BSIM4V4_MOD_LUB1: + value->rValue = model->BSIM4V4lub1; + return(OK); + case BSIM4V4_MOD_LUC: + value->rValue = model->BSIM4V4luc; + return(OK); + case BSIM4V4_MOD_LUC1: + value->rValue = model->BSIM4V4luc1; + return(OK); + case BSIM4V4_MOD_LU0: + value->rValue = model->BSIM4V4lu0; + return(OK); + case BSIM4V4_MOD_LUTE: + value->rValue = model->BSIM4V4lute; + return(OK); + case BSIM4V4_MOD_LVOFF: + value->rValue = model->BSIM4V4lvoff; + return(OK); + case BSIM4V4_MOD_LMINV: + value->rValue = model->BSIM4V4lminv; + return(OK); + case BSIM4V4_MOD_LFPROUT: + value->rValue = model->BSIM4V4lfprout; + return(OK); + case BSIM4V4_MOD_LPDITS: + value->rValue = model->BSIM4V4lpdits; + return(OK); + case BSIM4V4_MOD_LPDITSD: + value->rValue = model->BSIM4V4lpditsd; + return(OK); + case BSIM4V4_MOD_LDELTA: + value->rValue = model->BSIM4V4ldelta; + return(OK); + case BSIM4V4_MOD_LRDSW: + value->rValue = model->BSIM4V4lrdsw; + return(OK); + case BSIM4V4_MOD_LRDW: + value->rValue = model->BSIM4V4lrdw; + return(OK); + case BSIM4V4_MOD_LRSW: + value->rValue = model->BSIM4V4lrsw; + return(OK); + case BSIM4V4_MOD_LPRWB: + value->rValue = model->BSIM4V4lprwb; + return(OK); + case BSIM4V4_MOD_LPRWG: + value->rValue = model->BSIM4V4lprwg; + return(OK); + case BSIM4V4_MOD_LPRT: + value->rValue = model->BSIM4V4lprt; + return(OK); + case BSIM4V4_MOD_LETA0: + value->rValue = model->BSIM4V4leta0; + return(OK); + case BSIM4V4_MOD_LETAB: + value->rValue = model->BSIM4V4letab; + return(OK); + case BSIM4V4_MOD_LPCLM: + value->rValue = model->BSIM4V4lpclm; + return(OK); + case BSIM4V4_MOD_LPDIBL1: + value->rValue = model->BSIM4V4lpdibl1; + return(OK); + case BSIM4V4_MOD_LPDIBL2: + value->rValue = model->BSIM4V4lpdibl2; + return(OK); + case BSIM4V4_MOD_LPDIBLB: + value->rValue = model->BSIM4V4lpdiblb; + return(OK); + case BSIM4V4_MOD_LPSCBE1: + value->rValue = model->BSIM4V4lpscbe1; + return(OK); + case BSIM4V4_MOD_LPSCBE2: + value->rValue = model->BSIM4V4lpscbe2; + return(OK); + case BSIM4V4_MOD_LPVAG: + value->rValue = model->BSIM4V4lpvag; + return(OK); + case BSIM4V4_MOD_LWR: + value->rValue = model->BSIM4V4lwr; + return(OK); + case BSIM4V4_MOD_LDWG: + value->rValue = model->BSIM4V4ldwg; + return(OK); + case BSIM4V4_MOD_LDWB: + value->rValue = model->BSIM4V4ldwb; + return(OK); + case BSIM4V4_MOD_LB0: + value->rValue = model->BSIM4V4lb0; + return(OK); + case BSIM4V4_MOD_LB1: + value->rValue = model->BSIM4V4lb1; + return(OK); + case BSIM4V4_MOD_LALPHA0: + value->rValue = model->BSIM4V4lalpha0; + return(OK); + case BSIM4V4_MOD_LALPHA1: + value->rValue = model->BSIM4V4lalpha1; + return(OK); + case BSIM4V4_MOD_LBETA0: + value->rValue = model->BSIM4V4lbeta0; + return(OK); + case BSIM4V4_MOD_LAGIDL: + value->rValue = model->BSIM4V4lagidl; + return(OK); + case BSIM4V4_MOD_LBGIDL: + value->rValue = model->BSIM4V4lbgidl; + return(OK); + case BSIM4V4_MOD_LCGIDL: + value->rValue = model->BSIM4V4lcgidl; + return(OK); + case BSIM4V4_MOD_LEGIDL: + value->rValue = model->BSIM4V4legidl; + return(OK); + case BSIM4V4_MOD_LAIGC: + value->rValue = model->BSIM4V4laigc; + return(OK); + case BSIM4V4_MOD_LBIGC: + value->rValue = model->BSIM4V4lbigc; + return(OK); + case BSIM4V4_MOD_LCIGC: + value->rValue = model->BSIM4V4lcigc; + return(OK); + case BSIM4V4_MOD_LAIGSD: + value->rValue = model->BSIM4V4laigsd; + return(OK); + case BSIM4V4_MOD_LBIGSD: + value->rValue = model->BSIM4V4lbigsd; + return(OK); + case BSIM4V4_MOD_LCIGSD: + value->rValue = model->BSIM4V4lcigsd; + return(OK); + case BSIM4V4_MOD_LAIGBACC: + value->rValue = model->BSIM4V4laigbacc; + return(OK); + case BSIM4V4_MOD_LBIGBACC: + value->rValue = model->BSIM4V4lbigbacc; + return(OK); + case BSIM4V4_MOD_LCIGBACC: + value->rValue = model->BSIM4V4lcigbacc; + return(OK); + case BSIM4V4_MOD_LAIGBINV: + value->rValue = model->BSIM4V4laigbinv; + return(OK); + case BSIM4V4_MOD_LBIGBINV: + value->rValue = model->BSIM4V4lbigbinv; + return(OK); + case BSIM4V4_MOD_LCIGBINV: + value->rValue = model->BSIM4V4lcigbinv; + return(OK); + case BSIM4V4_MOD_LNIGC: + value->rValue = model->BSIM4V4lnigc; + return(OK); + case BSIM4V4_MOD_LNIGBACC: + value->rValue = model->BSIM4V4lnigbacc; + return(OK); + case BSIM4V4_MOD_LNIGBINV: + value->rValue = model->BSIM4V4lnigbinv; + return(OK); + case BSIM4V4_MOD_LNTOX: + value->rValue = model->BSIM4V4lntox; + return(OK); + case BSIM4V4_MOD_LEIGBINV: + value->rValue = model->BSIM4V4leigbinv; + return(OK); + case BSIM4V4_MOD_LPIGCD: + value->rValue = model->BSIM4V4lpigcd; + return(OK); + case BSIM4V4_MOD_LPOXEDGE: + value->rValue = model->BSIM4V4lpoxedge; + return(OK); + case BSIM4V4_MOD_LPHIN: + value->rValue = model->BSIM4V4lphin; + return(OK); + case BSIM4V4_MOD_LXRCRG1: + value->rValue = model->BSIM4V4lxrcrg1; + return(OK); + case BSIM4V4_MOD_LXRCRG2: + value->rValue = model->BSIM4V4lxrcrg2; + return(OK); + case BSIM4V4_MOD_LEU: + value->rValue = model->BSIM4V4leu; + return(OK); + case BSIM4V4_MOD_LVFB: + value->rValue = model->BSIM4V4lvfb; + return(OK); + + case BSIM4V4_MOD_LCGSL: + value->rValue = model->BSIM4V4lcgsl; + return(OK); + case BSIM4V4_MOD_LCGDL: + value->rValue = model->BSIM4V4lcgdl; + return(OK); + case BSIM4V4_MOD_LCKAPPAS: + value->rValue = model->BSIM4V4lckappas; + return(OK); + case BSIM4V4_MOD_LCKAPPAD: + value->rValue = model->BSIM4V4lckappad; + return(OK); + case BSIM4V4_MOD_LCF: + value->rValue = model->BSIM4V4lcf; + return(OK); + case BSIM4V4_MOD_LCLC: + value->rValue = model->BSIM4V4lclc; + return(OK); + case BSIM4V4_MOD_LCLE: + value->rValue = model->BSIM4V4lcle; + return(OK); + case BSIM4V4_MOD_LVFBCV: + value->rValue = model->BSIM4V4lvfbcv; + return(OK); + case BSIM4V4_MOD_LACDE: + value->rValue = model->BSIM4V4lacde; + return(OK); + case BSIM4V4_MOD_LMOIN: + value->rValue = model->BSIM4V4lmoin; + return(OK); + case BSIM4V4_MOD_LNOFF: + value->rValue = model->BSIM4V4lnoff; + return(OK); + case BSIM4V4_MOD_LVOFFCV: + value->rValue = model->BSIM4V4lvoffcv; + return(OK); + + /* Width dependence */ + case BSIM4V4_MOD_WCDSC : + value->rValue = model->BSIM4V4wcdsc; + return(OK); + case BSIM4V4_MOD_WCDSCB : + value->rValue = model->BSIM4V4wcdscb; + return(OK); + case BSIM4V4_MOD_WCDSCD : + value->rValue = model->BSIM4V4wcdscd; + return(OK); + case BSIM4V4_MOD_WCIT : + value->rValue = model->BSIM4V4wcit; + return(OK); + case BSIM4V4_MOD_WNFACTOR : + value->rValue = model->BSIM4V4wnfactor; + return(OK); + case BSIM4V4_MOD_WXJ: + value->rValue = model->BSIM4V4wxj; + return(OK); + case BSIM4V4_MOD_WVSAT: + value->rValue = model->BSIM4V4wvsat; + return(OK); + case BSIM4V4_MOD_WAT: + value->rValue = model->BSIM4V4wat; + return(OK); + case BSIM4V4_MOD_WA0: + value->rValue = model->BSIM4V4wa0; + return(OK); + case BSIM4V4_MOD_WAGS: + value->rValue = model->BSIM4V4wags; + return(OK); + case BSIM4V4_MOD_WA1: + value->rValue = model->BSIM4V4wa1; + return(OK); + case BSIM4V4_MOD_WA2: + value->rValue = model->BSIM4V4wa2; + return(OK); + case BSIM4V4_MOD_WKETA: + value->rValue = model->BSIM4V4wketa; + return(OK); + case BSIM4V4_MOD_WNSUB: + value->rValue = model->BSIM4V4wnsub; + return(OK); + case BSIM4V4_MOD_WNDEP: + value->rValue = model->BSIM4V4wndep; + return(OK); + case BSIM4V4_MOD_WNSD: + value->rValue = model->BSIM4V4wnsd; + return(OK); + case BSIM4V4_MOD_WNGATE: + value->rValue = model->BSIM4V4wngate; + return(OK); + case BSIM4V4_MOD_WGAMMA1: + value->rValue = model->BSIM4V4wgamma1; + return(OK); + case BSIM4V4_MOD_WGAMMA2: + value->rValue = model->BSIM4V4wgamma2; + return(OK); + case BSIM4V4_MOD_WVBX: + value->rValue = model->BSIM4V4wvbx; + return(OK); + case BSIM4V4_MOD_WVBM: + value->rValue = model->BSIM4V4wvbm; + return(OK); + case BSIM4V4_MOD_WXT: + value->rValue = model->BSIM4V4wxt; + return(OK); + case BSIM4V4_MOD_WK1: + value->rValue = model->BSIM4V4wk1; + return(OK); + case BSIM4V4_MOD_WKT1: + value->rValue = model->BSIM4V4wkt1; + return(OK); + case BSIM4V4_MOD_WKT1L: + value->rValue = model->BSIM4V4wkt1l; + return(OK); + case BSIM4V4_MOD_WKT2 : + value->rValue = model->BSIM4V4wkt2; + return(OK); + case BSIM4V4_MOD_WK2 : + value->rValue = model->BSIM4V4wk2; + return(OK); + case BSIM4V4_MOD_WK3: + value->rValue = model->BSIM4V4wk3; + return(OK); + case BSIM4V4_MOD_WK3B: + value->rValue = model->BSIM4V4wk3b; + return(OK); + case BSIM4V4_MOD_WW0: + value->rValue = model->BSIM4V4ww0; + return(OK); + case BSIM4V4_MOD_WLPE0: + value->rValue = model->BSIM4V4wlpe0; + return(OK); + case BSIM4V4_MOD_WDVTP0: + value->rValue = model->BSIM4V4wdvtp0; + return(OK); + case BSIM4V4_MOD_WDVTP1: + value->rValue = model->BSIM4V4wdvtp1; + return(OK); + case BSIM4V4_MOD_WLPEB: + value->rValue = model->BSIM4V4wlpeb; + return(OK); + case BSIM4V4_MOD_WDVT0: + value->rValue = model->BSIM4V4wdvt0; + return(OK); + case BSIM4V4_MOD_WDVT1 : + value->rValue = model->BSIM4V4wdvt1; + return(OK); + case BSIM4V4_MOD_WDVT2 : + value->rValue = model->BSIM4V4wdvt2; + return(OK); + case BSIM4V4_MOD_WDVT0W : + value->rValue = model->BSIM4V4wdvt0w; + return(OK); + case BSIM4V4_MOD_WDVT1W : + value->rValue = model->BSIM4V4wdvt1w; + return(OK); + case BSIM4V4_MOD_WDVT2W : + value->rValue = model->BSIM4V4wdvt2w; + return(OK); + case BSIM4V4_MOD_WDROUT : + value->rValue = model->BSIM4V4wdrout; + return(OK); + case BSIM4V4_MOD_WDSUB : + value->rValue = model->BSIM4V4wdsub; + return(OK); + case BSIM4V4_MOD_WVTH0: + value->rValue = model->BSIM4V4wvth0; + return(OK); + case BSIM4V4_MOD_WUA: + value->rValue = model->BSIM4V4wua; + return(OK); + case BSIM4V4_MOD_WUA1: + value->rValue = model->BSIM4V4wua1; + return(OK); + case BSIM4V4_MOD_WUB: + value->rValue = model->BSIM4V4wub; + return(OK); + case BSIM4V4_MOD_WUB1: + value->rValue = model->BSIM4V4wub1; + return(OK); + case BSIM4V4_MOD_WUC: + value->rValue = model->BSIM4V4wuc; + return(OK); + case BSIM4V4_MOD_WUC1: + value->rValue = model->BSIM4V4wuc1; + return(OK); + case BSIM4V4_MOD_WU0: + value->rValue = model->BSIM4V4wu0; + return(OK); + case BSIM4V4_MOD_WUTE: + value->rValue = model->BSIM4V4wute; + return(OK); + case BSIM4V4_MOD_WVOFF: + value->rValue = model->BSIM4V4wvoff; + return(OK); + case BSIM4V4_MOD_WMINV: + value->rValue = model->BSIM4V4wminv; + return(OK); + case BSIM4V4_MOD_WFPROUT: + value->rValue = model->BSIM4V4wfprout; + return(OK); + case BSIM4V4_MOD_WPDITS: + value->rValue = model->BSIM4V4wpdits; + return(OK); + case BSIM4V4_MOD_WPDITSD: + value->rValue = model->BSIM4V4wpditsd; + return(OK); + case BSIM4V4_MOD_WDELTA: + value->rValue = model->BSIM4V4wdelta; + return(OK); + case BSIM4V4_MOD_WRDSW: + value->rValue = model->BSIM4V4wrdsw; + return(OK); + case BSIM4V4_MOD_WRDW: + value->rValue = model->BSIM4V4wrdw; + return(OK); + case BSIM4V4_MOD_WRSW: + value->rValue = model->BSIM4V4wrsw; + return(OK); + case BSIM4V4_MOD_WPRWB: + value->rValue = model->BSIM4V4wprwb; + return(OK); + case BSIM4V4_MOD_WPRWG: + value->rValue = model->BSIM4V4wprwg; + return(OK); + case BSIM4V4_MOD_WPRT: + value->rValue = model->BSIM4V4wprt; + return(OK); + case BSIM4V4_MOD_WETA0: + value->rValue = model->BSIM4V4weta0; + return(OK); + case BSIM4V4_MOD_WETAB: + value->rValue = model->BSIM4V4wetab; + return(OK); + case BSIM4V4_MOD_WPCLM: + value->rValue = model->BSIM4V4wpclm; + return(OK); + case BSIM4V4_MOD_WPDIBL1: + value->rValue = model->BSIM4V4wpdibl1; + return(OK); + case BSIM4V4_MOD_WPDIBL2: + value->rValue = model->BSIM4V4wpdibl2; + return(OK); + case BSIM4V4_MOD_WPDIBLB: + value->rValue = model->BSIM4V4wpdiblb; + return(OK); + case BSIM4V4_MOD_WPSCBE1: + value->rValue = model->BSIM4V4wpscbe1; + return(OK); + case BSIM4V4_MOD_WPSCBE2: + value->rValue = model->BSIM4V4wpscbe2; + return(OK); + case BSIM4V4_MOD_WPVAG: + value->rValue = model->BSIM4V4wpvag; + return(OK); + case BSIM4V4_MOD_WWR: + value->rValue = model->BSIM4V4wwr; + return(OK); + case BSIM4V4_MOD_WDWG: + value->rValue = model->BSIM4V4wdwg; + return(OK); + case BSIM4V4_MOD_WDWB: + value->rValue = model->BSIM4V4wdwb; + return(OK); + case BSIM4V4_MOD_WB0: + value->rValue = model->BSIM4V4wb0; + return(OK); + case BSIM4V4_MOD_WB1: + value->rValue = model->BSIM4V4wb1; + return(OK); + case BSIM4V4_MOD_WALPHA0: + value->rValue = model->BSIM4V4walpha0; + return(OK); + case BSIM4V4_MOD_WALPHA1: + value->rValue = model->BSIM4V4walpha1; + return(OK); + case BSIM4V4_MOD_WBETA0: + value->rValue = model->BSIM4V4wbeta0; + return(OK); + case BSIM4V4_MOD_WAGIDL: + value->rValue = model->BSIM4V4wagidl; + return(OK); + case BSIM4V4_MOD_WBGIDL: + value->rValue = model->BSIM4V4wbgidl; + return(OK); + case BSIM4V4_MOD_WCGIDL: + value->rValue = model->BSIM4V4wcgidl; + return(OK); + case BSIM4V4_MOD_WEGIDL: + value->rValue = model->BSIM4V4wegidl; + return(OK); + case BSIM4V4_MOD_WAIGC: + value->rValue = model->BSIM4V4waigc; + return(OK); + case BSIM4V4_MOD_WBIGC: + value->rValue = model->BSIM4V4wbigc; + return(OK); + case BSIM4V4_MOD_WCIGC: + value->rValue = model->BSIM4V4wcigc; + return(OK); + case BSIM4V4_MOD_WAIGSD: + value->rValue = model->BSIM4V4waigsd; + return(OK); + case BSIM4V4_MOD_WBIGSD: + value->rValue = model->BSIM4V4wbigsd; + return(OK); + case BSIM4V4_MOD_WCIGSD: + value->rValue = model->BSIM4V4wcigsd; + return(OK); + case BSIM4V4_MOD_WAIGBACC: + value->rValue = model->BSIM4V4waigbacc; + return(OK); + case BSIM4V4_MOD_WBIGBACC: + value->rValue = model->BSIM4V4wbigbacc; + return(OK); + case BSIM4V4_MOD_WCIGBACC: + value->rValue = model->BSIM4V4wcigbacc; + return(OK); + case BSIM4V4_MOD_WAIGBINV: + value->rValue = model->BSIM4V4waigbinv; + return(OK); + case BSIM4V4_MOD_WBIGBINV: + value->rValue = model->BSIM4V4wbigbinv; + return(OK); + case BSIM4V4_MOD_WCIGBINV: + value->rValue = model->BSIM4V4wcigbinv; + return(OK); + case BSIM4V4_MOD_WNIGC: + value->rValue = model->BSIM4V4wnigc; + return(OK); + case BSIM4V4_MOD_WNIGBACC: + value->rValue = model->BSIM4V4wnigbacc; + return(OK); + case BSIM4V4_MOD_WNIGBINV: + value->rValue = model->BSIM4V4wnigbinv; + return(OK); + case BSIM4V4_MOD_WNTOX: + value->rValue = model->BSIM4V4wntox; + return(OK); + case BSIM4V4_MOD_WEIGBINV: + value->rValue = model->BSIM4V4weigbinv; + return(OK); + case BSIM4V4_MOD_WPIGCD: + value->rValue = model->BSIM4V4wpigcd; + return(OK); + case BSIM4V4_MOD_WPOXEDGE: + value->rValue = model->BSIM4V4wpoxedge; + return(OK); + case BSIM4V4_MOD_WPHIN: + value->rValue = model->BSIM4V4wphin; + return(OK); + case BSIM4V4_MOD_WXRCRG1: + value->rValue = model->BSIM4V4wxrcrg1; + return(OK); + case BSIM4V4_MOD_WXRCRG2: + value->rValue = model->BSIM4V4wxrcrg2; + return(OK); + case BSIM4V4_MOD_WEU: + value->rValue = model->BSIM4V4weu; + return(OK); + case BSIM4V4_MOD_WVFB: + value->rValue = model->BSIM4V4wvfb; + return(OK); + + case BSIM4V4_MOD_WCGSL: + value->rValue = model->BSIM4V4wcgsl; + return(OK); + case BSIM4V4_MOD_WCGDL: + value->rValue = model->BSIM4V4wcgdl; + return(OK); + case BSIM4V4_MOD_WCKAPPAS: + value->rValue = model->BSIM4V4wckappas; + return(OK); + case BSIM4V4_MOD_WCKAPPAD: + value->rValue = model->BSIM4V4wckappad; + return(OK); + case BSIM4V4_MOD_WCF: + value->rValue = model->BSIM4V4wcf; + return(OK); + case BSIM4V4_MOD_WCLC: + value->rValue = model->BSIM4V4wclc; + return(OK); + case BSIM4V4_MOD_WCLE: + value->rValue = model->BSIM4V4wcle; + return(OK); + case BSIM4V4_MOD_WVFBCV: + value->rValue = model->BSIM4V4wvfbcv; + return(OK); + case BSIM4V4_MOD_WACDE: + value->rValue = model->BSIM4V4wacde; + return(OK); + case BSIM4V4_MOD_WMOIN: + value->rValue = model->BSIM4V4wmoin; + return(OK); + case BSIM4V4_MOD_WNOFF: + value->rValue = model->BSIM4V4wnoff; + return(OK); + case BSIM4V4_MOD_WVOFFCV: + value->rValue = model->BSIM4V4wvoffcv; + return(OK); + + /* Cross-term dependence */ + case BSIM4V4_MOD_PCDSC : + value->rValue = model->BSIM4V4pcdsc; + return(OK); + case BSIM4V4_MOD_PCDSCB : + value->rValue = model->BSIM4V4pcdscb; + return(OK); + case BSIM4V4_MOD_PCDSCD : + value->rValue = model->BSIM4V4pcdscd; + return(OK); + case BSIM4V4_MOD_PCIT : + value->rValue = model->BSIM4V4pcit; + return(OK); + case BSIM4V4_MOD_PNFACTOR : + value->rValue = model->BSIM4V4pnfactor; + return(OK); + case BSIM4V4_MOD_PXJ: + value->rValue = model->BSIM4V4pxj; + return(OK); + case BSIM4V4_MOD_PVSAT: + value->rValue = model->BSIM4V4pvsat; + return(OK); + case BSIM4V4_MOD_PAT: + value->rValue = model->BSIM4V4pat; + return(OK); + case BSIM4V4_MOD_PA0: + value->rValue = model->BSIM4V4pa0; + return(OK); + case BSIM4V4_MOD_PAGS: + value->rValue = model->BSIM4V4pags; + return(OK); + case BSIM4V4_MOD_PA1: + value->rValue = model->BSIM4V4pa1; + return(OK); + case BSIM4V4_MOD_PA2: + value->rValue = model->BSIM4V4pa2; + return(OK); + case BSIM4V4_MOD_PKETA: + value->rValue = model->BSIM4V4pketa; + return(OK); + case BSIM4V4_MOD_PNSUB: + value->rValue = model->BSIM4V4pnsub; + return(OK); + case BSIM4V4_MOD_PNDEP: + value->rValue = model->BSIM4V4pndep; + return(OK); + case BSIM4V4_MOD_PNSD: + value->rValue = model->BSIM4V4pnsd; + return(OK); + case BSIM4V4_MOD_PNGATE: + value->rValue = model->BSIM4V4pngate; + return(OK); + case BSIM4V4_MOD_PGAMMA1: + value->rValue = model->BSIM4V4pgamma1; + return(OK); + case BSIM4V4_MOD_PGAMMA2: + value->rValue = model->BSIM4V4pgamma2; + return(OK); + case BSIM4V4_MOD_PVBX: + value->rValue = model->BSIM4V4pvbx; + return(OK); + case BSIM4V4_MOD_PVBM: + value->rValue = model->BSIM4V4pvbm; + return(OK); + case BSIM4V4_MOD_PXT: + value->rValue = model->BSIM4V4pxt; + return(OK); + case BSIM4V4_MOD_PK1: + value->rValue = model->BSIM4V4pk1; + return(OK); + case BSIM4V4_MOD_PKT1: + value->rValue = model->BSIM4V4pkt1; + return(OK); + case BSIM4V4_MOD_PKT1L: + value->rValue = model->BSIM4V4pkt1l; + return(OK); + case BSIM4V4_MOD_PKT2 : + value->rValue = model->BSIM4V4pkt2; + return(OK); + case BSIM4V4_MOD_PK2 : + value->rValue = model->BSIM4V4pk2; + return(OK); + case BSIM4V4_MOD_PK3: + value->rValue = model->BSIM4V4pk3; + return(OK); + case BSIM4V4_MOD_PK3B: + value->rValue = model->BSIM4V4pk3b; + return(OK); + case BSIM4V4_MOD_PW0: + value->rValue = model->BSIM4V4pw0; + return(OK); + case BSIM4V4_MOD_PLPE0: + value->rValue = model->BSIM4V4plpe0; + return(OK); + case BSIM4V4_MOD_PLPEB: + value->rValue = model->BSIM4V4plpeb; + return(OK); + case BSIM4V4_MOD_PDVTP0: + value->rValue = model->BSIM4V4pdvtp0; + return(OK); + case BSIM4V4_MOD_PDVTP1: + value->rValue = model->BSIM4V4pdvtp1; + return(OK); + case BSIM4V4_MOD_PDVT0 : + value->rValue = model->BSIM4V4pdvt0; + return(OK); + case BSIM4V4_MOD_PDVT1 : + value->rValue = model->BSIM4V4pdvt1; + return(OK); + case BSIM4V4_MOD_PDVT2 : + value->rValue = model->BSIM4V4pdvt2; + return(OK); + case BSIM4V4_MOD_PDVT0W : + value->rValue = model->BSIM4V4pdvt0w; + return(OK); + case BSIM4V4_MOD_PDVT1W : + value->rValue = model->BSIM4V4pdvt1w; + return(OK); + case BSIM4V4_MOD_PDVT2W : + value->rValue = model->BSIM4V4pdvt2w; + return(OK); + case BSIM4V4_MOD_PDROUT : + value->rValue = model->BSIM4V4pdrout; + return(OK); + case BSIM4V4_MOD_PDSUB : + value->rValue = model->BSIM4V4pdsub; + return(OK); + case BSIM4V4_MOD_PVTH0: + value->rValue = model->BSIM4V4pvth0; + return(OK); + case BSIM4V4_MOD_PUA: + value->rValue = model->BSIM4V4pua; + return(OK); + case BSIM4V4_MOD_PUA1: + value->rValue = model->BSIM4V4pua1; + return(OK); + case BSIM4V4_MOD_PUB: + value->rValue = model->BSIM4V4pub; + return(OK); + case BSIM4V4_MOD_PUB1: + value->rValue = model->BSIM4V4pub1; + return(OK); + case BSIM4V4_MOD_PUC: + value->rValue = model->BSIM4V4puc; + return(OK); + case BSIM4V4_MOD_PUC1: + value->rValue = model->BSIM4V4puc1; + return(OK); + case BSIM4V4_MOD_PU0: + value->rValue = model->BSIM4V4pu0; + return(OK); + case BSIM4V4_MOD_PUTE: + value->rValue = model->BSIM4V4pute; + return(OK); + case BSIM4V4_MOD_PVOFF: + value->rValue = model->BSIM4V4pvoff; + return(OK); + case BSIM4V4_MOD_PMINV: + value->rValue = model->BSIM4V4pminv; + return(OK); + case BSIM4V4_MOD_PFPROUT: + value->rValue = model->BSIM4V4pfprout; + return(OK); + case BSIM4V4_MOD_PPDITS: + value->rValue = model->BSIM4V4ppdits; + return(OK); + case BSIM4V4_MOD_PPDITSD: + value->rValue = model->BSIM4V4ppditsd; + return(OK); + case BSIM4V4_MOD_PDELTA: + value->rValue = model->BSIM4V4pdelta; + return(OK); + case BSIM4V4_MOD_PRDSW: + value->rValue = model->BSIM4V4prdsw; + return(OK); + case BSIM4V4_MOD_PRDW: + value->rValue = model->BSIM4V4prdw; + return(OK); + case BSIM4V4_MOD_PRSW: + value->rValue = model->BSIM4V4prsw; + return(OK); + case BSIM4V4_MOD_PPRWB: + value->rValue = model->BSIM4V4pprwb; + return(OK); + case BSIM4V4_MOD_PPRWG: + value->rValue = model->BSIM4V4pprwg; + return(OK); + case BSIM4V4_MOD_PPRT: + value->rValue = model->BSIM4V4pprt; + return(OK); + case BSIM4V4_MOD_PETA0: + value->rValue = model->BSIM4V4peta0; + return(OK); + case BSIM4V4_MOD_PETAB: + value->rValue = model->BSIM4V4petab; + return(OK); + case BSIM4V4_MOD_PPCLM: + value->rValue = model->BSIM4V4ppclm; + return(OK); + case BSIM4V4_MOD_PPDIBL1: + value->rValue = model->BSIM4V4ppdibl1; + return(OK); + case BSIM4V4_MOD_PPDIBL2: + value->rValue = model->BSIM4V4ppdibl2; + return(OK); + case BSIM4V4_MOD_PPDIBLB: + value->rValue = model->BSIM4V4ppdiblb; + return(OK); + case BSIM4V4_MOD_PPSCBE1: + value->rValue = model->BSIM4V4ppscbe1; + return(OK); + case BSIM4V4_MOD_PPSCBE2: + value->rValue = model->BSIM4V4ppscbe2; + return(OK); + case BSIM4V4_MOD_PPVAG: + value->rValue = model->BSIM4V4ppvag; + return(OK); + case BSIM4V4_MOD_PWR: + value->rValue = model->BSIM4V4pwr; + return(OK); + case BSIM4V4_MOD_PDWG: + value->rValue = model->BSIM4V4pdwg; + return(OK); + case BSIM4V4_MOD_PDWB: + value->rValue = model->BSIM4V4pdwb; + return(OK); + case BSIM4V4_MOD_PB0: + value->rValue = model->BSIM4V4pb0; + return(OK); + case BSIM4V4_MOD_PB1: + value->rValue = model->BSIM4V4pb1; + return(OK); + case BSIM4V4_MOD_PALPHA0: + value->rValue = model->BSIM4V4palpha0; + return(OK); + case BSIM4V4_MOD_PALPHA1: + value->rValue = model->BSIM4V4palpha1; + return(OK); + case BSIM4V4_MOD_PBETA0: + value->rValue = model->BSIM4V4pbeta0; + return(OK); + case BSIM4V4_MOD_PAGIDL: + value->rValue = model->BSIM4V4pagidl; + return(OK); + case BSIM4V4_MOD_PBGIDL: + value->rValue = model->BSIM4V4pbgidl; + return(OK); + case BSIM4V4_MOD_PCGIDL: + value->rValue = model->BSIM4V4pcgidl; + return(OK); + case BSIM4V4_MOD_PEGIDL: + value->rValue = model->BSIM4V4pegidl; + return(OK); + case BSIM4V4_MOD_PAIGC: + value->rValue = model->BSIM4V4paigc; + return(OK); + case BSIM4V4_MOD_PBIGC: + value->rValue = model->BSIM4V4pbigc; + return(OK); + case BSIM4V4_MOD_PCIGC: + value->rValue = model->BSIM4V4pcigc; + return(OK); + case BSIM4V4_MOD_PAIGSD: + value->rValue = model->BSIM4V4paigsd; + return(OK); + case BSIM4V4_MOD_PBIGSD: + value->rValue = model->BSIM4V4pbigsd; + return(OK); + case BSIM4V4_MOD_PCIGSD: + value->rValue = model->BSIM4V4pcigsd; + return(OK); + case BSIM4V4_MOD_PAIGBACC: + value->rValue = model->BSIM4V4paigbacc; + return(OK); + case BSIM4V4_MOD_PBIGBACC: + value->rValue = model->BSIM4V4pbigbacc; + return(OK); + case BSIM4V4_MOD_PCIGBACC: + value->rValue = model->BSIM4V4pcigbacc; + return(OK); + case BSIM4V4_MOD_PAIGBINV: + value->rValue = model->BSIM4V4paigbinv; + return(OK); + case BSIM4V4_MOD_PBIGBINV: + value->rValue = model->BSIM4V4pbigbinv; + return(OK); + case BSIM4V4_MOD_PCIGBINV: + value->rValue = model->BSIM4V4pcigbinv; + return(OK); + case BSIM4V4_MOD_PNIGC: + value->rValue = model->BSIM4V4pnigc; + return(OK); + case BSIM4V4_MOD_PNIGBACC: + value->rValue = model->BSIM4V4pnigbacc; + return(OK); + case BSIM4V4_MOD_PNIGBINV: + value->rValue = model->BSIM4V4pnigbinv; + return(OK); + case BSIM4V4_MOD_PNTOX: + value->rValue = model->BSIM4V4pntox; + return(OK); + case BSIM4V4_MOD_PEIGBINV: + value->rValue = model->BSIM4V4peigbinv; + return(OK); + case BSIM4V4_MOD_PPIGCD: + value->rValue = model->BSIM4V4ppigcd; + return(OK); + case BSIM4V4_MOD_PPOXEDGE: + value->rValue = model->BSIM4V4ppoxedge; + return(OK); + case BSIM4V4_MOD_PPHIN: + value->rValue = model->BSIM4V4pphin; + return(OK); + case BSIM4V4_MOD_PXRCRG1: + value->rValue = model->BSIM4V4pxrcrg1; + return(OK); + case BSIM4V4_MOD_PXRCRG2: + value->rValue = model->BSIM4V4pxrcrg2; + return(OK); + case BSIM4V4_MOD_PEU: + value->rValue = model->BSIM4V4peu; + return(OK); + case BSIM4V4_MOD_PVFB: + value->rValue = model->BSIM4V4pvfb; + return(OK); + + case BSIM4V4_MOD_PCGSL: + value->rValue = model->BSIM4V4pcgsl; + return(OK); + case BSIM4V4_MOD_PCGDL: + value->rValue = model->BSIM4V4pcgdl; + return(OK); + case BSIM4V4_MOD_PCKAPPAS: + value->rValue = model->BSIM4V4pckappas; + return(OK); + case BSIM4V4_MOD_PCKAPPAD: + value->rValue = model->BSIM4V4pckappad; + return(OK); + case BSIM4V4_MOD_PCF: + value->rValue = model->BSIM4V4pcf; + return(OK); + case BSIM4V4_MOD_PCLC: + value->rValue = model->BSIM4V4pclc; + return(OK); + case BSIM4V4_MOD_PCLE: + value->rValue = model->BSIM4V4pcle; + return(OK); + case BSIM4V4_MOD_PVFBCV: + value->rValue = model->BSIM4V4pvfbcv; + return(OK); + case BSIM4V4_MOD_PACDE: + value->rValue = model->BSIM4V4pacde; + return(OK); + case BSIM4V4_MOD_PMOIN: + value->rValue = model->BSIM4V4pmoin; + return(OK); + case BSIM4V4_MOD_PNOFF: + value->rValue = model->BSIM4V4pnoff; + return(OK); + case BSIM4V4_MOD_PVOFFCV: + value->rValue = model->BSIM4V4pvoffcv; + return(OK); + + case BSIM4V4_MOD_TNOM : + value->rValue = model->BSIM4V4tnom; + return(OK); + case BSIM4V4_MOD_CGSO: + value->rValue = model->BSIM4V4cgso; + return(OK); + case BSIM4V4_MOD_CGDO: + value->rValue = model->BSIM4V4cgdo; + return(OK); + case BSIM4V4_MOD_CGBO: + value->rValue = model->BSIM4V4cgbo; + return(OK); + case BSIM4V4_MOD_XPART: + value->rValue = model->BSIM4V4xpart; + return(OK); + case BSIM4V4_MOD_RSH: + value->rValue = model->BSIM4V4sheetResistance; + return(OK); + case BSIM4V4_MOD_JSS: + value->rValue = model->BSIM4V4SjctSatCurDensity; + return(OK); + case BSIM4V4_MOD_JSWS: + value->rValue = model->BSIM4V4SjctSidewallSatCurDensity; + return(OK); + case BSIM4V4_MOD_JSWGS: + value->rValue = model->BSIM4V4SjctGateSidewallSatCurDensity; + return(OK); + case BSIM4V4_MOD_PBS: + value->rValue = model->BSIM4V4SbulkJctPotential; + return(OK); + case BSIM4V4_MOD_MJS: + value->rValue = model->BSIM4V4SbulkJctBotGradingCoeff; + return(OK); + case BSIM4V4_MOD_PBSWS: + value->rValue = model->BSIM4V4SsidewallJctPotential; + return(OK); + case BSIM4V4_MOD_MJSWS: + value->rValue = model->BSIM4V4SbulkJctSideGradingCoeff; + return(OK); + case BSIM4V4_MOD_CJS: + value->rValue = model->BSIM4V4SunitAreaJctCap; + return(OK); + case BSIM4V4_MOD_CJSWS: + value->rValue = model->BSIM4V4SunitLengthSidewallJctCap; + return(OK); + case BSIM4V4_MOD_PBSWGS: + value->rValue = model->BSIM4V4SGatesidewallJctPotential; + return(OK); + case BSIM4V4_MOD_MJSWGS: + value->rValue = model->BSIM4V4SbulkJctGateSideGradingCoeff; + return(OK); + case BSIM4V4_MOD_CJSWGS: + value->rValue = model->BSIM4V4SunitLengthGateSidewallJctCap; + return(OK); + case BSIM4V4_MOD_NJS: + value->rValue = model->BSIM4V4SjctEmissionCoeff; + return(OK); + case BSIM4V4_MOD_XTIS: + value->rValue = model->BSIM4V4SjctTempExponent; + return(OK); + case BSIM4V4_MOD_JSD: + value->rValue = model->BSIM4V4DjctSatCurDensity; + return(OK); + case BSIM4V4_MOD_JSWD: + value->rValue = model->BSIM4V4DjctSidewallSatCurDensity; + return(OK); + case BSIM4V4_MOD_JSWGD: + value->rValue = model->BSIM4V4DjctGateSidewallSatCurDensity; + return(OK); + case BSIM4V4_MOD_PBD: + value->rValue = model->BSIM4V4DbulkJctPotential; + return(OK); + case BSIM4V4_MOD_MJD: + value->rValue = model->BSIM4V4DbulkJctBotGradingCoeff; + return(OK); + case BSIM4V4_MOD_PBSWD: + value->rValue = model->BSIM4V4DsidewallJctPotential; + return(OK); + case BSIM4V4_MOD_MJSWD: + value->rValue = model->BSIM4V4DbulkJctSideGradingCoeff; + return(OK); + case BSIM4V4_MOD_CJD: + value->rValue = model->BSIM4V4DunitAreaJctCap; + return(OK); + case BSIM4V4_MOD_CJSWD: + value->rValue = model->BSIM4V4DunitLengthSidewallJctCap; + return(OK); + case BSIM4V4_MOD_PBSWGD: + value->rValue = model->BSIM4V4DGatesidewallJctPotential; + return(OK); + case BSIM4V4_MOD_MJSWGD: + value->rValue = model->BSIM4V4DbulkJctGateSideGradingCoeff; + return(OK); + case BSIM4V4_MOD_CJSWGD: + value->rValue = model->BSIM4V4DunitLengthGateSidewallJctCap; + return(OK); + case BSIM4V4_MOD_NJD: + value->rValue = model->BSIM4V4DjctEmissionCoeff; + return(OK); + case BSIM4V4_MOD_XTID: + value->rValue = model->BSIM4V4DjctTempExponent; + return(OK); + case BSIM4V4_MOD_LINT: + value->rValue = model->BSIM4V4Lint; + return(OK); + case BSIM4V4_MOD_LL: + value->rValue = model->BSIM4V4Ll; + return(OK); + case BSIM4V4_MOD_LLC: + value->rValue = model->BSIM4V4Llc; + return(OK); + case BSIM4V4_MOD_LLN: + value->rValue = model->BSIM4V4Lln; + return(OK); + case BSIM4V4_MOD_LW: + value->rValue = model->BSIM4V4Lw; + return(OK); + case BSIM4V4_MOD_LWC: + value->rValue = model->BSIM4V4Lwc; + return(OK); + case BSIM4V4_MOD_LWN: + value->rValue = model->BSIM4V4Lwn; + return(OK); + case BSIM4V4_MOD_LWL: + value->rValue = model->BSIM4V4Lwl; + return(OK); + case BSIM4V4_MOD_LWLC: + value->rValue = model->BSIM4V4Lwlc; + return(OK); + case BSIM4V4_MOD_LMIN: + value->rValue = model->BSIM4V4Lmin; + return(OK); + case BSIM4V4_MOD_LMAX: + value->rValue = model->BSIM4V4Lmax; + return(OK); + case BSIM4V4_MOD_WINT: + value->rValue = model->BSIM4V4Wint; + return(OK); + case BSIM4V4_MOD_WL: + value->rValue = model->BSIM4V4Wl; + return(OK); + case BSIM4V4_MOD_WLC: + value->rValue = model->BSIM4V4Wlc; + return(OK); + case BSIM4V4_MOD_WLN: + value->rValue = model->BSIM4V4Wln; + return(OK); + case BSIM4V4_MOD_WW: + value->rValue = model->BSIM4V4Ww; + return(OK); + case BSIM4V4_MOD_WWC: + value->rValue = model->BSIM4V4Wwc; + return(OK); + case BSIM4V4_MOD_WWN: + value->rValue = model->BSIM4V4Wwn; + return(OK); + case BSIM4V4_MOD_WWL: + value->rValue = model->BSIM4V4Wwl; + return(OK); + case BSIM4V4_MOD_WWLC: + value->rValue = model->BSIM4V4Wwlc; + return(OK); + case BSIM4V4_MOD_WMIN: + value->rValue = model->BSIM4V4Wmin; + return(OK); + case BSIM4V4_MOD_WMAX: + value->rValue = model->BSIM4V4Wmax; + return(OK); + + /* stress effect */ + case BSIM4V4_MOD_SAREF: + value->rValue = model->BSIM4V4saref; + return(OK); + case BSIM4V4_MOD_SBREF: + value->rValue = model->BSIM4V4sbref; + return(OK); + case BSIM4V4_MOD_WLOD: + value->rValue = model->BSIM4V4wlod; + return(OK); + case BSIM4V4_MOD_KU0: + value->rValue = model->BSIM4V4ku0; + return(OK); + case BSIM4V4_MOD_KVSAT: + value->rValue = model->BSIM4V4kvsat; + return(OK); + case BSIM4V4_MOD_KVTH0: + value->rValue = model->BSIM4V4kvth0; + return(OK); + case BSIM4V4_MOD_TKU0: + value->rValue = model->BSIM4V4tku0; + return(OK); + case BSIM4V4_MOD_LLODKU0: + value->rValue = model->BSIM4V4llodku0; + return(OK); + case BSIM4V4_MOD_WLODKU0: + value->rValue = model->BSIM4V4wlodku0; + return(OK); + case BSIM4V4_MOD_LLODVTH: + value->rValue = model->BSIM4V4llodvth; + return(OK); + case BSIM4V4_MOD_WLODVTH: + value->rValue = model->BSIM4V4wlodvth; + return(OK); + case BSIM4V4_MOD_LKU0: + value->rValue = model->BSIM4V4lku0; + return(OK); + case BSIM4V4_MOD_WKU0: + value->rValue = model->BSIM4V4wku0; + return(OK); + case BSIM4V4_MOD_PKU0: + value->rValue = model->BSIM4V4pku0; + return(OK); + case BSIM4V4_MOD_LKVTH0: + value->rValue = model->BSIM4V4lkvth0; + return(OK); + case BSIM4V4_MOD_WKVTH0: + value->rValue = model->BSIM4V4wkvth0; + return(OK); + case BSIM4V4_MOD_PKVTH0: + value->rValue = model->BSIM4V4pkvth0; + return(OK); + case BSIM4V4_MOD_STK2: + value->rValue = model->BSIM4V4stk2; + return(OK); + case BSIM4V4_MOD_LODK2: + value->rValue = model->BSIM4V4lodk2; + return(OK); + case BSIM4V4_MOD_STETA0: + value->rValue = model->BSIM4V4steta0; + return(OK); + case BSIM4V4_MOD_LODETA0: + value->rValue = model->BSIM4V4lodeta0; + return(OK); + + case BSIM4V4_MOD_NOIA: + value->rValue = model->BSIM4V4oxideTrapDensityA; + return(OK); + case BSIM4V4_MOD_NOIB: + value->rValue = model->BSIM4V4oxideTrapDensityB; + return(OK); + case BSIM4V4_MOD_NOIC: + value->rValue = model->BSIM4V4oxideTrapDensityC; + return(OK); + case BSIM4V4_MOD_EM: + value->rValue = model->BSIM4V4em; + return(OK); + case BSIM4V4_MOD_EF: + value->rValue = model->BSIM4V4ef; + return(OK); + case BSIM4V4_MOD_AF: + value->rValue = model->BSIM4V4af; + return(OK); + case BSIM4V4_MOD_KF: + value->rValue = model->BSIM4V4kf; + return(OK); + case BSIM4V4_MOD_STIMOD: + value->rValue = model->BSIM4V4stimod; + return(OK); + case BSIM4V4_MOD_RGEOMOD: + value->rValue = model->BSIM4V4rgeomod; + return(OK); + case BSIM4V4_MOD_SA0: + value->rValue = model->BSIM4V4sa0; + return(OK); + case BSIM4V4_MOD_SB0: + value->rValue = model->BSIM4V4sb0; + return(OK); + default: + return(E_BADPARM); + } + /* NOTREACHED */ +} + + + diff --git a/src/spicelib/devices/bsim4v4/b4v4mdel.c b/src/spicelib/devices/bsim4v4/b4v4mdel.c new file mode 100644 index 000000000..f6b42a9e8 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4mdel.c @@ -0,0 +1,46 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4mdel.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + **********/ + +#include "ngspice.h" +#include "bsim4v4def.h" +#include "sperror.h" +#include "suffix.h" + +int +BSIM4V4mDelete(inModel,modname,kill) +GENmodel **inModel; +IFuid modname; +GENmodel *kill; +{ +BSIM4V4model **model = (BSIM4V4model**)inModel; +BSIM4V4model *modfast = (BSIM4V4model*)kill; +BSIM4V4instance *here; +BSIM4V4instance *prev = NULL; +BSIM4V4model **oldmod; + + oldmod = model; + for (; *model ; model = &((*model)->BSIM4V4nextModel)) + { if ((*model)->BSIM4V4modName == modname || + (modfast && *model == modfast)) + goto delgot; + oldmod = model; + } + return(E_NOMOD); + +delgot: + *oldmod = (*model)->BSIM4V4nextModel; /* cut deleted device out of list */ + for (here = (*model)->BSIM4V4instances; here; here = here->BSIM4V4nextInstance) + { if(prev) FREE(prev); + prev = here; + } + if(prev) FREE(prev); + FREE(*model); + return(OK); +} diff --git a/src/spicelib/devices/bsim4v4/b4v4mpar.c b/src/spicelib/devices/bsim4v4/b4v4mpar.c new file mode 100644 index 000000000..f658bebc8 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4mpar.c @@ -0,0 +1,2817 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4mpar.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 11/15/2002. + * Modified by Xuemei Xi, 05/09/2003. + * Modified by Xuemei Xi, 03/04/2004. + **********/ + +#include "ngspice.h" +#include "bsim4v4def.h" +#include "ifsim.h" +#include "sperror.h" +#include "suffix.h" + +int +BSIM4V4mParam(param,value,inMod) +int param; +IFvalue *value; +GENmodel *inMod; +{ + BSIM4V4model *mod = (BSIM4V4model*)inMod; + switch(param) + { case BSIM4V4_MOD_MOBMOD : + mod->BSIM4V4mobMod = value->iValue; + mod->BSIM4V4mobModGiven = TRUE; + break; + case BSIM4V4_MOD_BINUNIT : + mod->BSIM4V4binUnit = value->iValue; + mod->BSIM4V4binUnitGiven = TRUE; + break; + case BSIM4V4_MOD_PARAMCHK : + mod->BSIM4V4paramChk = value->iValue; + mod->BSIM4V4paramChkGiven = TRUE; + break; + case BSIM4V4_MOD_CAPMOD : + mod->BSIM4V4capMod = value->iValue; + mod->BSIM4V4capModGiven = TRUE; + break; + case BSIM4V4_MOD_DIOMOD : + mod->BSIM4V4dioMod = value->iValue; + mod->BSIM4V4dioModGiven = TRUE; + break; + case BSIM4V4_MOD_RDSMOD : + mod->BSIM4V4rdsMod = value->iValue; + mod->BSIM4V4rdsModGiven = TRUE; + break; + case BSIM4V4_MOD_TRNQSMOD : + mod->BSIM4V4trnqsMod = value->iValue; + mod->BSIM4V4trnqsModGiven = TRUE; + break; + case BSIM4V4_MOD_ACNQSMOD : + mod->BSIM4V4acnqsMod = value->iValue; + mod->BSIM4V4acnqsModGiven = TRUE; + break; + case BSIM4V4_MOD_RBODYMOD : + mod->BSIM4V4rbodyMod = value->iValue; + mod->BSIM4V4rbodyModGiven = TRUE; + break; + case BSIM4V4_MOD_RGATEMOD : + mod->BSIM4V4rgateMod = value->iValue; + mod->BSIM4V4rgateModGiven = TRUE; + break; + case BSIM4V4_MOD_PERMOD : + mod->BSIM4V4perMod = value->iValue; + mod->BSIM4V4perModGiven = TRUE; + break; + case BSIM4V4_MOD_GEOMOD : + mod->BSIM4V4geoMod = value->iValue; + mod->BSIM4V4geoModGiven = TRUE; + break; + case BSIM4V4_MOD_FNOIMOD : + mod->BSIM4V4fnoiMod = value->iValue; + mod->BSIM4V4fnoiModGiven = TRUE; + break; + case BSIM4V4_MOD_TNOIMOD : + mod->BSIM4V4tnoiMod = value->iValue; + mod->BSIM4V4tnoiModGiven = TRUE; + break; + case BSIM4V4_MOD_IGCMOD : + mod->BSIM4V4igcMod = value->iValue; + mod->BSIM4V4igcModGiven = TRUE; + break; + case BSIM4V4_MOD_IGBMOD : + mod->BSIM4V4igbMod = value->iValue; + mod->BSIM4V4igbModGiven = TRUE; + break; + case BSIM4V4_MOD_TEMPMOD : + mod->BSIM4V4tempMod = value->iValue; + mod->BSIM4V4tempModGiven = TRUE; + break; + case BSIM4V4_MOD_VERSION : + mod->BSIM4V4version = value->sValue; + mod->BSIM4V4versionGiven = TRUE; + break; + case BSIM4V4_MOD_TOXREF : + mod->BSIM4V4toxref = value->rValue; + mod->BSIM4V4toxrefGiven = TRUE; + break; + case BSIM4V4_MOD_TOXE : + mod->BSIM4V4toxe = value->rValue; + mod->BSIM4V4toxeGiven = TRUE; + break; + case BSIM4V4_MOD_TOXP : + mod->BSIM4V4toxp = value->rValue; + mod->BSIM4V4toxpGiven = TRUE; + break; + case BSIM4V4_MOD_TOXM : + mod->BSIM4V4toxm = value->rValue; + mod->BSIM4V4toxmGiven = TRUE; + break; + case BSIM4V4_MOD_DTOX : + mod->BSIM4V4dtox = value->rValue; + mod->BSIM4V4dtoxGiven = TRUE; + break; + case BSIM4V4_MOD_EPSROX : + mod->BSIM4V4epsrox = value->rValue; + mod->BSIM4V4epsroxGiven = TRUE; + break; + + case BSIM4V4_MOD_CDSC : + mod->BSIM4V4cdsc = value->rValue; + mod->BSIM4V4cdscGiven = TRUE; + break; + case BSIM4V4_MOD_CDSCB : + mod->BSIM4V4cdscb = value->rValue; + mod->BSIM4V4cdscbGiven = TRUE; + break; + + case BSIM4V4_MOD_CDSCD : + mod->BSIM4V4cdscd = value->rValue; + mod->BSIM4V4cdscdGiven = TRUE; + break; + + case BSIM4V4_MOD_CIT : + mod->BSIM4V4cit = value->rValue; + mod->BSIM4V4citGiven = TRUE; + break; + case BSIM4V4_MOD_NFACTOR : + mod->BSIM4V4nfactor = value->rValue; + mod->BSIM4V4nfactorGiven = TRUE; + break; + case BSIM4V4_MOD_XJ: + mod->BSIM4V4xj = value->rValue; + mod->BSIM4V4xjGiven = TRUE; + break; + case BSIM4V4_MOD_VSAT: + mod->BSIM4V4vsat = value->rValue; + mod->BSIM4V4vsatGiven = TRUE; + break; + case BSIM4V4_MOD_A0: + mod->BSIM4V4a0 = value->rValue; + mod->BSIM4V4a0Given = TRUE; + break; + + case BSIM4V4_MOD_AGS: + mod->BSIM4V4ags= value->rValue; + mod->BSIM4V4agsGiven = TRUE; + break; + + case BSIM4V4_MOD_A1: + mod->BSIM4V4a1 = value->rValue; + mod->BSIM4V4a1Given = TRUE; + break; + case BSIM4V4_MOD_A2: + mod->BSIM4V4a2 = value->rValue; + mod->BSIM4V4a2Given = TRUE; + break; + case BSIM4V4_MOD_AT: + mod->BSIM4V4at = value->rValue; + mod->BSIM4V4atGiven = TRUE; + break; + case BSIM4V4_MOD_KETA: + mod->BSIM4V4keta = value->rValue; + mod->BSIM4V4ketaGiven = TRUE; + break; + case BSIM4V4_MOD_NSUB: + mod->BSIM4V4nsub = value->rValue; + mod->BSIM4V4nsubGiven = TRUE; + break; + case BSIM4V4_MOD_NDEP: + mod->BSIM4V4ndep = value->rValue; + mod->BSIM4V4ndepGiven = TRUE; + if (mod->BSIM4V4ndep > 1.0e20) + mod->BSIM4V4ndep *= 1.0e-6; + break; + case BSIM4V4_MOD_NSD: + mod->BSIM4V4nsd = value->rValue; + mod->BSIM4V4nsdGiven = TRUE; + if (mod->BSIM4V4nsd > 1.0e23) + mod->BSIM4V4nsd *= 1.0e-6; + break; + case BSIM4V4_MOD_NGATE: + mod->BSIM4V4ngate = value->rValue; + mod->BSIM4V4ngateGiven = TRUE; + if (mod->BSIM4V4ngate > 1.0e23) + mod->BSIM4V4ngate *= 1.0e-6; + break; + case BSIM4V4_MOD_GAMMA1: + mod->BSIM4V4gamma1 = value->rValue; + mod->BSIM4V4gamma1Given = TRUE; + break; + case BSIM4V4_MOD_GAMMA2: + mod->BSIM4V4gamma2 = value->rValue; + mod->BSIM4V4gamma2Given = TRUE; + break; + case BSIM4V4_MOD_VBX: + mod->BSIM4V4vbx = value->rValue; + mod->BSIM4V4vbxGiven = TRUE; + break; + case BSIM4V4_MOD_VBM: + mod->BSIM4V4vbm = value->rValue; + mod->BSIM4V4vbmGiven = TRUE; + break; + case BSIM4V4_MOD_XT: + mod->BSIM4V4xt = value->rValue; + mod->BSIM4V4xtGiven = TRUE; + break; + case BSIM4V4_MOD_K1: + mod->BSIM4V4k1 = value->rValue; + mod->BSIM4V4k1Given = TRUE; + break; + case BSIM4V4_MOD_KT1: + mod->BSIM4V4kt1 = value->rValue; + mod->BSIM4V4kt1Given = TRUE; + break; + case BSIM4V4_MOD_KT1L: + mod->BSIM4V4kt1l = value->rValue; + mod->BSIM4V4kt1lGiven = TRUE; + break; + case BSIM4V4_MOD_KT2: + mod->BSIM4V4kt2 = value->rValue; + mod->BSIM4V4kt2Given = TRUE; + break; + case BSIM4V4_MOD_K2: + mod->BSIM4V4k2 = value->rValue; + mod->BSIM4V4k2Given = TRUE; + break; + case BSIM4V4_MOD_K3: + mod->BSIM4V4k3 = value->rValue; + mod->BSIM4V4k3Given = TRUE; + break; + case BSIM4V4_MOD_K3B: + mod->BSIM4V4k3b = value->rValue; + mod->BSIM4V4k3bGiven = TRUE; + break; + case BSIM4V4_MOD_LPE0: + mod->BSIM4V4lpe0 = value->rValue; + mod->BSIM4V4lpe0Given = TRUE; + break; + case BSIM4V4_MOD_LPEB: + mod->BSIM4V4lpeb = value->rValue; + mod->BSIM4V4lpebGiven = TRUE; + break; + case BSIM4V4_MOD_DVTP0: + mod->BSIM4V4dvtp0 = value->rValue; + mod->BSIM4V4dvtp0Given = TRUE; + break; + case BSIM4V4_MOD_DVTP1: + mod->BSIM4V4dvtp1 = value->rValue; + mod->BSIM4V4dvtp1Given = TRUE; + break; + case BSIM4V4_MOD_W0: + mod->BSIM4V4w0 = value->rValue; + mod->BSIM4V4w0Given = TRUE; + break; + case BSIM4V4_MOD_DVT0: + mod->BSIM4V4dvt0 = value->rValue; + mod->BSIM4V4dvt0Given = TRUE; + break; + case BSIM4V4_MOD_DVT1: + mod->BSIM4V4dvt1 = value->rValue; + mod->BSIM4V4dvt1Given = TRUE; + break; + case BSIM4V4_MOD_DVT2: + mod->BSIM4V4dvt2 = value->rValue; + mod->BSIM4V4dvt2Given = TRUE; + break; + case BSIM4V4_MOD_DVT0W: + mod->BSIM4V4dvt0w = value->rValue; + mod->BSIM4V4dvt0wGiven = TRUE; + break; + case BSIM4V4_MOD_DVT1W: + mod->BSIM4V4dvt1w = value->rValue; + mod->BSIM4V4dvt1wGiven = TRUE; + break; + case BSIM4V4_MOD_DVT2W: + mod->BSIM4V4dvt2w = value->rValue; + mod->BSIM4V4dvt2wGiven = TRUE; + break; + case BSIM4V4_MOD_DROUT: + mod->BSIM4V4drout = value->rValue; + mod->BSIM4V4droutGiven = TRUE; + break; + case BSIM4V4_MOD_DSUB: + mod->BSIM4V4dsub = value->rValue; + mod->BSIM4V4dsubGiven = TRUE; + break; + case BSIM4V4_MOD_VTH0: + mod->BSIM4V4vth0 = value->rValue; + mod->BSIM4V4vth0Given = TRUE; + break; + case BSIM4V4_MOD_EU: + mod->BSIM4V4eu = value->rValue; + mod->BSIM4V4euGiven = TRUE; + break; + case BSIM4V4_MOD_UA: + mod->BSIM4V4ua = value->rValue; + mod->BSIM4V4uaGiven = TRUE; + break; + case BSIM4V4_MOD_UA1: + mod->BSIM4V4ua1 = value->rValue; + mod->BSIM4V4ua1Given = TRUE; + break; + case BSIM4V4_MOD_UB: + mod->BSIM4V4ub = value->rValue; + mod->BSIM4V4ubGiven = TRUE; + break; + case BSIM4V4_MOD_UB1: + mod->BSIM4V4ub1 = value->rValue; + mod->BSIM4V4ub1Given = TRUE; + break; + case BSIM4V4_MOD_UC: + mod->BSIM4V4uc = value->rValue; + mod->BSIM4V4ucGiven = TRUE; + break; + case BSIM4V4_MOD_UC1: + mod->BSIM4V4uc1 = value->rValue; + mod->BSIM4V4uc1Given = TRUE; + break; + case BSIM4V4_MOD_U0 : + mod->BSIM4V4u0 = value->rValue; + mod->BSIM4V4u0Given = TRUE; + break; + case BSIM4V4_MOD_UTE : + mod->BSIM4V4ute = value->rValue; + mod->BSIM4V4uteGiven = TRUE; + break; + case BSIM4V4_MOD_VOFF: + mod->BSIM4V4voff = value->rValue; + mod->BSIM4V4voffGiven = TRUE; + break; + case BSIM4V4_MOD_VOFFL: + mod->BSIM4V4voffl = value->rValue; + mod->BSIM4V4vofflGiven = TRUE; + break; + case BSIM4V4_MOD_MINV: + mod->BSIM4V4minv = value->rValue; + mod->BSIM4V4minvGiven = TRUE; + break; + case BSIM4V4_MOD_FPROUT: + mod->BSIM4V4fprout = value->rValue; + mod->BSIM4V4fproutGiven = TRUE; + break; + case BSIM4V4_MOD_PDITS: + mod->BSIM4V4pdits = value->rValue; + mod->BSIM4V4pditsGiven = TRUE; + break; + case BSIM4V4_MOD_PDITSD: + mod->BSIM4V4pditsd = value->rValue; + mod->BSIM4V4pditsdGiven = TRUE; + break; + case BSIM4V4_MOD_PDITSL: + mod->BSIM4V4pditsl = value->rValue; + mod->BSIM4V4pditslGiven = TRUE; + break; + case BSIM4V4_MOD_DELTA : + mod->BSIM4V4delta = value->rValue; + mod->BSIM4V4deltaGiven = TRUE; + break; + case BSIM4V4_MOD_RDSW: + mod->BSIM4V4rdsw = value->rValue; + mod->BSIM4V4rdswGiven = TRUE; + break; + case BSIM4V4_MOD_RDSWMIN: + mod->BSIM4V4rdswmin = value->rValue; + mod->BSIM4V4rdswminGiven = TRUE; + break; + case BSIM4V4_MOD_RDWMIN: + mod->BSIM4V4rdwmin = value->rValue; + mod->BSIM4V4rdwminGiven = TRUE; + break; + case BSIM4V4_MOD_RSWMIN: + mod->BSIM4V4rswmin = value->rValue; + mod->BSIM4V4rswminGiven = TRUE; + break; + case BSIM4V4_MOD_RDW: + mod->BSIM4V4rdw = value->rValue; + mod->BSIM4V4rdwGiven = TRUE; + break; + case BSIM4V4_MOD_RSW: + mod->BSIM4V4rsw = value->rValue; + mod->BSIM4V4rswGiven = TRUE; + break; + case BSIM4V4_MOD_PRWG: + mod->BSIM4V4prwg = value->rValue; + mod->BSIM4V4prwgGiven = TRUE; + break; + case BSIM4V4_MOD_PRWB: + mod->BSIM4V4prwb = value->rValue; + mod->BSIM4V4prwbGiven = TRUE; + break; + case BSIM4V4_MOD_PRT: + mod->BSIM4V4prt = value->rValue; + mod->BSIM4V4prtGiven = TRUE; + break; + case BSIM4V4_MOD_ETA0: + mod->BSIM4V4eta0 = value->rValue; + mod->BSIM4V4eta0Given = TRUE; + break; + case BSIM4V4_MOD_ETAB: + mod->BSIM4V4etab = value->rValue; + mod->BSIM4V4etabGiven = TRUE; + break; + case BSIM4V4_MOD_PCLM: + mod->BSIM4V4pclm = value->rValue; + mod->BSIM4V4pclmGiven = TRUE; + break; + case BSIM4V4_MOD_PDIBL1: + mod->BSIM4V4pdibl1 = value->rValue; + mod->BSIM4V4pdibl1Given = TRUE; + break; + case BSIM4V4_MOD_PDIBL2: + mod->BSIM4V4pdibl2 = value->rValue; + mod->BSIM4V4pdibl2Given = TRUE; + break; + case BSIM4V4_MOD_PDIBLB: + mod->BSIM4V4pdiblb = value->rValue; + mod->BSIM4V4pdiblbGiven = TRUE; + break; + case BSIM4V4_MOD_PSCBE1: + mod->BSIM4V4pscbe1 = value->rValue; + mod->BSIM4V4pscbe1Given = TRUE; + break; + case BSIM4V4_MOD_PSCBE2: + mod->BSIM4V4pscbe2 = value->rValue; + mod->BSIM4V4pscbe2Given = TRUE; + break; + case BSIM4V4_MOD_PVAG: + mod->BSIM4V4pvag = value->rValue; + mod->BSIM4V4pvagGiven = TRUE; + break; + case BSIM4V4_MOD_WR : + mod->BSIM4V4wr = value->rValue; + mod->BSIM4V4wrGiven = TRUE; + break; + case BSIM4V4_MOD_DWG : + mod->BSIM4V4dwg = value->rValue; + mod->BSIM4V4dwgGiven = TRUE; + break; + case BSIM4V4_MOD_DWB : + mod->BSIM4V4dwb = value->rValue; + mod->BSIM4V4dwbGiven = TRUE; + break; + case BSIM4V4_MOD_B0 : + mod->BSIM4V4b0 = value->rValue; + mod->BSIM4V4b0Given = TRUE; + break; + case BSIM4V4_MOD_B1 : + mod->BSIM4V4b1 = value->rValue; + mod->BSIM4V4b1Given = TRUE; + break; + case BSIM4V4_MOD_ALPHA0 : + mod->BSIM4V4alpha0 = value->rValue; + mod->BSIM4V4alpha0Given = TRUE; + break; + case BSIM4V4_MOD_ALPHA1 : + mod->BSIM4V4alpha1 = value->rValue; + mod->BSIM4V4alpha1Given = TRUE; + break; + case BSIM4V4_MOD_AGIDL : + mod->BSIM4V4agidl = value->rValue; + mod->BSIM4V4agidlGiven = TRUE; + break; + case BSIM4V4_MOD_BGIDL : + mod->BSIM4V4bgidl = value->rValue; + mod->BSIM4V4bgidlGiven = TRUE; + break; + case BSIM4V4_MOD_CGIDL : + mod->BSIM4V4cgidl = value->rValue; + mod->BSIM4V4cgidlGiven = TRUE; + break; + case BSIM4V4_MOD_PHIN : + mod->BSIM4V4phin = value->rValue; + mod->BSIM4V4phinGiven = TRUE; + break; + case BSIM4V4_MOD_EGIDL : + mod->BSIM4V4egidl = value->rValue; + mod->BSIM4V4egidlGiven = TRUE; + break; + case BSIM4V4_MOD_AIGC : + mod->BSIM4V4aigc = value->rValue; + mod->BSIM4V4aigcGiven = TRUE; + break; + case BSIM4V4_MOD_BIGC : + mod->BSIM4V4bigc = value->rValue; + mod->BSIM4V4bigcGiven = TRUE; + break; + case BSIM4V4_MOD_CIGC : + mod->BSIM4V4cigc = value->rValue; + mod->BSIM4V4cigcGiven = TRUE; + break; + case BSIM4V4_MOD_AIGSD : + mod->BSIM4V4aigsd = value->rValue; + mod->BSIM4V4aigsdGiven = TRUE; + break; + case BSIM4V4_MOD_BIGSD : + mod->BSIM4V4bigsd = value->rValue; + mod->BSIM4V4bigsdGiven = TRUE; + break; + case BSIM4V4_MOD_CIGSD : + mod->BSIM4V4cigsd = value->rValue; + mod->BSIM4V4cigsdGiven = TRUE; + break; + case BSIM4V4_MOD_AIGBACC : + mod->BSIM4V4aigbacc = value->rValue; + mod->BSIM4V4aigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_BIGBACC : + mod->BSIM4V4bigbacc = value->rValue; + mod->BSIM4V4bigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_CIGBACC : + mod->BSIM4V4cigbacc = value->rValue; + mod->BSIM4V4cigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_AIGBINV : + mod->BSIM4V4aigbinv = value->rValue; + mod->BSIM4V4aigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_BIGBINV : + mod->BSIM4V4bigbinv = value->rValue; + mod->BSIM4V4bigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_CIGBINV : + mod->BSIM4V4cigbinv = value->rValue; + mod->BSIM4V4cigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_NIGC : + mod->BSIM4V4nigc = value->rValue; + mod->BSIM4V4nigcGiven = TRUE; + break; + case BSIM4V4_MOD_NIGBINV : + mod->BSIM4V4nigbinv = value->rValue; + mod->BSIM4V4nigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_NIGBACC : + mod->BSIM4V4nigbacc = value->rValue; + mod->BSIM4V4nigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_NTOX : + mod->BSIM4V4ntox = value->rValue; + mod->BSIM4V4ntoxGiven = TRUE; + break; + case BSIM4V4_MOD_EIGBINV : + mod->BSIM4V4eigbinv = value->rValue; + mod->BSIM4V4eigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_PIGCD : + mod->BSIM4V4pigcd = value->rValue; + mod->BSIM4V4pigcdGiven = TRUE; + break; + case BSIM4V4_MOD_POXEDGE : + mod->BSIM4V4poxedge = value->rValue; + mod->BSIM4V4poxedgeGiven = TRUE; + break; + case BSIM4V4_MOD_XRCRG1 : + mod->BSIM4V4xrcrg1 = value->rValue; + mod->BSIM4V4xrcrg1Given = TRUE; + break; + case BSIM4V4_MOD_XRCRG2 : + mod->BSIM4V4xrcrg2 = value->rValue; + mod->BSIM4V4xrcrg2Given = TRUE; + break; + case BSIM4V4_MOD_LAMBDA : + mod->BSIM4V4lambda = value->rValue; + mod->BSIM4V4lambdaGiven = TRUE; + break; + case BSIM4V4_MOD_VTL : + mod->BSIM4V4vtl = value->rValue; + mod->BSIM4V4vtlGiven = TRUE; + break; + case BSIM4V4_MOD_XN: + mod->BSIM4V4xn = value->rValue; + mod->BSIM4V4xnGiven = TRUE; + break; + case BSIM4V4_MOD_LC: + mod->BSIM4V4lc = value->rValue; + mod->BSIM4V4lcGiven = TRUE; + break; + case BSIM4V4_MOD_TNOIA : + mod->BSIM4V4tnoia = value->rValue; + mod->BSIM4V4tnoiaGiven = TRUE; + break; + case BSIM4V4_MOD_TNOIB : + mod->BSIM4V4tnoib = value->rValue; + mod->BSIM4V4tnoibGiven = TRUE; + break; + case BSIM4V4_MOD_RNOIA : + mod->BSIM4V4rnoia = value->rValue; + mod->BSIM4V4rnoiaGiven = TRUE; + break; + case BSIM4V4_MOD_RNOIB : + mod->BSIM4V4rnoib = value->rValue; + mod->BSIM4V4rnoibGiven = TRUE; + break; + case BSIM4V4_MOD_NTNOI : + mod->BSIM4V4ntnoi = value->rValue; + mod->BSIM4V4ntnoiGiven = TRUE; + break; + case BSIM4V4_MOD_VFBSDOFF: + mod->BSIM4V4vfbsdoff = value->rValue; + mod->BSIM4V4vfbsdoffGiven = TRUE; + break; + case BSIM4V4_MOD_LINTNOI: + mod->BSIM4V4lintnoi = value->rValue; + mod->BSIM4V4lintnoiGiven = TRUE; + break; + + /* stress effect */ + case BSIM4V4_MOD_SAREF : + mod->BSIM4V4saref = value->rValue; + mod->BSIM4V4sarefGiven = TRUE; + break; + case BSIM4V4_MOD_SBREF : + mod->BSIM4V4sbref = value->rValue; + mod->BSIM4V4sbrefGiven = TRUE; + break; + case BSIM4V4_MOD_WLOD : + mod->BSIM4V4wlod = value->rValue; + mod->BSIM4V4wlodGiven = TRUE; + break; + case BSIM4V4_MOD_KU0 : + mod->BSIM4V4ku0 = value->rValue; + mod->BSIM4V4ku0Given = TRUE; + break; + case BSIM4V4_MOD_KVSAT : + mod->BSIM4V4kvsat = value->rValue; + mod->BSIM4V4kvsatGiven = TRUE; + break; + case BSIM4V4_MOD_KVTH0 : + mod->BSIM4V4kvth0 = value->rValue; + mod->BSIM4V4kvth0Given = TRUE; + break; + case BSIM4V4_MOD_TKU0 : + mod->BSIM4V4tku0 = value->rValue; + mod->BSIM4V4tku0Given = TRUE; + break; + case BSIM4V4_MOD_LLODKU0 : + mod->BSIM4V4llodku0 = value->rValue; + mod->BSIM4V4llodku0Given = TRUE; + break; + case BSIM4V4_MOD_WLODKU0 : + mod->BSIM4V4wlodku0 = value->rValue; + mod->BSIM4V4wlodku0Given = TRUE; + break; + case BSIM4V4_MOD_LLODVTH : + mod->BSIM4V4llodvth = value->rValue; + mod->BSIM4V4llodvthGiven = TRUE; + break; + case BSIM4V4_MOD_WLODVTH : + mod->BSIM4V4wlodvth = value->rValue; + mod->BSIM4V4wlodvthGiven = TRUE; + break; + case BSIM4V4_MOD_LKU0 : + mod->BSIM4V4lku0 = value->rValue; + mod->BSIM4V4lku0Given = TRUE; + break; + case BSIM4V4_MOD_WKU0 : + mod->BSIM4V4wku0 = value->rValue; + mod->BSIM4V4wku0Given = TRUE; + break; + case BSIM4V4_MOD_PKU0 : + mod->BSIM4V4pku0 = value->rValue; + mod->BSIM4V4pku0Given = TRUE; + break; + case BSIM4V4_MOD_LKVTH0 : + mod->BSIM4V4lkvth0 = value->rValue; + mod->BSIM4V4lkvth0Given = TRUE; + break; + case BSIM4V4_MOD_WKVTH0 : + mod->BSIM4V4wkvth0 = value->rValue; + mod->BSIM4V4wkvth0Given = TRUE; + break; + case BSIM4V4_MOD_PKVTH0 : + mod->BSIM4V4pkvth0 = value->rValue; + mod->BSIM4V4pkvth0Given = TRUE; + break; + case BSIM4V4_MOD_STK2 : + mod->BSIM4V4stk2 = value->rValue; + mod->BSIM4V4stk2Given = TRUE; + break; + case BSIM4V4_MOD_LODK2 : + mod->BSIM4V4lodk2 = value->rValue; + mod->BSIM4V4lodk2Given = TRUE; + break; + case BSIM4V4_MOD_STETA0 : + mod->BSIM4V4steta0 = value->rValue; + mod->BSIM4V4steta0Given = TRUE; + break; + case BSIM4V4_MOD_LODETA0 : + mod->BSIM4V4lodeta0 = value->rValue; + mod->BSIM4V4lodeta0Given = TRUE; + break; + + case BSIM4V4_MOD_BETA0 : + mod->BSIM4V4beta0 = value->rValue; + mod->BSIM4V4beta0Given = TRUE; + break; + case BSIM4V4_MOD_IJTHDFWD : + mod->BSIM4V4ijthdfwd = value->rValue; + mod->BSIM4V4ijthdfwdGiven = TRUE; + break; + case BSIM4V4_MOD_IJTHSFWD : + mod->BSIM4V4ijthsfwd = value->rValue; + mod->BSIM4V4ijthsfwdGiven = TRUE; + break; + case BSIM4V4_MOD_IJTHDREV : + mod->BSIM4V4ijthdrev = value->rValue; + mod->BSIM4V4ijthdrevGiven = TRUE; + break; + case BSIM4V4_MOD_IJTHSREV : + mod->BSIM4V4ijthsrev = value->rValue; + mod->BSIM4V4ijthsrevGiven = TRUE; + break; + case BSIM4V4_MOD_XJBVD : + mod->BSIM4V4xjbvd = value->rValue; + mod->BSIM4V4xjbvdGiven = TRUE; + break; + case BSIM4V4_MOD_XJBVS : + mod->BSIM4V4xjbvs = value->rValue; + mod->BSIM4V4xjbvsGiven = TRUE; + break; + case BSIM4V4_MOD_BVD : + mod->BSIM4V4bvd = value->rValue; + mod->BSIM4V4bvdGiven = TRUE; + break; + case BSIM4V4_MOD_BVS : + mod->BSIM4V4bvs = value->rValue; + mod->BSIM4V4bvsGiven = TRUE; + break; + + /* reverse diode */ + case BSIM4V4_MOD_JTSS : + mod->BSIM4V4jtss = value->rValue; + mod->BSIM4V4jtssGiven = TRUE; + break; + case BSIM4V4_MOD_JTSD : + mod->BSIM4V4jtsd = value->rValue; + mod->BSIM4V4jtsdGiven = TRUE; + break; + case BSIM4V4_MOD_JTSSWS : + mod->BSIM4V4jtssws = value->rValue; + mod->BSIM4V4jtsswsGiven = TRUE; + break; + case BSIM4V4_MOD_JTSSWD : + mod->BSIM4V4jtsswd = value->rValue; + mod->BSIM4V4jtsswdGiven = TRUE; + break; + case BSIM4V4_MOD_JTSSWGS : + mod->BSIM4V4jtsswgs = value->rValue; + mod->BSIM4V4jtsswgsGiven = TRUE; + break; + case BSIM4V4_MOD_JTSSWGD : + mod->BSIM4V4jtsswgd = value->rValue; + mod->BSIM4V4jtsswgdGiven = TRUE; + break; + case BSIM4V4_MOD_NJTS : + mod->BSIM4V4njts = value->rValue; + mod->BSIM4V4njtsGiven = TRUE; + break; + case BSIM4V4_MOD_NJTSSW : + mod->BSIM4V4njtssw = value->rValue; + mod->BSIM4V4njtsswGiven = TRUE; + break; + case BSIM4V4_MOD_NJTSSWG : + mod->BSIM4V4njtsswg = value->rValue; + mod->BSIM4V4njtsswgGiven = TRUE; + break; + case BSIM4V4_MOD_XTSS : + mod->BSIM4V4xtss = value->rValue; + mod->BSIM4V4xtssGiven = TRUE; + break; + case BSIM4V4_MOD_XTSD : + mod->BSIM4V4xtsd = value->rValue; + mod->BSIM4V4xtsdGiven = TRUE; + break; + case BSIM4V4_MOD_XTSSWS : + mod->BSIM4V4xtssws = value->rValue; + mod->BSIM4V4xtsswsGiven = TRUE; + break; + case BSIM4V4_MOD_XTSSWD : + mod->BSIM4V4xtsswd = value->rValue; + mod->BSIM4V4xtsswdGiven = TRUE; + break; + case BSIM4V4_MOD_XTSSWGS : + mod->BSIM4V4xtsswgs = value->rValue; + mod->BSIM4V4xtsswgsGiven = TRUE; + break; + case BSIM4V4_MOD_XTSSWGD : + mod->BSIM4V4xtsswgd = value->rValue; + mod->BSIM4V4xtsswgdGiven = TRUE; + break; + case BSIM4V4_MOD_TNJTS : + mod->BSIM4V4tnjts = value->rValue; + mod->BSIM4V4tnjtsGiven = TRUE; + break; + case BSIM4V4_MOD_TNJTSSW : + mod->BSIM4V4tnjtssw = value->rValue; + mod->BSIM4V4tnjtsswGiven = TRUE; + break; + case BSIM4V4_MOD_TNJTSSWG : + mod->BSIM4V4tnjtsswg = value->rValue; + mod->BSIM4V4tnjtsswgGiven = TRUE; + break; + case BSIM4V4_MOD_VTSS : + mod->BSIM4V4vtss = value->rValue; + mod->BSIM4V4vtssGiven = TRUE; + break; + case BSIM4V4_MOD_VTSD : + mod->BSIM4V4vtsd = value->rValue; + mod->BSIM4V4vtsdGiven = TRUE; + break; + case BSIM4V4_MOD_VTSSWS : + mod->BSIM4V4vtssws = value->rValue; + mod->BSIM4V4vtsswsGiven = TRUE; + break; + case BSIM4V4_MOD_VTSSWD : + mod->BSIM4V4vtsswd = value->rValue; + mod->BSIM4V4vtsswdGiven = TRUE; + break; + case BSIM4V4_MOD_VTSSWGS : + mod->BSIM4V4vtsswgs = value->rValue; + mod->BSIM4V4vtsswgsGiven = TRUE; + break; + case BSIM4V4_MOD_VTSSWGD : + mod->BSIM4V4vtsswgd = value->rValue; + mod->BSIM4V4vtsswgdGiven = TRUE; + break; + + case BSIM4V4_MOD_VFB : + mod->BSIM4V4vfb = value->rValue; + mod->BSIM4V4vfbGiven = TRUE; + break; + + case BSIM4V4_MOD_GBMIN : + mod->BSIM4V4gbmin = value->rValue; + mod->BSIM4V4gbminGiven = TRUE; + break; + case BSIM4V4_MOD_RBDB : + mod->BSIM4V4rbdb = value->rValue; + mod->BSIM4V4rbdbGiven = TRUE; + break; + case BSIM4V4_MOD_RBPB : + mod->BSIM4V4rbpb = value->rValue; + mod->BSIM4V4rbpbGiven = TRUE; + break; + case BSIM4V4_MOD_RBSB : + mod->BSIM4V4rbsb = value->rValue; + mod->BSIM4V4rbsbGiven = TRUE; + break; + case BSIM4V4_MOD_RBPS : + mod->BSIM4V4rbps = value->rValue; + mod->BSIM4V4rbpsGiven = TRUE; + break; + case BSIM4V4_MOD_RBPD : + mod->BSIM4V4rbpd = value->rValue; + mod->BSIM4V4rbpdGiven = TRUE; + break; + + case BSIM4V4_MOD_CGSL : + mod->BSIM4V4cgsl = value->rValue; + mod->BSIM4V4cgslGiven = TRUE; + break; + case BSIM4V4_MOD_CGDL : + mod->BSIM4V4cgdl = value->rValue; + mod->BSIM4V4cgdlGiven = TRUE; + break; + case BSIM4V4_MOD_CKAPPAS : + mod->BSIM4V4ckappas = value->rValue; + mod->BSIM4V4ckappasGiven = TRUE; + break; + case BSIM4V4_MOD_CKAPPAD : + mod->BSIM4V4ckappad = value->rValue; + mod->BSIM4V4ckappadGiven = TRUE; + break; + case BSIM4V4_MOD_CF : + mod->BSIM4V4cf = value->rValue; + mod->BSIM4V4cfGiven = TRUE; + break; + case BSIM4V4_MOD_CLC : + mod->BSIM4V4clc = value->rValue; + mod->BSIM4V4clcGiven = TRUE; + break; + case BSIM4V4_MOD_CLE : + mod->BSIM4V4cle = value->rValue; + mod->BSIM4V4cleGiven = TRUE; + break; + case BSIM4V4_MOD_DWC : + mod->BSIM4V4dwc = value->rValue; + mod->BSIM4V4dwcGiven = TRUE; + break; + case BSIM4V4_MOD_DLC : + mod->BSIM4V4dlc = value->rValue; + mod->BSIM4V4dlcGiven = TRUE; + break; + case BSIM4V4_MOD_XW : + mod->BSIM4V4xw = value->rValue; + mod->BSIM4V4xwGiven = TRUE; + break; + case BSIM4V4_MOD_XL : + mod->BSIM4V4xl = value->rValue; + mod->BSIM4V4xlGiven = TRUE; + break; + case BSIM4V4_MOD_DLCIG : + mod->BSIM4V4dlcig = value->rValue; + mod->BSIM4V4dlcigGiven = TRUE; + break; + case BSIM4V4_MOD_DWJ : + mod->BSIM4V4dwj = value->rValue; + mod->BSIM4V4dwjGiven = TRUE; + break; + case BSIM4V4_MOD_VFBCV : + mod->BSIM4V4vfbcv = value->rValue; + mod->BSIM4V4vfbcvGiven = TRUE; + break; + case BSIM4V4_MOD_ACDE : + mod->BSIM4V4acde = value->rValue; + mod->BSIM4V4acdeGiven = TRUE; + break; + case BSIM4V4_MOD_MOIN : + mod->BSIM4V4moin = value->rValue; + mod->BSIM4V4moinGiven = TRUE; + break; + case BSIM4V4_MOD_NOFF : + mod->BSIM4V4noff = value->rValue; + mod->BSIM4V4noffGiven = TRUE; + break; + case BSIM4V4_MOD_VOFFCV : + mod->BSIM4V4voffcv = value->rValue; + mod->BSIM4V4voffcvGiven = TRUE; + break; + case BSIM4V4_MOD_DMCG : + mod->BSIM4V4dmcg = value->rValue; + mod->BSIM4V4dmcgGiven = TRUE; + break; + case BSIM4V4_MOD_DMCI : + mod->BSIM4V4dmci = value->rValue; + mod->BSIM4V4dmciGiven = TRUE; + break; + case BSIM4V4_MOD_DMDG : + mod->BSIM4V4dmdg = value->rValue; + mod->BSIM4V4dmdgGiven = TRUE; + break; + case BSIM4V4_MOD_DMCGT : + mod->BSIM4V4dmcgt = value->rValue; + mod->BSIM4V4dmcgtGiven = TRUE; + break; + case BSIM4V4_MOD_XGW : + mod->BSIM4V4xgw = value->rValue; + mod->BSIM4V4xgwGiven = TRUE; + break; + case BSIM4V4_MOD_XGL : + mod->BSIM4V4xgl = value->rValue; + mod->BSIM4V4xglGiven = TRUE; + break; + case BSIM4V4_MOD_RSHG : + mod->BSIM4V4rshg = value->rValue; + mod->BSIM4V4rshgGiven = TRUE; + break; + case BSIM4V4_MOD_NGCON : + mod->BSIM4V4ngcon = value->rValue; + mod->BSIM4V4ngconGiven = TRUE; + break; + case BSIM4V4_MOD_TCJ : + mod->BSIM4V4tcj = value->rValue; + mod->BSIM4V4tcjGiven = TRUE; + break; + case BSIM4V4_MOD_TPB : + mod->BSIM4V4tpb = value->rValue; + mod->BSIM4V4tpbGiven = TRUE; + break; + case BSIM4V4_MOD_TCJSW : + mod->BSIM4V4tcjsw = value->rValue; + mod->BSIM4V4tcjswGiven = TRUE; + break; + case BSIM4V4_MOD_TPBSW : + mod->BSIM4V4tpbsw = value->rValue; + mod->BSIM4V4tpbswGiven = TRUE; + break; + case BSIM4V4_MOD_TCJSWG : + mod->BSIM4V4tcjswg = value->rValue; + mod->BSIM4V4tcjswgGiven = TRUE; + break; + case BSIM4V4_MOD_TPBSWG : + mod->BSIM4V4tpbswg = value->rValue; + mod->BSIM4V4tpbswgGiven = TRUE; + break; + + /* Length dependence */ + case BSIM4V4_MOD_LCDSC : + mod->BSIM4V4lcdsc = value->rValue; + mod->BSIM4V4lcdscGiven = TRUE; + break; + + + case BSIM4V4_MOD_LCDSCB : + mod->BSIM4V4lcdscb = value->rValue; + mod->BSIM4V4lcdscbGiven = TRUE; + break; + case BSIM4V4_MOD_LCDSCD : + mod->BSIM4V4lcdscd = value->rValue; + mod->BSIM4V4lcdscdGiven = TRUE; + break; + case BSIM4V4_MOD_LCIT : + mod->BSIM4V4lcit = value->rValue; + mod->BSIM4V4lcitGiven = TRUE; + break; + case BSIM4V4_MOD_LNFACTOR : + mod->BSIM4V4lnfactor = value->rValue; + mod->BSIM4V4lnfactorGiven = TRUE; + break; + case BSIM4V4_MOD_LXJ: + mod->BSIM4V4lxj = value->rValue; + mod->BSIM4V4lxjGiven = TRUE; + break; + case BSIM4V4_MOD_LVSAT: + mod->BSIM4V4lvsat = value->rValue; + mod->BSIM4V4lvsatGiven = TRUE; + break; + + + case BSIM4V4_MOD_LA0: + mod->BSIM4V4la0 = value->rValue; + mod->BSIM4V4la0Given = TRUE; + break; + case BSIM4V4_MOD_LAGS: + mod->BSIM4V4lags = value->rValue; + mod->BSIM4V4lagsGiven = TRUE; + break; + case BSIM4V4_MOD_LA1: + mod->BSIM4V4la1 = value->rValue; + mod->BSIM4V4la1Given = TRUE; + break; + case BSIM4V4_MOD_LA2: + mod->BSIM4V4la2 = value->rValue; + mod->BSIM4V4la2Given = TRUE; + break; + case BSIM4V4_MOD_LAT: + mod->BSIM4V4lat = value->rValue; + mod->BSIM4V4latGiven = TRUE; + break; + case BSIM4V4_MOD_LKETA: + mod->BSIM4V4lketa = value->rValue; + mod->BSIM4V4lketaGiven = TRUE; + break; + case BSIM4V4_MOD_LNSUB: + mod->BSIM4V4lnsub = value->rValue; + mod->BSIM4V4lnsubGiven = TRUE; + break; + case BSIM4V4_MOD_LNDEP: + mod->BSIM4V4lndep = value->rValue; + mod->BSIM4V4lndepGiven = TRUE; + if (mod->BSIM4V4lndep > 1.0e20) + mod->BSIM4V4lndep *= 1.0e-6; + break; + case BSIM4V4_MOD_LNSD: + mod->BSIM4V4lnsd = value->rValue; + mod->BSIM4V4lnsdGiven = TRUE; + if (mod->BSIM4V4lnsd > 1.0e23) + mod->BSIM4V4lnsd *= 1.0e-6; + break; + case BSIM4V4_MOD_LNGATE: + mod->BSIM4V4lngate = value->rValue; + mod->BSIM4V4lngateGiven = TRUE; + if (mod->BSIM4V4lngate > 1.0e23) + mod->BSIM4V4lngate *= 1.0e-6; + break; + case BSIM4V4_MOD_LGAMMA1: + mod->BSIM4V4lgamma1 = value->rValue; + mod->BSIM4V4lgamma1Given = TRUE; + break; + case BSIM4V4_MOD_LGAMMA2: + mod->BSIM4V4lgamma2 = value->rValue; + mod->BSIM4V4lgamma2Given = TRUE; + break; + case BSIM4V4_MOD_LVBX: + mod->BSIM4V4lvbx = value->rValue; + mod->BSIM4V4lvbxGiven = TRUE; + break; + case BSIM4V4_MOD_LVBM: + mod->BSIM4V4lvbm = value->rValue; + mod->BSIM4V4lvbmGiven = TRUE; + break; + case BSIM4V4_MOD_LXT: + mod->BSIM4V4lxt = value->rValue; + mod->BSIM4V4lxtGiven = TRUE; + break; + case BSIM4V4_MOD_LK1: + mod->BSIM4V4lk1 = value->rValue; + mod->BSIM4V4lk1Given = TRUE; + break; + case BSIM4V4_MOD_LKT1: + mod->BSIM4V4lkt1 = value->rValue; + mod->BSIM4V4lkt1Given = TRUE; + break; + case BSIM4V4_MOD_LKT1L: + mod->BSIM4V4lkt1l = value->rValue; + mod->BSIM4V4lkt1lGiven = TRUE; + break; + case BSIM4V4_MOD_LKT2: + mod->BSIM4V4lkt2 = value->rValue; + mod->BSIM4V4lkt2Given = TRUE; + break; + case BSIM4V4_MOD_LK2: + mod->BSIM4V4lk2 = value->rValue; + mod->BSIM4V4lk2Given = TRUE; + break; + case BSIM4V4_MOD_LK3: + mod->BSIM4V4lk3 = value->rValue; + mod->BSIM4V4lk3Given = TRUE; + break; + case BSIM4V4_MOD_LK3B: + mod->BSIM4V4lk3b = value->rValue; + mod->BSIM4V4lk3bGiven = TRUE; + break; + case BSIM4V4_MOD_LLPE0: + mod->BSIM4V4llpe0 = value->rValue; + mod->BSIM4V4llpe0Given = TRUE; + break; + case BSIM4V4_MOD_LLPEB: + mod->BSIM4V4llpeb = value->rValue; + mod->BSIM4V4llpebGiven = TRUE; + break; + case BSIM4V4_MOD_LDVTP0: + mod->BSIM4V4ldvtp0 = value->rValue; + mod->BSIM4V4ldvtp0Given = TRUE; + break; + case BSIM4V4_MOD_LDVTP1: + mod->BSIM4V4ldvtp1 = value->rValue; + mod->BSIM4V4ldvtp1Given = TRUE; + break; + case BSIM4V4_MOD_LW0: + mod->BSIM4V4lw0 = value->rValue; + mod->BSIM4V4lw0Given = TRUE; + break; + case BSIM4V4_MOD_LDVT0: + mod->BSIM4V4ldvt0 = value->rValue; + mod->BSIM4V4ldvt0Given = TRUE; + break; + case BSIM4V4_MOD_LDVT1: + mod->BSIM4V4ldvt1 = value->rValue; + mod->BSIM4V4ldvt1Given = TRUE; + break; + case BSIM4V4_MOD_LDVT2: + mod->BSIM4V4ldvt2 = value->rValue; + mod->BSIM4V4ldvt2Given = TRUE; + break; + case BSIM4V4_MOD_LDVT0W: + mod->BSIM4V4ldvt0w = value->rValue; + mod->BSIM4V4ldvt0wGiven = TRUE; + break; + case BSIM4V4_MOD_LDVT1W: + mod->BSIM4V4ldvt1w = value->rValue; + mod->BSIM4V4ldvt1wGiven = TRUE; + break; + case BSIM4V4_MOD_LDVT2W: + mod->BSIM4V4ldvt2w = value->rValue; + mod->BSIM4V4ldvt2wGiven = TRUE; + break; + case BSIM4V4_MOD_LDROUT: + mod->BSIM4V4ldrout = value->rValue; + mod->BSIM4V4ldroutGiven = TRUE; + break; + case BSIM4V4_MOD_LDSUB: + mod->BSIM4V4ldsub = value->rValue; + mod->BSIM4V4ldsubGiven = TRUE; + break; + case BSIM4V4_MOD_LVTH0: + mod->BSIM4V4lvth0 = value->rValue; + mod->BSIM4V4lvth0Given = TRUE; + break; + case BSIM4V4_MOD_LUA: + mod->BSIM4V4lua = value->rValue; + mod->BSIM4V4luaGiven = TRUE; + break; + case BSIM4V4_MOD_LUA1: + mod->BSIM4V4lua1 = value->rValue; + mod->BSIM4V4lua1Given = TRUE; + break; + case BSIM4V4_MOD_LUB: + mod->BSIM4V4lub = value->rValue; + mod->BSIM4V4lubGiven = TRUE; + break; + case BSIM4V4_MOD_LUB1: + mod->BSIM4V4lub1 = value->rValue; + mod->BSIM4V4lub1Given = TRUE; + break; + case BSIM4V4_MOD_LUC: + mod->BSIM4V4luc = value->rValue; + mod->BSIM4V4lucGiven = TRUE; + break; + case BSIM4V4_MOD_LUC1: + mod->BSIM4V4luc1 = value->rValue; + mod->BSIM4V4luc1Given = TRUE; + break; + case BSIM4V4_MOD_LU0 : + mod->BSIM4V4lu0 = value->rValue; + mod->BSIM4V4lu0Given = TRUE; + break; + case BSIM4V4_MOD_LUTE : + mod->BSIM4V4lute = value->rValue; + mod->BSIM4V4luteGiven = TRUE; + break; + case BSIM4V4_MOD_LVOFF: + mod->BSIM4V4lvoff = value->rValue; + mod->BSIM4V4lvoffGiven = TRUE; + break; + case BSIM4V4_MOD_LMINV: + mod->BSIM4V4lminv = value->rValue; + mod->BSIM4V4lminvGiven = TRUE; + break; + case BSIM4V4_MOD_LFPROUT: + mod->BSIM4V4lfprout = value->rValue; + mod->BSIM4V4lfproutGiven = TRUE; + break; + case BSIM4V4_MOD_LPDITS: + mod->BSIM4V4lpdits = value->rValue; + mod->BSIM4V4lpditsGiven = TRUE; + break; + case BSIM4V4_MOD_LPDITSD: + mod->BSIM4V4lpditsd = value->rValue; + mod->BSIM4V4lpditsdGiven = TRUE; + break; + case BSIM4V4_MOD_LDELTA : + mod->BSIM4V4ldelta = value->rValue; + mod->BSIM4V4ldeltaGiven = TRUE; + break; + case BSIM4V4_MOD_LRDSW: + mod->BSIM4V4lrdsw = value->rValue; + mod->BSIM4V4lrdswGiven = TRUE; + break; + case BSIM4V4_MOD_LRDW: + mod->BSIM4V4lrdw = value->rValue; + mod->BSIM4V4lrdwGiven = TRUE; + break; + case BSIM4V4_MOD_LRSW: + mod->BSIM4V4lrsw = value->rValue; + mod->BSIM4V4lrswGiven = TRUE; + break; + case BSIM4V4_MOD_LPRWB: + mod->BSIM4V4lprwb = value->rValue; + mod->BSIM4V4lprwbGiven = TRUE; + break; + case BSIM4V4_MOD_LPRWG: + mod->BSIM4V4lprwg = value->rValue; + mod->BSIM4V4lprwgGiven = TRUE; + break; + case BSIM4V4_MOD_LPRT: + mod->BSIM4V4lprt = value->rValue; + mod->BSIM4V4lprtGiven = TRUE; + break; + case BSIM4V4_MOD_LETA0: + mod->BSIM4V4leta0 = value->rValue; + mod->BSIM4V4leta0Given = TRUE; + break; + case BSIM4V4_MOD_LETAB: + mod->BSIM4V4letab = value->rValue; + mod->BSIM4V4letabGiven = TRUE; + break; + case BSIM4V4_MOD_LPCLM: + mod->BSIM4V4lpclm = value->rValue; + mod->BSIM4V4lpclmGiven = TRUE; + break; + case BSIM4V4_MOD_LPDIBL1: + mod->BSIM4V4lpdibl1 = value->rValue; + mod->BSIM4V4lpdibl1Given = TRUE; + break; + case BSIM4V4_MOD_LPDIBL2: + mod->BSIM4V4lpdibl2 = value->rValue; + mod->BSIM4V4lpdibl2Given = TRUE; + break; + case BSIM4V4_MOD_LPDIBLB: + mod->BSIM4V4lpdiblb = value->rValue; + mod->BSIM4V4lpdiblbGiven = TRUE; + break; + case BSIM4V4_MOD_LPSCBE1: + mod->BSIM4V4lpscbe1 = value->rValue; + mod->BSIM4V4lpscbe1Given = TRUE; + break; + case BSIM4V4_MOD_LPSCBE2: + mod->BSIM4V4lpscbe2 = value->rValue; + mod->BSIM4V4lpscbe2Given = TRUE; + break; + case BSIM4V4_MOD_LPVAG: + mod->BSIM4V4lpvag = value->rValue; + mod->BSIM4V4lpvagGiven = TRUE; + break; + case BSIM4V4_MOD_LWR : + mod->BSIM4V4lwr = value->rValue; + mod->BSIM4V4lwrGiven = TRUE; + break; + case BSIM4V4_MOD_LDWG : + mod->BSIM4V4ldwg = value->rValue; + mod->BSIM4V4ldwgGiven = TRUE; + break; + case BSIM4V4_MOD_LDWB : + mod->BSIM4V4ldwb = value->rValue; + mod->BSIM4V4ldwbGiven = TRUE; + break; + case BSIM4V4_MOD_LB0 : + mod->BSIM4V4lb0 = value->rValue; + mod->BSIM4V4lb0Given = TRUE; + break; + case BSIM4V4_MOD_LB1 : + mod->BSIM4V4lb1 = value->rValue; + mod->BSIM4V4lb1Given = TRUE; + break; + case BSIM4V4_MOD_LALPHA0 : + mod->BSIM4V4lalpha0 = value->rValue; + mod->BSIM4V4lalpha0Given = TRUE; + break; + case BSIM4V4_MOD_LALPHA1 : + mod->BSIM4V4lalpha1 = value->rValue; + mod->BSIM4V4lalpha1Given = TRUE; + break; + case BSIM4V4_MOD_LBETA0 : + mod->BSIM4V4lbeta0 = value->rValue; + mod->BSIM4V4lbeta0Given = TRUE; + break; + case BSIM4V4_MOD_LAGIDL : + mod->BSIM4V4lagidl = value->rValue; + mod->BSIM4V4lagidlGiven = TRUE; + break; + case BSIM4V4_MOD_LBGIDL : + mod->BSIM4V4lbgidl = value->rValue; + mod->BSIM4V4lbgidlGiven = TRUE; + break; + case BSIM4V4_MOD_LCGIDL : + mod->BSIM4V4lcgidl = value->rValue; + mod->BSIM4V4lcgidlGiven = TRUE; + break; + case BSIM4V4_MOD_LPHIN : + mod->BSIM4V4lphin = value->rValue; + mod->BSIM4V4lphinGiven = TRUE; + break; + case BSIM4V4_MOD_LEGIDL : + mod->BSIM4V4legidl = value->rValue; + mod->BSIM4V4legidlGiven = TRUE; + break; + case BSIM4V4_MOD_LAIGC : + mod->BSIM4V4laigc = value->rValue; + mod->BSIM4V4laigcGiven = TRUE; + break; + case BSIM4V4_MOD_LBIGC : + mod->BSIM4V4lbigc = value->rValue; + mod->BSIM4V4lbigcGiven = TRUE; + break; + case BSIM4V4_MOD_LCIGC : + mod->BSIM4V4lcigc = value->rValue; + mod->BSIM4V4lcigcGiven = TRUE; + break; + case BSIM4V4_MOD_LAIGSD : + mod->BSIM4V4laigsd = value->rValue; + mod->BSIM4V4laigsdGiven = TRUE; + break; + case BSIM4V4_MOD_LBIGSD : + mod->BSIM4V4lbigsd = value->rValue; + mod->BSIM4V4lbigsdGiven = TRUE; + break; + case BSIM4V4_MOD_LCIGSD : + mod->BSIM4V4lcigsd = value->rValue; + mod->BSIM4V4lcigsdGiven = TRUE; + break; + case BSIM4V4_MOD_LAIGBACC : + mod->BSIM4V4laigbacc = value->rValue; + mod->BSIM4V4laigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_LBIGBACC : + mod->BSIM4V4lbigbacc = value->rValue; + mod->BSIM4V4lbigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_LCIGBACC : + mod->BSIM4V4lcigbacc = value->rValue; + mod->BSIM4V4lcigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_LAIGBINV : + mod->BSIM4V4laigbinv = value->rValue; + mod->BSIM4V4laigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_LBIGBINV : + mod->BSIM4V4lbigbinv = value->rValue; + mod->BSIM4V4lbigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_LCIGBINV : + mod->BSIM4V4lcigbinv = value->rValue; + mod->BSIM4V4lcigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_LNIGC : + mod->BSIM4V4lnigc = value->rValue; + mod->BSIM4V4lnigcGiven = TRUE; + break; + case BSIM4V4_MOD_LNIGBINV : + mod->BSIM4V4lnigbinv = value->rValue; + mod->BSIM4V4lnigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_LNIGBACC : + mod->BSIM4V4lnigbacc = value->rValue; + mod->BSIM4V4lnigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_LNTOX : + mod->BSIM4V4lntox = value->rValue; + mod->BSIM4V4lntoxGiven = TRUE; + break; + case BSIM4V4_MOD_LEIGBINV : + mod->BSIM4V4leigbinv = value->rValue; + mod->BSIM4V4leigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_LPIGCD : + mod->BSIM4V4lpigcd = value->rValue; + mod->BSIM4V4lpigcdGiven = TRUE; + break; + case BSIM4V4_MOD_LPOXEDGE : + mod->BSIM4V4lpoxedge = value->rValue; + mod->BSIM4V4lpoxedgeGiven = TRUE; + break; + case BSIM4V4_MOD_LXRCRG1 : + mod->BSIM4V4lxrcrg1 = value->rValue; + mod->BSIM4V4lxrcrg1Given = TRUE; + break; + case BSIM4V4_MOD_LXRCRG2 : + mod->BSIM4V4lxrcrg2 = value->rValue; + mod->BSIM4V4lxrcrg2Given = TRUE; + break; + case BSIM4V4_MOD_LLAMBDA : + mod->BSIM4V4llambda = value->rValue; + mod->BSIM4V4llambdaGiven = TRUE; + break; + case BSIM4V4_MOD_LVTL : + mod->BSIM4V4lvtl = value->rValue; + mod->BSIM4V4lvtlGiven = TRUE; + break; + case BSIM4V4_MOD_LXN: + mod->BSIM4V4lxn = value->rValue; + mod->BSIM4V4lxnGiven = TRUE; + break; + case BSIM4V4_MOD_LVFBSDOFF: + mod->BSIM4V4lvfbsdoff = value->rValue; + mod->BSIM4V4lvfbsdoffGiven = TRUE; + break; + case BSIM4V4_MOD_LEU : + mod->BSIM4V4leu = value->rValue; + mod->BSIM4V4leuGiven = TRUE; + break; + case BSIM4V4_MOD_LVFB : + mod->BSIM4V4lvfb = value->rValue; + mod->BSIM4V4lvfbGiven = TRUE; + break; + case BSIM4V4_MOD_LCGSL : + mod->BSIM4V4lcgsl = value->rValue; + mod->BSIM4V4lcgslGiven = TRUE; + break; + case BSIM4V4_MOD_LCGDL : + mod->BSIM4V4lcgdl = value->rValue; + mod->BSIM4V4lcgdlGiven = TRUE; + break; + case BSIM4V4_MOD_LCKAPPAS : + mod->BSIM4V4lckappas = value->rValue; + mod->BSIM4V4lckappasGiven = TRUE; + break; + case BSIM4V4_MOD_LCKAPPAD : + mod->BSIM4V4lckappad = value->rValue; + mod->BSIM4V4lckappadGiven = TRUE; + break; + case BSIM4V4_MOD_LCF : + mod->BSIM4V4lcf = value->rValue; + mod->BSIM4V4lcfGiven = TRUE; + break; + case BSIM4V4_MOD_LCLC : + mod->BSIM4V4lclc = value->rValue; + mod->BSIM4V4lclcGiven = TRUE; + break; + case BSIM4V4_MOD_LCLE : + mod->BSIM4V4lcle = value->rValue; + mod->BSIM4V4lcleGiven = TRUE; + break; + case BSIM4V4_MOD_LVFBCV : + mod->BSIM4V4lvfbcv = value->rValue; + mod->BSIM4V4lvfbcvGiven = TRUE; + break; + case BSIM4V4_MOD_LACDE : + mod->BSIM4V4lacde = value->rValue; + mod->BSIM4V4lacdeGiven = TRUE; + break; + case BSIM4V4_MOD_LMOIN : + mod->BSIM4V4lmoin = value->rValue; + mod->BSIM4V4lmoinGiven = TRUE; + break; + case BSIM4V4_MOD_LNOFF : + mod->BSIM4V4lnoff = value->rValue; + mod->BSIM4V4lnoffGiven = TRUE; + break; + case BSIM4V4_MOD_LVOFFCV : + mod->BSIM4V4lvoffcv = value->rValue; + mod->BSIM4V4lvoffcvGiven = TRUE; + break; + + /* Width dependence */ + case BSIM4V4_MOD_WCDSC : + mod->BSIM4V4wcdsc = value->rValue; + mod->BSIM4V4wcdscGiven = TRUE; + break; + + + case BSIM4V4_MOD_WCDSCB : + mod->BSIM4V4wcdscb = value->rValue; + mod->BSIM4V4wcdscbGiven = TRUE; + break; + case BSIM4V4_MOD_WCDSCD : + mod->BSIM4V4wcdscd = value->rValue; + mod->BSIM4V4wcdscdGiven = TRUE; + break; + case BSIM4V4_MOD_WCIT : + mod->BSIM4V4wcit = value->rValue; + mod->BSIM4V4wcitGiven = TRUE; + break; + case BSIM4V4_MOD_WNFACTOR : + mod->BSIM4V4wnfactor = value->rValue; + mod->BSIM4V4wnfactorGiven = TRUE; + break; + case BSIM4V4_MOD_WXJ: + mod->BSIM4V4wxj = value->rValue; + mod->BSIM4V4wxjGiven = TRUE; + break; + case BSIM4V4_MOD_WVSAT: + mod->BSIM4V4wvsat = value->rValue; + mod->BSIM4V4wvsatGiven = TRUE; + break; + + + case BSIM4V4_MOD_WA0: + mod->BSIM4V4wa0 = value->rValue; + mod->BSIM4V4wa0Given = TRUE; + break; + case BSIM4V4_MOD_WAGS: + mod->BSIM4V4wags = value->rValue; + mod->BSIM4V4wagsGiven = TRUE; + break; + case BSIM4V4_MOD_WA1: + mod->BSIM4V4wa1 = value->rValue; + mod->BSIM4V4wa1Given = TRUE; + break; + case BSIM4V4_MOD_WA2: + mod->BSIM4V4wa2 = value->rValue; + mod->BSIM4V4wa2Given = TRUE; + break; + case BSIM4V4_MOD_WAT: + mod->BSIM4V4wat = value->rValue; + mod->BSIM4V4watGiven = TRUE; + break; + case BSIM4V4_MOD_WKETA: + mod->BSIM4V4wketa = value->rValue; + mod->BSIM4V4wketaGiven = TRUE; + break; + case BSIM4V4_MOD_WNSUB: + mod->BSIM4V4wnsub = value->rValue; + mod->BSIM4V4wnsubGiven = TRUE; + break; + case BSIM4V4_MOD_WNDEP: + mod->BSIM4V4wndep = value->rValue; + mod->BSIM4V4wndepGiven = TRUE; + if (mod->BSIM4V4wndep > 1.0e20) + mod->BSIM4V4wndep *= 1.0e-6; + break; + case BSIM4V4_MOD_WNSD: + mod->BSIM4V4wnsd = value->rValue; + mod->BSIM4V4wnsdGiven = TRUE; + if (mod->BSIM4V4wnsd > 1.0e23) + mod->BSIM4V4wnsd *= 1.0e-6; + break; + case BSIM4V4_MOD_WNGATE: + mod->BSIM4V4wngate = value->rValue; + mod->BSIM4V4wngateGiven = TRUE; + if (mod->BSIM4V4wngate > 1.0e23) + mod->BSIM4V4wngate *= 1.0e-6; + break; + case BSIM4V4_MOD_WGAMMA1: + mod->BSIM4V4wgamma1 = value->rValue; + mod->BSIM4V4wgamma1Given = TRUE; + break; + case BSIM4V4_MOD_WGAMMA2: + mod->BSIM4V4wgamma2 = value->rValue; + mod->BSIM4V4wgamma2Given = TRUE; + break; + case BSIM4V4_MOD_WVBX: + mod->BSIM4V4wvbx = value->rValue; + mod->BSIM4V4wvbxGiven = TRUE; + break; + case BSIM4V4_MOD_WVBM: + mod->BSIM4V4wvbm = value->rValue; + mod->BSIM4V4wvbmGiven = TRUE; + break; + case BSIM4V4_MOD_WXT: + mod->BSIM4V4wxt = value->rValue; + mod->BSIM4V4wxtGiven = TRUE; + break; + case BSIM4V4_MOD_WK1: + mod->BSIM4V4wk1 = value->rValue; + mod->BSIM4V4wk1Given = TRUE; + break; + case BSIM4V4_MOD_WKT1: + mod->BSIM4V4wkt1 = value->rValue; + mod->BSIM4V4wkt1Given = TRUE; + break; + case BSIM4V4_MOD_WKT1L: + mod->BSIM4V4wkt1l = value->rValue; + mod->BSIM4V4wkt1lGiven = TRUE; + break; + case BSIM4V4_MOD_WKT2: + mod->BSIM4V4wkt2 = value->rValue; + mod->BSIM4V4wkt2Given = TRUE; + break; + case BSIM4V4_MOD_WK2: + mod->BSIM4V4wk2 = value->rValue; + mod->BSIM4V4wk2Given = TRUE; + break; + case BSIM4V4_MOD_WK3: + mod->BSIM4V4wk3 = value->rValue; + mod->BSIM4V4wk3Given = TRUE; + break; + case BSIM4V4_MOD_WK3B: + mod->BSIM4V4wk3b = value->rValue; + mod->BSIM4V4wk3bGiven = TRUE; + break; + case BSIM4V4_MOD_WLPE0: + mod->BSIM4V4wlpe0 = value->rValue; + mod->BSIM4V4wlpe0Given = TRUE; + break; + case BSIM4V4_MOD_WLPEB: + mod->BSIM4V4wlpeb = value->rValue; + mod->BSIM4V4wlpebGiven = TRUE; + break; + case BSIM4V4_MOD_WDVTP0: + mod->BSIM4V4wdvtp0 = value->rValue; + mod->BSIM4V4wdvtp0Given = TRUE; + break; + case BSIM4V4_MOD_WDVTP1: + mod->BSIM4V4wdvtp1 = value->rValue; + mod->BSIM4V4wdvtp1Given = TRUE; + break; + case BSIM4V4_MOD_WW0: + mod->BSIM4V4ww0 = value->rValue; + mod->BSIM4V4ww0Given = TRUE; + break; + case BSIM4V4_MOD_WDVT0: + mod->BSIM4V4wdvt0 = value->rValue; + mod->BSIM4V4wdvt0Given = TRUE; + break; + case BSIM4V4_MOD_WDVT1: + mod->BSIM4V4wdvt1 = value->rValue; + mod->BSIM4V4wdvt1Given = TRUE; + break; + case BSIM4V4_MOD_WDVT2: + mod->BSIM4V4wdvt2 = value->rValue; + mod->BSIM4V4wdvt2Given = TRUE; + break; + case BSIM4V4_MOD_WDVT0W: + mod->BSIM4V4wdvt0w = value->rValue; + mod->BSIM4V4wdvt0wGiven = TRUE; + break; + case BSIM4V4_MOD_WDVT1W: + mod->BSIM4V4wdvt1w = value->rValue; + mod->BSIM4V4wdvt1wGiven = TRUE; + break; + case BSIM4V4_MOD_WDVT2W: + mod->BSIM4V4wdvt2w = value->rValue; + mod->BSIM4V4wdvt2wGiven = TRUE; + break; + case BSIM4V4_MOD_WDROUT: + mod->BSIM4V4wdrout = value->rValue; + mod->BSIM4V4wdroutGiven = TRUE; + break; + case BSIM4V4_MOD_WDSUB: + mod->BSIM4V4wdsub = value->rValue; + mod->BSIM4V4wdsubGiven = TRUE; + break; + case BSIM4V4_MOD_WVTH0: + mod->BSIM4V4wvth0 = value->rValue; + mod->BSIM4V4wvth0Given = TRUE; + break; + case BSIM4V4_MOD_WUA: + mod->BSIM4V4wua = value->rValue; + mod->BSIM4V4wuaGiven = TRUE; + break; + case BSIM4V4_MOD_WUA1: + mod->BSIM4V4wua1 = value->rValue; + mod->BSIM4V4wua1Given = TRUE; + break; + case BSIM4V4_MOD_WUB: + mod->BSIM4V4wub = value->rValue; + mod->BSIM4V4wubGiven = TRUE; + break; + case BSIM4V4_MOD_WUB1: + mod->BSIM4V4wub1 = value->rValue; + mod->BSIM4V4wub1Given = TRUE; + break; + case BSIM4V4_MOD_WUC: + mod->BSIM4V4wuc = value->rValue; + mod->BSIM4V4wucGiven = TRUE; + break; + case BSIM4V4_MOD_WUC1: + mod->BSIM4V4wuc1 = value->rValue; + mod->BSIM4V4wuc1Given = TRUE; + break; + case BSIM4V4_MOD_WU0 : + mod->BSIM4V4wu0 = value->rValue; + mod->BSIM4V4wu0Given = TRUE; + break; + case BSIM4V4_MOD_WUTE : + mod->BSIM4V4wute = value->rValue; + mod->BSIM4V4wuteGiven = TRUE; + break; + case BSIM4V4_MOD_WVOFF: + mod->BSIM4V4wvoff = value->rValue; + mod->BSIM4V4wvoffGiven = TRUE; + break; + case BSIM4V4_MOD_WMINV: + mod->BSIM4V4wminv = value->rValue; + mod->BSIM4V4wminvGiven = TRUE; + break; + case BSIM4V4_MOD_WFPROUT: + mod->BSIM4V4wfprout = value->rValue; + mod->BSIM4V4wfproutGiven = TRUE; + break; + case BSIM4V4_MOD_WPDITS: + mod->BSIM4V4wpdits = value->rValue; + mod->BSIM4V4wpditsGiven = TRUE; + break; + case BSIM4V4_MOD_WPDITSD: + mod->BSIM4V4wpditsd = value->rValue; + mod->BSIM4V4wpditsdGiven = TRUE; + break; + case BSIM4V4_MOD_WDELTA : + mod->BSIM4V4wdelta = value->rValue; + mod->BSIM4V4wdeltaGiven = TRUE; + break; + case BSIM4V4_MOD_WRDSW: + mod->BSIM4V4wrdsw = value->rValue; + mod->BSIM4V4wrdswGiven = TRUE; + break; + case BSIM4V4_MOD_WRDW: + mod->BSIM4V4wrdw = value->rValue; + mod->BSIM4V4wrdwGiven = TRUE; + break; + case BSIM4V4_MOD_WRSW: + mod->BSIM4V4wrsw = value->rValue; + mod->BSIM4V4wrswGiven = TRUE; + break; + case BSIM4V4_MOD_WPRWB: + mod->BSIM4V4wprwb = value->rValue; + mod->BSIM4V4wprwbGiven = TRUE; + break; + case BSIM4V4_MOD_WPRWG: + mod->BSIM4V4wprwg = value->rValue; + mod->BSIM4V4wprwgGiven = TRUE; + break; + case BSIM4V4_MOD_WPRT: + mod->BSIM4V4wprt = value->rValue; + mod->BSIM4V4wprtGiven = TRUE; + break; + case BSIM4V4_MOD_WETA0: + mod->BSIM4V4weta0 = value->rValue; + mod->BSIM4V4weta0Given = TRUE; + break; + case BSIM4V4_MOD_WETAB: + mod->BSIM4V4wetab = value->rValue; + mod->BSIM4V4wetabGiven = TRUE; + break; + case BSIM4V4_MOD_WPCLM: + mod->BSIM4V4wpclm = value->rValue; + mod->BSIM4V4wpclmGiven = TRUE; + break; + case BSIM4V4_MOD_WPDIBL1: + mod->BSIM4V4wpdibl1 = value->rValue; + mod->BSIM4V4wpdibl1Given = TRUE; + break; + case BSIM4V4_MOD_WPDIBL2: + mod->BSIM4V4wpdibl2 = value->rValue; + mod->BSIM4V4wpdibl2Given = TRUE; + break; + case BSIM4V4_MOD_WPDIBLB: + mod->BSIM4V4wpdiblb = value->rValue; + mod->BSIM4V4wpdiblbGiven = TRUE; + break; + case BSIM4V4_MOD_WPSCBE1: + mod->BSIM4V4wpscbe1 = value->rValue; + mod->BSIM4V4wpscbe1Given = TRUE; + break; + case BSIM4V4_MOD_WPSCBE2: + mod->BSIM4V4wpscbe2 = value->rValue; + mod->BSIM4V4wpscbe2Given = TRUE; + break; + case BSIM4V4_MOD_WPVAG: + mod->BSIM4V4wpvag = value->rValue; + mod->BSIM4V4wpvagGiven = TRUE; + break; + case BSIM4V4_MOD_WWR : + mod->BSIM4V4wwr = value->rValue; + mod->BSIM4V4wwrGiven = TRUE; + break; + case BSIM4V4_MOD_WDWG : + mod->BSIM4V4wdwg = value->rValue; + mod->BSIM4V4wdwgGiven = TRUE; + break; + case BSIM4V4_MOD_WDWB : + mod->BSIM4V4wdwb = value->rValue; + mod->BSIM4V4wdwbGiven = TRUE; + break; + case BSIM4V4_MOD_WB0 : + mod->BSIM4V4wb0 = value->rValue; + mod->BSIM4V4wb0Given = TRUE; + break; + case BSIM4V4_MOD_WB1 : + mod->BSIM4V4wb1 = value->rValue; + mod->BSIM4V4wb1Given = TRUE; + break; + case BSIM4V4_MOD_WALPHA0 : + mod->BSIM4V4walpha0 = value->rValue; + mod->BSIM4V4walpha0Given = TRUE; + break; + case BSIM4V4_MOD_WALPHA1 : + mod->BSIM4V4walpha1 = value->rValue; + mod->BSIM4V4walpha1Given = TRUE; + break; + case BSIM4V4_MOD_WBETA0 : + mod->BSIM4V4wbeta0 = value->rValue; + mod->BSIM4V4wbeta0Given = TRUE; + break; + case BSIM4V4_MOD_WAGIDL : + mod->BSIM4V4wagidl = value->rValue; + mod->BSIM4V4wagidlGiven = TRUE; + break; + case BSIM4V4_MOD_WBGIDL : + mod->BSIM4V4wbgidl = value->rValue; + mod->BSIM4V4wbgidlGiven = TRUE; + break; + case BSIM4V4_MOD_WCGIDL : + mod->BSIM4V4wcgidl = value->rValue; + mod->BSIM4V4wcgidlGiven = TRUE; + break; + case BSIM4V4_MOD_WPHIN : + mod->BSIM4V4wphin = value->rValue; + mod->BSIM4V4wphinGiven = TRUE; + break; + case BSIM4V4_MOD_WEGIDL : + mod->BSIM4V4wegidl = value->rValue; + mod->BSIM4V4wegidlGiven = TRUE; + break; + case BSIM4V4_MOD_WAIGC : + mod->BSIM4V4waigc = value->rValue; + mod->BSIM4V4waigcGiven = TRUE; + break; + case BSIM4V4_MOD_WBIGC : + mod->BSIM4V4wbigc = value->rValue; + mod->BSIM4V4wbigcGiven = TRUE; + break; + case BSIM4V4_MOD_WCIGC : + mod->BSIM4V4wcigc = value->rValue; + mod->BSIM4V4wcigcGiven = TRUE; + break; + case BSIM4V4_MOD_WAIGSD : + mod->BSIM4V4waigsd = value->rValue; + mod->BSIM4V4waigsdGiven = TRUE; + break; + case BSIM4V4_MOD_WBIGSD : + mod->BSIM4V4wbigsd = value->rValue; + mod->BSIM4V4wbigsdGiven = TRUE; + break; + case BSIM4V4_MOD_WCIGSD : + mod->BSIM4V4wcigsd = value->rValue; + mod->BSIM4V4wcigsdGiven = TRUE; + break; + case BSIM4V4_MOD_WAIGBACC : + mod->BSIM4V4waigbacc = value->rValue; + mod->BSIM4V4waigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_WBIGBACC : + mod->BSIM4V4wbigbacc = value->rValue; + mod->BSIM4V4wbigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_WCIGBACC : + mod->BSIM4V4wcigbacc = value->rValue; + mod->BSIM4V4wcigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_WAIGBINV : + mod->BSIM4V4waigbinv = value->rValue; + mod->BSIM4V4waigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_WBIGBINV : + mod->BSIM4V4wbigbinv = value->rValue; + mod->BSIM4V4wbigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_WCIGBINV : + mod->BSIM4V4wcigbinv = value->rValue; + mod->BSIM4V4wcigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_WNIGC : + mod->BSIM4V4wnigc = value->rValue; + mod->BSIM4V4wnigcGiven = TRUE; + break; + case BSIM4V4_MOD_WNIGBINV : + mod->BSIM4V4wnigbinv = value->rValue; + mod->BSIM4V4wnigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_WNIGBACC : + mod->BSIM4V4wnigbacc = value->rValue; + mod->BSIM4V4wnigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_WNTOX : + mod->BSIM4V4wntox = value->rValue; + mod->BSIM4V4wntoxGiven = TRUE; + break; + case BSIM4V4_MOD_WEIGBINV : + mod->BSIM4V4weigbinv = value->rValue; + mod->BSIM4V4weigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_WPIGCD : + mod->BSIM4V4wpigcd = value->rValue; + mod->BSIM4V4wpigcdGiven = TRUE; + break; + case BSIM4V4_MOD_WPOXEDGE : + mod->BSIM4V4wpoxedge = value->rValue; + mod->BSIM4V4wpoxedgeGiven = TRUE; + break; + case BSIM4V4_MOD_WXRCRG1 : + mod->BSIM4V4wxrcrg1 = value->rValue; + mod->BSIM4V4wxrcrg1Given = TRUE; + break; + case BSIM4V4_MOD_WXRCRG2 : + mod->BSIM4V4wxrcrg2 = value->rValue; + mod->BSIM4V4wxrcrg2Given = TRUE; + break; + case BSIM4V4_MOD_WLAMBDA : + mod->BSIM4V4wlambda = value->rValue; + mod->BSIM4V4wlambdaGiven = TRUE; + break; + case BSIM4V4_MOD_WVTL : + mod->BSIM4V4wvtl = value->rValue; + mod->BSIM4V4wvtlGiven = TRUE; + break; + case BSIM4V4_MOD_WXN: + mod->BSIM4V4wxn = value->rValue; + mod->BSIM4V4wxnGiven = TRUE; + break; + case BSIM4V4_MOD_WVFBSDOFF: + mod->BSIM4V4wvfbsdoff = value->rValue; + mod->BSIM4V4wvfbsdoffGiven = TRUE; + break; + case BSIM4V4_MOD_WEU : + mod->BSIM4V4weu = value->rValue; + mod->BSIM4V4weuGiven = TRUE; + break; + case BSIM4V4_MOD_WVFB : + mod->BSIM4V4wvfb = value->rValue; + mod->BSIM4V4wvfbGiven = TRUE; + break; + case BSIM4V4_MOD_WCGSL : + mod->BSIM4V4wcgsl = value->rValue; + mod->BSIM4V4wcgslGiven = TRUE; + break; + case BSIM4V4_MOD_WCGDL : + mod->BSIM4V4wcgdl = value->rValue; + mod->BSIM4V4wcgdlGiven = TRUE; + break; + case BSIM4V4_MOD_WCKAPPAS : + mod->BSIM4V4wckappas = value->rValue; + mod->BSIM4V4wckappasGiven = TRUE; + break; + case BSIM4V4_MOD_WCKAPPAD : + mod->BSIM4V4wckappad = value->rValue; + mod->BSIM4V4wckappadGiven = TRUE; + break; + case BSIM4V4_MOD_WCF : + mod->BSIM4V4wcf = value->rValue; + mod->BSIM4V4wcfGiven = TRUE; + break; + case BSIM4V4_MOD_WCLC : + mod->BSIM4V4wclc = value->rValue; + mod->BSIM4V4wclcGiven = TRUE; + break; + case BSIM4V4_MOD_WCLE : + mod->BSIM4V4wcle = value->rValue; + mod->BSIM4V4wcleGiven = TRUE; + break; + case BSIM4V4_MOD_WVFBCV : + mod->BSIM4V4wvfbcv = value->rValue; + mod->BSIM4V4wvfbcvGiven = TRUE; + break; + case BSIM4V4_MOD_WACDE : + mod->BSIM4V4wacde = value->rValue; + mod->BSIM4V4wacdeGiven = TRUE; + break; + case BSIM4V4_MOD_WMOIN : + mod->BSIM4V4wmoin = value->rValue; + mod->BSIM4V4wmoinGiven = TRUE; + break; + case BSIM4V4_MOD_WNOFF : + mod->BSIM4V4wnoff = value->rValue; + mod->BSIM4V4wnoffGiven = TRUE; + break; + case BSIM4V4_MOD_WVOFFCV : + mod->BSIM4V4wvoffcv = value->rValue; + mod->BSIM4V4wvoffcvGiven = TRUE; + break; + + /* Cross-term dependence */ + case BSIM4V4_MOD_PCDSC : + mod->BSIM4V4pcdsc = value->rValue; + mod->BSIM4V4pcdscGiven = TRUE; + break; + + + case BSIM4V4_MOD_PCDSCB : + mod->BSIM4V4pcdscb = value->rValue; + mod->BSIM4V4pcdscbGiven = TRUE; + break; + case BSIM4V4_MOD_PCDSCD : + mod->BSIM4V4pcdscd = value->rValue; + mod->BSIM4V4pcdscdGiven = TRUE; + break; + case BSIM4V4_MOD_PCIT : + mod->BSIM4V4pcit = value->rValue; + mod->BSIM4V4pcitGiven = TRUE; + break; + case BSIM4V4_MOD_PNFACTOR : + mod->BSIM4V4pnfactor = value->rValue; + mod->BSIM4V4pnfactorGiven = TRUE; + break; + case BSIM4V4_MOD_PXJ: + mod->BSIM4V4pxj = value->rValue; + mod->BSIM4V4pxjGiven = TRUE; + break; + case BSIM4V4_MOD_PVSAT: + mod->BSIM4V4pvsat = value->rValue; + mod->BSIM4V4pvsatGiven = TRUE; + break; + + + case BSIM4V4_MOD_PA0: + mod->BSIM4V4pa0 = value->rValue; + mod->BSIM4V4pa0Given = TRUE; + break; + case BSIM4V4_MOD_PAGS: + mod->BSIM4V4pags = value->rValue; + mod->BSIM4V4pagsGiven = TRUE; + break; + case BSIM4V4_MOD_PA1: + mod->BSIM4V4pa1 = value->rValue; + mod->BSIM4V4pa1Given = TRUE; + break; + case BSIM4V4_MOD_PA2: + mod->BSIM4V4pa2 = value->rValue; + mod->BSIM4V4pa2Given = TRUE; + break; + case BSIM4V4_MOD_PAT: + mod->BSIM4V4pat = value->rValue; + mod->BSIM4V4patGiven = TRUE; + break; + case BSIM4V4_MOD_PKETA: + mod->BSIM4V4pketa = value->rValue; + mod->BSIM4V4pketaGiven = TRUE; + break; + case BSIM4V4_MOD_PNSUB: + mod->BSIM4V4pnsub = value->rValue; + mod->BSIM4V4pnsubGiven = TRUE; + break; + case BSIM4V4_MOD_PNDEP: + mod->BSIM4V4pndep = value->rValue; + mod->BSIM4V4pndepGiven = TRUE; + if (mod->BSIM4V4pndep > 1.0e20) + mod->BSIM4V4pndep *= 1.0e-6; + break; + case BSIM4V4_MOD_PNSD: + mod->BSIM4V4pnsd = value->rValue; + mod->BSIM4V4pnsdGiven = TRUE; + if (mod->BSIM4V4pnsd > 1.0e23) + mod->BSIM4V4pnsd *= 1.0e-6; + break; + case BSIM4V4_MOD_PNGATE: + mod->BSIM4V4pngate = value->rValue; + mod->BSIM4V4pngateGiven = TRUE; + if (mod->BSIM4V4pngate > 1.0e23) + mod->BSIM4V4pngate *= 1.0e-6; + break; + case BSIM4V4_MOD_PGAMMA1: + mod->BSIM4V4pgamma1 = value->rValue; + mod->BSIM4V4pgamma1Given = TRUE; + break; + case BSIM4V4_MOD_PGAMMA2: + mod->BSIM4V4pgamma2 = value->rValue; + mod->BSIM4V4pgamma2Given = TRUE; + break; + case BSIM4V4_MOD_PVBX: + mod->BSIM4V4pvbx = value->rValue; + mod->BSIM4V4pvbxGiven = TRUE; + break; + case BSIM4V4_MOD_PVBM: + mod->BSIM4V4pvbm = value->rValue; + mod->BSIM4V4pvbmGiven = TRUE; + break; + case BSIM4V4_MOD_PXT: + mod->BSIM4V4pxt = value->rValue; + mod->BSIM4V4pxtGiven = TRUE; + break; + case BSIM4V4_MOD_PK1: + mod->BSIM4V4pk1 = value->rValue; + mod->BSIM4V4pk1Given = TRUE; + break; + case BSIM4V4_MOD_PKT1: + mod->BSIM4V4pkt1 = value->rValue; + mod->BSIM4V4pkt1Given = TRUE; + break; + case BSIM4V4_MOD_PKT1L: + mod->BSIM4V4pkt1l = value->rValue; + mod->BSIM4V4pkt1lGiven = TRUE; + break; + case BSIM4V4_MOD_PKT2: + mod->BSIM4V4pkt2 = value->rValue; + mod->BSIM4V4pkt2Given = TRUE; + break; + case BSIM4V4_MOD_PK2: + mod->BSIM4V4pk2 = value->rValue; + mod->BSIM4V4pk2Given = TRUE; + break; + case BSIM4V4_MOD_PK3: + mod->BSIM4V4pk3 = value->rValue; + mod->BSIM4V4pk3Given = TRUE; + break; + case BSIM4V4_MOD_PK3B: + mod->BSIM4V4pk3b = value->rValue; + mod->BSIM4V4pk3bGiven = TRUE; + break; + case BSIM4V4_MOD_PLPE0: + mod->BSIM4V4plpe0 = value->rValue; + mod->BSIM4V4plpe0Given = TRUE; + break; + case BSIM4V4_MOD_PLPEB: + mod->BSIM4V4plpeb = value->rValue; + mod->BSIM4V4plpebGiven = TRUE; + break; + case BSIM4V4_MOD_PDVTP0: + mod->BSIM4V4pdvtp0 = value->rValue; + mod->BSIM4V4pdvtp0Given = TRUE; + break; + case BSIM4V4_MOD_PDVTP1: + mod->BSIM4V4pdvtp1 = value->rValue; + mod->BSIM4V4pdvtp1Given = TRUE; + break; + case BSIM4V4_MOD_PW0: + mod->BSIM4V4pw0 = value->rValue; + mod->BSIM4V4pw0Given = TRUE; + break; + case BSIM4V4_MOD_PDVT0: + mod->BSIM4V4pdvt0 = value->rValue; + mod->BSIM4V4pdvt0Given = TRUE; + break; + case BSIM4V4_MOD_PDVT1: + mod->BSIM4V4pdvt1 = value->rValue; + mod->BSIM4V4pdvt1Given = TRUE; + break; + case BSIM4V4_MOD_PDVT2: + mod->BSIM4V4pdvt2 = value->rValue; + mod->BSIM4V4pdvt2Given = TRUE; + break; + case BSIM4V4_MOD_PDVT0W: + mod->BSIM4V4pdvt0w = value->rValue; + mod->BSIM4V4pdvt0wGiven = TRUE; + break; + case BSIM4V4_MOD_PDVT1W: + mod->BSIM4V4pdvt1w = value->rValue; + mod->BSIM4V4pdvt1wGiven = TRUE; + break; + case BSIM4V4_MOD_PDVT2W: + mod->BSIM4V4pdvt2w = value->rValue; + mod->BSIM4V4pdvt2wGiven = TRUE; + break; + case BSIM4V4_MOD_PDROUT: + mod->BSIM4V4pdrout = value->rValue; + mod->BSIM4V4pdroutGiven = TRUE; + break; + case BSIM4V4_MOD_PDSUB: + mod->BSIM4V4pdsub = value->rValue; + mod->BSIM4V4pdsubGiven = TRUE; + break; + case BSIM4V4_MOD_PVTH0: + mod->BSIM4V4pvth0 = value->rValue; + mod->BSIM4V4pvth0Given = TRUE; + break; + case BSIM4V4_MOD_PUA: + mod->BSIM4V4pua = value->rValue; + mod->BSIM4V4puaGiven = TRUE; + break; + case BSIM4V4_MOD_PUA1: + mod->BSIM4V4pua1 = value->rValue; + mod->BSIM4V4pua1Given = TRUE; + break; + case BSIM4V4_MOD_PUB: + mod->BSIM4V4pub = value->rValue; + mod->BSIM4V4pubGiven = TRUE; + break; + case BSIM4V4_MOD_PUB1: + mod->BSIM4V4pub1 = value->rValue; + mod->BSIM4V4pub1Given = TRUE; + break; + case BSIM4V4_MOD_PUC: + mod->BSIM4V4puc = value->rValue; + mod->BSIM4V4pucGiven = TRUE; + break; + case BSIM4V4_MOD_PUC1: + mod->BSIM4V4puc1 = value->rValue; + mod->BSIM4V4puc1Given = TRUE; + break; + case BSIM4V4_MOD_PU0 : + mod->BSIM4V4pu0 = value->rValue; + mod->BSIM4V4pu0Given = TRUE; + break; + case BSIM4V4_MOD_PUTE : + mod->BSIM4V4pute = value->rValue; + mod->BSIM4V4puteGiven = TRUE; + break; + case BSIM4V4_MOD_PVOFF: + mod->BSIM4V4pvoff = value->rValue; + mod->BSIM4V4pvoffGiven = TRUE; + break; + case BSIM4V4_MOD_PMINV: + mod->BSIM4V4pminv = value->rValue; + mod->BSIM4V4pminvGiven = TRUE; + break; + case BSIM4V4_MOD_PFPROUT: + mod->BSIM4V4pfprout = value->rValue; + mod->BSIM4V4pfproutGiven = TRUE; + break; + case BSIM4V4_MOD_PPDITS: + mod->BSIM4V4ppdits = value->rValue; + mod->BSIM4V4ppditsGiven = TRUE; + break; + case BSIM4V4_MOD_PPDITSD: + mod->BSIM4V4ppditsd = value->rValue; + mod->BSIM4V4ppditsdGiven = TRUE; + break; + case BSIM4V4_MOD_PDELTA : + mod->BSIM4V4pdelta = value->rValue; + mod->BSIM4V4pdeltaGiven = TRUE; + break; + case BSIM4V4_MOD_PRDSW: + mod->BSIM4V4prdsw = value->rValue; + mod->BSIM4V4prdswGiven = TRUE; + break; + case BSIM4V4_MOD_PRDW: + mod->BSIM4V4prdw = value->rValue; + mod->BSIM4V4prdwGiven = TRUE; + break; + case BSIM4V4_MOD_PRSW: + mod->BSIM4V4prsw = value->rValue; + mod->BSIM4V4prswGiven = TRUE; + break; + case BSIM4V4_MOD_PPRWB: + mod->BSIM4V4pprwb = value->rValue; + mod->BSIM4V4pprwbGiven = TRUE; + break; + case BSIM4V4_MOD_PPRWG: + mod->BSIM4V4pprwg = value->rValue; + mod->BSIM4V4pprwgGiven = TRUE; + break; + case BSIM4V4_MOD_PPRT: + mod->BSIM4V4pprt = value->rValue; + mod->BSIM4V4pprtGiven = TRUE; + break; + case BSIM4V4_MOD_PETA0: + mod->BSIM4V4peta0 = value->rValue; + mod->BSIM4V4peta0Given = TRUE; + break; + case BSIM4V4_MOD_PETAB: + mod->BSIM4V4petab = value->rValue; + mod->BSIM4V4petabGiven = TRUE; + break; + case BSIM4V4_MOD_PPCLM: + mod->BSIM4V4ppclm = value->rValue; + mod->BSIM4V4ppclmGiven = TRUE; + break; + case BSIM4V4_MOD_PPDIBL1: + mod->BSIM4V4ppdibl1 = value->rValue; + mod->BSIM4V4ppdibl1Given = TRUE; + break; + case BSIM4V4_MOD_PPDIBL2: + mod->BSIM4V4ppdibl2 = value->rValue; + mod->BSIM4V4ppdibl2Given = TRUE; + break; + case BSIM4V4_MOD_PPDIBLB: + mod->BSIM4V4ppdiblb = value->rValue; + mod->BSIM4V4ppdiblbGiven = TRUE; + break; + case BSIM4V4_MOD_PPSCBE1: + mod->BSIM4V4ppscbe1 = value->rValue; + mod->BSIM4V4ppscbe1Given = TRUE; + break; + case BSIM4V4_MOD_PPSCBE2: + mod->BSIM4V4ppscbe2 = value->rValue; + mod->BSIM4V4ppscbe2Given = TRUE; + break; + case BSIM4V4_MOD_PPVAG: + mod->BSIM4V4ppvag = value->rValue; + mod->BSIM4V4ppvagGiven = TRUE; + break; + case BSIM4V4_MOD_PWR : + mod->BSIM4V4pwr = value->rValue; + mod->BSIM4V4pwrGiven = TRUE; + break; + case BSIM4V4_MOD_PDWG : + mod->BSIM4V4pdwg = value->rValue; + mod->BSIM4V4pdwgGiven = TRUE; + break; + case BSIM4V4_MOD_PDWB : + mod->BSIM4V4pdwb = value->rValue; + mod->BSIM4V4pdwbGiven = TRUE; + break; + case BSIM4V4_MOD_PB0 : + mod->BSIM4V4pb0 = value->rValue; + mod->BSIM4V4pb0Given = TRUE; + break; + case BSIM4V4_MOD_PB1 : + mod->BSIM4V4pb1 = value->rValue; + mod->BSIM4V4pb1Given = TRUE; + break; + case BSIM4V4_MOD_PALPHA0 : + mod->BSIM4V4palpha0 = value->rValue; + mod->BSIM4V4palpha0Given = TRUE; + break; + case BSIM4V4_MOD_PALPHA1 : + mod->BSIM4V4palpha1 = value->rValue; + mod->BSIM4V4palpha1Given = TRUE; + break; + case BSIM4V4_MOD_PBETA0 : + mod->BSIM4V4pbeta0 = value->rValue; + mod->BSIM4V4pbeta0Given = TRUE; + break; + case BSIM4V4_MOD_PAGIDL : + mod->BSIM4V4pagidl = value->rValue; + mod->BSIM4V4pagidlGiven = TRUE; + break; + case BSIM4V4_MOD_PBGIDL : + mod->BSIM4V4pbgidl = value->rValue; + mod->BSIM4V4pbgidlGiven = TRUE; + break; + case BSIM4V4_MOD_PCGIDL : + mod->BSIM4V4pcgidl = value->rValue; + mod->BSIM4V4pcgidlGiven = TRUE; + break; + case BSIM4V4_MOD_PPHIN : + mod->BSIM4V4pphin = value->rValue; + mod->BSIM4V4pphinGiven = TRUE; + break; + case BSIM4V4_MOD_PEGIDL : + mod->BSIM4V4pegidl = value->rValue; + mod->BSIM4V4pegidlGiven = TRUE; + break; + case BSIM4V4_MOD_PAIGC : + mod->BSIM4V4paigc = value->rValue; + mod->BSIM4V4paigcGiven = TRUE; + break; + case BSIM4V4_MOD_PBIGC : + mod->BSIM4V4pbigc = value->rValue; + mod->BSIM4V4pbigcGiven = TRUE; + break; + case BSIM4V4_MOD_PCIGC : + mod->BSIM4V4pcigc = value->rValue; + mod->BSIM4V4pcigcGiven = TRUE; + break; + case BSIM4V4_MOD_PAIGSD : + mod->BSIM4V4paigsd = value->rValue; + mod->BSIM4V4paigsdGiven = TRUE; + break; + case BSIM4V4_MOD_PBIGSD : + mod->BSIM4V4pbigsd = value->rValue; + mod->BSIM4V4pbigsdGiven = TRUE; + break; + case BSIM4V4_MOD_PCIGSD : + mod->BSIM4V4pcigsd = value->rValue; + mod->BSIM4V4pcigsdGiven = TRUE; + break; + case BSIM4V4_MOD_PAIGBACC : + mod->BSIM4V4paigbacc = value->rValue; + mod->BSIM4V4paigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_PBIGBACC : + mod->BSIM4V4pbigbacc = value->rValue; + mod->BSIM4V4pbigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_PCIGBACC : + mod->BSIM4V4pcigbacc = value->rValue; + mod->BSIM4V4pcigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_PAIGBINV : + mod->BSIM4V4paigbinv = value->rValue; + mod->BSIM4V4paigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_PBIGBINV : + mod->BSIM4V4pbigbinv = value->rValue; + mod->BSIM4V4pbigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_PCIGBINV : + mod->BSIM4V4pcigbinv = value->rValue; + mod->BSIM4V4pcigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_PNIGC : + mod->BSIM4V4pnigc = value->rValue; + mod->BSIM4V4pnigcGiven = TRUE; + break; + case BSIM4V4_MOD_PNIGBINV : + mod->BSIM4V4pnigbinv = value->rValue; + mod->BSIM4V4pnigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_PNIGBACC : + mod->BSIM4V4pnigbacc = value->rValue; + mod->BSIM4V4pnigbaccGiven = TRUE; + break; + case BSIM4V4_MOD_PNTOX : + mod->BSIM4V4pntox = value->rValue; + mod->BSIM4V4pntoxGiven = TRUE; + break; + case BSIM4V4_MOD_PEIGBINV : + mod->BSIM4V4peigbinv = value->rValue; + mod->BSIM4V4peigbinvGiven = TRUE; + break; + case BSIM4V4_MOD_PPIGCD : + mod->BSIM4V4ppigcd = value->rValue; + mod->BSIM4V4ppigcdGiven = TRUE; + break; + case BSIM4V4_MOD_PPOXEDGE : + mod->BSIM4V4ppoxedge = value->rValue; + mod->BSIM4V4ppoxedgeGiven = TRUE; + break; + case BSIM4V4_MOD_PXRCRG1 : + mod->BSIM4V4pxrcrg1 = value->rValue; + mod->BSIM4V4pxrcrg1Given = TRUE; + break; + case BSIM4V4_MOD_PXRCRG2 : + mod->BSIM4V4pxrcrg2 = value->rValue; + mod->BSIM4V4pxrcrg2Given = TRUE; + break; + case BSIM4V4_MOD_PLAMBDA : + mod->BSIM4V4plambda = value->rValue; + mod->BSIM4V4plambdaGiven = TRUE; + break; + case BSIM4V4_MOD_PVTL : + mod->BSIM4V4pvtl = value->rValue; + mod->BSIM4V4pvtlGiven = TRUE; + break; + case BSIM4V4_MOD_PXN: + mod->BSIM4V4pxn = value->rValue; + mod->BSIM4V4pxnGiven = TRUE; + break; + case BSIM4V4_MOD_PVFBSDOFF: + mod->BSIM4V4pvfbsdoff = value->rValue; + mod->BSIM4V4pvfbsdoffGiven = TRUE; + break; + case BSIM4V4_MOD_PEU : + mod->BSIM4V4peu = value->rValue; + mod->BSIM4V4peuGiven = TRUE; + break; + case BSIM4V4_MOD_PVFB : + mod->BSIM4V4pvfb = value->rValue; + mod->BSIM4V4pvfbGiven = TRUE; + break; + case BSIM4V4_MOD_PCGSL : + mod->BSIM4V4pcgsl = value->rValue; + mod->BSIM4V4pcgslGiven = TRUE; + break; + case BSIM4V4_MOD_PCGDL : + mod->BSIM4V4pcgdl = value->rValue; + mod->BSIM4V4pcgdlGiven = TRUE; + break; + case BSIM4V4_MOD_PCKAPPAS : + mod->BSIM4V4pckappas = value->rValue; + mod->BSIM4V4pckappasGiven = TRUE; + break; + case BSIM4V4_MOD_PCKAPPAD : + mod->BSIM4V4pckappad = value->rValue; + mod->BSIM4V4pckappadGiven = TRUE; + break; + case BSIM4V4_MOD_PCF : + mod->BSIM4V4pcf = value->rValue; + mod->BSIM4V4pcfGiven = TRUE; + break; + case BSIM4V4_MOD_PCLC : + mod->BSIM4V4pclc = value->rValue; + mod->BSIM4V4pclcGiven = TRUE; + break; + case BSIM4V4_MOD_PCLE : + mod->BSIM4V4pcle = value->rValue; + mod->BSIM4V4pcleGiven = TRUE; + break; + case BSIM4V4_MOD_PVFBCV : + mod->BSIM4V4pvfbcv = value->rValue; + mod->BSIM4V4pvfbcvGiven = TRUE; + break; + case BSIM4V4_MOD_PACDE : + mod->BSIM4V4pacde = value->rValue; + mod->BSIM4V4pacdeGiven = TRUE; + break; + case BSIM4V4_MOD_PMOIN : + mod->BSIM4V4pmoin = value->rValue; + mod->BSIM4V4pmoinGiven = TRUE; + break; + case BSIM4V4_MOD_PNOFF : + mod->BSIM4V4pnoff = value->rValue; + mod->BSIM4V4pnoffGiven = TRUE; + break; + case BSIM4V4_MOD_PVOFFCV : + mod->BSIM4V4pvoffcv = value->rValue; + mod->BSIM4V4pvoffcvGiven = TRUE; + break; + + case BSIM4V4_MOD_TNOM : + mod->BSIM4V4tnom = value->rValue + CONSTCtoK; + mod->BSIM4V4tnomGiven = TRUE; + break; + case BSIM4V4_MOD_CGSO : + mod->BSIM4V4cgso = value->rValue; + mod->BSIM4V4cgsoGiven = TRUE; + break; + case BSIM4V4_MOD_CGDO : + mod->BSIM4V4cgdo = value->rValue; + mod->BSIM4V4cgdoGiven = TRUE; + break; + case BSIM4V4_MOD_CGBO : + mod->BSIM4V4cgbo = value->rValue; + mod->BSIM4V4cgboGiven = TRUE; + break; + case BSIM4V4_MOD_XPART : + mod->BSIM4V4xpart = value->rValue; + mod->BSIM4V4xpartGiven = TRUE; + break; + case BSIM4V4_MOD_RSH : + mod->BSIM4V4sheetResistance = value->rValue; + mod->BSIM4V4sheetResistanceGiven = TRUE; + break; + case BSIM4V4_MOD_JSS : + mod->BSIM4V4SjctSatCurDensity = value->rValue; + mod->BSIM4V4SjctSatCurDensityGiven = TRUE; + break; + case BSIM4V4_MOD_JSWS : + mod->BSIM4V4SjctSidewallSatCurDensity = value->rValue; + mod->BSIM4V4SjctSidewallSatCurDensityGiven = TRUE; + break; + case BSIM4V4_MOD_JSWGS : + mod->BSIM4V4SjctGateSidewallSatCurDensity = value->rValue; + mod->BSIM4V4SjctGateSidewallSatCurDensityGiven = TRUE; + break; + case BSIM4V4_MOD_PBS : + mod->BSIM4V4SbulkJctPotential = value->rValue; + mod->BSIM4V4SbulkJctPotentialGiven = TRUE; + break; + case BSIM4V4_MOD_MJS : + mod->BSIM4V4SbulkJctBotGradingCoeff = value->rValue; + mod->BSIM4V4SbulkJctBotGradingCoeffGiven = TRUE; + break; + case BSIM4V4_MOD_PBSWS : + mod->BSIM4V4SsidewallJctPotential = value->rValue; + mod->BSIM4V4SsidewallJctPotentialGiven = TRUE; + break; + case BSIM4V4_MOD_MJSWS : + mod->BSIM4V4SbulkJctSideGradingCoeff = value->rValue; + mod->BSIM4V4SbulkJctSideGradingCoeffGiven = TRUE; + break; + case BSIM4V4_MOD_CJS : + mod->BSIM4V4SunitAreaJctCap = value->rValue; + mod->BSIM4V4SunitAreaJctCapGiven = TRUE; + break; + case BSIM4V4_MOD_CJSWS : + mod->BSIM4V4SunitLengthSidewallJctCap = value->rValue; + mod->BSIM4V4SunitLengthSidewallJctCapGiven = TRUE; + break; + case BSIM4V4_MOD_NJS : + mod->BSIM4V4SjctEmissionCoeff = value->rValue; + mod->BSIM4V4SjctEmissionCoeffGiven = TRUE; + break; + case BSIM4V4_MOD_PBSWGS : + mod->BSIM4V4SGatesidewallJctPotential = value->rValue; + mod->BSIM4V4SGatesidewallJctPotentialGiven = TRUE; + break; + case BSIM4V4_MOD_MJSWGS : + mod->BSIM4V4SbulkJctGateSideGradingCoeff = value->rValue; + mod->BSIM4V4SbulkJctGateSideGradingCoeffGiven = TRUE; + break; + case BSIM4V4_MOD_CJSWGS : + mod->BSIM4V4SunitLengthGateSidewallJctCap = value->rValue; + mod->BSIM4V4SunitLengthGateSidewallJctCapGiven = TRUE; + break; + case BSIM4V4_MOD_XTIS : + mod->BSIM4V4SjctTempExponent = value->rValue; + mod->BSIM4V4SjctTempExponentGiven = TRUE; + break; + case BSIM4V4_MOD_JSD : + mod->BSIM4V4DjctSatCurDensity = value->rValue; + mod->BSIM4V4DjctSatCurDensityGiven = TRUE; + break; + case BSIM4V4_MOD_JSWD : + mod->BSIM4V4DjctSidewallSatCurDensity = value->rValue; + mod->BSIM4V4DjctSidewallSatCurDensityGiven = TRUE; + break; + case BSIM4V4_MOD_JSWGD : + mod->BSIM4V4DjctGateSidewallSatCurDensity = value->rValue; + mod->BSIM4V4DjctGateSidewallSatCurDensityGiven = TRUE; + break; + case BSIM4V4_MOD_PBD : + mod->BSIM4V4DbulkJctPotential = value->rValue; + mod->BSIM4V4DbulkJctPotentialGiven = TRUE; + break; + case BSIM4V4_MOD_MJD : + mod->BSIM4V4DbulkJctBotGradingCoeff = value->rValue; + mod->BSIM4V4DbulkJctBotGradingCoeffGiven = TRUE; + break; + case BSIM4V4_MOD_PBSWD : + mod->BSIM4V4DsidewallJctPotential = value->rValue; + mod->BSIM4V4DsidewallJctPotentialGiven = TRUE; + break; + case BSIM4V4_MOD_MJSWD : + mod->BSIM4V4DbulkJctSideGradingCoeff = value->rValue; + mod->BSIM4V4DbulkJctSideGradingCoeffGiven = TRUE; + break; + case BSIM4V4_MOD_CJD : + mod->BSIM4V4DunitAreaJctCap = value->rValue; + mod->BSIM4V4DunitAreaJctCapGiven = TRUE; + break; + case BSIM4V4_MOD_CJSWD : + mod->BSIM4V4DunitLengthSidewallJctCap = value->rValue; + mod->BSIM4V4DunitLengthSidewallJctCapGiven = TRUE; + break; + case BSIM4V4_MOD_NJD : + mod->BSIM4V4DjctEmissionCoeff = value->rValue; + mod->BSIM4V4DjctEmissionCoeffGiven = TRUE; + break; + case BSIM4V4_MOD_PBSWGD : + mod->BSIM4V4DGatesidewallJctPotential = value->rValue; + mod->BSIM4V4DGatesidewallJctPotentialGiven = TRUE; + break; + case BSIM4V4_MOD_MJSWGD : + mod->BSIM4V4DbulkJctGateSideGradingCoeff = value->rValue; + mod->BSIM4V4DbulkJctGateSideGradingCoeffGiven = TRUE; + break; + case BSIM4V4_MOD_CJSWGD : + mod->BSIM4V4DunitLengthGateSidewallJctCap = value->rValue; + mod->BSIM4V4DunitLengthGateSidewallJctCapGiven = TRUE; + break; + case BSIM4V4_MOD_XTID : + mod->BSIM4V4DjctTempExponent = value->rValue; + mod->BSIM4V4DjctTempExponentGiven = TRUE; + break; + case BSIM4V4_MOD_LINT : + mod->BSIM4V4Lint = value->rValue; + mod->BSIM4V4LintGiven = TRUE; + break; + case BSIM4V4_MOD_LL : + mod->BSIM4V4Ll = value->rValue; + mod->BSIM4V4LlGiven = TRUE; + break; + case BSIM4V4_MOD_LLC : + mod->BSIM4V4Llc = value->rValue; + mod->BSIM4V4LlcGiven = TRUE; + break; + case BSIM4V4_MOD_LLN : + mod->BSIM4V4Lln = value->rValue; + mod->BSIM4V4LlnGiven = TRUE; + break; + case BSIM4V4_MOD_LW : + mod->BSIM4V4Lw = value->rValue; + mod->BSIM4V4LwGiven = TRUE; + break; + case BSIM4V4_MOD_LWC : + mod->BSIM4V4Lwc = value->rValue; + mod->BSIM4V4LwcGiven = TRUE; + break; + case BSIM4V4_MOD_LWN : + mod->BSIM4V4Lwn = value->rValue; + mod->BSIM4V4LwnGiven = TRUE; + break; + case BSIM4V4_MOD_LWL : + mod->BSIM4V4Lwl = value->rValue; + mod->BSIM4V4LwlGiven = TRUE; + break; + case BSIM4V4_MOD_LWLC : + mod->BSIM4V4Lwlc = value->rValue; + mod->BSIM4V4LwlcGiven = TRUE; + break; + case BSIM4V4_MOD_LMIN : + mod->BSIM4V4Lmin = value->rValue; + mod->BSIM4V4LminGiven = TRUE; + break; + case BSIM4V4_MOD_LMAX : + mod->BSIM4V4Lmax = value->rValue; + mod->BSIM4V4LmaxGiven = TRUE; + break; + case BSIM4V4_MOD_WINT : + mod->BSIM4V4Wint = value->rValue; + mod->BSIM4V4WintGiven = TRUE; + break; + case BSIM4V4_MOD_WL : + mod->BSIM4V4Wl = value->rValue; + mod->BSIM4V4WlGiven = TRUE; + break; + case BSIM4V4_MOD_WLC : + mod->BSIM4V4Wlc = value->rValue; + mod->BSIM4V4WlcGiven = TRUE; + break; + case BSIM4V4_MOD_WLN : + mod->BSIM4V4Wln = value->rValue; + mod->BSIM4V4WlnGiven = TRUE; + break; + case BSIM4V4_MOD_WW : + mod->BSIM4V4Ww = value->rValue; + mod->BSIM4V4WwGiven = TRUE; + break; + case BSIM4V4_MOD_WWC : + mod->BSIM4V4Wwc = value->rValue; + mod->BSIM4V4WwcGiven = TRUE; + break; + case BSIM4V4_MOD_WWN : + mod->BSIM4V4Wwn = value->rValue; + mod->BSIM4V4WwnGiven = TRUE; + break; + case BSIM4V4_MOD_WWL : + mod->BSIM4V4Wwl = value->rValue; + mod->BSIM4V4WwlGiven = TRUE; + break; + case BSIM4V4_MOD_WWLC : + mod->BSIM4V4Wwlc = value->rValue; + mod->BSIM4V4WwlcGiven = TRUE; + break; + case BSIM4V4_MOD_WMIN : + mod->BSIM4V4Wmin = value->rValue; + mod->BSIM4V4WminGiven = TRUE; + break; + case BSIM4V4_MOD_WMAX : + mod->BSIM4V4Wmax = value->rValue; + mod->BSIM4V4WmaxGiven = TRUE; + break; + + case BSIM4V4_MOD_NOIA : + mod->BSIM4V4oxideTrapDensityA = value->rValue; + mod->BSIM4V4oxideTrapDensityAGiven = TRUE; + break; + case BSIM4V4_MOD_NOIB : + mod->BSIM4V4oxideTrapDensityB = value->rValue; + mod->BSIM4V4oxideTrapDensityBGiven = TRUE; + break; + case BSIM4V4_MOD_NOIC : + mod->BSIM4V4oxideTrapDensityC = value->rValue; + mod->BSIM4V4oxideTrapDensityCGiven = TRUE; + break; + case BSIM4V4_MOD_EM : + mod->BSIM4V4em = value->rValue; + mod->BSIM4V4emGiven = TRUE; + break; + case BSIM4V4_MOD_EF : + mod->BSIM4V4ef = value->rValue; + mod->BSIM4V4efGiven = TRUE; + break; + case BSIM4V4_MOD_AF : + mod->BSIM4V4af = value->rValue; + mod->BSIM4V4afGiven = TRUE; + break; + case BSIM4V4_MOD_KF : + mod->BSIM4V4kf = value->rValue; + mod->BSIM4V4kfGiven = TRUE; + break; + case BSIM4V4_MOD_STIMOD : + mod->BSIM4V4stimod = value->rValue; + mod->BSIM4V4stimodGiven = TRUE; + break; + case BSIM4V4_MOD_RGEOMOD : + mod->BSIM4V4rgeomod = value->rValue; + mod->BSIM4V4rgeomodGiven = TRUE; + break; + case BSIM4V4_MOD_SA0 : + mod->BSIM4V4sa0 = value->rValue; + mod->BSIM4V4sa0Given = TRUE; + break; + case BSIM4V4_MOD_SB0 : + mod->BSIM4V4sb0 = value->rValue; + mod->BSIM4V4sb0Given = TRUE; + break; + case BSIM4V4_MOD_NMOS : + if(value->iValue) { + mod->BSIM4V4type = 1; + mod->BSIM4V4typeGiven = TRUE; + } + break; + case BSIM4V4_MOD_PMOS : + if(value->iValue) { + mod->BSIM4V4type = - 1; + mod->BSIM4V4typeGiven = TRUE; + } + break; + default: + return(E_BADPARM); + } + return(OK); +} + + diff --git a/src/spicelib/devices/bsim4v4/b4v4noi.c b/src/spicelib/devices/bsim4v4/b4v4noi.c new file mode 100644 index 000000000..d1791d704 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4noi.c @@ -0,0 +1,488 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4noi.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 11/15/2002. + * Modified by Xuemei Xi, 05/09/2003. + * Modified by Xuemei Xi, 03/04/2004. + **********/ + +#include "ngspice.h" +#include "bsim4v4def.h" +#include "cktdefs.h" +#include "iferrmsg.h" +#include "noisedef.h" +#include "suffix.h" +#include "const.h" + + +extern void NevalSrc(); +extern double Nintegrate(); + +/* + * WDL: 1/f noise model has been smoothed out and enhanced with + * bulk charge effect as well as physical N* equ. and necessary + * conversion into the SI unit system. + */ + +static double +Eval1ovFNoise(Vds, model, here, freq, temp) +double Vds, freq, temp; +BSIM4V4model *model; +BSIM4V4instance *here; +{ +struct bsim4SizeDependParam *pParam; +double cd, esat, DelClm, EffFreq, N0, Nl, Leff, Leffsq; +double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Ssi; + + pParam = here->pParam; + cd = fabs(here->BSIM4V4cd); + Leff = pParam->BSIM4V4leff - 2.0 * model->BSIM4V4lintnoi; + Leffsq = Leff * Leff; + esat = 2.0 * here->BSIM4V4vsattemp / here->BSIM4V4ueff; + if(model->BSIM4V4em<=0.0) DelClm = 0.0; /* flicker noise modified -JX */ + else { + T0 = ((((Vds - here->BSIM4V4Vdseff) / pParam->BSIM4V4litl) + + model->BSIM4V4em) / esat); + DelClm = pParam->BSIM4V4litl * log (MAX(T0, N_MINLOG)); + } + EffFreq = pow(freq, model->BSIM4V4ef); + T1 = CHARGE * CHARGE * CONSTboltz * cd * temp * here->BSIM4V4ueff; + T2 = 1.0e10 * EffFreq * here->BSIM4V4Abulk * model->BSIM4V4coxe * Leffsq; + N0 = model->BSIM4V4coxe * here->BSIM4V4Vgsteff / CHARGE; + Nl = model->BSIM4V4coxe * here->BSIM4V4Vgsteff + * (1.0 - here->BSIM4V4AbovVgst2Vtm * here->BSIM4V4Vdseff) / CHARGE; + + T3 = model->BSIM4V4oxideTrapDensityA + * log(MAX(((N0 + here->BSIM4V4nstar) / (Nl + here->BSIM4V4nstar)), N_MINLOG)); + T4 = model->BSIM4V4oxideTrapDensityB * (N0 - Nl); + T5 = model->BSIM4V4oxideTrapDensityC * 0.5 * (N0 * N0 - Nl * Nl); + + T6 = CONSTboltz * temp * cd * cd; + T7 = 1.0e10 * EffFreq * Leffsq * pParam->BSIM4V4weff; + T8 = model->BSIM4V4oxideTrapDensityA + model->BSIM4V4oxideTrapDensityB * Nl + + model->BSIM4V4oxideTrapDensityC * Nl * Nl; + T9 = (Nl + here->BSIM4V4nstar) * (Nl + here->BSIM4V4nstar); + Ssi = T1 / T2 * (T3 + T4 + T5) + T6 / T7 * DelClm * T8 / T9; + return Ssi; +} + + +int +BSIM4V4noise (mode, operation, inModel, ckt, data, OnDens) +int mode, operation; +GENmodel *inModel; +CKTcircuit *ckt; +Ndata *data; +double *OnDens; +{ +BSIM4V4model *model = (BSIM4V4model *)inModel; +BSIM4V4instance *here; +struct bsim4SizeDependParam *pParam; +char name[N_MXVLNTH]; +double tempOnoise; +double tempInoise; +double noizDens[BSIM4V4NSRCS]; +double lnNdens[BSIM4V4NSRCS]; + +double T0, T1, T2, T5, T10, T11; +double Vds, Ssi, Swi; +double tmp=0.0, gdpr, gspr, npart_theta=0.0, npart_beta=0.0, igsquare; + +double m; + +int i; + + /* define the names of the noise sources */ + static char *BSIM4V4nNames[BSIM4V4NSRCS] = + { /* Note that we have to keep the order */ + ".rd", /* noise due to rd */ + ".rs", /* noise due to rs */ + ".rg", /* noise due to rgeltd */ + ".rbps", /* noise due to rbps */ + ".rbpd", /* noise due to rbpd */ + ".rbpb", /* noise due to rbpb */ + ".rbsb", /* noise due to rbsb */ + ".rbdb", /* noise due to rbdb */ + ".id", /* noise due to id */ + ".1overf", /* flicker (1/f) noise */ + ".igs", /* shot noise due to IGS */ + ".igd", /* shot noise due to IGD */ + ".igb", /* shot noise due to IGB */ + "" /* total transistor noise */ + }; + + for (; model != NULL; model = model->BSIM4V4nextModel) + { for (here = model->BSIM4V4instances; here != NULL; + here = here->BSIM4V4nextInstance) + { 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 < BSIM4V4NSRCS; i++) + { (void) sprintf(name, "onoise.%s%s", + here->BSIM4V4name, + BSIM4V4nNames[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 < BSIM4V4NSRCS; i++) + { (void) sprintf(name, "onoise_total.%s%s", + here->BSIM4V4name, + BSIM4V4nNames[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->BSIM4V4name, + BSIM4V4nNames[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: + m = here->BSIM4V4m; + switch (mode) + { case N_DENS: + if (model->BSIM4V4tnoiMod == 0) + { if (model->BSIM4V4rdsMod == 0) + { gspr = here->BSIM4V4sourceConductance; + gdpr = here->BSIM4V4drainConductance; + if (here->BSIM4V4grdsw > 0.0) + tmp = 1.0 / here->BSIM4V4grdsw; /* tmp used below */ + else + tmp = 0.0; + } + else + { gspr = here->BSIM4V4gstot; + gdpr = here->BSIM4V4gdtot; + tmp = 0.0; + } + } + else + { T5 = here->BSIM4V4Vgsteff / here->BSIM4V4EsatL; + T5 *= T5; + npart_beta = model->BSIM4V4rnoia * (1.0 + T5 + * model->BSIM4V4tnoia * pParam->BSIM4V4leff); + npart_theta = model->BSIM4V4rnoib * (1.0 + T5 + * model->BSIM4V4tnoib * pParam->BSIM4V4leff); + + if (model->BSIM4V4rdsMod == 0) + { gspr = here->BSIM4V4sourceConductance; + gdpr = here->BSIM4V4drainConductance; + } + else + { gspr = here->BSIM4V4gstot; + gdpr = here->BSIM4V4gdtot; + } + + if ((*(ckt->CKTstates[0] + here->BSIM4V4vds)) >= 0.0) + gspr = gspr / (1.0 + npart_theta * npart_theta * gspr + / here->BSIM4V4IdovVds); /* bugfix */ + else + gdpr = gdpr / (1.0 + npart_theta * npart_theta * gdpr + / here->BSIM4V4IdovVds); + } + + NevalSrc(&noizDens[BSIM4V4RDNOIZ], + &lnNdens[BSIM4V4RDNOIZ], ckt, THERMNOISE, + here->BSIM4V4dNodePrime, here->BSIM4V4dNode, + gdpr * m); + + NevalSrc(&noizDens[BSIM4V4RSNOIZ], + &lnNdens[BSIM4V4RSNOIZ], ckt, THERMNOISE, + here->BSIM4V4sNodePrime, here->BSIM4V4sNode, + gspr * m); + + + if ((here->BSIM4V4rgateMod == 1) || (here->BSIM4V4rgateMod == 2)) + { NevalSrc(&noizDens[BSIM4V4RGNOIZ], + &lnNdens[BSIM4V4RGNOIZ], ckt, THERMNOISE, + here->BSIM4V4gNodePrime, here->BSIM4V4gNodeExt, + here->BSIM4V4grgeltd * m); + } + else if (here->BSIM4V4rgateMod == 3) + { NevalSrc(&noizDens[BSIM4V4RGNOIZ], + &lnNdens[BSIM4V4RGNOIZ], ckt, THERMNOISE, + here->BSIM4V4gNodeMid, here->BSIM4V4gNodeExt, + here->BSIM4V4grgeltd * m); + } + else + { noizDens[BSIM4V4RGNOIZ] = 0.0; + lnNdens[BSIM4V4RGNOIZ] = + log(MAX(noizDens[BSIM4V4RGNOIZ], N_MINLOG)); + } + + + if (here->BSIM4V4rbodyMod) + { NevalSrc(&noizDens[BSIM4V4RBPSNOIZ], + &lnNdens[BSIM4V4RBPSNOIZ], ckt, THERMNOISE, + here->BSIM4V4bNodePrime, here->BSIM4V4sbNode, + here->BSIM4V4grbps * m); + NevalSrc(&noizDens[BSIM4V4RBPDNOIZ], + &lnNdens[BSIM4V4RBPDNOIZ], ckt, THERMNOISE, + here->BSIM4V4bNodePrime, here->BSIM4V4dbNode, + here->BSIM4V4grbpd * m); + NevalSrc(&noizDens[BSIM4V4RBPBNOIZ], + &lnNdens[BSIM4V4RBPBNOIZ], ckt, THERMNOISE, + here->BSIM4V4bNodePrime, here->BSIM4V4bNode, + here->BSIM4V4grbpb * m); + NevalSrc(&noizDens[BSIM4V4RBSBNOIZ], + &lnNdens[BSIM4V4RBSBNOIZ], ckt, THERMNOISE, + here->BSIM4V4bNode, here->BSIM4V4sbNode, + here->BSIM4V4grbsb * m); + NevalSrc(&noizDens[BSIM4V4RBDBNOIZ], + &lnNdens[BSIM4V4RBDBNOIZ], ckt, THERMNOISE, + here->BSIM4V4bNode, here->BSIM4V4dbNode, + here->BSIM4V4grbdb * m); + } + else + { noizDens[BSIM4V4RBPSNOIZ] = noizDens[BSIM4V4RBPDNOIZ] = 0.0; + noizDens[BSIM4V4RBPBNOIZ] = 0.0; + noizDens[BSIM4V4RBSBNOIZ] = noizDens[BSIM4V4RBDBNOIZ] = 0.0; + lnNdens[BSIM4V4RBPSNOIZ] = + log(MAX(noizDens[BSIM4V4RBPSNOIZ], N_MINLOG)); + lnNdens[BSIM4V4RBPDNOIZ] = + log(MAX(noizDens[BSIM4V4RBPDNOIZ], N_MINLOG)); + lnNdens[BSIM4V4RBPBNOIZ] = + log(MAX(noizDens[BSIM4V4RBPBNOIZ], N_MINLOG)); + lnNdens[BSIM4V4RBSBNOIZ] = + log(MAX(noizDens[BSIM4V4RBSBNOIZ], N_MINLOG)); + lnNdens[BSIM4V4RBDBNOIZ] = + log(MAX(noizDens[BSIM4V4RBDBNOIZ], N_MINLOG)); + } + + + switch(model->BSIM4V4tnoiMod) + { case 0: + T0 = m * here->BSIM4V4ueff * fabs(here->BSIM4V4qinv); + T1 = T0 * tmp + pParam->BSIM4V4leff + * pParam->BSIM4V4leff; + NevalSrc(&noizDens[BSIM4V4IDNOIZ], + &lnNdens[BSIM4V4IDNOIZ], ckt, + THERMNOISE, here->BSIM4V4dNodePrime, + here->BSIM4V4sNodePrime, + (T0 / T1) * model->BSIM4V4ntnoi); + break; + case 1: + T0 = m * (here->BSIM4V4gm + here->BSIM4V4gmbs + here->BSIM4V4gds); + T0 *= T0; + igsquare = npart_theta * npart_theta * T0 / here->BSIM4V4IdovVds; + T1 = npart_beta * (here->BSIM4V4gm + + here->BSIM4V4gmbs) + here->BSIM4V4gds; + T2 = T1 * T1 / here->BSIM4V4IdovVds; + NevalSrc(&noizDens[BSIM4V4IDNOIZ], + &lnNdens[BSIM4V4IDNOIZ], ckt, + THERMNOISE, here->BSIM4V4dNodePrime, + here->BSIM4V4sNodePrime, (T2 - igsquare)); + break; + } + + NevalSrc(&noizDens[BSIM4V4FLNOIZ], (double*) NULL, + ckt, N_GAIN, here->BSIM4V4dNodePrime, + here->BSIM4V4sNodePrime, (double) 0.0); + + switch(model->BSIM4V4fnoiMod) + { case 0: + noizDens[BSIM4V4FLNOIZ] *= m * model->BSIM4V4kf + * exp(model->BSIM4V4af + * log(MAX(fabs(here->BSIM4V4cd), + N_MINLOG))) + / (pow(data->freq, model->BSIM4V4ef) + * pParam->BSIM4V4leff + * pParam->BSIM4V4leff + * model->BSIM4V4coxe); + break; + case 1: + Vds = *(ckt->CKTstates[0] + here->BSIM4V4vds); + if (Vds < 0.0) + Vds = -Vds; + + Ssi = Eval1ovFNoise(Vds, model, here, + data->freq, ckt->CKTtemp); + T10 = model->BSIM4V4oxideTrapDensityA + * CONSTboltz * ckt->CKTtemp; + T11 = pParam->BSIM4V4weff * pParam->BSIM4V4leff + * pow(data->freq, model->BSIM4V4ef) * 1.0e10 + * here->BSIM4V4nstar * here->BSIM4V4nstar; + Swi = T10 / T11 * here->BSIM4V4cd + * here->BSIM4V4cd; + T1 = Swi + Ssi; + if (T1 > 0.0) + noizDens[BSIM4V4FLNOIZ] *= m * (Ssi * Swi) / T1; + else + noizDens[BSIM4V4FLNOIZ] *= 0.0; + break; + } + + lnNdens[BSIM4V4FLNOIZ] = + log(MAX(noizDens[BSIM4V4FLNOIZ], N_MINLOG)); + + + if(here->BSIM4V4mode >= 0) { /* bugfix */ + NevalSrc(&noizDens[BSIM4V4IGSNOIZ], + &lnNdens[BSIM4V4IGSNOIZ], ckt, SHOTNOISE, + here->BSIM4V4gNodePrime, here->BSIM4V4sNodePrime, + m * (here->BSIM4V4Igs + here->BSIM4V4Igcs)); + NevalSrc(&noizDens[BSIM4V4IGDNOIZ], + &lnNdens[BSIM4V4IGDNOIZ], ckt, SHOTNOISE, + here->BSIM4V4gNodePrime, here->BSIM4V4dNodePrime, + m * (here->BSIM4V4Igd + here->BSIM4V4Igcd)); + } else { + NevalSrc(&noizDens[BSIM4V4IGSNOIZ], + &lnNdens[BSIM4V4IGSNOIZ], ckt, SHOTNOISE, + here->BSIM4V4gNodePrime, here->BSIM4V4sNodePrime, + m * (here->BSIM4V4Igs + here->BSIM4V4Igcd)); + NevalSrc(&noizDens[BSIM4V4IGDNOIZ], + &lnNdens[BSIM4V4IGDNOIZ], ckt, SHOTNOISE, + here->BSIM4V4gNodePrime, here->BSIM4V4dNodePrime, + m * (here->BSIM4V4Igd + here->BSIM4V4Igcs)); + } + NevalSrc(&noizDens[BSIM4V4IGBNOIZ], + &lnNdens[BSIM4V4IGBNOIZ], ckt, SHOTNOISE, + here->BSIM4V4gNodePrime, here->BSIM4V4bNodePrime, + m * here->BSIM4V4Igb); + + + noizDens[BSIM4V4TOTNOIZ] = noizDens[BSIM4V4RDNOIZ] + + noizDens[BSIM4V4RSNOIZ] + noizDens[BSIM4V4RGNOIZ] + + noizDens[BSIM4V4RBPSNOIZ] + noizDens[BSIM4V4RBPDNOIZ] + + noizDens[BSIM4V4RBPBNOIZ] + + noizDens[BSIM4V4RBSBNOIZ] + noizDens[BSIM4V4RBDBNOIZ] + + noizDens[BSIM4V4IDNOIZ] + noizDens[BSIM4V4FLNOIZ] + + noizDens[BSIM4V4IGSNOIZ] + noizDens[BSIM4V4IGDNOIZ] + + noizDens[BSIM4V4IGBNOIZ]; + lnNdens[BSIM4V4TOTNOIZ] = + log(MAX(noizDens[BSIM4V4TOTNOIZ], N_MINLOG)); + + *OnDens += noizDens[BSIM4V4TOTNOIZ]; + + if (data->delFreq == 0.0) + { /* if we haven't done any previous + integration, we need to initialize our + "history" variables. + */ + + for (i = 0; i < BSIM4V4NSRCS; i++) + { here->BSIM4V4nVar[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 < BSIM4V4NSRCS; i++) + { here->BSIM4V4nVar[OUTNOIZ][i] = 0.0; + here->BSIM4V4nVar[INNOIZ][i] = 0.0; + } + } + } + else + { /* data->delFreq != 0.0, + we have to integrate. + */ + for (i = 0; i < BSIM4V4NSRCS; i++) + { if (i != BSIM4V4TOTNOIZ) + { tempOnoise = Nintegrate(noizDens[i], + lnNdens[i], + here->BSIM4V4nVar[LNLSTDENS][i], + data); + tempInoise = Nintegrate(noizDens[i] + * data->GainSqInv, lnNdens[i] + + data->lnGainInv, + here->BSIM4V4nVar[LNLSTDENS][i] + + data->lnGainInv, data); + here->BSIM4V4nVar[LNLSTDENS][i] = + lnNdens[i]; + data->outNoiz += tempOnoise; + data->inNoise += tempInoise; + if (((NOISEAN*) + ckt->CKTcurJob)->NStpsSm != 0) + { here->BSIM4V4nVar[OUTNOIZ][i] + += tempOnoise; + here->BSIM4V4nVar[OUTNOIZ][BSIM4V4TOTNOIZ] + += tempOnoise; + here->BSIM4V4nVar[INNOIZ][i] + += tempInoise; + here->BSIM4V4nVar[INNOIZ][BSIM4V4TOTNOIZ] + += tempInoise; + } + } + } + } + if (data->prtSummary) + { for (i = 0; i < BSIM4V4NSRCS; 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 < BSIM4V4NSRCS; i++) + { data->outpVector[data->outNumber++] + = here->BSIM4V4nVar[OUTNOIZ][i]; + data->outpVector[data->outNumber++] + = here->BSIM4V4nVar[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/bsim4v4/b4v4par.c b/src/spicelib/devices/bsim4v4/b4v4par.c new file mode 100644 index 000000000..dbc7f1ddd --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4par.c @@ -0,0 +1,169 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4par.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 11/15/2002. + * Modified by Xuemei Xi, 05/09/2003. + **********/ + +#include "ngspice.h" +#include "ifsim.h" +#include "bsim4v4def.h" +#include "sperror.h" +#include "suffix.h" +#include "fteext.h" + +int +BSIM4V4param(param,value,inst,select) +int param; +IFvalue *value; +GENinstance *inst; +IFvalue *select; +{ + double scale; + + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; + + BSIM4V4instance *here = (BSIM4V4instance*)inst; + switch(param) + { case BSIM4V4_W: + here->BSIM4V4w = value->rValue*scale; + here->BSIM4V4wGiven = TRUE; + break; + case BSIM4V4_L: + here->BSIM4V4l = value->rValue*scale; + here->BSIM4V4lGiven = TRUE; + break; + case BSIM4V4_M: + here->BSIM4V4m = value->rValue; + here->BSIM4V4mGiven = TRUE; + break; + case BSIM4V4_NF: + here->BSIM4V4nf = value->rValue; + here->BSIM4V4nfGiven = TRUE; + break; + case BSIM4V4_MIN: + here->BSIM4V4min = value->iValue; + here->BSIM4V4minGiven = TRUE; + break; + case BSIM4V4_AS: + here->BSIM4V4sourceArea = value->rValue*scale*scale; + here->BSIM4V4sourceAreaGiven = TRUE; + break; + case BSIM4V4_AD: + here->BSIM4V4drainArea = value->rValue*scale*scale; + here->BSIM4V4drainAreaGiven = TRUE; + break; + case BSIM4V4_PS: + here->BSIM4V4sourcePerimeter = value->rValue*scale; + here->BSIM4V4sourcePerimeterGiven = TRUE; + break; + case BSIM4V4_PD: + here->BSIM4V4drainPerimeter = value->rValue*scale; + here->BSIM4V4drainPerimeterGiven = TRUE; + break; + case BSIM4V4_NRS: + here->BSIM4V4sourceSquares = value->rValue; + here->BSIM4V4sourceSquaresGiven = TRUE; + break; + case BSIM4V4_NRD: + here->BSIM4V4drainSquares = value->rValue; + here->BSIM4V4drainSquaresGiven = TRUE; + break; + case BSIM4V4_OFF: + here->BSIM4V4off = value->iValue; + break; + case BSIM4V4_SA: + here->BSIM4V4sa = value->rValue*scale; + here->BSIM4V4saGiven = TRUE; + break; + case BSIM4V4_SB: + here->BSIM4V4sb = value->rValue*scale; + here->BSIM4V4sbGiven = TRUE; + break; + case BSIM4V4_SD: + here->BSIM4V4sd = value->rValue*scale; + here->BSIM4V4sdGiven = TRUE; + break; + case BSIM4V4_RBSB: + here->BSIM4V4rbsb = value->rValue; + here->BSIM4V4rbsbGiven = TRUE; + break; + case BSIM4V4_RBDB: + here->BSIM4V4rbdb = value->rValue; + here->BSIM4V4rbdbGiven = TRUE; + break; + case BSIM4V4_RBPB: + here->BSIM4V4rbpb = value->rValue; + here->BSIM4V4rbpbGiven = TRUE; + break; + case BSIM4V4_RBPS: + here->BSIM4V4rbps = value->rValue; + here->BSIM4V4rbpsGiven = TRUE; + break; + case BSIM4V4_RBPD: + here->BSIM4V4rbpd = value->rValue; + here->BSIM4V4rbpdGiven = TRUE; + break; + case BSIM4V4_TRNQSMOD: + here->BSIM4V4trnqsMod = value->iValue; + here->BSIM4V4trnqsModGiven = TRUE; + break; + case BSIM4V4_ACNQSMOD: + here->BSIM4V4acnqsMod = value->iValue; + here->BSIM4V4acnqsModGiven = TRUE; + break; + case BSIM4V4_RBODYMOD: + here->BSIM4V4rbodyMod = value->iValue; + here->BSIM4V4rbodyModGiven = TRUE; + break; + case BSIM4V4_RGATEMOD: + here->BSIM4V4rgateMod = value->iValue; + here->BSIM4V4rgateModGiven = TRUE; + break; + case BSIM4V4_GEOMOD: + here->BSIM4V4geoMod = value->iValue; + here->BSIM4V4geoModGiven = TRUE; + break; + case BSIM4V4_RGEOMOD: + here->BSIM4V4rgeoMod = value->iValue; + here->BSIM4V4rgeoModGiven = TRUE; + break; + case BSIM4V4_IC_VDS: + here->BSIM4V4icVDS = value->rValue; + here->BSIM4V4icVDSGiven = TRUE; + break; + case BSIM4V4_IC_VGS: + here->BSIM4V4icVGS = value->rValue; + here->BSIM4V4icVGSGiven = TRUE; + break; + case BSIM4V4_IC_VBS: + here->BSIM4V4icVBS = value->rValue; + here->BSIM4V4icVBSGiven = TRUE; + break; + case BSIM4V4_IC: + switch(value->v.numValue) + { case 3: + here->BSIM4V4icVBS = *(value->v.vec.rVec+2); + here->BSIM4V4icVBSGiven = TRUE; + case 2: + here->BSIM4V4icVGS = *(value->v.vec.rVec+1); + here->BSIM4V4icVGSGiven = TRUE; + case 1: + here->BSIM4V4icVDS = *(value->v.vec.rVec); + here->BSIM4V4icVDSGiven = TRUE; + break; + default: + return(E_BADPARM); + } + break; + default: + return(E_BADPARM); + } + return(OK); +} diff --git a/src/spicelib/devices/bsim4v4/b4v4pzld.c b/src/spicelib/devices/bsim4v4/b4v4pzld.c new file mode 100644 index 000000000..cfd534d4e --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4pzld.c @@ -0,0 +1,758 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4pzld.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 10/05/2001. + **********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "complex.h" +#include "sperror.h" +#include "bsim4v4def.h" +#include "suffix.h" + +int +BSIM4V4pzLoad(inModel,ckt,s) +GENmodel *inModel; +CKTcircuit *ckt; +SPcomplex *s; +{ +BSIM4V4model *model = (BSIM4V4model*)inModel; +BSIM4V4instance *here; + +double gjbd, gjbs, geltd, gcrg, gcrgg, gcrgd, gcrgs, gcrgb; +double xcggb, xcgdb, xcgsb, xcgbb, xcbgb, xcbdb, xcbsb, xcbbb; +double xcdgb, xcddb, xcdsb, xcdbb, xcsgb, xcsdb, xcssb, xcsbb; +double gds, capbd, capbs, FwdSum, RevSum, Gm, Gmbs; +double gstot, gstotd, gstotg, gstots, gstotb, gspr; +double gdtot, gdtotd, gdtotg, gdtots, gdtotb, gdpr; +double gIstotg, gIstotd, gIstots, gIstotb; +double gIdtotg, gIdtotd, gIdtots, gIdtotb; +double gIbtotg, gIbtotd, gIbtots, gIbtotb; +double gIgtotg, gIgtotd, gIgtots, gIgtotb; +double cgso, cgdo, cgbo; +double xcdbdb=0.0, xcsbsb=0.0, xcgmgmb=0.0, xcgmdb=0.0, xcgmsb=0.0, xcdgmb=0.0, xcsgmb=0.0; +double xcgmbb=0.0, xcbgmb=0.0; +double dxpart, sxpart, xgtg, xgtd, xgts, xgtb, xcqgb=0.0, xcqdb=0.0, xcqsb=0.0, xcqbb=0.0; +double gbspsp, gbbdp, gbbsp, gbspg, gbspb; +double gbspdp, gbdpdp, gbdpg, gbdpb, gbdpsp; +double ddxpart_dVd, ddxpart_dVg, ddxpart_dVb, ddxpart_dVs; +double dsxpart_dVd, dsxpart_dVg, dsxpart_dVb, dsxpart_dVs; +double T0=0.0, T1, CoxWL, qcheq, Cdg, Cdd, Cds, Csg, Csd, Css; +double ScalingFactor = 1.0e-9; +struct bsim4SizeDependParam *pParam; +double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; + +double m; + + for (; model != NULL; model = model->BSIM4V4nextModel) + { for (here = model->BSIM4V4instances; here!= NULL; + here = here->BSIM4V4nextInstance) + { if (here->BSIM4V4owner != ARCHme) continue; + pParam = here->pParam; + capbd = here->BSIM4V4capbd; + capbs = here->BSIM4V4capbs; + cgso = here->BSIM4V4cgso; + cgdo = here->BSIM4V4cgdo; + cgbo = pParam->BSIM4V4cgbo; + + if (here->BSIM4V4mode >= 0) + { Gm = here->BSIM4V4gm; + Gmbs = here->BSIM4V4gmbs; + FwdSum = Gm + Gmbs; + RevSum = 0.0; + + gbbdp = -(here->BSIM4V4gbds); + gbbsp = here->BSIM4V4gbds + here->BSIM4V4gbgs + here->BSIM4V4gbbs; + gbdpg = here->BSIM4V4gbgs; + gbdpdp = here->BSIM4V4gbds; + gbdpb = here->BSIM4V4gbbs; + gbdpsp = -(gbdpg + gbdpdp + gbdpb); + + gbspdp = 0.0; + gbspg = 0.0; + gbspb = 0.0; + gbspsp = 0.0; + + if (model->BSIM4V4igcMod) + { gIstotg = here->BSIM4V4gIgsg + here->BSIM4V4gIgcsg; + gIstotd = here->BSIM4V4gIgcsd; + gIstots = here->BSIM4V4gIgss + here->BSIM4V4gIgcss; + gIstotb = here->BSIM4V4gIgcsb; + + gIdtotg = here->BSIM4V4gIgdg + here->BSIM4V4gIgcdg; + gIdtotd = here->BSIM4V4gIgdd + here->BSIM4V4gIgcdd; + gIdtots = here->BSIM4V4gIgcds; + gIdtotb = here->BSIM4V4gIgcdb; + } + else + { gIstotg = gIstotd = gIstots = gIstotb = 0.0; + gIdtotg = gIdtotd = gIdtots = gIdtotb = 0.0; + } + + if (model->BSIM4V4igbMod) + { gIbtotg = here->BSIM4V4gIgbg; + gIbtotd = here->BSIM4V4gIgbd; + gIbtots = here->BSIM4V4gIgbs; + gIbtotb = here->BSIM4V4gIgbb; + } + else + gIbtotg = gIbtotd = gIbtots = gIbtotb = 0.0; + + if ((model->BSIM4V4igcMod != 0) || (model->BSIM4V4igbMod != 0)) + { gIgtotg = gIstotg + gIdtotg + gIbtotg; + gIgtotd = gIstotd + gIdtotd + gIbtotd ; + gIgtots = gIstots + gIdtots + gIbtots; + gIgtotb = gIstotb + gIdtotb + gIbtotb; + } + else + gIgtotg = gIgtotd = gIgtots = gIgtotb = 0.0; + + if (here->BSIM4V4rgateMod == 2) + T0 = *(ckt->CKTstates[0] + here->BSIM4V4vges) + - *(ckt->CKTstates[0] + here->BSIM4V4vgs); + else if (here->BSIM4V4rgateMod == 3) + T0 = *(ckt->CKTstates[0] + here->BSIM4V4vgms) + - *(ckt->CKTstates[0] + here->BSIM4V4vgs); + if (here->BSIM4V4rgateMod > 1) + { gcrgd = here->BSIM4V4gcrgd * T0; + gcrgg = here->BSIM4V4gcrgg * T0; + gcrgs = here->BSIM4V4gcrgs * T0; + gcrgb = here->BSIM4V4gcrgb * T0; + gcrgg -= here->BSIM4V4gcrg; + gcrg = here->BSIM4V4gcrg; + } + else + gcrg = gcrgd = gcrgg = gcrgs = gcrgb = 0.0; + + if (here->BSIM4V4acnqsMod == 0) + { if (here->BSIM4V4rgateMod == 3) + { xcgmgmb = cgdo + cgso + pParam->BSIM4V4cgbo; + xcgmdb = -cgdo; + xcgmsb = -cgso; + xcgmbb = -pParam->BSIM4V4cgbo; + + xcdgmb = xcgmdb; + xcsgmb = xcgmsb; + xcbgmb = xcgmbb; + + xcggb = here->BSIM4V4cggb; + xcgdb = here->BSIM4V4cgdb; + xcgsb = here->BSIM4V4cgsb; + xcgbb = -(xcggb + xcgdb + xcgsb); + + xcdgb = here->BSIM4V4cdgb; + xcsgb = -(here->BSIM4V4cggb + here->BSIM4V4cbgb + + here->BSIM4V4cdgb); + xcbgb = here->BSIM4V4cbgb; + } + else + { xcggb = here->BSIM4V4cggb + cgdo + cgso + + pParam->BSIM4V4cgbo; + xcgdb = here->BSIM4V4cgdb - cgdo; + xcgsb = here->BSIM4V4cgsb - cgso; + xcgbb = -(xcggb + xcgdb + xcgsb); + + xcdgb = here->BSIM4V4cdgb - cgdo; + xcsgb = -(here->BSIM4V4cggb + here->BSIM4V4cbgb + + here->BSIM4V4cdgb + cgso); + xcbgb = here->BSIM4V4cbgb - pParam->BSIM4V4cgbo; + + xcdgmb = xcsgmb = xcbgmb = 0.0; + } + xcddb = here->BSIM4V4cddb + here->BSIM4V4capbd + cgdo; + xcdsb = here->BSIM4V4cdsb; + + xcsdb = -(here->BSIM4V4cgdb + here->BSIM4V4cbdb + + here->BSIM4V4cddb); + xcssb = here->BSIM4V4capbs + cgso - (here->BSIM4V4cgsb + + here->BSIM4V4cbsb + here->BSIM4V4cdsb); + + if (!here->BSIM4V4rbodyMod) + { xcdbb = -(xcdgb + xcddb + xcdsb + xcdgmb); + xcsbb = -(xcsgb + xcsdb + xcssb + xcsgmb); + xcbdb = here->BSIM4V4cbdb - here->BSIM4V4capbd; + xcbsb = here->BSIM4V4cbsb - here->BSIM4V4capbs; + xcdbdb = 0.0; + } + else + { xcdbb = -(here->BSIM4V4cddb + here->BSIM4V4cdgb + + here->BSIM4V4cdsb); + xcsbb = -(xcsgb + xcsdb + xcssb + xcsgmb) + + here->BSIM4V4capbs; + xcbdb = here->BSIM4V4cbdb; + xcbsb = here->BSIM4V4cbsb; + + xcdbdb = -here->BSIM4V4capbd; + xcsbsb = -here->BSIM4V4capbs; + } + xcbbb = -(xcbdb + xcbgb + xcbsb + xcbgmb); + + xgtg = xgtd = xgts = xgtb = 0.0; + sxpart = 0.6; + dxpart = 0.4; + ddxpart_dVd = ddxpart_dVg = ddxpart_dVb + = ddxpart_dVs = 0.0; + dsxpart_dVd = dsxpart_dVg = dsxpart_dVb + = dsxpart_dVs = 0.0; + } + else + { xcggb = xcgdb = xcgsb = xcgbb = 0.0; + xcbgb = xcbdb = xcbsb = xcbbb = 0.0; + xcdgb = xcddb = xcdsb = xcdbb = 0.0; + xcsgb = xcsdb = xcssb = xcsbb = 0.0; + + xgtg = here->BSIM4V4gtg; + xgtd = here->BSIM4V4gtd; + xgts = here->BSIM4V4gts; + xgtb = here->BSIM4V4gtb; + + xcqgb = here->BSIM4V4cqgb; + xcqdb = here->BSIM4V4cqdb; + xcqsb = here->BSIM4V4cqsb; + xcqbb = here->BSIM4V4cqbb; + + CoxWL = model->BSIM4V4coxe * here->pParam->BSIM4V4weffCV + * here->BSIM4V4nf * here->pParam->BSIM4V4leffCV; + qcheq = -(here->BSIM4V4qgate + here->BSIM4V4qbulk); + if (fabs(qcheq) <= 1.0e-5 * CoxWL) + { if (model->BSIM4V4xpart < 0.5) + { dxpart = 0.4; + } + else if (model->BSIM4V4xpart > 0.5) + { dxpart = 0.0; + } + else + { dxpart = 0.5; + } + ddxpart_dVd = ddxpart_dVg = ddxpart_dVb + = ddxpart_dVs = 0.0; + } + else + { dxpart = here->BSIM4V4qdrn / qcheq; + Cdd = here->BSIM4V4cddb; + Csd = -(here->BSIM4V4cgdb + here->BSIM4V4cddb + + here->BSIM4V4cbdb); + ddxpart_dVd = (Cdd - dxpart * (Cdd + Csd)) / qcheq; + Cdg = here->BSIM4V4cdgb; + Csg = -(here->BSIM4V4cggb + here->BSIM4V4cdgb + + here->BSIM4V4cbgb); + ddxpart_dVg = (Cdg - dxpart * (Cdg + Csg)) / qcheq; + + Cds = here->BSIM4V4cdsb; + Css = -(here->BSIM4V4cgsb + here->BSIM4V4cdsb + + here->BSIM4V4cbsb); + ddxpart_dVs = (Cds - dxpart * (Cds + Css)) / qcheq; + + ddxpart_dVb = -(ddxpart_dVd + ddxpart_dVg + + ddxpart_dVs); + } + sxpart = 1.0 - dxpart; + dsxpart_dVd = -ddxpart_dVd; + dsxpart_dVg = -ddxpart_dVg; + dsxpart_dVs = -ddxpart_dVs; + dsxpart_dVb = -(dsxpart_dVd + dsxpart_dVg + dsxpart_dVs); + } + } + else + { Gm = -here->BSIM4V4gm; + Gmbs = -here->BSIM4V4gmbs; + FwdSum = 0.0; + RevSum = -(Gm + Gmbs); + + gbbsp = -(here->BSIM4V4gbds); + gbbdp = here->BSIM4V4gbds + here->BSIM4V4gbgs + here->BSIM4V4gbbs; + + gbdpg = 0.0; + gbdpsp = 0.0; + gbdpb = 0.0; + gbdpdp = 0.0; + + gbspg = here->BSIM4V4gbgs; + gbspsp = here->BSIM4V4gbds; + gbspb = here->BSIM4V4gbbs; + gbspdp = -(gbspg + gbspsp + gbspb); + + if (model->BSIM4V4igcMod) + { gIstotg = here->BSIM4V4gIgsg + here->BSIM4V4gIgcdg; + gIstotd = here->BSIM4V4gIgcds; + gIstots = here->BSIM4V4gIgss + here->BSIM4V4gIgcdd; + gIstotb = here->BSIM4V4gIgcdb; + + gIdtotg = here->BSIM4V4gIgdg + here->BSIM4V4gIgcsg; + gIdtotd = here->BSIM4V4gIgdd + here->BSIM4V4gIgcss; + gIdtots = here->BSIM4V4gIgcsd; + gIdtotb = here->BSIM4V4gIgcsb; + } + else + { gIstotg = gIstotd = gIstots = gIstotb = 0.0; + gIdtotg = gIdtotd = gIdtots = gIdtotb = 0.0; + } + + if (model->BSIM4V4igbMod) + { gIbtotg = here->BSIM4V4gIgbg; + gIbtotd = here->BSIM4V4gIgbs; + gIbtots = here->BSIM4V4gIgbd; + gIbtotb = here->BSIM4V4gIgbb; + } + else + gIbtotg = gIbtotd = gIbtots = gIbtotb = 0.0; + + if ((model->BSIM4V4igcMod != 0) || (model->BSIM4V4igbMod != 0)) + { gIgtotg = gIstotg + gIdtotg + gIbtotg; + gIgtotd = gIstotd + gIdtotd + gIbtotd ; + gIgtots = gIstots + gIdtots + gIbtots; + gIgtotb = gIstotb + gIdtotb + gIbtotb; + } + else + gIgtotg = gIgtotd = gIgtots = gIgtotb = 0.0; + + if (here->BSIM4V4rgateMod == 2) + T0 = *(ckt->CKTstates[0] + here->BSIM4V4vges) + - *(ckt->CKTstates[0] + here->BSIM4V4vgs); + else if (here->BSIM4V4rgateMod == 3) + T0 = *(ckt->CKTstates[0] + here->BSIM4V4vgms) + - *(ckt->CKTstates[0] + here->BSIM4V4vgs); + if (here->BSIM4V4rgateMod > 1) + { gcrgd = here->BSIM4V4gcrgs * T0; + gcrgg = here->BSIM4V4gcrgg * T0; + gcrgs = here->BSIM4V4gcrgd * T0; + gcrgb = here->BSIM4V4gcrgb * T0; + gcrgg -= here->BSIM4V4gcrg; + gcrg = here->BSIM4V4gcrg; + } + else + gcrg = gcrgd = gcrgg = gcrgs = gcrgb = 0.0; + + if (here->BSIM4V4acnqsMod == 0) + { if (here->BSIM4V4rgateMod == 3) + { xcgmgmb = cgdo + cgso + pParam->BSIM4V4cgbo; + xcgmdb = -cgdo; + xcgmsb = -cgso; + xcgmbb = -pParam->BSIM4V4cgbo; + + xcdgmb = xcgmdb; + xcsgmb = xcgmsb; + xcbgmb = xcgmbb; + + xcggb = here->BSIM4V4cggb; + xcgdb = here->BSIM4V4cgsb; + xcgsb = here->BSIM4V4cgdb; + xcgbb = -(xcggb + xcgdb + xcgsb); + + xcdgb = -(here->BSIM4V4cggb + here->BSIM4V4cbgb + + here->BSIM4V4cdgb); + xcsgb = here->BSIM4V4cdgb; + xcbgb = here->BSIM4V4cbgb; + } + else + { xcggb = here->BSIM4V4cggb + cgdo + cgso + + pParam->BSIM4V4cgbo; + xcgdb = here->BSIM4V4cgsb - cgdo; + xcgsb = here->BSIM4V4cgdb - cgso; + xcgbb = -(xcggb + xcgdb + xcgsb); + + xcdgb = -(here->BSIM4V4cggb + here->BSIM4V4cbgb + + here->BSIM4V4cdgb + cgdo); + xcsgb = here->BSIM4V4cdgb - cgso; + xcbgb = here->BSIM4V4cbgb - pParam->BSIM4V4cgbo; + + xcdgmb = xcsgmb = xcbgmb = 0.0; + } + xcddb = here->BSIM4V4capbd + cgdo - (here->BSIM4V4cgsb + + here->BSIM4V4cbsb + here->BSIM4V4cdsb); + xcdsb = -(here->BSIM4V4cgdb + here->BSIM4V4cbdb + + here->BSIM4V4cddb); + + xcsdb = here->BSIM4V4cdsb; + xcssb = here->BSIM4V4cddb + here->BSIM4V4capbs + cgso; + + if (!here->BSIM4V4rbodyMod) + { xcdbb = -(xcdgb + xcddb + xcdsb + xcdgmb); + xcsbb = -(xcsgb + xcsdb + xcssb + xcsgmb); + xcbdb = here->BSIM4V4cbsb - here->BSIM4V4capbd; + xcbsb = here->BSIM4V4cbdb - here->BSIM4V4capbs; + xcdbdb = 0.0; + } + else + { xcdbb = -(xcdgb + xcddb + xcdsb + xcdgmb) + + here->BSIM4V4capbd; + xcsbb = -(here->BSIM4V4cddb + here->BSIM4V4cdgb + + here->BSIM4V4cdsb); + xcbdb = here->BSIM4V4cbsb; + xcbsb = here->BSIM4V4cbdb; + xcdbdb = -here->BSIM4V4capbd; + xcsbsb = -here->BSIM4V4capbs; + } + xcbbb = -(xcbgb + xcbdb + xcbsb + xcbgmb); + + xgtg = xgtd = xgts = xgtb = 0.0; + sxpart = 0.4; + dxpart = 0.6; + ddxpart_dVd = ddxpart_dVg = ddxpart_dVb + = ddxpart_dVs = 0.0; + dsxpart_dVd = dsxpart_dVg = dsxpart_dVb + = dsxpart_dVs = 0.0; + } + else + { xcggb = xcgdb = xcgsb = xcgbb = 0.0; + xcbgb = xcbdb = xcbsb = xcbbb = 0.0; + xcdgb = xcddb = xcdsb = xcdbb = 0.0; + xcsgb = xcsdb = xcssb = xcsbb = 0.0; + + xgtg = here->BSIM4V4gtg; + xgtd = here->BSIM4V4gts; + xgts = here->BSIM4V4gtd; + xgtb = here->BSIM4V4gtb; + + xcqgb = here->BSIM4V4cqgb; + xcqdb = here->BSIM4V4cqsb; + xcqsb = here->BSIM4V4cqdb; + xcqbb = here->BSIM4V4cqbb; + + CoxWL = model->BSIM4V4coxe * here->pParam->BSIM4V4weffCV + * here->BSIM4V4nf * here->pParam->BSIM4V4leffCV; + qcheq = -(here->BSIM4V4qgate + here->BSIM4V4qbulk); + if (fabs(qcheq) <= 1.0e-5 * CoxWL) + { if (model->BSIM4V4xpart < 0.5) + { sxpart = 0.4; + } + else if (model->BSIM4V4xpart > 0.5) + { sxpart = 0.0; + } + else + { sxpart = 0.5; + } + dsxpart_dVd = dsxpart_dVg = dsxpart_dVb + = dsxpart_dVs = 0.0; + } + else + { sxpart = here->BSIM4V4qdrn / qcheq; + Css = here->BSIM4V4cddb; + Cds = -(here->BSIM4V4cgdb + here->BSIM4V4cddb + + here->BSIM4V4cbdb); + dsxpart_dVs = (Css - sxpart * (Css + Cds)) / qcheq; + Csg = here->BSIM4V4cdgb; + Cdg = -(here->BSIM4V4cggb + here->BSIM4V4cdgb + + here->BSIM4V4cbgb); + dsxpart_dVg = (Csg - sxpart * (Csg + Cdg)) / qcheq; + + Csd = here->BSIM4V4cdsb; + Cdd = -(here->BSIM4V4cgsb + here->BSIM4V4cdsb + + here->BSIM4V4cbsb); + dsxpart_dVd = (Csd - sxpart * (Csd + Cdd)) / qcheq; + + dsxpart_dVb = -(dsxpart_dVd + dsxpart_dVg + + dsxpart_dVs); + } + dxpart = 1.0 - sxpart; + ddxpart_dVd = -dsxpart_dVd; + ddxpart_dVg = -dsxpart_dVg; + ddxpart_dVs = -dsxpart_dVs; + ddxpart_dVb = -(ddxpart_dVd + ddxpart_dVg + ddxpart_dVs); + } + } + + if (model->BSIM4V4rdsMod == 1) + { gstot = here->BSIM4V4gstot; + gstotd = here->BSIM4V4gstotd; + gstotg = here->BSIM4V4gstotg; + gstots = here->BSIM4V4gstots - gstot; + gstotb = here->BSIM4V4gstotb; + + gdtot = here->BSIM4V4gdtot; + gdtotd = here->BSIM4V4gdtotd - gdtot; + gdtotg = here->BSIM4V4gdtotg; + gdtots = here->BSIM4V4gdtots; + gdtotb = here->BSIM4V4gdtotb; + } + else + { gstot = gstotd = gstotg = gstots = gstotb = 0.0; + gdtot = gdtotd = gdtotg = gdtots = gdtotb = 0.0; + } + + + T1 = *(ckt->CKTstate0 + here->BSIM4V4qdef) * here->BSIM4V4gtau; + gds = here->BSIM4V4gds; + + /* + * Loading PZ matrix + */ + + m = here->BSIM4V4m; + + if (!model->BSIM4V4rdsMod) + { gdpr = here->BSIM4V4drainConductance; + gspr = here->BSIM4V4sourceConductance; + } + else + gdpr = gspr = 0.0; + + if (!here->BSIM4V4rbodyMod) + { gjbd = here->BSIM4V4gbd; + gjbs = here->BSIM4V4gbs; + } + else + gjbd = gjbs = 0.0; + + geltd = here->BSIM4V4grgeltd; + + if (here->BSIM4V4rgateMod == 1) + { *(here->BSIM4V4GEgePtr) += m * geltd; + *(here->BSIM4V4GPgePtr) -= m * geltd; + *(here->BSIM4V4GEgpPtr) -= m * geltd; + + *(here->BSIM4V4GPgpPtr ) += m * xcggb * s->real; + *(here->BSIM4V4GPgpPtr +1) += m * xcggb * s->imag; + *(here->BSIM4V4GPgpPtr) += m * (geltd - xgtg + gIgtotg); + *(here->BSIM4V4GPdpPtr ) += m * xcgdb * s->real; + *(here->BSIM4V4GPdpPtr +1) += m * xcgdb * s->imag; + *(here->BSIM4V4GPdpPtr) -= m * (xgtd - gIgtotd); + *(here->BSIM4V4GPspPtr ) += m * xcgsb * s->real; + *(here->BSIM4V4GPspPtr +1) += m * xcgsb * s->imag; + *(here->BSIM4V4GPspPtr) -= m * (xgts - gIgtots); + *(here->BSIM4V4GPbpPtr ) += m * xcgbb * s->real; + *(here->BSIM4V4GPbpPtr +1) += m * xcgbb * s->imag; + *(here->BSIM4V4GPbpPtr) -= m * (xgtb - gIgtotb); + } + else if (here->BSIM4V4rgateMod == 2) + { *(here->BSIM4V4GEgePtr) += m * gcrg; + *(here->BSIM4V4GEgpPtr) += m * gcrgg; + *(here->BSIM4V4GEdpPtr) += m * gcrgd; + *(here->BSIM4V4GEspPtr) += m * gcrgs; + *(here->BSIM4V4GEbpPtr) += m * gcrgb; + + *(here->BSIM4V4GPgePtr) -= m * gcrg; + *(here->BSIM4V4GPgpPtr ) += m * xcggb * s->real; + *(here->BSIM4V4GPgpPtr +1) += m * xcggb * s->imag; + *(here->BSIM4V4GPgpPtr) -= m * (gcrgg + xgtg - gIgtotg); + *(here->BSIM4V4GPdpPtr ) += m * xcgdb * s->real; + *(here->BSIM4V4GPdpPtr +1) += m * xcgdb * s->imag; + *(here->BSIM4V4GPdpPtr) -= m * (gcrgd + xgtd - gIgtotd); + *(here->BSIM4V4GPspPtr ) += m * xcgsb * s->real; + *(here->BSIM4V4GPspPtr +1) += m * xcgsb * s->imag; + *(here->BSIM4V4GPspPtr) -= m * (gcrgs + xgts - gIgtots); + *(here->BSIM4V4GPbpPtr ) += m * xcgbb * s->real; + *(here->BSIM4V4GPbpPtr +1) += m * xcgbb * s->imag; + *(here->BSIM4V4GPbpPtr) -= m * (gcrgb + xgtb - gIgtotb); + } + else if (here->BSIM4V4rgateMod == 3) + { *(here->BSIM4V4GEgePtr) += m * geltd; + *(here->BSIM4V4GEgmPtr) -= m * geltd; + *(here->BSIM4V4GMgePtr) -= m * geltd; + *(here->BSIM4V4GMgmPtr) += m * (geltd + gcrg); + *(here->BSIM4V4GMgmPtr ) += m * xcgmgmb * s->real; + *(here->BSIM4V4GMgmPtr +1) += m * xcgmgmb * s->imag; + + *(here->BSIM4V4GMdpPtr) += m * gcrgd; + *(here->BSIM4V4GMdpPtr ) += m * xcgmdb * s->real; + *(here->BSIM4V4GMdpPtr +1) += m * xcgmdb * s->imag; + *(here->BSIM4V4GMgpPtr) += m * gcrgg; + *(here->BSIM4V4GMspPtr) += m * gcrgs; + *(here->BSIM4V4GMspPtr ) += m * xcgmsb * s->real; + *(here->BSIM4V4GMspPtr +1) += m * xcgmsb * s->imag; + *(here->BSIM4V4GMbpPtr) += m * gcrgb; + *(here->BSIM4V4GMbpPtr ) += m * xcgmbb * s->real; + *(here->BSIM4V4GMbpPtr +1) += m * xcgmbb * s->imag; + + *(here->BSIM4V4DPgmPtr ) += m * xcdgmb * s->real; + *(here->BSIM4V4DPgmPtr +1) += m * xcdgmb * s->imag; + *(here->BSIM4V4GPgmPtr) -= m * gcrg; + *(here->BSIM4V4SPgmPtr ) += m * xcsgmb * s->real; + *(here->BSIM4V4SPgmPtr +1) += m * xcsgmb * s->imag; + *(here->BSIM4V4BPgmPtr ) += m * xcbgmb * s->real; + *(here->BSIM4V4BPgmPtr +1) += m * xcbgmb * s->imag; + + *(here->BSIM4V4GPgpPtr) -= m * (gcrgg + xgtg - gIgtotg); + *(here->BSIM4V4GPgpPtr ) += m * xcggb * s->real; + *(here->BSIM4V4GPgpPtr +1) += m * xcggb * s->imag; + *(here->BSIM4V4GPdpPtr) -= m * (gcrgd + xgtd - gIgtotd); + *(here->BSIM4V4GPdpPtr ) += m * xcgdb * s->real; + *(here->BSIM4V4GPdpPtr +1) += m * xcgdb * s->imag; + *(here->BSIM4V4GPspPtr) -= m * (gcrgs + xgts - gIgtots); + *(here->BSIM4V4GPspPtr ) += m * xcgsb * s->real; + *(here->BSIM4V4GPspPtr +1) += m * xcgsb * s->imag; + *(here->BSIM4V4GPbpPtr) -= m * (gcrgb + xgtb - gIgtotb); + *(here->BSIM4V4GPbpPtr ) += m * xcgbb * s->real; + *(here->BSIM4V4GPbpPtr +1) += m * xcgbb * s->imag; + } + else + { *(here->BSIM4V4GPdpPtr ) += m * xcgdb * s->real; + *(here->BSIM4V4GPdpPtr +1) += m * xcgdb * s->imag; + *(here->BSIM4V4GPdpPtr) -= m * (xgtd - gIgtotd); + *(here->BSIM4V4GPgpPtr ) += m * xcggb * s->real; + *(here->BSIM4V4GPgpPtr +1) += m * xcggb * s->imag; + *(here->BSIM4V4GPgpPtr) -= m * (xgtg - gIgtotg); + *(here->BSIM4V4GPspPtr ) += m * xcgsb * s->real; + *(here->BSIM4V4GPspPtr +1) += m * xcgsb * s->imag; + *(here->BSIM4V4GPspPtr) -= m * (xgts - gIgtots); + *(here->BSIM4V4GPbpPtr ) += m * xcgbb * s->real; + *(here->BSIM4V4GPbpPtr +1) += m * xcgbb * s->imag; + *(here->BSIM4V4GPbpPtr) -= m * (xgtb - gIgtotb); + } + + if (model->BSIM4V4rdsMod) + { (*(here->BSIM4V4DgpPtr) += m * gdtotg); + (*(here->BSIM4V4DspPtr) += m * gdtots); + (*(here->BSIM4V4DbpPtr) += m * gdtotb); + (*(here->BSIM4V4SdpPtr) += m * gstotd); + (*(here->BSIM4V4SgpPtr) += m * gstotg); + (*(here->BSIM4V4SbpPtr) += m * gstotb); + } + + *(here->BSIM4V4DPdpPtr ) += m * xcddb * s->real; + *(here->BSIM4V4DPdpPtr +1) += m * xcddb * s->imag; + *(here->BSIM4V4DPdpPtr) += m * (gdpr + gds + here->BSIM4V4gbd + - gdtotd + RevSum + gbdpdp - gIdtotd + + dxpart * xgtd + T1 * ddxpart_dVd); + *(here->BSIM4V4DPdPtr) -= m * (gdpr + gdtot); + *(here->BSIM4V4DPgpPtr ) += m * xcdgb * s->real; + *(here->BSIM4V4DPgpPtr +1) += m * xcdgb * s->imag; + *(here->BSIM4V4DPgpPtr) += m * (Gm - gdtotg + gbdpg - gIdtotg + + T1 * ddxpart_dVg + dxpart * xgtg); + *(here->BSIM4V4DPspPtr ) += m * xcdsb * s->real; + *(here->BSIM4V4DPspPtr +1) += m * xcdsb * s->imag; + *(here->BSIM4V4DPspPtr) -= m * (gds + FwdSum + gdtots - gbdpsp + gIdtots + - T1 * ddxpart_dVs - dxpart * xgts); + *(here->BSIM4V4DPbpPtr ) += m * xcdbb * s->real; + *(here->BSIM4V4DPbpPtr +1) += m * xcdbb * s->imag; + *(here->BSIM4V4DPbpPtr) -= m * (gjbd + gdtotb - Gmbs - gbdpb + gIdtotb + - T1 * ddxpart_dVb - dxpart * xgtb); + + *(here->BSIM4V4DdpPtr) -= m * (gdpr - gdtotd); + *(here->BSIM4V4DdPtr) += m * (gdpr + gdtot); + + *(here->BSIM4V4SPdpPtr ) += m * xcsdb * s->real; + *(here->BSIM4V4SPdpPtr +1) += m * xcsdb * s->imag; + *(here->BSIM4V4SPdpPtr) -= m * (gds + gstotd + RevSum - gbspdp + gIstotd + - T1 * dsxpart_dVd - sxpart * xgtd); + *(here->BSIM4V4SPgpPtr ) += m * xcsgb * s->real; + *(here->BSIM4V4SPgpPtr +1) += m * xcsgb * s->imag; + *(here->BSIM4V4SPgpPtr) -= m * (Gm + gstotg - gbspg + gIstotg + - T1 * dsxpart_dVg - sxpart * xgtg); + *(here->BSIM4V4SPspPtr ) += m * xcssb * s->real; + *(here->BSIM4V4SPspPtr +1) += m * xcssb * s->imag; + *(here->BSIM4V4SPspPtr) += m * (gspr + gds + here->BSIM4V4gbs - gIstots + - gstots + FwdSum + gbspsp + + sxpart * xgts + T1 * dsxpart_dVs); + *(here->BSIM4V4SPsPtr) -= m * (gspr + gstot); + *(here->BSIM4V4SPbpPtr ) += m * xcsbb * s->real; + *(here->BSIM4V4SPbpPtr +1) += m * xcsbb * s->imag; + *(here->BSIM4V4SPbpPtr) -= m * (gjbs + gstotb + Gmbs - gbspb + gIstotb + - T1 * dsxpart_dVb - sxpart * xgtb); + + *(here->BSIM4V4SspPtr) -= m * (gspr - gstots); + *(here->BSIM4V4SsPtr) += m * (gspr + gstot); + + *(here->BSIM4V4BPdpPtr ) += m * xcbdb * s->real; + *(here->BSIM4V4BPdpPtr +1) += m * xcbdb * s->imag; + *(here->BSIM4V4BPdpPtr) -= m * (gjbd - gbbdp + gIbtotd); + *(here->BSIM4V4BPgpPtr ) += m * xcbgb * s->real; + *(here->BSIM4V4BPgpPtr +1) += m * xcbgb * s->imag; + *(here->BSIM4V4BPgpPtr) -= m * (here->BSIM4V4gbgs + gIbtotg); + *(here->BSIM4V4BPspPtr ) += m * xcbsb * s->real; + *(here->BSIM4V4BPspPtr +1) += m * xcbsb * s->imag; + *(here->BSIM4V4BPspPtr) -= m * (gjbs - gbbsp + gIbtots); + *(here->BSIM4V4BPbpPtr ) += m * xcbbb * s->real; + *(here->BSIM4V4BPbpPtr +1) += m * xcbbb * s->imag; + *(here->BSIM4V4BPbpPtr) += m * (gjbd + gjbs - here->BSIM4V4gbbs + - gIbtotb); + ggidld = here->BSIM4V4ggidld; + ggidlg = here->BSIM4V4ggidlg; + ggidlb = here->BSIM4V4ggidlb; + ggislg = here->BSIM4V4ggislg; + ggisls = here->BSIM4V4ggisls; + ggislb = here->BSIM4V4ggislb; + + /* stamp gidl */ + (*(here->BSIM4V4DPdpPtr) += m * ggidld); + (*(here->BSIM4V4DPgpPtr) += m * ggidlg); + (*(here->BSIM4V4DPspPtr) -= m * ((ggidlg + ggidld) + ggidlb)); + (*(here->BSIM4V4DPbpPtr) += m * ggidlb); + (*(here->BSIM4V4BPdpPtr) -= m * ggidld); + (*(here->BSIM4V4BPgpPtr) -= m * ggidlg); + (*(here->BSIM4V4BPspPtr) += m * ((ggidlg + ggidld) + ggidlb)); + (*(here->BSIM4V4BPbpPtr) -= m * ggidlb); + /* stamp gisl */ + (*(here->BSIM4V4SPdpPtr) -= m * ((ggisls + ggislg) + ggislb)); + (*(here->BSIM4V4SPgpPtr) += m * ggislg); + (*(here->BSIM4V4SPspPtr) += m * ggisls); + (*(here->BSIM4V4SPbpPtr) += m * ggislb); + (*(here->BSIM4V4BPdpPtr) += m * ((ggislg + ggisls) + ggislb)); + (*(here->BSIM4V4BPgpPtr) -= m * ggislg); + (*(here->BSIM4V4BPspPtr) -= m * ggisls); + (*(here->BSIM4V4BPbpPtr) -= m * ggislb); + + if (here->BSIM4V4rbodyMod) + { (*(here->BSIM4V4DPdbPtr ) += m * xcdbdb * s->real); + (*(here->BSIM4V4DPdbPtr +1) += m * xcdbdb * s->imag); + (*(here->BSIM4V4DPdbPtr) -= m * here->BSIM4V4gbd); + (*(here->BSIM4V4SPsbPtr ) += m * xcsbsb * s->real); + (*(here->BSIM4V4SPsbPtr +1) += m * xcsbsb * s->imag); + (*(here->BSIM4V4SPsbPtr) -= m * here->BSIM4V4gbs); + + (*(here->BSIM4V4DBdpPtr ) += m * xcdbdb * s->real); + (*(here->BSIM4V4DBdpPtr +1) += m * xcdbdb * s->imag); + (*(here->BSIM4V4DBdpPtr) -= m * here->BSIM4V4gbd); + (*(here->BSIM4V4DBdbPtr ) -= m * xcdbdb * s->real); + (*(here->BSIM4V4DBdbPtr +1) -= m * xcdbdb * s->imag); + (*(here->BSIM4V4DBdbPtr) += m * (here->BSIM4V4gbd + here->BSIM4V4grbpd + + here->BSIM4V4grbdb)); + (*(here->BSIM4V4DBbpPtr) -= m * here->BSIM4V4grbpd); + (*(here->BSIM4V4DBbPtr) -= m * here->BSIM4V4grbdb); + + (*(here->BSIM4V4BPdbPtr) -= m * here->BSIM4V4grbpd); + (*(here->BSIM4V4BPbPtr) -= m * here->BSIM4V4grbpb); + (*(here->BSIM4V4BPsbPtr) -= m * here->BSIM4V4grbps); + (*(here->BSIM4V4BPbpPtr) += m * (here->BSIM4V4grbpd + here->BSIM4V4grbps + + here->BSIM4V4grbpb)); + /* WDL: (-here->BSIM4V4gbbs) already added to BPbpPtr */ + + (*(here->BSIM4V4SBspPtr ) += m * xcsbsb * s->real); + (*(here->BSIM4V4SBspPtr +1) += m * xcsbsb * s->imag); + (*(here->BSIM4V4SBspPtr) -= m * here->BSIM4V4gbs); + (*(here->BSIM4V4SBbpPtr) -= m * here->BSIM4V4grbps); + (*(here->BSIM4V4SBbPtr) -= m * here->BSIM4V4grbsb); + (*(here->BSIM4V4SBsbPtr ) -= m * xcsbsb * s->real); + (*(here->BSIM4V4SBsbPtr +1) -= m * xcsbsb * s->imag); + (*(here->BSIM4V4SBsbPtr) += m * (here->BSIM4V4gbs + + here->BSIM4V4grbps + here->BSIM4V4grbsb)); + + (*(here->BSIM4V4BdbPtr) -= m * here->BSIM4V4grbdb); + (*(here->BSIM4V4BbpPtr) -= m * here->BSIM4V4grbpb); + (*(here->BSIM4V4BsbPtr) -= m * here->BSIM4V4grbsb); + (*(here->BSIM4V4BbPtr) += m * (here->BSIM4V4grbsb + here->BSIM4V4grbdb + + here->BSIM4V4grbpb)); + } + + if (here->BSIM4V4acnqsMod) + { *(here->BSIM4V4QqPtr ) += m * s->real * ScalingFactor; + *(here->BSIM4V4QqPtr +1) += m * s->imag * ScalingFactor; + *(here->BSIM4V4QgpPtr ) -= m * xcqgb * s->real; + *(here->BSIM4V4QgpPtr +1) -= m * xcqgb * s->imag; + *(here->BSIM4V4QdpPtr ) -= m * xcqdb * s->real; + *(here->BSIM4V4QdpPtr +1) -= m * xcqdb * s->imag; + *(here->BSIM4V4QbpPtr ) -= m * xcqbb * s->real; + *(here->BSIM4V4QbpPtr +1) -= m * xcqbb * s->imag; + *(here->BSIM4V4QspPtr ) -= m * xcqsb * s->real; + *(here->BSIM4V4QspPtr +1) -= m * xcqsb * s->imag; + + *(here->BSIM4V4GPqPtr) -= m * here->BSIM4V4gtau; + *(here->BSIM4V4DPqPtr) += m * dxpart * here->BSIM4V4gtau; + *(here->BSIM4V4SPqPtr) += m * sxpart * here->BSIM4V4gtau; + + *(here->BSIM4V4QqPtr) += m * here->BSIM4V4gtau; + *(here->BSIM4V4QgpPtr) += m * xgtg; + *(here->BSIM4V4QdpPtr) += m * xgtd; + *(here->BSIM4V4QbpPtr) += m * xgtb; + *(here->BSIM4V4QspPtr) += m * xgts; + } + } + } + return(OK); +} diff --git a/src/spicelib/devices/bsim4v4/b4v4set.c b/src/spicelib/devices/bsim4v4/b4v4set.c new file mode 100644 index 000000000..9b9a14400 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4set.c @@ -0,0 +1,1922 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4set.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 11/15/2002. + * Modified by Xuemei Xi, 05/09/2003. + * Modified by Xuemei Xi, 03/04/2004. + **********/ + +#include "ngspice.h" +#include "jobdefs.h" /* Needed because the model searches for noise Analysis */ +#include "ftedefs.h" /* " " */ +#include "smpdefs.h" +#include "cktdefs.h" +#include "bsim4v4def.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 EPS0 8.85418e-12 +#define EPSSI 1.03594e-10 +#define PI 3.141592654 +#define Charge_q 1.60219e-19 + +int +BSIM4V4PAeffGeo(double, int, int, double, double, double, double, double *, double *, double *, double *); +int +BSIM4V4RdseffGeo(double, int, int, int, double, double, double, double, double, int, double *); + +int +BSIM4V4setup(matrix,inModel,ckt,states) +SMPmatrix *matrix; +GENmodel *inModel; +CKTcircuit *ckt; +int *states; +{ +BSIM4V4model *model = (BSIM4V4model*)inModel; +BSIM4V4instance *here; +int error; +CKTnode *tmp; +int noiseAnalGiven = 0, createNode; /* Criteria for new node creation */ +double Rtot, DMCGeff, DMCIeff, DMDGeff; +JOB *job; + + /* Search for a noise analysis request */ + for (job = ((TSKtask *)ft_curckt->ci_curTask)->jobs;job;job = job->JOBnextJob) { + if(strcmp(job->JOBname,"Noise Analysis")==0) { + noiseAnalGiven = 1; + break; + } + } + + /* loop through all the BSIM4V4 device models */ + for( ; model != NULL; model = model->BSIM4V4nextModel ) + { /* process defaults of model parameters */ + if (!model->BSIM4V4typeGiven) + model->BSIM4V4type = NMOS; + + if (!model->BSIM4V4mobModGiven) + model->BSIM4V4mobMod = 0; + else if ((model->BSIM4V4mobMod != 0) && (model->BSIM4V4mobMod != 1) + && (model->BSIM4V4mobMod != 2)) + { model->BSIM4V4mobMod = 0; + printf("Warning: mobMod has been set to its default value: 0.\n"); + } + + if (!model->BSIM4V4binUnitGiven) + model->BSIM4V4binUnit = 1; + if (!model->BSIM4V4paramChkGiven) + model->BSIM4V4paramChk = 1; + + if (!model->BSIM4V4dioModGiven) + model->BSIM4V4dioMod = 1; + else if ((model->BSIM4V4dioMod != 0) && (model->BSIM4V4dioMod != 1) + && (model->BSIM4V4dioMod != 2)) + { model->BSIM4V4dioMod = 1; + printf("Warning: dioMod has been set to its default value: 1.\n"); + } + + if (!model->BSIM4V4capModGiven) + model->BSIM4V4capMod = 2; + else if ((model->BSIM4V4capMod != 0) && (model->BSIM4V4capMod != 1) + && (model->BSIM4V4capMod != 2)) + { model->BSIM4V4capMod = 2; + printf("Warning: capMod has been set to its default value: 2.\n"); + } + + if (!model->BSIM4V4rdsModGiven) + model->BSIM4V4rdsMod = 0; + else if ((model->BSIM4V4rdsMod != 0) && (model->BSIM4V4rdsMod != 1)) + { model->BSIM4V4rdsMod = 0; + printf("Warning: rdsMod has been set to its default value: 0.\n"); + } + if (!model->BSIM4V4rbodyModGiven) + model->BSIM4V4rbodyMod = 0; + else if ((model->BSIM4V4rbodyMod != 0) && (model->BSIM4V4rbodyMod != 1)) + { model->BSIM4V4rbodyMod = 0; + printf("Warning: rbodyMod has been set to its default value: 0.\n"); + } + + if (!model->BSIM4V4rgateModGiven) + model->BSIM4V4rgateMod = 0; + else if ((model->BSIM4V4rgateMod != 0) && (model->BSIM4V4rgateMod != 1) + && (model->BSIM4V4rgateMod != 2) && (model->BSIM4V4rgateMod != 3)) + { model->BSIM4V4rgateMod = 0; + printf("Warning: rgateMod has been set to its default value: 0.\n"); + } + + if (!model->BSIM4V4perModGiven) + model->BSIM4V4perMod = 1; + else if ((model->BSIM4V4perMod != 0) && (model->BSIM4V4perMod != 1)) + { model->BSIM4V4perMod = 1; + printf("Warning: perMod has been set to its default value: 1.\n"); + } + + if (!model->BSIM4V4geoModGiven) + model->BSIM4V4geoMod = 0; + + if (!model->BSIM4V4fnoiModGiven) + model->BSIM4V4fnoiMod = 1; + else if ((model->BSIM4V4fnoiMod != 0) && (model->BSIM4V4fnoiMod != 1)) + { model->BSIM4V4fnoiMod = 1; + printf("Warning: fnoiMod has been set to its default value: 1.\n"); + } + if (!model->BSIM4V4tnoiModGiven) + model->BSIM4V4tnoiMod = 0; /* WDLiu: tnoiMod=1 needs to set internal S/D nodes */ + else if ((model->BSIM4V4tnoiMod != 0) && (model->BSIM4V4tnoiMod != 1)) + { model->BSIM4V4tnoiMod = 0; + printf("Warning: tnoiMod has been set to its default value: 0.\n"); + } + + if (!model->BSIM4V4trnqsModGiven) + model->BSIM4V4trnqsMod = 0; + else if ((model->BSIM4V4trnqsMod != 0) && (model->BSIM4V4trnqsMod != 1)) + { model->BSIM4V4trnqsMod = 0; + printf("Warning: trnqsMod has been set to its default value: 0.\n"); + } + if (!model->BSIM4V4acnqsModGiven) + model->BSIM4V4acnqsMod = 0; + else if ((model->BSIM4V4acnqsMod != 0) && (model->BSIM4V4acnqsMod != 1)) + { model->BSIM4V4acnqsMod = 0; + printf("Warning: acnqsMod has been set to its default value: 0.\n"); + } + + if (!model->BSIM4V4igcModGiven) + model->BSIM4V4igcMod = 0; + else if ((model->BSIM4V4igcMod != 0) && (model->BSIM4V4igcMod != 1)) + { model->BSIM4V4igcMod = 0; + printf("Warning: igcMod has been set to its default value: 0.\n"); + } + if (!model->BSIM4V4igbModGiven) + model->BSIM4V4igbMod = 0; + else if ((model->BSIM4V4igbMod != 0) && (model->BSIM4V4igbMod != 1)) + { model->BSIM4V4igbMod = 0; + printf("Warning: igbMod has been set to its default value: 0.\n"); + } + if (!model->BSIM4V4tempModGiven) + model->BSIM4V4tempMod = 0; + else if ((model->BSIM4V4tempMod != 0) && (model->BSIM4V4tempMod != 1)) + { model->BSIM4V4tempMod = 0; + printf("Warning: tempMod has been set to its default value: 0.\n"); + } + + if (!model->BSIM4V4versionGiven) + model->BSIM4V4version = "4.4.0"; + if (!model->BSIM4V4toxrefGiven) + model->BSIM4V4toxref = 30.0e-10; + if (!model->BSIM4V4toxeGiven) + model->BSIM4V4toxe = 30.0e-10; + if (!model->BSIM4V4toxpGiven) + model->BSIM4V4toxp = model->BSIM4V4toxe; + if (!model->BSIM4V4toxmGiven) + model->BSIM4V4toxm = model->BSIM4V4toxe; + if (!model->BSIM4V4dtoxGiven) + model->BSIM4V4dtox = 0.0; + if (!model->BSIM4V4epsroxGiven) + model->BSIM4V4epsrox = 3.9; + + if (!model->BSIM4V4cdscGiven) + model->BSIM4V4cdsc = 2.4e-4; /* unit Q/V/m^2 */ + if (!model->BSIM4V4cdscbGiven) + model->BSIM4V4cdscb = 0.0; /* unit Q/V/m^2 */ + if (!model->BSIM4V4cdscdGiven) + model->BSIM4V4cdscd = 0.0; /* unit Q/V/m^2 */ + if (!model->BSIM4V4citGiven) + model->BSIM4V4cit = 0.0; /* unit Q/V/m^2 */ + if (!model->BSIM4V4nfactorGiven) + model->BSIM4V4nfactor = 1.0; + if (!model->BSIM4V4xjGiven) + model->BSIM4V4xj = .15e-6; + if (!model->BSIM4V4vsatGiven) + model->BSIM4V4vsat = 8.0e4; /* unit m/s */ + if (!model->BSIM4V4atGiven) + model->BSIM4V4at = 3.3e4; /* unit m/s */ + if (!model->BSIM4V4a0Given) + model->BSIM4V4a0 = 1.0; + if (!model->BSIM4V4agsGiven) + model->BSIM4V4ags = 0.0; + if (!model->BSIM4V4a1Given) + model->BSIM4V4a1 = 0.0; + if (!model->BSIM4V4a2Given) + model->BSIM4V4a2 = 1.0; + if (!model->BSIM4V4ketaGiven) + model->BSIM4V4keta = -0.047; /* unit / V */ + if (!model->BSIM4V4nsubGiven) + model->BSIM4V4nsub = 6.0e16; /* unit 1/cm3 */ + if (!model->BSIM4V4ndepGiven) + model->BSIM4V4ndep = 1.7e17; /* unit 1/cm3 */ + if (!model->BSIM4V4nsdGiven) + model->BSIM4V4nsd = 1.0e20; /* unit 1/cm3 */ + if (!model->BSIM4V4phinGiven) + model->BSIM4V4phin = 0.0; /* unit V */ + if (!model->BSIM4V4ngateGiven) + model->BSIM4V4ngate = 0; /* unit 1/cm3 */ + if (!model->BSIM4V4vbmGiven) + model->BSIM4V4vbm = -3.0; + if (!model->BSIM4V4xtGiven) + model->BSIM4V4xt = 1.55e-7; + if (!model->BSIM4V4kt1Given) + model->BSIM4V4kt1 = -0.11; /* unit V */ + if (!model->BSIM4V4kt1lGiven) + model->BSIM4V4kt1l = 0.0; /* unit V*m */ + if (!model->BSIM4V4kt2Given) + model->BSIM4V4kt2 = 0.022; /* No unit */ + if (!model->BSIM4V4k3Given) + model->BSIM4V4k3 = 80.0; + if (!model->BSIM4V4k3bGiven) + model->BSIM4V4k3b = 0.0; + if (!model->BSIM4V4w0Given) + model->BSIM4V4w0 = 2.5e-6; + if (!model->BSIM4V4lpe0Given) + model->BSIM4V4lpe0 = 1.74e-7; + if (!model->BSIM4V4lpebGiven) + model->BSIM4V4lpeb = 0.0; + if (!model->BSIM4V4dvtp0Given) + model->BSIM4V4dvtp0 = 0.0; + if (!model->BSIM4V4dvtp1Given) + model->BSIM4V4dvtp1 = 0.0; + if (!model->BSIM4V4dvt0Given) + model->BSIM4V4dvt0 = 2.2; + if (!model->BSIM4V4dvt1Given) + model->BSIM4V4dvt1 = 0.53; + if (!model->BSIM4V4dvt2Given) + model->BSIM4V4dvt2 = -0.032; /* unit 1 / V */ + + if (!model->BSIM4V4dvt0wGiven) + model->BSIM4V4dvt0w = 0.0; + if (!model->BSIM4V4dvt1wGiven) + model->BSIM4V4dvt1w = 5.3e6; + if (!model->BSIM4V4dvt2wGiven) + model->BSIM4V4dvt2w = -0.032; + + if (!model->BSIM4V4droutGiven) + model->BSIM4V4drout = 0.56; + if (!model->BSIM4V4dsubGiven) + model->BSIM4V4dsub = model->BSIM4V4drout; + if (!model->BSIM4V4vth0Given) + model->BSIM4V4vth0 = (model->BSIM4V4type == NMOS) ? 0.7 : -0.7; + if (!model->BSIM4V4euGiven) + model->BSIM4V4eu = (model->BSIM4V4type == NMOS) ? 1.67 : 1.0;; + if (!model->BSIM4V4uaGiven) + model->BSIM4V4ua = (model->BSIM4V4mobMod == 2) ? 1.0e-15 : 1.0e-9; /* unit m/V */ + if (!model->BSIM4V4ua1Given) + model->BSIM4V4ua1 = 1.0e-9; /* unit m/V */ + if (!model->BSIM4V4ubGiven) + model->BSIM4V4ub = 1.0e-19; /* unit (m/V)**2 */ + if (!model->BSIM4V4ub1Given) + model->BSIM4V4ub1 = -1.0e-18; /* unit (m/V)**2 */ + if (!model->BSIM4V4ucGiven) + model->BSIM4V4uc = (model->BSIM4V4mobMod == 1) ? -0.0465 : -0.0465e-9; + if (!model->BSIM4V4uc1Given) + model->BSIM4V4uc1 = (model->BSIM4V4mobMod == 1) ? -0.056 : -0.056e-9; + if (!model->BSIM4V4u0Given) + model->BSIM4V4u0 = (model->BSIM4V4type == NMOS) ? 0.067 : 0.025; + if (!model->BSIM4V4uteGiven) + model->BSIM4V4ute = -1.5; + if (!model->BSIM4V4voffGiven) + model->BSIM4V4voff = -0.08; + if (!model->BSIM4V4vofflGiven) + model->BSIM4V4voffl = 0.0; + if (!model->BSIM4V4minvGiven) + model->BSIM4V4minv = 0.0; + if (!model->BSIM4V4fproutGiven) + model->BSIM4V4fprout = 0.0; + if (!model->BSIM4V4pditsGiven) + model->BSIM4V4pdits = 0.0; + if (!model->BSIM4V4pditsdGiven) + model->BSIM4V4pditsd = 0.0; + if (!model->BSIM4V4pditslGiven) + model->BSIM4V4pditsl = 0.0; + if (!model->BSIM4V4deltaGiven) + model->BSIM4V4delta = 0.01; + if (!model->BSIM4V4rdswminGiven) + model->BSIM4V4rdswmin = 0.0; + if (!model->BSIM4V4rdwminGiven) + model->BSIM4V4rdwmin = 0.0; + if (!model->BSIM4V4rswminGiven) + model->BSIM4V4rswmin = 0.0; + if (!model->BSIM4V4rdswGiven) + model->BSIM4V4rdsw = 200.0; /* in ohm*um */ + if (!model->BSIM4V4rdwGiven) + model->BSIM4V4rdw = 100.0; + if (!model->BSIM4V4rswGiven) + model->BSIM4V4rsw = 100.0; + if (!model->BSIM4V4prwgGiven) + model->BSIM4V4prwg = 1.0; /* in 1/V */ + if (!model->BSIM4V4prwbGiven) + model->BSIM4V4prwb = 0.0; + if (!model->BSIM4V4prtGiven) + if (!model->BSIM4V4prtGiven) + model->BSIM4V4prt = 0.0; + if (!model->BSIM4V4eta0Given) + model->BSIM4V4eta0 = 0.08; /* no unit */ + if (!model->BSIM4V4etabGiven) + model->BSIM4V4etab = -0.07; /* unit 1/V */ + if (!model->BSIM4V4pclmGiven) + model->BSIM4V4pclm = 1.3; /* no unit */ + if (!model->BSIM4V4pdibl1Given) + model->BSIM4V4pdibl1 = 0.39; /* no unit */ + if (!model->BSIM4V4pdibl2Given) + model->BSIM4V4pdibl2 = 0.0086; /* no unit */ + if (!model->BSIM4V4pdiblbGiven) + model->BSIM4V4pdiblb = 0.0; /* 1/V */ + if (!model->BSIM4V4pscbe1Given) + model->BSIM4V4pscbe1 = 4.24e8; + if (!model->BSIM4V4pscbe2Given) + model->BSIM4V4pscbe2 = 1.0e-5; + if (!model->BSIM4V4pvagGiven) + model->BSIM4V4pvag = 0.0; + if (!model->BSIM4V4wrGiven) + model->BSIM4V4wr = 1.0; + if (!model->BSIM4V4dwgGiven) + model->BSIM4V4dwg = 0.0; + if (!model->BSIM4V4dwbGiven) + model->BSIM4V4dwb = 0.0; + if (!model->BSIM4V4b0Given) + model->BSIM4V4b0 = 0.0; + if (!model->BSIM4V4b1Given) + model->BSIM4V4b1 = 0.0; + if (!model->BSIM4V4alpha0Given) + model->BSIM4V4alpha0 = 0.0; + if (!model->BSIM4V4alpha1Given) + model->BSIM4V4alpha1 = 0.0; + if (!model->BSIM4V4beta0Given) + model->BSIM4V4beta0 = 30.0; + if (!model->BSIM4V4agidlGiven) + model->BSIM4V4agidl = 0.0; + if (!model->BSIM4V4bgidlGiven) + model->BSIM4V4bgidl = 2.3e9; /* V/m */ + if (!model->BSIM4V4cgidlGiven) + model->BSIM4V4cgidl = 0.5; /* V^3 */ + if (!model->BSIM4V4egidlGiven) + model->BSIM4V4egidl = 0.8; /* V */ + if (!model->BSIM4V4aigcGiven) + model->BSIM4V4aigc = (model->BSIM4V4type == NMOS) ? 0.43 : 0.31; + if (!model->BSIM4V4bigcGiven) + model->BSIM4V4bigc = (model->BSIM4V4type == NMOS) ? 0.054 : 0.024; + if (!model->BSIM4V4cigcGiven) + model->BSIM4V4cigc = (model->BSIM4V4type == NMOS) ? 0.075 : 0.03; + if (!model->BSIM4V4aigsdGiven) + model->BSIM4V4aigsd = (model->BSIM4V4type == NMOS) ? 0.43 : 0.31; + if (!model->BSIM4V4bigsdGiven) + model->BSIM4V4bigsd = (model->BSIM4V4type == NMOS) ? 0.054 : 0.024; + if (!model->BSIM4V4cigsdGiven) + model->BSIM4V4cigsd = (model->BSIM4V4type == NMOS) ? 0.075 : 0.03; + if (!model->BSIM4V4aigbaccGiven) + model->BSIM4V4aigbacc = 0.43; + if (!model->BSIM4V4bigbaccGiven) + model->BSIM4V4bigbacc = 0.054; + if (!model->BSIM4V4cigbaccGiven) + model->BSIM4V4cigbacc = 0.075; + if (!model->BSIM4V4aigbinvGiven) + model->BSIM4V4aigbinv = 0.35; + if (!model->BSIM4V4bigbinvGiven) + model->BSIM4V4bigbinv = 0.03; + if (!model->BSIM4V4cigbinvGiven) + model->BSIM4V4cigbinv = 0.006; + if (!model->BSIM4V4nigcGiven) + model->BSIM4V4nigc = 1.0; + if (!model->BSIM4V4nigbinvGiven) + model->BSIM4V4nigbinv = 3.0; + if (!model->BSIM4V4nigbaccGiven) + model->BSIM4V4nigbacc = 1.0; + if (!model->BSIM4V4ntoxGiven) + model->BSIM4V4ntox = 1.0; + if (!model->BSIM4V4eigbinvGiven) + model->BSIM4V4eigbinv = 1.1; + if (!model->BSIM4V4pigcdGiven) + model->BSIM4V4pigcd = 1.0; + if (!model->BSIM4V4poxedgeGiven) + model->BSIM4V4poxedge = 1.0; + if (!model->BSIM4V4xrcrg1Given) + model->BSIM4V4xrcrg1 = 12.0; + if (!model->BSIM4V4xrcrg2Given) + model->BSIM4V4xrcrg2 = 1.0; + if (!model->BSIM4V4ijthsfwdGiven) + model->BSIM4V4ijthsfwd = 0.1; /* unit A */ + if (!model->BSIM4V4ijthdfwdGiven) + model->BSIM4V4ijthdfwd = model->BSIM4V4ijthsfwd; + if (!model->BSIM4V4ijthsrevGiven) + model->BSIM4V4ijthsrev = 0.1; /* unit A */ + if (!model->BSIM4V4ijthdrevGiven) + model->BSIM4V4ijthdrev = model->BSIM4V4ijthsrev; + if (!model->BSIM4V4tnoiaGiven) + model->BSIM4V4tnoia = 1.5; + if (!model->BSIM4V4tnoibGiven) + model->BSIM4V4tnoib = 3.5; + if (!model->BSIM4V4rnoiaGiven) + model->BSIM4V4rnoia = 0.577; + if (!model->BSIM4V4rnoibGiven) + model->BSIM4V4rnoib = 0.5164; + if (!model->BSIM4V4ntnoiGiven) + model->BSIM4V4ntnoi = 1.0; + if (!model->BSIM4V4lambdaGiven) + model->BSIM4V4lambda = 0.0; + if (!model->BSIM4V4vtlGiven) + model->BSIM4V4vtl = 2.0e5; /* unit m/s */ + if (!model->BSIM4V4xnGiven) + model->BSIM4V4xn = 3.0; + if (!model->BSIM4V4lcGiven) + model->BSIM4V4lc = 5.0e-9; + if (!model->BSIM4V4vfbsdoffGiven) + model->BSIM4V4vfbsdoff = 0.0; /* unit v */ + if (!model->BSIM4V4lintnoiGiven) + model->BSIM4V4lintnoi = 0.0; /* unit m */ + + if (!model->BSIM4V4xjbvsGiven) + model->BSIM4V4xjbvs = 1.0; /* no unit */ + if (!model->BSIM4V4xjbvdGiven) + model->BSIM4V4xjbvd = model->BSIM4V4xjbvs; + if (!model->BSIM4V4bvsGiven) + model->BSIM4V4bvs = 10.0; /* V */ + if (!model->BSIM4V4bvdGiven) + model->BSIM4V4bvd = model->BSIM4V4bvs; + + if (!model->BSIM4V4gbminGiven) + model->BSIM4V4gbmin = 1.0e-12; /* in mho */ + if (!model->BSIM4V4rbdbGiven) + model->BSIM4V4rbdb = 50.0; /* in ohm */ + if (!model->BSIM4V4rbpbGiven) + model->BSIM4V4rbpb = 50.0; + if (!model->BSIM4V4rbsbGiven) + model->BSIM4V4rbsb = 50.0; + if (!model->BSIM4V4rbpsGiven) + model->BSIM4V4rbps = 50.0; + if (!model->BSIM4V4rbpdGiven) + model->BSIM4V4rbpd = 50.0; + + if (!model->BSIM4V4cgslGiven) + model->BSIM4V4cgsl = 0.0; + if (!model->BSIM4V4cgdlGiven) + model->BSIM4V4cgdl = 0.0; + if (!model->BSIM4V4ckappasGiven) + model->BSIM4V4ckappas = 0.6; + if (!model->BSIM4V4ckappadGiven) + model->BSIM4V4ckappad = model->BSIM4V4ckappas; + if (!model->BSIM4V4clcGiven) + model->BSIM4V4clc = 0.1e-6; + if (!model->BSIM4V4cleGiven) + model->BSIM4V4cle = 0.6; + if (!model->BSIM4V4vfbcvGiven) + model->BSIM4V4vfbcv = -1.0; + if (!model->BSIM4V4acdeGiven) + model->BSIM4V4acde = 1.0; + if (!model->BSIM4V4moinGiven) + model->BSIM4V4moin = 15.0; + if (!model->BSIM4V4noffGiven) + model->BSIM4V4noff = 1.0; + if (!model->BSIM4V4voffcvGiven) + model->BSIM4V4voffcv = 0.0; + if (!model->BSIM4V4dmcgGiven) + model->BSIM4V4dmcg = 0.0; + if (!model->BSIM4V4dmciGiven) + model->BSIM4V4dmci = model->BSIM4V4dmcg; + if (!model->BSIM4V4dmdgGiven) + model->BSIM4V4dmdg = 0.0; + if (!model->BSIM4V4dmcgtGiven) + model->BSIM4V4dmcgt = 0.0; + if (!model->BSIM4V4xgwGiven) + model->BSIM4V4xgw = 0.0; + if (!model->BSIM4V4xglGiven) + model->BSIM4V4xgl = 0.0; + if (!model->BSIM4V4rshgGiven) + model->BSIM4V4rshg = 0.1; + if (!model->BSIM4V4ngconGiven) + model->BSIM4V4ngcon = 1.0; + if (!model->BSIM4V4tcjGiven) + model->BSIM4V4tcj = 0.0; + if (!model->BSIM4V4tpbGiven) + model->BSIM4V4tpb = 0.0; + if (!model->BSIM4V4tcjswGiven) + model->BSIM4V4tcjsw = 0.0; + if (!model->BSIM4V4tpbswGiven) + model->BSIM4V4tpbsw = 0.0; + if (!model->BSIM4V4tcjswgGiven) + model->BSIM4V4tcjswg = 0.0; + if (!model->BSIM4V4tpbswgGiven) + model->BSIM4V4tpbswg = 0.0; + + /* Length dependence */ + if (!model->BSIM4V4lcdscGiven) + model->BSIM4V4lcdsc = 0.0; + if (!model->BSIM4V4lcdscbGiven) + model->BSIM4V4lcdscb = 0.0; + if (!model->BSIM4V4lcdscdGiven) + model->BSIM4V4lcdscd = 0.0; + if (!model->BSIM4V4lcitGiven) + model->BSIM4V4lcit = 0.0; + if (!model->BSIM4V4lnfactorGiven) + model->BSIM4V4lnfactor = 0.0; + if (!model->BSIM4V4lxjGiven) + model->BSIM4V4lxj = 0.0; + if (!model->BSIM4V4lvsatGiven) + model->BSIM4V4lvsat = 0.0; + if (!model->BSIM4V4latGiven) + model->BSIM4V4lat = 0.0; + if (!model->BSIM4V4la0Given) + model->BSIM4V4la0 = 0.0; + if (!model->BSIM4V4lagsGiven) + model->BSIM4V4lags = 0.0; + if (!model->BSIM4V4la1Given) + model->BSIM4V4la1 = 0.0; + if (!model->BSIM4V4la2Given) + model->BSIM4V4la2 = 0.0; + if (!model->BSIM4V4lketaGiven) + model->BSIM4V4lketa = 0.0; + if (!model->BSIM4V4lnsubGiven) + model->BSIM4V4lnsub = 0.0; + if (!model->BSIM4V4lndepGiven) + model->BSIM4V4lndep = 0.0; + if (!model->BSIM4V4lnsdGiven) + model->BSIM4V4lnsd = 0.0; + if (!model->BSIM4V4lphinGiven) + model->BSIM4V4lphin = 0.0; + if (!model->BSIM4V4lngateGiven) + model->BSIM4V4lngate = 0.0; + if (!model->BSIM4V4lvbmGiven) + model->BSIM4V4lvbm = 0.0; + if (!model->BSIM4V4lxtGiven) + model->BSIM4V4lxt = 0.0; + if (!model->BSIM4V4lkt1Given) + model->BSIM4V4lkt1 = 0.0; + if (!model->BSIM4V4lkt1lGiven) + model->BSIM4V4lkt1l = 0.0; + if (!model->BSIM4V4lkt2Given) + model->BSIM4V4lkt2 = 0.0; + if (!model->BSIM4V4lk3Given) + model->BSIM4V4lk3 = 0.0; + if (!model->BSIM4V4lk3bGiven) + model->BSIM4V4lk3b = 0.0; + if (!model->BSIM4V4lw0Given) + model->BSIM4V4lw0 = 0.0; + if (!model->BSIM4V4llpe0Given) + model->BSIM4V4llpe0 = 0.0; + if (!model->BSIM4V4llpebGiven) + model->BSIM4V4llpeb = 0.0; + if (!model->BSIM4V4ldvtp0Given) + model->BSIM4V4ldvtp0 = 0.0; + if (!model->BSIM4V4ldvtp1Given) + model->BSIM4V4ldvtp1 = 0.0; + if (!model->BSIM4V4ldvt0Given) + model->BSIM4V4ldvt0 = 0.0; + if (!model->BSIM4V4ldvt1Given) + model->BSIM4V4ldvt1 = 0.0; + if (!model->BSIM4V4ldvt2Given) + model->BSIM4V4ldvt2 = 0.0; + if (!model->BSIM4V4ldvt0wGiven) + model->BSIM4V4ldvt0w = 0.0; + if (!model->BSIM4V4ldvt1wGiven) + model->BSIM4V4ldvt1w = 0.0; + if (!model->BSIM4V4ldvt2wGiven) + model->BSIM4V4ldvt2w = 0.0; + if (!model->BSIM4V4ldroutGiven) + model->BSIM4V4ldrout = 0.0; + if (!model->BSIM4V4ldsubGiven) + model->BSIM4V4ldsub = 0.0; + if (!model->BSIM4V4lvth0Given) + model->BSIM4V4lvth0 = 0.0; + if (!model->BSIM4V4luaGiven) + model->BSIM4V4lua = 0.0; + if (!model->BSIM4V4lua1Given) + model->BSIM4V4lua1 = 0.0; + if (!model->BSIM4V4lubGiven) + model->BSIM4V4lub = 0.0; + if (!model->BSIM4V4lub1Given) + model->BSIM4V4lub1 = 0.0; + if (!model->BSIM4V4lucGiven) + model->BSIM4V4luc = 0.0; + if (!model->BSIM4V4luc1Given) + model->BSIM4V4luc1 = 0.0; + if (!model->BSIM4V4lu0Given) + model->BSIM4V4lu0 = 0.0; + if (!model->BSIM4V4luteGiven) + model->BSIM4V4lute = 0.0; + if (!model->BSIM4V4lvoffGiven) + model->BSIM4V4lvoff = 0.0; + if (!model->BSIM4V4lminvGiven) + model->BSIM4V4lminv = 0.0; + if (!model->BSIM4V4lfproutGiven) + model->BSIM4V4lfprout = 0.0; + if (!model->BSIM4V4lpditsGiven) + model->BSIM4V4lpdits = 0.0; + if (!model->BSIM4V4lpditsdGiven) + model->BSIM4V4lpditsd = 0.0; + if (!model->BSIM4V4ldeltaGiven) + model->BSIM4V4ldelta = 0.0; + if (!model->BSIM4V4lrdswGiven) + model->BSIM4V4lrdsw = 0.0; + if (!model->BSIM4V4lrdwGiven) + model->BSIM4V4lrdw = 0.0; + if (!model->BSIM4V4lrswGiven) + model->BSIM4V4lrsw = 0.0; + if (!model->BSIM4V4lprwbGiven) + model->BSIM4V4lprwb = 0.0; + if (!model->BSIM4V4lprwgGiven) + model->BSIM4V4lprwg = 0.0; + if (!model->BSIM4V4lprtGiven) + model->BSIM4V4lprt = 0.0; + if (!model->BSIM4V4leta0Given) + model->BSIM4V4leta0 = 0.0; + if (!model->BSIM4V4letabGiven) + model->BSIM4V4letab = -0.0; + if (!model->BSIM4V4lpclmGiven) + model->BSIM4V4lpclm = 0.0; + if (!model->BSIM4V4lpdibl1Given) + model->BSIM4V4lpdibl1 = 0.0; + if (!model->BSIM4V4lpdibl2Given) + model->BSIM4V4lpdibl2 = 0.0; + if (!model->BSIM4V4lpdiblbGiven) + model->BSIM4V4lpdiblb = 0.0; + if (!model->BSIM4V4lpscbe1Given) + model->BSIM4V4lpscbe1 = 0.0; + if (!model->BSIM4V4lpscbe2Given) + model->BSIM4V4lpscbe2 = 0.0; + if (!model->BSIM4V4lpvagGiven) + model->BSIM4V4lpvag = 0.0; + if (!model->BSIM4V4lwrGiven) + model->BSIM4V4lwr = 0.0; + if (!model->BSIM4V4ldwgGiven) + model->BSIM4V4ldwg = 0.0; + if (!model->BSIM4V4ldwbGiven) + model->BSIM4V4ldwb = 0.0; + if (!model->BSIM4V4lb0Given) + model->BSIM4V4lb0 = 0.0; + if (!model->BSIM4V4lb1Given) + model->BSIM4V4lb1 = 0.0; + if (!model->BSIM4V4lalpha0Given) + model->BSIM4V4lalpha0 = 0.0; + if (!model->BSIM4V4lalpha1Given) + model->BSIM4V4lalpha1 = 0.0; + if (!model->BSIM4V4lbeta0Given) + model->BSIM4V4lbeta0 = 0.0; + if (!model->BSIM4V4lagidlGiven) + model->BSIM4V4lagidl = 0.0; + if (!model->BSIM4V4lbgidlGiven) + model->BSIM4V4lbgidl = 0.0; + if (!model->BSIM4V4lcgidlGiven) + model->BSIM4V4lcgidl = 0.0; + if (!model->BSIM4V4legidlGiven) + model->BSIM4V4legidl = 0.0; + if (!model->BSIM4V4laigcGiven) + model->BSIM4V4laigc = 0.0; + if (!model->BSIM4V4lbigcGiven) + model->BSIM4V4lbigc = 0.0; + if (!model->BSIM4V4lcigcGiven) + model->BSIM4V4lcigc = 0.0; + if (!model->BSIM4V4laigsdGiven) + model->BSIM4V4laigsd = 0.0; + if (!model->BSIM4V4lbigsdGiven) + model->BSIM4V4lbigsd = 0.0; + if (!model->BSIM4V4lcigsdGiven) + model->BSIM4V4lcigsd = 0.0; + if (!model->BSIM4V4laigbaccGiven) + model->BSIM4V4laigbacc = 0.0; + if (!model->BSIM4V4lbigbaccGiven) + model->BSIM4V4lbigbacc = 0.0; + if (!model->BSIM4V4lcigbaccGiven) + model->BSIM4V4lcigbacc = 0.0; + if (!model->BSIM4V4laigbinvGiven) + model->BSIM4V4laigbinv = 0.0; + if (!model->BSIM4V4lbigbinvGiven) + model->BSIM4V4lbigbinv = 0.0; + if (!model->BSIM4V4lcigbinvGiven) + model->BSIM4V4lcigbinv = 0.0; + if (!model->BSIM4V4lnigcGiven) + model->BSIM4V4lnigc = 0.0; + if (!model->BSIM4V4lnigbinvGiven) + model->BSIM4V4lnigbinv = 0.0; + if (!model->BSIM4V4lnigbaccGiven) + model->BSIM4V4lnigbacc = 0.0; + if (!model->BSIM4V4lntoxGiven) + model->BSIM4V4lntox = 0.0; + if (!model->BSIM4V4leigbinvGiven) + model->BSIM4V4leigbinv = 0.0; + if (!model->BSIM4V4lpigcdGiven) + model->BSIM4V4lpigcd = 0.0; + if (!model->BSIM4V4lpoxedgeGiven) + model->BSIM4V4lpoxedge = 0.0; + if (!model->BSIM4V4lxrcrg1Given) + model->BSIM4V4lxrcrg1 = 0.0; + if (!model->BSIM4V4lxrcrg2Given) + model->BSIM4V4lxrcrg2 = 0.0; + if (!model->BSIM4V4leuGiven) + model->BSIM4V4leu = 0.0; + if (!model->BSIM4V4lvfbGiven) + model->BSIM4V4lvfb = 0.0; + if (!model->BSIM4V4llambdaGiven) + model->BSIM4V4llambda = 0.0; + if (!model->BSIM4V4lvtlGiven) + model->BSIM4V4lvtl = 0.0; + if (!model->BSIM4V4lxnGiven) + model->BSIM4V4lxn = 0.0; + if (!model->BSIM4V4lvfbsdoffGiven) + model->BSIM4V4lvfbsdoff = 0.0; + + if (!model->BSIM4V4lcgslGiven) + model->BSIM4V4lcgsl = 0.0; + if (!model->BSIM4V4lcgdlGiven) + model->BSIM4V4lcgdl = 0.0; + if (!model->BSIM4V4lckappasGiven) + model->BSIM4V4lckappas = 0.0; + if (!model->BSIM4V4lckappadGiven) + model->BSIM4V4lckappad = 0.0; + if (!model->BSIM4V4lclcGiven) + model->BSIM4V4lclc = 0.0; + if (!model->BSIM4V4lcleGiven) + model->BSIM4V4lcle = 0.0; + if (!model->BSIM4V4lcfGiven) + model->BSIM4V4lcf = 0.0; + if (!model->BSIM4V4lvfbcvGiven) + model->BSIM4V4lvfbcv = 0.0; + if (!model->BSIM4V4lacdeGiven) + model->BSIM4V4lacde = 0.0; + if (!model->BSIM4V4lmoinGiven) + model->BSIM4V4lmoin = 0.0; + if (!model->BSIM4V4lnoffGiven) + model->BSIM4V4lnoff = 0.0; + if (!model->BSIM4V4lvoffcvGiven) + model->BSIM4V4lvoffcv = 0.0; + + /* Width dependence */ + if (!model->BSIM4V4wcdscGiven) + model->BSIM4V4wcdsc = 0.0; + if (!model->BSIM4V4wcdscbGiven) + model->BSIM4V4wcdscb = 0.0; + if (!model->BSIM4V4wcdscdGiven) + model->BSIM4V4wcdscd = 0.0; + if (!model->BSIM4V4wcitGiven) + model->BSIM4V4wcit = 0.0; + if (!model->BSIM4V4wnfactorGiven) + model->BSIM4V4wnfactor = 0.0; + if (!model->BSIM4V4wxjGiven) + model->BSIM4V4wxj = 0.0; + if (!model->BSIM4V4wvsatGiven) + model->BSIM4V4wvsat = 0.0; + if (!model->BSIM4V4watGiven) + model->BSIM4V4wat = 0.0; + if (!model->BSIM4V4wa0Given) + model->BSIM4V4wa0 = 0.0; + if (!model->BSIM4V4wagsGiven) + model->BSIM4V4wags = 0.0; + if (!model->BSIM4V4wa1Given) + model->BSIM4V4wa1 = 0.0; + if (!model->BSIM4V4wa2Given) + model->BSIM4V4wa2 = 0.0; + if (!model->BSIM4V4wketaGiven) + model->BSIM4V4wketa = 0.0; + if (!model->BSIM4V4wnsubGiven) + model->BSIM4V4wnsub = 0.0; + if (!model->BSIM4V4wndepGiven) + model->BSIM4V4wndep = 0.0; + if (!model->BSIM4V4wnsdGiven) + model->BSIM4V4wnsd = 0.0; + if (!model->BSIM4V4wphinGiven) + model->BSIM4V4wphin = 0.0; + if (!model->BSIM4V4wngateGiven) + model->BSIM4V4wngate = 0.0; + if (!model->BSIM4V4wvbmGiven) + model->BSIM4V4wvbm = 0.0; + if (!model->BSIM4V4wxtGiven) + model->BSIM4V4wxt = 0.0; + if (!model->BSIM4V4wkt1Given) + model->BSIM4V4wkt1 = 0.0; + if (!model->BSIM4V4wkt1lGiven) + model->BSIM4V4wkt1l = 0.0; + if (!model->BSIM4V4wkt2Given) + model->BSIM4V4wkt2 = 0.0; + if (!model->BSIM4V4wk3Given) + model->BSIM4V4wk3 = 0.0; + if (!model->BSIM4V4wk3bGiven) + model->BSIM4V4wk3b = 0.0; + if (!model->BSIM4V4ww0Given) + model->BSIM4V4ww0 = 0.0; + if (!model->BSIM4V4wlpe0Given) + model->BSIM4V4wlpe0 = 0.0; + if (!model->BSIM4V4wlpebGiven) + model->BSIM4V4wlpeb = 0.0; + if (!model->BSIM4V4wdvtp0Given) + model->BSIM4V4wdvtp0 = 0.0; + if (!model->BSIM4V4wdvtp1Given) + model->BSIM4V4wdvtp1 = 0.0; + if (!model->BSIM4V4wdvt0Given) + model->BSIM4V4wdvt0 = 0.0; + if (!model->BSIM4V4wdvt1Given) + model->BSIM4V4wdvt1 = 0.0; + if (!model->BSIM4V4wdvt2Given) + model->BSIM4V4wdvt2 = 0.0; + if (!model->BSIM4V4wdvt0wGiven) + model->BSIM4V4wdvt0w = 0.0; + if (!model->BSIM4V4wdvt1wGiven) + model->BSIM4V4wdvt1w = 0.0; + if (!model->BSIM4V4wdvt2wGiven) + model->BSIM4V4wdvt2w = 0.0; + if (!model->BSIM4V4wdroutGiven) + model->BSIM4V4wdrout = 0.0; + if (!model->BSIM4V4wdsubGiven) + model->BSIM4V4wdsub = 0.0; + if (!model->BSIM4V4wvth0Given) + model->BSIM4V4wvth0 = 0.0; + if (!model->BSIM4V4wuaGiven) + model->BSIM4V4wua = 0.0; + if (!model->BSIM4V4wua1Given) + model->BSIM4V4wua1 = 0.0; + if (!model->BSIM4V4wubGiven) + model->BSIM4V4wub = 0.0; + if (!model->BSIM4V4wub1Given) + model->BSIM4V4wub1 = 0.0; + if (!model->BSIM4V4wucGiven) + model->BSIM4V4wuc = 0.0; + if (!model->BSIM4V4wuc1Given) + model->BSIM4V4wuc1 = 0.0; + if (!model->BSIM4V4wu0Given) + model->BSIM4V4wu0 = 0.0; + if (!model->BSIM4V4wuteGiven) + model->BSIM4V4wute = 0.0; + if (!model->BSIM4V4wvoffGiven) + model->BSIM4V4wvoff = 0.0; + if (!model->BSIM4V4wminvGiven) + model->BSIM4V4wminv = 0.0; + if (!model->BSIM4V4wfproutGiven) + model->BSIM4V4wfprout = 0.0; + if (!model->BSIM4V4wpditsGiven) + model->BSIM4V4wpdits = 0.0; + if (!model->BSIM4V4wpditsdGiven) + model->BSIM4V4wpditsd = 0.0; + if (!model->BSIM4V4wdeltaGiven) + model->BSIM4V4wdelta = 0.0; + if (!model->BSIM4V4wrdswGiven) + model->BSIM4V4wrdsw = 0.0; + if (!model->BSIM4V4wrdwGiven) + model->BSIM4V4wrdw = 0.0; + if (!model->BSIM4V4wrswGiven) + model->BSIM4V4wrsw = 0.0; + if (!model->BSIM4V4wprwbGiven) + model->BSIM4V4wprwb = 0.0; + if (!model->BSIM4V4wprwgGiven) + model->BSIM4V4wprwg = 0.0; + if (!model->BSIM4V4wprtGiven) + model->BSIM4V4wprt = 0.0; + if (!model->BSIM4V4weta0Given) + model->BSIM4V4weta0 = 0.0; + if (!model->BSIM4V4wetabGiven) + model->BSIM4V4wetab = 0.0; + if (!model->BSIM4V4wpclmGiven) + model->BSIM4V4wpclm = 0.0; + if (!model->BSIM4V4wpdibl1Given) + model->BSIM4V4wpdibl1 = 0.0; + if (!model->BSIM4V4wpdibl2Given) + model->BSIM4V4wpdibl2 = 0.0; + if (!model->BSIM4V4wpdiblbGiven) + model->BSIM4V4wpdiblb = 0.0; + if (!model->BSIM4V4wpscbe1Given) + model->BSIM4V4wpscbe1 = 0.0; + if (!model->BSIM4V4wpscbe2Given) + model->BSIM4V4wpscbe2 = 0.0; + if (!model->BSIM4V4wpvagGiven) + model->BSIM4V4wpvag = 0.0; + if (!model->BSIM4V4wwrGiven) + model->BSIM4V4wwr = 0.0; + if (!model->BSIM4V4wdwgGiven) + model->BSIM4V4wdwg = 0.0; + if (!model->BSIM4V4wdwbGiven) + model->BSIM4V4wdwb = 0.0; + if (!model->BSIM4V4wb0Given) + model->BSIM4V4wb0 = 0.0; + if (!model->BSIM4V4wb1Given) + model->BSIM4V4wb1 = 0.0; + if (!model->BSIM4V4walpha0Given) + model->BSIM4V4walpha0 = 0.0; + if (!model->BSIM4V4walpha1Given) + model->BSIM4V4walpha1 = 0.0; + if (!model->BSIM4V4wbeta0Given) + model->BSIM4V4wbeta0 = 0.0; + if (!model->BSIM4V4wagidlGiven) + model->BSIM4V4wagidl = 0.0; + if (!model->BSIM4V4wbgidlGiven) + model->BSIM4V4wbgidl = 0.0; + if (!model->BSIM4V4wcgidlGiven) + model->BSIM4V4wcgidl = 0.0; + if (!model->BSIM4V4wegidlGiven) + model->BSIM4V4wegidl = 0.0; + if (!model->BSIM4V4waigcGiven) + model->BSIM4V4waigc = 0.0; + if (!model->BSIM4V4wbigcGiven) + model->BSIM4V4wbigc = 0.0; + if (!model->BSIM4V4wcigcGiven) + model->BSIM4V4wcigc = 0.0; + if (!model->BSIM4V4waigsdGiven) + model->BSIM4V4waigsd = 0.0; + if (!model->BSIM4V4wbigsdGiven) + model->BSIM4V4wbigsd = 0.0; + if (!model->BSIM4V4wcigsdGiven) + model->BSIM4V4wcigsd = 0.0; + if (!model->BSIM4V4waigbaccGiven) + model->BSIM4V4waigbacc = 0.0; + if (!model->BSIM4V4wbigbaccGiven) + model->BSIM4V4wbigbacc = 0.0; + if (!model->BSIM4V4wcigbaccGiven) + model->BSIM4V4wcigbacc = 0.0; + if (!model->BSIM4V4waigbinvGiven) + model->BSIM4V4waigbinv = 0.0; + if (!model->BSIM4V4wbigbinvGiven) + model->BSIM4V4wbigbinv = 0.0; + if (!model->BSIM4V4wcigbinvGiven) + model->BSIM4V4wcigbinv = 0.0; + if (!model->BSIM4V4wnigcGiven) + model->BSIM4V4wnigc = 0.0; + if (!model->BSIM4V4wnigbinvGiven) + model->BSIM4V4wnigbinv = 0.0; + if (!model->BSIM4V4wnigbaccGiven) + model->BSIM4V4wnigbacc = 0.0; + if (!model->BSIM4V4wntoxGiven) + model->BSIM4V4wntox = 0.0; + if (!model->BSIM4V4weigbinvGiven) + model->BSIM4V4weigbinv = 0.0; + if (!model->BSIM4V4wpigcdGiven) + model->BSIM4V4wpigcd = 0.0; + if (!model->BSIM4V4wpoxedgeGiven) + model->BSIM4V4wpoxedge = 0.0; + if (!model->BSIM4V4wxrcrg1Given) + model->BSIM4V4wxrcrg1 = 0.0; + if (!model->BSIM4V4wxrcrg2Given) + model->BSIM4V4wxrcrg2 = 0.0; + if (!model->BSIM4V4weuGiven) + model->BSIM4V4weu = 0.0; + if (!model->BSIM4V4wvfbGiven) + model->BSIM4V4wvfb = 0.0; + if (!model->BSIM4V4wlambdaGiven) + model->BSIM4V4wlambda = 0.0; + if (!model->BSIM4V4wvtlGiven) + model->BSIM4V4wvtl = 0.0; + if (!model->BSIM4V4wxnGiven) + model->BSIM4V4wxn = 0.0; + if (!model->BSIM4V4wvfbsdoffGiven) + model->BSIM4V4wvfbsdoff = 0.0; + + if (!model->BSIM4V4wcgslGiven) + model->BSIM4V4wcgsl = 0.0; + if (!model->BSIM4V4wcgdlGiven) + model->BSIM4V4wcgdl = 0.0; + if (!model->BSIM4V4wckappasGiven) + model->BSIM4V4wckappas = 0.0; + if (!model->BSIM4V4wckappadGiven) + model->BSIM4V4wckappad = 0.0; + if (!model->BSIM4V4wcfGiven) + model->BSIM4V4wcf = 0.0; + if (!model->BSIM4V4wclcGiven) + model->BSIM4V4wclc = 0.0; + if (!model->BSIM4V4wcleGiven) + model->BSIM4V4wcle = 0.0; + if (!model->BSIM4V4wvfbcvGiven) + model->BSIM4V4wvfbcv = 0.0; + if (!model->BSIM4V4wacdeGiven) + model->BSIM4V4wacde = 0.0; + if (!model->BSIM4V4wmoinGiven) + model->BSIM4V4wmoin = 0.0; + if (!model->BSIM4V4wnoffGiven) + model->BSIM4V4wnoff = 0.0; + if (!model->BSIM4V4wvoffcvGiven) + model->BSIM4V4wvoffcv = 0.0; + + /* Cross-term dependence */ + if (!model->BSIM4V4pcdscGiven) + model->BSIM4V4pcdsc = 0.0; + if (!model->BSIM4V4pcdscbGiven) + model->BSIM4V4pcdscb = 0.0; + if (!model->BSIM4V4pcdscdGiven) + model->BSIM4V4pcdscd = 0.0; + if (!model->BSIM4V4pcitGiven) + model->BSIM4V4pcit = 0.0; + if (!model->BSIM4V4pnfactorGiven) + model->BSIM4V4pnfactor = 0.0; + if (!model->BSIM4V4pxjGiven) + model->BSIM4V4pxj = 0.0; + if (!model->BSIM4V4pvsatGiven) + model->BSIM4V4pvsat = 0.0; + if (!model->BSIM4V4patGiven) + model->BSIM4V4pat = 0.0; + if (!model->BSIM4V4pa0Given) + model->BSIM4V4pa0 = 0.0; + + if (!model->BSIM4V4pagsGiven) + model->BSIM4V4pags = 0.0; + if (!model->BSIM4V4pa1Given) + model->BSIM4V4pa1 = 0.0; + if (!model->BSIM4V4pa2Given) + model->BSIM4V4pa2 = 0.0; + if (!model->BSIM4V4pketaGiven) + model->BSIM4V4pketa = 0.0; + if (!model->BSIM4V4pnsubGiven) + model->BSIM4V4pnsub = 0.0; + if (!model->BSIM4V4pndepGiven) + model->BSIM4V4pndep = 0.0; + if (!model->BSIM4V4pnsdGiven) + model->BSIM4V4pnsd = 0.0; + if (!model->BSIM4V4pphinGiven) + model->BSIM4V4pphin = 0.0; + if (!model->BSIM4V4pngateGiven) + model->BSIM4V4pngate = 0.0; + if (!model->BSIM4V4pvbmGiven) + model->BSIM4V4pvbm = 0.0; + if (!model->BSIM4V4pxtGiven) + model->BSIM4V4pxt = 0.0; + if (!model->BSIM4V4pkt1Given) + model->BSIM4V4pkt1 = 0.0; + if (!model->BSIM4V4pkt1lGiven) + model->BSIM4V4pkt1l = 0.0; + if (!model->BSIM4V4pkt2Given) + model->BSIM4V4pkt2 = 0.0; + if (!model->BSIM4V4pk3Given) + model->BSIM4V4pk3 = 0.0; + if (!model->BSIM4V4pk3bGiven) + model->BSIM4V4pk3b = 0.0; + if (!model->BSIM4V4pw0Given) + model->BSIM4V4pw0 = 0.0; + if (!model->BSIM4V4plpe0Given) + model->BSIM4V4plpe0 = 0.0; + if (!model->BSIM4V4plpebGiven) + model->BSIM4V4plpeb = 0.0; + if (!model->BSIM4V4pdvtp0Given) + model->BSIM4V4pdvtp0 = 0.0; + if (!model->BSIM4V4pdvtp1Given) + model->BSIM4V4pdvtp1 = 0.0; + if (!model->BSIM4V4pdvt0Given) + model->BSIM4V4pdvt0 = 0.0; + if (!model->BSIM4V4pdvt1Given) + model->BSIM4V4pdvt1 = 0.0; + if (!model->BSIM4V4pdvt2Given) + model->BSIM4V4pdvt2 = 0.0; + if (!model->BSIM4V4pdvt0wGiven) + model->BSIM4V4pdvt0w = 0.0; + if (!model->BSIM4V4pdvt1wGiven) + model->BSIM4V4pdvt1w = 0.0; + if (!model->BSIM4V4pdvt2wGiven) + model->BSIM4V4pdvt2w = 0.0; + if (!model->BSIM4V4pdroutGiven) + model->BSIM4V4pdrout = 0.0; + if (!model->BSIM4V4pdsubGiven) + model->BSIM4V4pdsub = 0.0; + if (!model->BSIM4V4pvth0Given) + model->BSIM4V4pvth0 = 0.0; + if (!model->BSIM4V4puaGiven) + model->BSIM4V4pua = 0.0; + if (!model->BSIM4V4pua1Given) + model->BSIM4V4pua1 = 0.0; + if (!model->BSIM4V4pubGiven) + model->BSIM4V4pub = 0.0; + if (!model->BSIM4V4pub1Given) + model->BSIM4V4pub1 = 0.0; + if (!model->BSIM4V4pucGiven) + model->BSIM4V4puc = 0.0; + if (!model->BSIM4V4puc1Given) + model->BSIM4V4puc1 = 0.0; + if (!model->BSIM4V4pu0Given) + model->BSIM4V4pu0 = 0.0; + if (!model->BSIM4V4puteGiven) + model->BSIM4V4pute = 0.0; + if (!model->BSIM4V4pvoffGiven) + model->BSIM4V4pvoff = 0.0; + if (!model->BSIM4V4pminvGiven) + model->BSIM4V4pminv = 0.0; + if (!model->BSIM4V4pfproutGiven) + model->BSIM4V4pfprout = 0.0; + if (!model->BSIM4V4ppditsGiven) + model->BSIM4V4ppdits = 0.0; + if (!model->BSIM4V4ppditsdGiven) + model->BSIM4V4ppditsd = 0.0; + if (!model->BSIM4V4pdeltaGiven) + model->BSIM4V4pdelta = 0.0; + if (!model->BSIM4V4prdswGiven) + model->BSIM4V4prdsw = 0.0; + if (!model->BSIM4V4prdwGiven) + model->BSIM4V4prdw = 0.0; + if (!model->BSIM4V4prswGiven) + model->BSIM4V4prsw = 0.0; + if (!model->BSIM4V4pprwbGiven) + model->BSIM4V4pprwb = 0.0; + if (!model->BSIM4V4pprwgGiven) + model->BSIM4V4pprwg = 0.0; + if (!model->BSIM4V4pprtGiven) + model->BSIM4V4pprt = 0.0; + if (!model->BSIM4V4peta0Given) + model->BSIM4V4peta0 = 0.0; + if (!model->BSIM4V4petabGiven) + model->BSIM4V4petab = 0.0; + if (!model->BSIM4V4ppclmGiven) + model->BSIM4V4ppclm = 0.0; + if (!model->BSIM4V4ppdibl1Given) + model->BSIM4V4ppdibl1 = 0.0; + if (!model->BSIM4V4ppdibl2Given) + model->BSIM4V4ppdibl2 = 0.0; + if (!model->BSIM4V4ppdiblbGiven) + model->BSIM4V4ppdiblb = 0.0; + if (!model->BSIM4V4ppscbe1Given) + model->BSIM4V4ppscbe1 = 0.0; + if (!model->BSIM4V4ppscbe2Given) + model->BSIM4V4ppscbe2 = 0.0; + if (!model->BSIM4V4ppvagGiven) + model->BSIM4V4ppvag = 0.0; + if (!model->BSIM4V4pwrGiven) + model->BSIM4V4pwr = 0.0; + if (!model->BSIM4V4pdwgGiven) + model->BSIM4V4pdwg = 0.0; + if (!model->BSIM4V4pdwbGiven) + model->BSIM4V4pdwb = 0.0; + if (!model->BSIM4V4pb0Given) + model->BSIM4V4pb0 = 0.0; + if (!model->BSIM4V4pb1Given) + model->BSIM4V4pb1 = 0.0; + if (!model->BSIM4V4palpha0Given) + model->BSIM4V4palpha0 = 0.0; + if (!model->BSIM4V4palpha1Given) + model->BSIM4V4palpha1 = 0.0; + if (!model->BSIM4V4pbeta0Given) + model->BSIM4V4pbeta0 = 0.0; + if (!model->BSIM4V4pagidlGiven) + model->BSIM4V4pagidl = 0.0; + if (!model->BSIM4V4pbgidlGiven) + model->BSIM4V4pbgidl = 0.0; + if (!model->BSIM4V4pcgidlGiven) + model->BSIM4V4pcgidl = 0.0; + if (!model->BSIM4V4pegidlGiven) + model->BSIM4V4pegidl = 0.0; + if (!model->BSIM4V4paigcGiven) + model->BSIM4V4paigc = 0.0; + if (!model->BSIM4V4pbigcGiven) + model->BSIM4V4pbigc = 0.0; + if (!model->BSIM4V4pcigcGiven) + model->BSIM4V4pcigc = 0.0; + if (!model->BSIM4V4paigsdGiven) + model->BSIM4V4paigsd = 0.0; + if (!model->BSIM4V4pbigsdGiven) + model->BSIM4V4pbigsd = 0.0; + if (!model->BSIM4V4pcigsdGiven) + model->BSIM4V4pcigsd = 0.0; + if (!model->BSIM4V4paigbaccGiven) + model->BSIM4V4paigbacc = 0.0; + if (!model->BSIM4V4pbigbaccGiven) + model->BSIM4V4pbigbacc = 0.0; + if (!model->BSIM4V4pcigbaccGiven) + model->BSIM4V4pcigbacc = 0.0; + if (!model->BSIM4V4paigbinvGiven) + model->BSIM4V4paigbinv = 0.0; + if (!model->BSIM4V4pbigbinvGiven) + model->BSIM4V4pbigbinv = 0.0; + if (!model->BSIM4V4pcigbinvGiven) + model->BSIM4V4pcigbinv = 0.0; + if (!model->BSIM4V4pnigcGiven) + model->BSIM4V4pnigc = 0.0; + if (!model->BSIM4V4pnigbinvGiven) + model->BSIM4V4pnigbinv = 0.0; + if (!model->BSIM4V4pnigbaccGiven) + model->BSIM4V4pnigbacc = 0.0; + if (!model->BSIM4V4pntoxGiven) + model->BSIM4V4pntox = 0.0; + if (!model->BSIM4V4peigbinvGiven) + model->BSIM4V4peigbinv = 0.0; + if (!model->BSIM4V4ppigcdGiven) + model->BSIM4V4ppigcd = 0.0; + if (!model->BSIM4V4ppoxedgeGiven) + model->BSIM4V4ppoxedge = 0.0; + if (!model->BSIM4V4pxrcrg1Given) + model->BSIM4V4pxrcrg1 = 0.0; + if (!model->BSIM4V4pxrcrg2Given) + model->BSIM4V4pxrcrg2 = 0.0; + if (!model->BSIM4V4peuGiven) + model->BSIM4V4peu = 0.0; + if (!model->BSIM4V4pvfbGiven) + model->BSIM4V4pvfb = 0.0; + if (!model->BSIM4V4plambdaGiven) + model->BSIM4V4plambda = 0.0; + if (!model->BSIM4V4pvtlGiven) + model->BSIM4V4pvtl = 0.0; + if (!model->BSIM4V4pxnGiven) + model->BSIM4V4pxn = 0.0; + if (!model->BSIM4V4pvfbsdoffGiven) + model->BSIM4V4pvfbsdoff = 0.0; + + if (!model->BSIM4V4pcgslGiven) + model->BSIM4V4pcgsl = 0.0; + if (!model->BSIM4V4pcgdlGiven) + model->BSIM4V4pcgdl = 0.0; + if (!model->BSIM4V4pckappasGiven) + model->BSIM4V4pckappas = 0.0; + if (!model->BSIM4V4pckappadGiven) + model->BSIM4V4pckappad = 0.0; + if (!model->BSIM4V4pcfGiven) + model->BSIM4V4pcf = 0.0; + if (!model->BSIM4V4pclcGiven) + model->BSIM4V4pclc = 0.0; + if (!model->BSIM4V4pcleGiven) + model->BSIM4V4pcle = 0.0; + if (!model->BSIM4V4pvfbcvGiven) + model->BSIM4V4pvfbcv = 0.0; + if (!model->BSIM4V4pacdeGiven) + model->BSIM4V4pacde = 0.0; + if (!model->BSIM4V4pmoinGiven) + model->BSIM4V4pmoin = 0.0; + if (!model->BSIM4V4pnoffGiven) + model->BSIM4V4pnoff = 0.0; + if (!model->BSIM4V4pvoffcvGiven) + model->BSIM4V4pvoffcv = 0.0; + + if (!model->BSIM4V4gamma1Given) + model->BSIM4V4gamma1 = 0.0; + if (!model->BSIM4V4lgamma1Given) + model->BSIM4V4lgamma1 = 0.0; + if (!model->BSIM4V4wgamma1Given) + model->BSIM4V4wgamma1 = 0.0; + if (!model->BSIM4V4pgamma1Given) + model->BSIM4V4pgamma1 = 0.0; + if (!model->BSIM4V4gamma2Given) + model->BSIM4V4gamma2 = 0.0; + if (!model->BSIM4V4lgamma2Given) + model->BSIM4V4lgamma2 = 0.0; + if (!model->BSIM4V4wgamma2Given) + model->BSIM4V4wgamma2 = 0.0; + if (!model->BSIM4V4pgamma2Given) + model->BSIM4V4pgamma2 = 0.0; + if (!model->BSIM4V4vbxGiven) + model->BSIM4V4vbx = 0.0; + if (!model->BSIM4V4lvbxGiven) + model->BSIM4V4lvbx = 0.0; + if (!model->BSIM4V4wvbxGiven) + model->BSIM4V4wvbx = 0.0; + if (!model->BSIM4V4pvbxGiven) + model->BSIM4V4pvbx = 0.0; + + /* unit degree celcius */ + if (!model->BSIM4V4tnomGiven) + model->BSIM4V4tnom = ckt->CKTnomTemp; + if (!model->BSIM4V4LintGiven) + model->BSIM4V4Lint = 0.0; + if (!model->BSIM4V4LlGiven) + model->BSIM4V4Ll = 0.0; + if (!model->BSIM4V4LlcGiven) + model->BSIM4V4Llc = model->BSIM4V4Ll; + if (!model->BSIM4V4LlnGiven) + model->BSIM4V4Lln = 1.0; + if (!model->BSIM4V4LwGiven) + model->BSIM4V4Lw = 0.0; + if (!model->BSIM4V4LwcGiven) + model->BSIM4V4Lwc = model->BSIM4V4Lw; + if (!model->BSIM4V4LwnGiven) + model->BSIM4V4Lwn = 1.0; + if (!model->BSIM4V4LwlGiven) + model->BSIM4V4Lwl = 0.0; + if (!model->BSIM4V4LwlcGiven) + model->BSIM4V4Lwlc = model->BSIM4V4Lwl; + if (!model->BSIM4V4LminGiven) + model->BSIM4V4Lmin = 0.0; + if (!model->BSIM4V4LmaxGiven) + model->BSIM4V4Lmax = 1.0; + if (!model->BSIM4V4WintGiven) + model->BSIM4V4Wint = 0.0; + if (!model->BSIM4V4WlGiven) + model->BSIM4V4Wl = 0.0; + if (!model->BSIM4V4WlcGiven) + model->BSIM4V4Wlc = model->BSIM4V4Wl; + if (!model->BSIM4V4WlnGiven) + model->BSIM4V4Wln = 1.0; + if (!model->BSIM4V4WwGiven) + model->BSIM4V4Ww = 0.0; + if (!model->BSIM4V4WwcGiven) + model->BSIM4V4Wwc = model->BSIM4V4Ww; + if (!model->BSIM4V4WwnGiven) + model->BSIM4V4Wwn = 1.0; + if (!model->BSIM4V4WwlGiven) + model->BSIM4V4Wwl = 0.0; + if (!model->BSIM4V4WwlcGiven) + model->BSIM4V4Wwlc = model->BSIM4V4Wwl; + if (!model->BSIM4V4WminGiven) + model->BSIM4V4Wmin = 0.0; + if (!model->BSIM4V4WmaxGiven) + model->BSIM4V4Wmax = 1.0; + if (!model->BSIM4V4dwcGiven) + model->BSIM4V4dwc = model->BSIM4V4Wint; + if (!model->BSIM4V4dlcGiven) + model->BSIM4V4dlc = model->BSIM4V4Lint; + if (!model->BSIM4V4xlGiven) + model->BSIM4V4xl = 0.0; + if (!model->BSIM4V4xwGiven) + model->BSIM4V4xw = 0.0; + if (!model->BSIM4V4dlcigGiven) + model->BSIM4V4dlcig = model->BSIM4V4Lint; + if (!model->BSIM4V4dwjGiven) + model->BSIM4V4dwj = model->BSIM4V4dwc; + if (!model->BSIM4V4cfGiven) + model->BSIM4V4cf = 2.0 * model->BSIM4V4epsrox * EPS0 / PI + * log(1.0 + 0.4e-6 / model->BSIM4V4toxe); + + if (!model->BSIM4V4xpartGiven) + model->BSIM4V4xpart = 0.0; + if (!model->BSIM4V4sheetResistanceGiven) + model->BSIM4V4sheetResistance = 0.0; + + if (!model->BSIM4V4SunitAreaJctCapGiven) + model->BSIM4V4SunitAreaJctCap = 5.0E-4; + if (!model->BSIM4V4DunitAreaJctCapGiven) + model->BSIM4V4DunitAreaJctCap = model->BSIM4V4SunitAreaJctCap; + if (!model->BSIM4V4SunitLengthSidewallJctCapGiven) + model->BSIM4V4SunitLengthSidewallJctCap = 5.0E-10; + if (!model->BSIM4V4DunitLengthSidewallJctCapGiven) + model->BSIM4V4DunitLengthSidewallJctCap = model->BSIM4V4SunitLengthSidewallJctCap; + if (!model->BSIM4V4SunitLengthGateSidewallJctCapGiven) + model->BSIM4V4SunitLengthGateSidewallJctCap = model->BSIM4V4SunitLengthSidewallJctCap ; + if (!model->BSIM4V4DunitLengthGateSidewallJctCapGiven) + model->BSIM4V4DunitLengthGateSidewallJctCap = model->BSIM4V4SunitLengthGateSidewallJctCap; + if (!model->BSIM4V4SjctSatCurDensityGiven) + model->BSIM4V4SjctSatCurDensity = 1.0E-4; + if (!model->BSIM4V4DjctSatCurDensityGiven) + model->BSIM4V4DjctSatCurDensity = model->BSIM4V4SjctSatCurDensity; + if (!model->BSIM4V4SjctSidewallSatCurDensityGiven) + model->BSIM4V4SjctSidewallSatCurDensity = 0.0; + if (!model->BSIM4V4DjctSidewallSatCurDensityGiven) + model->BSIM4V4DjctSidewallSatCurDensity = model->BSIM4V4SjctSidewallSatCurDensity; + if (!model->BSIM4V4SjctGateSidewallSatCurDensityGiven) + model->BSIM4V4SjctGateSidewallSatCurDensity = 0.0; + if (!model->BSIM4V4DjctGateSidewallSatCurDensityGiven) + model->BSIM4V4DjctGateSidewallSatCurDensity = model->BSIM4V4SjctGateSidewallSatCurDensity; + if (!model->BSIM4V4SbulkJctPotentialGiven) + model->BSIM4V4SbulkJctPotential = 1.0; + if (!model->BSIM4V4DbulkJctPotentialGiven) + model->BSIM4V4DbulkJctPotential = model->BSIM4V4SbulkJctPotential; + if (!model->BSIM4V4SsidewallJctPotentialGiven) + model->BSIM4V4SsidewallJctPotential = 1.0; + if (!model->BSIM4V4DsidewallJctPotentialGiven) + model->BSIM4V4DsidewallJctPotential = model->BSIM4V4SsidewallJctPotential; + if (!model->BSIM4V4SGatesidewallJctPotentialGiven) + model->BSIM4V4SGatesidewallJctPotential = model->BSIM4V4SsidewallJctPotential; + if (!model->BSIM4V4DGatesidewallJctPotentialGiven) + model->BSIM4V4DGatesidewallJctPotential = model->BSIM4V4SGatesidewallJctPotential; + if (!model->BSIM4V4SbulkJctBotGradingCoeffGiven) + model->BSIM4V4SbulkJctBotGradingCoeff = 0.5; + if (!model->BSIM4V4DbulkJctBotGradingCoeffGiven) + model->BSIM4V4DbulkJctBotGradingCoeff = model->BSIM4V4SbulkJctBotGradingCoeff; + if (!model->BSIM4V4SbulkJctSideGradingCoeffGiven) + model->BSIM4V4SbulkJctSideGradingCoeff = 0.33; + if (!model->BSIM4V4DbulkJctSideGradingCoeffGiven) + model->BSIM4V4DbulkJctSideGradingCoeff = model->BSIM4V4SbulkJctSideGradingCoeff; + if (!model->BSIM4V4SbulkJctGateSideGradingCoeffGiven) + model->BSIM4V4SbulkJctGateSideGradingCoeff = model->BSIM4V4SbulkJctSideGradingCoeff; + if (!model->BSIM4V4DbulkJctGateSideGradingCoeffGiven) + model->BSIM4V4DbulkJctGateSideGradingCoeff = model->BSIM4V4SbulkJctGateSideGradingCoeff; + if (!model->BSIM4V4SjctEmissionCoeffGiven) + model->BSIM4V4SjctEmissionCoeff = 1.0; + if (!model->BSIM4V4DjctEmissionCoeffGiven) + model->BSIM4V4DjctEmissionCoeff = model->BSIM4V4SjctEmissionCoeff; + if (!model->BSIM4V4SjctTempExponentGiven) + model->BSIM4V4SjctTempExponent = 3.0; + if (!model->BSIM4V4DjctTempExponentGiven) + model->BSIM4V4DjctTempExponent = model->BSIM4V4SjctTempExponent; + + if (!model->BSIM4V4jtssGiven) + model->BSIM4V4jtss = 0.0; + if (!model->BSIM4V4jtsdGiven) + model->BSIM4V4jtsd = model->BSIM4V4jtss; + if (!model->BSIM4V4jtsswsGiven) + model->BSIM4V4jtssws = 0.0; + if (!model->BSIM4V4jtsswdGiven) + model->BSIM4V4jtsswd = model->BSIM4V4jtssws; + if (!model->BSIM4V4jtsswgsGiven) + model->BSIM4V4jtsswgs = 0.0; + if (!model->BSIM4V4jtsswgdGiven) + model->BSIM4V4jtsswgd = model->BSIM4V4jtsswgs; + if (!model->BSIM4V4njtsGiven) + model->BSIM4V4njts = 20.0; + if (!model->BSIM4V4njtsswGiven) + model->BSIM4V4njtssw = 20.0; + if (!model->BSIM4V4njtsswgGiven) + model->BSIM4V4njtsswg = 20.0; + if (!model->BSIM4V4xtssGiven) + model->BSIM4V4xtss = 0.02; + if (!model->BSIM4V4xtsdGiven) + model->BSIM4V4xtsd = model->BSIM4V4xtss; + if (!model->BSIM4V4xtsswsGiven) + model->BSIM4V4xtssws = 0.02; + if (!model->BSIM4V4jtsswdGiven) + model->BSIM4V4xtsswd = model->BSIM4V4xtssws; + if (!model->BSIM4V4xtsswgsGiven) + model->BSIM4V4xtsswgs = 0.02; + if (!model->BSIM4V4xtsswgdGiven) + model->BSIM4V4xtsswgd = model->BSIM4V4xtsswgs; + if (!model->BSIM4V4tnjtsGiven) + model->BSIM4V4tnjts = 0.0; + if (!model->BSIM4V4tnjtsswGiven) + model->BSIM4V4tnjtssw = 0.0; + if (!model->BSIM4V4tnjtsswgGiven) + model->BSIM4V4tnjtsswg = 0.0; + if (!model->BSIM4V4vtssGiven) + model->BSIM4V4vtss = 10.0; + if (!model->BSIM4V4vtsdGiven) + model->BSIM4V4vtsd = model->BSIM4V4vtss; + if (!model->BSIM4V4vtsswsGiven) + model->BSIM4V4vtssws = 10.0; + if (!model->BSIM4V4vtsswdGiven) + model->BSIM4V4vtsswd = model->BSIM4V4vtssws; + if (!model->BSIM4V4vtsswgsGiven) + model->BSIM4V4vtsswgs = 10.0; + if (!model->BSIM4V4vtsswgdGiven) + model->BSIM4V4vtsswgd = model->BSIM4V4vtsswgs; + + if (!model->BSIM4V4oxideTrapDensityAGiven) + { if (model->BSIM4V4type == NMOS) + model->BSIM4V4oxideTrapDensityA = 6.25e41; + else + model->BSIM4V4oxideTrapDensityA= 6.188e40; + } + if (!model->BSIM4V4oxideTrapDensityBGiven) + { if (model->BSIM4V4type == NMOS) + model->BSIM4V4oxideTrapDensityB = 3.125e26; + else + model->BSIM4V4oxideTrapDensityB = 1.5e25; + } + if (!model->BSIM4V4oxideTrapDensityCGiven) + model->BSIM4V4oxideTrapDensityC = 8.75e9; + if (!model->BSIM4V4emGiven) + model->BSIM4V4em = 4.1e7; /* V/m */ + if (!model->BSIM4V4efGiven) + model->BSIM4V4ef = 1.0; + if (!model->BSIM4V4afGiven) + model->BSIM4V4af = 1.0; + if (!model->BSIM4V4kfGiven) + model->BSIM4V4kf = 0.0; + if (!model->BSIM4V4stimodGiven) + model->BSIM4V4stimod = 0.0; + if (!model->BSIM4V4rgeomodGiven) + model->BSIM4V4rgeomod = 0; + if (!model->BSIM4V4sa0Given) + model->BSIM4V4sa0 = 0.0; + if (!model->BSIM4V4sb0Given) + model->BSIM4V4sb0 = 0.0; + + /* stress effect */ + if (!model->BSIM4V4sarefGiven) + model->BSIM4V4saref = 1e-6; /* m */ + if (!model->BSIM4V4sbrefGiven) + model->BSIM4V4sbref = 1e-6; /* m */ + if (!model->BSIM4V4wlodGiven) + model->BSIM4V4wlod = 0; /* m */ + if (!model->BSIM4V4ku0Given) + model->BSIM4V4ku0 = 0; /* 1/m */ + if (!model->BSIM4V4kvsatGiven) + model->BSIM4V4kvsat = 0; + if (!model->BSIM4V4kvth0Given) /* m */ + model->BSIM4V4kvth0 = 0; + if (!model->BSIM4V4tku0Given) + model->BSIM4V4tku0 = 0; + if (!model->BSIM4V4llodku0Given) + model->BSIM4V4llodku0 = 0; + if (!model->BSIM4V4wlodku0Given) + model->BSIM4V4wlodku0 = 0; + if (!model->BSIM4V4llodvthGiven) + model->BSIM4V4llodvth = 0; + if (!model->BSIM4V4wlodvthGiven) + model->BSIM4V4wlodvth = 0; + if (!model->BSIM4V4lku0Given) + model->BSIM4V4lku0 = 0; + if (!model->BSIM4V4wku0Given) + model->BSIM4V4wku0 = 0; + if (!model->BSIM4V4pku0Given) + model->BSIM4V4pku0 = 0; + if (!model->BSIM4V4lkvth0Given) + model->BSIM4V4lkvth0 = 0; + if (!model->BSIM4V4wkvth0Given) + model->BSIM4V4wkvth0 = 0; + if (!model->BSIM4V4pkvth0Given) + model->BSIM4V4pkvth0 = 0; + if (!model->BSIM4V4stk2Given) + model->BSIM4V4stk2 = 0; + if (!model->BSIM4V4lodk2Given) + model->BSIM4V4lodk2 = 1.0; + if (!model->BSIM4V4steta0Given) + model->BSIM4V4steta0 = 0; + if (!model->BSIM4V4lodeta0Given) + model->BSIM4V4lodeta0 = 1.0; + + DMCGeff = model->BSIM4V4dmcg - model->BSIM4V4dmcgt; + DMCIeff = model->BSIM4V4dmci; + DMDGeff = model->BSIM4V4dmdg - model->BSIM4V4dmcgt; + + /* + * End processing models and begin to loop + * through all the instances of the model + */ + + for (here = model->BSIM4V4instances; here != NULL ; + here=here->BSIM4V4nextInstance) + { + if (here->BSIM4V4owner == ARCHme) { + /* allocate a chunk of the state vector */ + here->BSIM4V4states = *states; + *states += BSIM4V4numStates; + } + /* perform the parameter defaulting */ + if (!here->BSIM4V4lGiven) + here->BSIM4V4l = 5.0e-6; + if (!here->BSIM4V4wGiven) + here->BSIM4V4w = 5.0e-6; + if (!here->BSIM4V4mGiven) + here->BSIM4V4m = 1.0; + if (!here->BSIM4V4nfGiven) + here->BSIM4V4nf = 1.0; + if (!here->BSIM4V4minGiven) + here->BSIM4V4min = 0; /* integer */ + if (!here->BSIM4V4icVDSGiven) + here->BSIM4V4icVDS = 0.0; + if (!here->BSIM4V4icVGSGiven) + here->BSIM4V4icVGS = 0.0; + if (!here->BSIM4V4icVBSGiven) + here->BSIM4V4icVBS = 0.0; + if (!here->BSIM4V4drainAreaGiven) + here->BSIM4V4drainArea = 0.0; + if (!here->BSIM4V4drainPerimeterGiven) + here->BSIM4V4drainPerimeter = 0.0; + if (!here->BSIM4V4drainSquaresGiven) + here->BSIM4V4drainSquares = 1.0; + if (!here->BSIM4V4sourceAreaGiven) + here->BSIM4V4sourceArea = 0.0; + if (!here->BSIM4V4sourcePerimeterGiven) + here->BSIM4V4sourcePerimeter = 0.0; + if (!here->BSIM4V4sourceSquaresGiven) + here->BSIM4V4sourceSquares = 1.0; + + if (!here->BSIM4V4saGiven) + here->BSIM4V4sa = 0.0; + if (!here->BSIM4V4sbGiven) + here->BSIM4V4sb = 0.0; + if (!here->BSIM4V4sdGiven) + here->BSIM4V4sd = 0.0; + + if (!here->BSIM4V4rbdbGiven) + here->BSIM4V4rbdb = model->BSIM4V4rbdb; /* in ohm */ + if (!here->BSIM4V4rbsbGiven) + here->BSIM4V4rbsb = model->BSIM4V4rbsb; + if (!here->BSIM4V4rbpbGiven) + here->BSIM4V4rbpb = model->BSIM4V4rbpb; + if (!here->BSIM4V4rbpsGiven) + here->BSIM4V4rbps = model->BSIM4V4rbps; + if (!here->BSIM4V4rbpdGiven) + here->BSIM4V4rbpd = model->BSIM4V4rbpd; + + + /* Process instance model selectors, some + * may override their global counterparts + */ + if (!here->BSIM4V4rbodyModGiven) + here->BSIM4V4rbodyMod = model->BSIM4V4rbodyMod; + else if ((here->BSIM4V4rbodyMod != 0) && (here->BSIM4V4rbodyMod != 1)) + { here->BSIM4V4rbodyMod = model->BSIM4V4rbodyMod; + printf("Warning: rbodyMod has been set to its global value %d.\n", + model->BSIM4V4rbodyMod); + } + + if (!here->BSIM4V4rgateModGiven) + here->BSIM4V4rgateMod = model->BSIM4V4rgateMod; + else if ((here->BSIM4V4rgateMod != 0) && (here->BSIM4V4rgateMod != 1) + && (here->BSIM4V4rgateMod != 2) && (here->BSIM4V4rgateMod != 3)) + { here->BSIM4V4rgateMod = model->BSIM4V4rgateMod; + printf("Warning: rgateMod has been set to its global value %d.\n", + model->BSIM4V4rgateMod); + } + + if (!here->BSIM4V4geoModGiven) + here->BSIM4V4geoMod = model->BSIM4V4geoMod; + if (!here->BSIM4V4rgeoModGiven) + here->BSIM4V4rgeoMod = model->BSIM4V4rgeomod; + if (!here->BSIM4V4trnqsModGiven) + here->BSIM4V4trnqsMod = model->BSIM4V4trnqsMod; + else if ((here->BSIM4V4trnqsMod != 0) && (here->BSIM4V4trnqsMod != 1)) + { here->BSIM4V4trnqsMod = model->BSIM4V4trnqsMod; + printf("Warning: trnqsMod has been set to its global value %d.\n", + model->BSIM4V4trnqsMod); + } + + if (!here->BSIM4V4acnqsModGiven) + here->BSIM4V4acnqsMod = model->BSIM4V4acnqsMod; + else if ((here->BSIM4V4acnqsMod != 0) && (here->BSIM4V4acnqsMod != 1)) + { here->BSIM4V4acnqsMod = model->BSIM4V4acnqsMod; + printf("Warning: acnqsMod has been set to its global value %d.\n", + model->BSIM4V4acnqsMod); + } + + /* stress effect */ + if (!here->BSIM4V4saGiven) + here->BSIM4V4sa = 0.0; + if (!here->BSIM4V4sbGiven) + here->BSIM4V4sb = 0.0; + if (!here->BSIM4V4sdGiven) + here->BSIM4V4sd = 0.0; + + + /* process drain series resistance */ + createNode = 0; + if ( (model->BSIM4V4rdsMod != 0) + || (model->BSIM4V4tnoiMod != 0 && noiseAnalGiven)) + { + createNode = 1; + } else if (model->BSIM4V4sheetResistance > 0) + { + if (here->BSIM4V4drainSquaresGiven + && here->BSIM4V4drainSquares > 0) + { + createNode = 1; + } else if (!here->BSIM4V4drainSquaresGiven + && (here->BSIM4V4rgeoMod != 0)) + { + BSIM4V4RdseffGeo(here->BSIM4V4nf*here->BSIM4V4m, here->BSIM4V4geoMod, + here->BSIM4V4rgeoMod, here->BSIM4V4min, + here->BSIM4V4w, model->BSIM4V4sheetResistance, + DMCGeff, DMCIeff, DMDGeff, 0, &Rtot); + if(Rtot > 0) + createNode = 1; + } + } + if ( createNode != 0 && (here->BSIM4V4dNodePrime == 0)) + { error = CKTmkVolt(ckt,&tmp,here->BSIM4V4name,"drain"); + if(error) return(error); + here->BSIM4V4dNodePrime = tmp->number; + + if (ckt->CKTcopyNodesets) { + CKTnode *tmpNode; + IFuid tmpName; + if (CKTinst2Node(ckt,here,1,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + +} + + } + else + { here->BSIM4V4dNodePrime = here->BSIM4V4dNode; + } + + /* process source series resistance */ + createNode = 0; + if ( (model->BSIM4V4rdsMod != 0) + || (model->BSIM4V4tnoiMod != 0 && noiseAnalGiven)) + { + createNode = 1; + } else if (model->BSIM4V4sheetResistance > 0) + { + if (here->BSIM4V4sourceSquaresGiven + && here->BSIM4V4sourceSquares > 0) + { + createNode = 1; + } else if (!here->BSIM4V4sourceSquaresGiven + && (here->BSIM4V4rgeoMod != 0)) + { + BSIM4V4RdseffGeo(here->BSIM4V4nf*here->BSIM4V4m, here->BSIM4V4geoMod, + here->BSIM4V4rgeoMod, here->BSIM4V4min, + here->BSIM4V4w, model->BSIM4V4sheetResistance, + DMCGeff, DMCIeff, DMDGeff, 1, &Rtot); + if(Rtot > 0) + createNode = 1; + } + } + if ( createNode != 0 && here->BSIM4V4sNodePrime == 0) + { error = CKTmkVolt(ckt,&tmp,here->BSIM4V4name,"source"); + if(error) return(error); + here->BSIM4V4sNodePrime = tmp->number; + + if (ckt->CKTcopyNodesets) { + CKTnode *tmpNode; + IFuid tmpName; + if (CKTinst2Node(ckt,here,3,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + + } + else + here->BSIM4V4sNodePrime = here->BSIM4V4sNode; + + if ((here->BSIM4V4rgateMod > 0) && (here->BSIM4V4gNodePrime == 0)) + { error = CKTmkVolt(ckt,&tmp,here->BSIM4V4name,"gate"); + if(error) return(error); + here->BSIM4V4gNodePrime = tmp->number; + + if (ckt->CKTcopyNodesets) { + CKTnode *tmpNode; + IFuid tmpName; + if (CKTinst2Node(ckt,here,2,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + + } + else + here->BSIM4V4gNodePrime = here->BSIM4V4gNodeExt; + + if ((here->BSIM4V4rgateMod == 3) && (here->BSIM4V4gNodeMid == 0)) + { error = CKTmkVolt(ckt,&tmp,here->BSIM4V4name,"midgate"); + if(error) return(error); + here->BSIM4V4gNodeMid = tmp->number; + } + else + here->BSIM4V4gNodeMid = here->BSIM4V4gNodeExt; + + + /* internal body nodes for body resistance model */ + if (here->BSIM4V4rbodyMod) + { if (here->BSIM4V4dbNode == 0) + { error = CKTmkVolt(ckt,&tmp,here->BSIM4V4name,"dbody"); + if(error) return(error); + here->BSIM4V4dbNode = tmp->number; + + if (ckt->CKTcopyNodesets) { + CKTnode *tmpNode; + IFuid tmpName; + if (CKTinst2Node(ckt,here,4,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + } + if (here->BSIM4V4bNodePrime == 0) + { error = CKTmkVolt(ckt,&tmp,here->BSIM4V4name,"body"); + if(error) return(error); + here->BSIM4V4bNodePrime = tmp->number; + } + if (here->BSIM4V4sbNode == 0) + { error = CKTmkVolt(ckt,&tmp,here->BSIM4V4name,"sbody"); + if(error) return(error); + here->BSIM4V4sbNode = tmp->number; + } + } + else + here->BSIM4V4dbNode = here->BSIM4V4bNodePrime = here->BSIM4V4sbNode + = here->BSIM4V4bNode; + + /* NQS node */ + if ((here->BSIM4V4trnqsMod) && (here->BSIM4V4qNode == 0)) + { error = CKTmkVolt(ckt,&tmp,here->BSIM4V4name,"charge"); + if(error) return(error); + here->BSIM4V4qNode = tmp->number; + + if (ckt->CKTcopyNodesets) { + CKTnode *tmpNode; + IFuid tmpName; + if (CKTinst2Node(ckt,here,5,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + } + else + here->BSIM4V4qNode = 0; + +/* set Sparse Matrix Pointers + * macro to make elements with built-in out-of-memory test */ +#define TSTALLOC(ptr,first,second) \ +if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ + return(E_NOMEM);\ +} + + TSTALLOC(BSIM4V4DPbpPtr, BSIM4V4dNodePrime, BSIM4V4bNodePrime) + TSTALLOC(BSIM4V4GPbpPtr, BSIM4V4gNodePrime, BSIM4V4bNodePrime) + TSTALLOC(BSIM4V4SPbpPtr, BSIM4V4sNodePrime, BSIM4V4bNodePrime) + + TSTALLOC(BSIM4V4BPdpPtr, BSIM4V4bNodePrime, BSIM4V4dNodePrime) + TSTALLOC(BSIM4V4BPgpPtr, BSIM4V4bNodePrime, BSIM4V4gNodePrime) + TSTALLOC(BSIM4V4BPspPtr, BSIM4V4bNodePrime, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4BPbpPtr, BSIM4V4bNodePrime, BSIM4V4bNodePrime) + + TSTALLOC(BSIM4V4DdPtr, BSIM4V4dNode, BSIM4V4dNode) + TSTALLOC(BSIM4V4GPgpPtr, BSIM4V4gNodePrime, BSIM4V4gNodePrime) + TSTALLOC(BSIM4V4SsPtr, BSIM4V4sNode, BSIM4V4sNode) + TSTALLOC(BSIM4V4DPdpPtr, BSIM4V4dNodePrime, BSIM4V4dNodePrime) + TSTALLOC(BSIM4V4SPspPtr, BSIM4V4sNodePrime, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4DdpPtr, BSIM4V4dNode, BSIM4V4dNodePrime) + TSTALLOC(BSIM4V4GPdpPtr, BSIM4V4gNodePrime, BSIM4V4dNodePrime) + TSTALLOC(BSIM4V4GPspPtr, BSIM4V4gNodePrime, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4SspPtr, BSIM4V4sNode, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4DPspPtr, BSIM4V4dNodePrime, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4DPdPtr, BSIM4V4dNodePrime, BSIM4V4dNode) + TSTALLOC(BSIM4V4DPgpPtr, BSIM4V4dNodePrime, BSIM4V4gNodePrime) + TSTALLOC(BSIM4V4SPgpPtr, BSIM4V4sNodePrime, BSIM4V4gNodePrime) + TSTALLOC(BSIM4V4SPsPtr, BSIM4V4sNodePrime, BSIM4V4sNode) + TSTALLOC(BSIM4V4SPdpPtr, BSIM4V4sNodePrime, BSIM4V4dNodePrime) + + TSTALLOC(BSIM4V4QqPtr, BSIM4V4qNode, BSIM4V4qNode) + TSTALLOC(BSIM4V4QbpPtr, BSIM4V4qNode, BSIM4V4bNodePrime) + TSTALLOC(BSIM4V4QdpPtr, BSIM4V4qNode, BSIM4V4dNodePrime) + TSTALLOC(BSIM4V4QspPtr, BSIM4V4qNode, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4QgpPtr, BSIM4V4qNode, BSIM4V4gNodePrime) + TSTALLOC(BSIM4V4DPqPtr, BSIM4V4dNodePrime, BSIM4V4qNode) + TSTALLOC(BSIM4V4SPqPtr, BSIM4V4sNodePrime, BSIM4V4qNode) + TSTALLOC(BSIM4V4GPqPtr, BSIM4V4gNodePrime, BSIM4V4qNode) + + if (here->BSIM4V4rgateMod != 0) + { TSTALLOC(BSIM4V4GEgePtr, BSIM4V4gNodeExt, BSIM4V4gNodeExt) + TSTALLOC(BSIM4V4GEgpPtr, BSIM4V4gNodeExt, BSIM4V4gNodePrime) + TSTALLOC(BSIM4V4GPgePtr, BSIM4V4gNodePrime, BSIM4V4gNodeExt) + TSTALLOC(BSIM4V4GEdpPtr, BSIM4V4gNodeExt, BSIM4V4dNodePrime) + TSTALLOC(BSIM4V4GEspPtr, BSIM4V4gNodeExt, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4GEbpPtr, BSIM4V4gNodeExt, BSIM4V4bNodePrime) + + TSTALLOC(BSIM4V4GMdpPtr, BSIM4V4gNodeMid, BSIM4V4dNodePrime) + TSTALLOC(BSIM4V4GMgpPtr, BSIM4V4gNodeMid, BSIM4V4gNodePrime) + TSTALLOC(BSIM4V4GMgmPtr, BSIM4V4gNodeMid, BSIM4V4gNodeMid) + TSTALLOC(BSIM4V4GMgePtr, BSIM4V4gNodeMid, BSIM4V4gNodeExt) + TSTALLOC(BSIM4V4GMspPtr, BSIM4V4gNodeMid, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4GMbpPtr, BSIM4V4gNodeMid, BSIM4V4bNodePrime) + TSTALLOC(BSIM4V4DPgmPtr, BSIM4V4dNodePrime, BSIM4V4gNodeMid) + TSTALLOC(BSIM4V4GPgmPtr, BSIM4V4gNodePrime, BSIM4V4gNodeMid) + TSTALLOC(BSIM4V4GEgmPtr, BSIM4V4gNodeExt, BSIM4V4gNodeMid) + TSTALLOC(BSIM4V4SPgmPtr, BSIM4V4sNodePrime, BSIM4V4gNodeMid) + TSTALLOC(BSIM4V4BPgmPtr, BSIM4V4bNodePrime, BSIM4V4gNodeMid) + } + + if (here->BSIM4V4rbodyMod) + { TSTALLOC(BSIM4V4DPdbPtr, BSIM4V4dNodePrime, BSIM4V4dbNode) + TSTALLOC(BSIM4V4SPsbPtr, BSIM4V4sNodePrime, BSIM4V4sbNode) + + TSTALLOC(BSIM4V4DBdpPtr, BSIM4V4dbNode, BSIM4V4dNodePrime) + TSTALLOC(BSIM4V4DBdbPtr, BSIM4V4dbNode, BSIM4V4dbNode) + TSTALLOC(BSIM4V4DBbpPtr, BSIM4V4dbNode, BSIM4V4bNodePrime) + TSTALLOC(BSIM4V4DBbPtr, BSIM4V4dbNode, BSIM4V4bNode) + + TSTALLOC(BSIM4V4BPdbPtr, BSIM4V4bNodePrime, BSIM4V4dbNode) + TSTALLOC(BSIM4V4BPbPtr, BSIM4V4bNodePrime, BSIM4V4bNode) + TSTALLOC(BSIM4V4BPsbPtr, BSIM4V4bNodePrime, BSIM4V4sbNode) + + TSTALLOC(BSIM4V4SBspPtr, BSIM4V4sbNode, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4SBbpPtr, BSIM4V4sbNode, BSIM4V4bNodePrime) + TSTALLOC(BSIM4V4SBbPtr, BSIM4V4sbNode, BSIM4V4bNode) + TSTALLOC(BSIM4V4SBsbPtr, BSIM4V4sbNode, BSIM4V4sbNode) + + TSTALLOC(BSIM4V4BdbPtr, BSIM4V4bNode, BSIM4V4dbNode) + TSTALLOC(BSIM4V4BbpPtr, BSIM4V4bNode, BSIM4V4bNodePrime) + TSTALLOC(BSIM4V4BsbPtr, BSIM4V4bNode, BSIM4V4sbNode) + TSTALLOC(BSIM4V4BbPtr, BSIM4V4bNode, BSIM4V4bNode) + } + + if (model->BSIM4V4rdsMod) + { TSTALLOC(BSIM4V4DgpPtr, BSIM4V4dNode, BSIM4V4gNodePrime) + TSTALLOC(BSIM4V4DspPtr, BSIM4V4dNode, BSIM4V4sNodePrime) + TSTALLOC(BSIM4V4DbpPtr, BSIM4V4dNode, BSIM4V4bNodePrime) + TSTALLOC(BSIM4V4SdpPtr, BSIM4V4sNode, BSIM4V4dNodePrime) + TSTALLOC(BSIM4V4SgpPtr, BSIM4V4sNode, BSIM4V4gNodePrime) + TSTALLOC(BSIM4V4SbpPtr, BSIM4V4sNode, BSIM4V4bNodePrime) + } + } + } + return(OK); +} + +int +BSIM4V4unsetup(inModel,ckt) + GENmodel *inModel; + CKTcircuit *ckt; +{ + + BSIM4V4model *model; + BSIM4V4instance *here; + + for (model = (BSIM4V4model *)inModel; model != NULL; + model = model->BSIM4V4nextModel) + { + for (here = model->BSIM4V4instances; here != NULL; + here=here->BSIM4V4nextInstance) + { + if (here->BSIM4V4dNodePrime + && here->BSIM4V4dNodePrime != here->BSIM4V4dNode) + { + CKTdltNNum(ckt, here->BSIM4V4dNodePrime); + here->BSIM4V4dNodePrime = 0; + } + if (here->BSIM4V4sNodePrime + && here->BSIM4V4sNodePrime != here->BSIM4V4sNode) + { + CKTdltNNum(ckt, here->BSIM4V4sNodePrime); + here->BSIM4V4sNodePrime = 0; + } + } + } + return OK; +} diff --git a/src/spicelib/devices/bsim4v4/b4v4temp.c b/src/spicelib/devices/bsim4v4/b4v4temp.c new file mode 100644 index 000000000..a4b1a4a29 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4temp.c @@ -0,0 +1,1709 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4temp.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. + * Modified by Xuemei Xi, 11/15/2002. + * Modified by Xuemei Xi, 05/09/2003. + * Modified by Xuemei Xi, 03/04/2004. + **********/ + +#include "ngspice.h" +#include "smpdefs.h" +#include "cktdefs.h" +#include "bsim4v4def.h" +#include "const.h" +#include "sperror.h" +#include "suffix.h" + +#define Kb 1.3806226e-23 +#define KboQ 8.617087e-5 +#define EPS0 8.85418e-12 +#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 +#define DELTA 1.0E-9 +#define DEXP(A,B) { \ + if (A > EXP_THRESHOLD) { \ + B = MAX_EXP*(1.0+(A)-EXP_THRESHOLD); \ + } else if (A < -EXP_THRESHOLD) { \ + B = MIN_EXP; \ + } else { \ + B = exp(A); \ + } \ + } + + +int +BSIM4V4PAeffGeo(double, int, int, double, double, double, double, double *, double *, double *, double *); +int +BSIM4V4RdseffGeo(double, int, int, int, double, double, double, double, double, int, double *); + +int +BSIM4V4DioIjthVjmEval(Nvtm, Ijth, Isb, XExpBV, Vjm) +double Nvtm, Ijth, Isb, XExpBV; +double *Vjm; +{ +double Tb, Tc, EVjmovNv; + + Tc = XExpBV; + Tb = 1.0 + Ijth / Isb - Tc; + EVjmovNv = 0.5 * (Tb + sqrt(Tb * Tb + 4.0 * Tc)); + *Vjm = Nvtm * log(EVjmovNv); + +return 0; +} + + +int +BSIM4V4temp(inModel,ckt) +GENmodel *inModel; +CKTcircuit *ckt; +{ +BSIM4V4model *model = (BSIM4V4model*) inModel; +BSIM4V4instance *here; +struct bsim4SizeDependParam *pSizeDependParamKnot, *pLastKnot, *pParam=NULL; +double tmp, tmp1, tmp2, tmp3, Eg, Eg0, ni; +double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Lnew=0.0, Wnew; +double delTemp, Temp, TRatio, Inv_L, Inv_W, Inv_LW, Vtm0, Tnom; +double dumPs, dumPd, dumAs, dumAd, PowWeffWr; +double DMCGeff, DMCIeff, DMDGeff; +double Nvtms, Nvtmd, SourceSatCurrent, DrainSatCurrent; +double T10; +double Inv_saref, Inv_sbref, Inv_sa, Inv_sb, rho, Ldrn, dvth0_lod; +double W_tmp, Inv_ODeff, OD_offset, dk2_lod, deta0_lod; + +int Size_Not_Found, i; + + /* loop through all the BSIM4V4 device models */ + for (; model != NULL; model = model->BSIM4V4nextModel) + { Temp = ckt->CKTtemp; + if (model->BSIM4V4SbulkJctPotential < 0.1) + { model->BSIM4V4SbulkJctPotential = 0.1; + fprintf(stderr, "Given pbs is less than 0.1. Pbs is set to 0.1.\n"); + } + if (model->BSIM4V4SsidewallJctPotential < 0.1) + { model->BSIM4V4SsidewallJctPotential = 0.1; + fprintf(stderr, "Given pbsws is less than 0.1. Pbsws is set to 0.1.\n"); + } + if (model->BSIM4V4SGatesidewallJctPotential < 0.1) + { model->BSIM4V4SGatesidewallJctPotential = 0.1; + fprintf(stderr, "Given pbswgs is less than 0.1. Pbswgs is set to 0.1.\n"); + } + + if (model->BSIM4V4DbulkJctPotential < 0.1) + { model->BSIM4V4DbulkJctPotential = 0.1; + fprintf(stderr, "Given pbd is less than 0.1. Pbd is set to 0.1.\n"); + } + if (model->BSIM4V4DsidewallJctPotential < 0.1) + { model->BSIM4V4DsidewallJctPotential = 0.1; + fprintf(stderr, "Given pbswd is less than 0.1. Pbswd is set to 0.1.\n"); + } + if (model->BSIM4V4DGatesidewallJctPotential < 0.1) + { model->BSIM4V4DGatesidewallJctPotential = 0.1; + fprintf(stderr, "Given pbswgd is less than 0.1. Pbswgd is set to 0.1.\n"); + } + + if ((model->BSIM4V4toxeGiven) && (model->BSIM4V4toxpGiven) && (model->BSIM4V4dtoxGiven) + && (model->BSIM4V4toxe != (model->BSIM4V4toxp + model->BSIM4V4dtox))) + printf("Warning: toxe, toxp and dtox all given and toxe != toxp + dtox; dtox ignored.\n"); + else if ((model->BSIM4V4toxeGiven) && (!model->BSIM4V4toxpGiven)) + model->BSIM4V4toxp = model->BSIM4V4toxe - model->BSIM4V4dtox; + else if ((!model->BSIM4V4toxeGiven) && (model->BSIM4V4toxpGiven)) + model->BSIM4V4toxe = model->BSIM4V4toxp + model->BSIM4V4dtox; + + model->BSIM4V4coxe = model->BSIM4V4epsrox * EPS0 / model->BSIM4V4toxe; + model->BSIM4V4coxp = model->BSIM4V4epsrox * EPS0 / model->BSIM4V4toxp; + + if (!model->BSIM4V4cgdoGiven) + { if (model->BSIM4V4dlcGiven && (model->BSIM4V4dlc > 0.0)) + model->BSIM4V4cgdo = model->BSIM4V4dlc * model->BSIM4V4coxe + - model->BSIM4V4cgdl ; + else + model->BSIM4V4cgdo = 0.6 * model->BSIM4V4xj * model->BSIM4V4coxe; + } + if (!model->BSIM4V4cgsoGiven) + { if (model->BSIM4V4dlcGiven && (model->BSIM4V4dlc > 0.0)) + model->BSIM4V4cgso = model->BSIM4V4dlc * model->BSIM4V4coxe + - model->BSIM4V4cgsl ; + else + model->BSIM4V4cgso = 0.6 * model->BSIM4V4xj * model->BSIM4V4coxe; + } + if (!model->BSIM4V4cgboGiven) + model->BSIM4V4cgbo = 2.0 * model->BSIM4V4dwc * model->BSIM4V4coxe; + model->pSizeDependParamKnot = NULL; + pLastKnot = NULL; + + Tnom = model->BSIM4V4tnom; + TRatio = Temp / Tnom; + + model->BSIM4V4vcrit = CONSTvt0 * log(CONSTvt0 / (CONSTroot2 * 1.0e-14)); + model->BSIM4V4factor1 = sqrt(EPSSI / (model->BSIM4V4epsrox * EPS0) + * model->BSIM4V4toxe); + + Vtm0 = model->BSIM4V4vtm0 = KboQ * Tnom; + Eg0 = 1.16 - 7.02e-4 * Tnom * Tnom / (Tnom + 1108.0); + ni = 1.45e10 * (Tnom / 300.15) * sqrt(Tnom / 300.15) + * exp(21.5565981 - Eg0 / (2.0 * Vtm0)); + + model->BSIM4V4vtm = KboQ * Temp; + Eg = 1.16 - 7.02e-4 * Temp * Temp / (Temp + 1108.0); + if (Temp != Tnom) + { T0 = Eg0 / Vtm0 - Eg / model->BSIM4V4vtm; + T1 = log(Temp / Tnom); + T2 = T0 + model->BSIM4V4SjctTempExponent * T1; + T3 = exp(T2 / model->BSIM4V4SjctEmissionCoeff); + model->BSIM4V4SjctTempSatCurDensity = model->BSIM4V4SjctSatCurDensity + * T3; + model->BSIM4V4SjctSidewallTempSatCurDensity + = model->BSIM4V4SjctSidewallSatCurDensity * T3; + model->BSIM4V4SjctGateSidewallTempSatCurDensity + = model->BSIM4V4SjctGateSidewallSatCurDensity * T3; + + T2 = T0 + model->BSIM4V4DjctTempExponent * T1; + T3 = exp(T2 / model->BSIM4V4DjctEmissionCoeff); + model->BSIM4V4DjctTempSatCurDensity = model->BSIM4V4DjctSatCurDensity + * T3; + model->BSIM4V4DjctSidewallTempSatCurDensity + = model->BSIM4V4DjctSidewallSatCurDensity * T3; + model->BSIM4V4DjctGateSidewallTempSatCurDensity + = model->BSIM4V4DjctGateSidewallSatCurDensity * T3; + } + else + { model->BSIM4V4SjctTempSatCurDensity = model->BSIM4V4SjctSatCurDensity; + model->BSIM4V4SjctSidewallTempSatCurDensity + = model->BSIM4V4SjctSidewallSatCurDensity; + model->BSIM4V4SjctGateSidewallTempSatCurDensity + = model->BSIM4V4SjctGateSidewallSatCurDensity; + model->BSIM4V4DjctTempSatCurDensity = model->BSIM4V4DjctSatCurDensity; + model->BSIM4V4DjctSidewallTempSatCurDensity + = model->BSIM4V4DjctSidewallSatCurDensity; + model->BSIM4V4DjctGateSidewallTempSatCurDensity + = model->BSIM4V4DjctGateSidewallSatCurDensity; + } + + if (model->BSIM4V4SjctTempSatCurDensity < 0.0) + model->BSIM4V4SjctTempSatCurDensity = 0.0; + if (model->BSIM4V4SjctSidewallTempSatCurDensity < 0.0) + model->BSIM4V4SjctSidewallTempSatCurDensity = 0.0; + if (model->BSIM4V4SjctGateSidewallTempSatCurDensity < 0.0) + model->BSIM4V4SjctGateSidewallTempSatCurDensity = 0.0; + if (model->BSIM4V4DjctTempSatCurDensity < 0.0) + model->BSIM4V4DjctTempSatCurDensity = 0.0; + if (model->BSIM4V4DjctSidewallTempSatCurDensity < 0.0) + model->BSIM4V4DjctSidewallTempSatCurDensity = 0.0; + if (model->BSIM4V4DjctGateSidewallTempSatCurDensity < 0.0) + model->BSIM4V4DjctGateSidewallTempSatCurDensity = 0.0; + + /* Temperature dependence of D/B and S/B diode capacitance begins */ + delTemp = ckt->CKTtemp - model->BSIM4V4tnom; + T0 = model->BSIM4V4tcj * delTemp; + if (T0 >= -1.0) + { model->BSIM4V4SunitAreaTempJctCap = model->BSIM4V4SunitAreaJctCap *(1.0 + T0); /*bug_fix -JX */ + model->BSIM4V4DunitAreaTempJctCap = model->BSIM4V4DunitAreaJctCap *(1.0 + T0); + } + else + { if (model->BSIM4V4SunitAreaJctCap > 0.0) + { model->BSIM4V4SunitAreaTempJctCap = 0.0; + fprintf(stderr, "Temperature effect has caused cjs to be negative. Cjs is clamped to zero.\n"); + } + if (model->BSIM4V4DunitAreaJctCap > 0.0) + { model->BSIM4V4DunitAreaTempJctCap = 0.0; + fprintf(stderr, "Temperature effect has caused cjd to be negative. Cjd is clamped to zero.\n"); + } + } + T0 = model->BSIM4V4tcjsw * delTemp; + if (T0 >= -1.0) + { model->BSIM4V4SunitLengthSidewallTempJctCap = model->BSIM4V4SunitLengthSidewallJctCap *(1.0 + T0); + model->BSIM4V4DunitLengthSidewallTempJctCap = model->BSIM4V4DunitLengthSidewallJctCap *(1.0 + T0); + } + else + { if (model->BSIM4V4SunitLengthSidewallJctCap > 0.0) + { model->BSIM4V4SunitLengthSidewallTempJctCap = 0.0; + fprintf(stderr, "Temperature effect has caused cjsws to be negative. Cjsws is clamped to zero.\n"); + } + if (model->BSIM4V4DunitLengthSidewallJctCap > 0.0) + { model->BSIM4V4DunitLengthSidewallTempJctCap = 0.0; + fprintf(stderr, "Temperature effect has caused cjswd to be negative. Cjswd is clamped to zero.\n"); + } + } + T0 = model->BSIM4V4tcjswg * delTemp; + if (T0 >= -1.0) + { model->BSIM4V4SunitLengthGateSidewallTempJctCap = model->BSIM4V4SunitLengthGateSidewallJctCap *(1.0 + T0); + model->BSIM4V4DunitLengthGateSidewallTempJctCap = model->BSIM4V4DunitLengthGateSidewallJctCap *(1.0 + T0); + } + else + { if (model->BSIM4V4SunitLengthGateSidewallJctCap > 0.0) + { model->BSIM4V4SunitLengthGateSidewallTempJctCap = 0.0; + fprintf(stderr, "Temperature effect has caused cjswgs to be negative. Cjswgs is clamped to zero.\n"); + } + if (model->BSIM4V4DunitLengthGateSidewallJctCap > 0.0) + { model->BSIM4V4DunitLengthGateSidewallTempJctCap = 0.0; + fprintf(stderr, "Temperature effect has caused cjswgd to be negative. Cjswgd is clamped to zero.\n"); + } + } + + model->BSIM4V4PhiBS = model->BSIM4V4SbulkJctPotential + - model->BSIM4V4tpb * delTemp; + if (model->BSIM4V4PhiBS < 0.01) + { model->BSIM4V4PhiBS = 0.01; + fprintf(stderr, "Temperature effect has caused pbs to be less than 0.01. Pbs is clamped to 0.01.\n"); + } + model->BSIM4V4PhiBD = model->BSIM4V4DbulkJctPotential + - model->BSIM4V4tpb * delTemp; + if (model->BSIM4V4PhiBD < 0.01) + { model->BSIM4V4PhiBD = 0.01; + fprintf(stderr, "Temperature effect has caused pbd to be less than 0.01. Pbd is clamped to 0.01.\n"); + } + + model->BSIM4V4PhiBSWS = model->BSIM4V4SsidewallJctPotential + - model->BSIM4V4tpbsw * delTemp; + if (model->BSIM4V4PhiBSWS <= 0.01) + { model->BSIM4V4PhiBSWS = 0.01; + fprintf(stderr, "Temperature effect has caused pbsws to be less than 0.01. Pbsws is clamped to 0.01.\n"); + } + model->BSIM4V4PhiBSWD = model->BSIM4V4DsidewallJctPotential + - model->BSIM4V4tpbsw * delTemp; + if (model->BSIM4V4PhiBSWD <= 0.01) + { model->BSIM4V4PhiBSWD = 0.01; + fprintf(stderr, "Temperature effect has caused pbswd to be less than 0.01. Pbswd is clamped to 0.01.\n"); + } + + model->BSIM4V4PhiBSWGS = model->BSIM4V4SGatesidewallJctPotential + - model->BSIM4V4tpbswg * delTemp; + if (model->BSIM4V4PhiBSWGS <= 0.01) + { model->BSIM4V4PhiBSWGS = 0.01; + fprintf(stderr, "Temperature effect has caused pbswgs to be less than 0.01. Pbswgs is clamped to 0.01.\n"); + } + model->BSIM4V4PhiBSWGD = model->BSIM4V4DGatesidewallJctPotential + - model->BSIM4V4tpbswg * delTemp; + if (model->BSIM4V4PhiBSWGD <= 0.01) + { model->BSIM4V4PhiBSWGD = 0.01; + fprintf(stderr, "Temperature effect has caused pbswgd to be less than 0.01. Pbswgd is clamped to 0.01.\n"); + } /* End of junction capacitance */ + + + if (model->BSIM4V4ijthdfwd <= 0.0) + { model->BSIM4V4ijthdfwd = 0.1; + fprintf(stderr, "Ijthdfwd reset to %g.\n", model->BSIM4V4ijthdfwd); + } + if (model->BSIM4V4ijthsfwd <= 0.0) + { model->BSIM4V4ijthsfwd = 0.1; + fprintf(stderr, "Ijthsfwd reset to %g.\n", model->BSIM4V4ijthsfwd); + } + if (model->BSIM4V4ijthdrev <= 0.0) + { model->BSIM4V4ijthdrev = 0.1; + fprintf(stderr, "Ijthdrev reset to %g.\n", model->BSIM4V4ijthdrev); + } + if (model->BSIM4V4ijthsrev <= 0.0) + { model->BSIM4V4ijthsrev = 0.1; + fprintf(stderr, "Ijthsrev reset to %g.\n", model->BSIM4V4ijthsrev); + } + + if ((model->BSIM4V4xjbvd <= 0.0) && (model->BSIM4V4dioMod == 2)) + { model->BSIM4V4xjbvd = 1.0; + fprintf(stderr, "Xjbvd reset to %g.\n", model->BSIM4V4xjbvd); + } + else if ((model->BSIM4V4xjbvd < 0.0) && (model->BSIM4V4dioMod == 0)) + { model->BSIM4V4xjbvd = 1.0; + fprintf(stderr, "Xjbvd reset to %g.\n", model->BSIM4V4xjbvd); + } + + if (model->BSIM4V4bvd <= 0.0) + { model->BSIM4V4bvd = 10.0; + fprintf(stderr, "BVD reset to %g.\n", model->BSIM4V4bvd); + } + + if ((model->BSIM4V4xjbvs <= 0.0) && (model->BSIM4V4dioMod == 2)) + { model->BSIM4V4xjbvs = 1.0; + fprintf(stderr, "Xjbvs reset to %g.\n", model->BSIM4V4xjbvs); + } + else if ((model->BSIM4V4xjbvs < 0.0) && (model->BSIM4V4dioMod == 0)) + { model->BSIM4V4xjbvs = 1.0; + fprintf(stderr, "Xjbvs reset to %g.\n", model->BSIM4V4xjbvs); + } + + if (model->BSIM4V4bvs <= 0.0) + { model->BSIM4V4bvs = 10.0; + fprintf(stderr, "BVS reset to %g.\n", model->BSIM4V4bvs); + } + + + /* loop through all the instances of the model */ + for (here = model->BSIM4V4instances; here != NULL; + here = here->BSIM4V4nextInstance) + { if (here->BSIM4V4owner != ARCHme) continue; + pSizeDependParamKnot = model->pSizeDependParamKnot; + Size_Not_Found = 1; + while ((pSizeDependParamKnot != NULL) && Size_Not_Found) + { if ((here->BSIM4V4l == pSizeDependParamKnot->Length) + && (here->BSIM4V4w == pSizeDependParamKnot->Width) + && (here->BSIM4V4nf == pSizeDependParamKnot->NFinger)) + { Size_Not_Found = 0; + here->pParam = pSizeDependParamKnot; + pParam = here->pParam; /*bug-fix */ + } + else + { pLastKnot = pSizeDependParamKnot; + pSizeDependParamKnot = pSizeDependParamKnot->pNext; + } + } + + /* stress effect */ + Ldrn = here->BSIM4V4l; + + if (Size_Not_Found) + { pParam = (struct bsim4SizeDependParam *)malloc( + sizeof(struct bsim4SizeDependParam)); + if (pLastKnot == NULL) + model->pSizeDependParamKnot = pParam; + else + pLastKnot->pNext = pParam; + pParam->pNext = NULL; + here->pParam = pParam; + + pParam->Length = here->BSIM4V4l; + pParam->Width = here->BSIM4V4w; + pParam->NFinger = here->BSIM4V4nf; + Lnew = here->BSIM4V4l + model->BSIM4V4xl ; + Wnew = here->BSIM4V4w / here->BSIM4V4nf + model->BSIM4V4xw; + + T0 = pow(Lnew, model->BSIM4V4Lln); + T1 = pow(Wnew, model->BSIM4V4Lwn); + tmp1 = model->BSIM4V4Ll / T0 + model->BSIM4V4Lw / T1 + + model->BSIM4V4Lwl / (T0 * T1); + pParam->BSIM4V4dl = model->BSIM4V4Lint + tmp1; + tmp2 = model->BSIM4V4Llc / T0 + model->BSIM4V4Lwc / T1 + + model->BSIM4V4Lwlc / (T0 * T1); + pParam->BSIM4V4dlc = model->BSIM4V4dlc + tmp2; + pParam->BSIM4V4dlcig = model->BSIM4V4dlcig; + + T2 = pow(Lnew, model->BSIM4V4Wln); + T3 = pow(Wnew, model->BSIM4V4Wwn); + tmp1 = model->BSIM4V4Wl / T2 + model->BSIM4V4Ww / T3 + + model->BSIM4V4Wwl / (T2 * T3); + pParam->BSIM4V4dw = model->BSIM4V4Wint + tmp1; + tmp2 = model->BSIM4V4Wlc / T2 + model->BSIM4V4Wwc / T3 + + model->BSIM4V4Wwlc / (T2 * T3); + pParam->BSIM4V4dwc = model->BSIM4V4dwc + tmp2; + pParam->BSIM4V4dwj = model->BSIM4V4dwj + tmp2; + + pParam->BSIM4V4leff = Lnew - 2.0 * pParam->BSIM4V4dl; + if (pParam->BSIM4V4leff <= 0.0) + { IFuid namarray[2]; + namarray[0] = model->BSIM4V4modName; + namarray[1] = here->BSIM4V4name; + (*(SPfrontEnd->IFerror))(ERR_FATAL, + "BSIM4V4: mosfet %s, model %s: Effective channel length <= 0", + namarray); + return(E_BADPARM); + } + + pParam->BSIM4V4weff = Wnew - 2.0 * pParam->BSIM4V4dw; + if (pParam->BSIM4V4weff <= 0.0) + { IFuid namarray[2]; + namarray[0] = model->BSIM4V4modName; + namarray[1] = here->BSIM4V4name; + (*(SPfrontEnd->IFerror))(ERR_FATAL, + "BSIM4V4: mosfet %s, model %s: Effective channel width <= 0", + namarray); + return(E_BADPARM); + } + + pParam->BSIM4V4leffCV = Lnew - 2.0 * pParam->BSIM4V4dlc; + if (pParam->BSIM4V4leffCV <= 0.0) + { IFuid namarray[2]; + namarray[0] = model->BSIM4V4modName; + namarray[1] = here->BSIM4V4name; + (*(SPfrontEnd->IFerror))(ERR_FATAL, + "BSIM4V4: mosfet %s, model %s: Effective channel length for C-V <= 0", + namarray); + fprintf(stderr,"BSIM4V4: mosfet %s, model %s: Effective channel length for C-V <= 0 (Lnew - 2.0*BSIM4V4dlc == %g - 2.0*%g)\n", + model->BSIM4V4modName, here->BSIM4V4name, Lnew, pParam->BSIM4V4dlc ); + return(E_BADPARM); + } + + pParam->BSIM4V4weffCV = Wnew - 2.0 * pParam->BSIM4V4dwc; + if (pParam->BSIM4V4weffCV <= 0.0) + { IFuid namarray[2]; + namarray[0] = model->BSIM4V4modName; + namarray[1] = here->BSIM4V4name; + (*(SPfrontEnd->IFerror))(ERR_FATAL, + "BSIM4V4: mosfet %s, model %s: Effective channel width for C-V <= 0", + namarray); + return(E_BADPARM); + } + + pParam->BSIM4V4weffCJ = Wnew - 2.0 * pParam->BSIM4V4dwj; + if (pParam->BSIM4V4weffCJ <= 0.0) + { IFuid namarray[2]; + namarray[0] = model->BSIM4V4modName; + namarray[1] = here->BSIM4V4name; + (*(SPfrontEnd->IFerror))(ERR_FATAL, + "BSIM4V4: mosfet %s, model %s: Effective channel width for S/D junctions <= 0", + namarray); + return(E_BADPARM); + } + + + if (model->BSIM4V4binUnit == 1) + { Inv_L = 1.0e-6 / pParam->BSIM4V4leff; + Inv_W = 1.0e-6 / pParam->BSIM4V4weff; + Inv_LW = 1.0e-12 / (pParam->BSIM4V4leff + * pParam->BSIM4V4weff); + } + else + { Inv_L = 1.0 / pParam->BSIM4V4leff; + Inv_W = 1.0 / pParam->BSIM4V4weff; + Inv_LW = 1.0 / (pParam->BSIM4V4leff + * pParam->BSIM4V4weff); + } + pParam->BSIM4V4cdsc = model->BSIM4V4cdsc + + model->BSIM4V4lcdsc * Inv_L + + model->BSIM4V4wcdsc * Inv_W + + model->BSIM4V4pcdsc * Inv_LW; + pParam->BSIM4V4cdscb = model->BSIM4V4cdscb + + model->BSIM4V4lcdscb * Inv_L + + model->BSIM4V4wcdscb * Inv_W + + model->BSIM4V4pcdscb * Inv_LW; + + pParam->BSIM4V4cdscd = model->BSIM4V4cdscd + + model->BSIM4V4lcdscd * Inv_L + + model->BSIM4V4wcdscd * Inv_W + + model->BSIM4V4pcdscd * Inv_LW; + + pParam->BSIM4V4cit = model->BSIM4V4cit + + model->BSIM4V4lcit * Inv_L + + model->BSIM4V4wcit * Inv_W + + model->BSIM4V4pcit * Inv_LW; + pParam->BSIM4V4nfactor = model->BSIM4V4nfactor + + model->BSIM4V4lnfactor * Inv_L + + model->BSIM4V4wnfactor * Inv_W + + model->BSIM4V4pnfactor * Inv_LW; + pParam->BSIM4V4xj = model->BSIM4V4xj + + model->BSIM4V4lxj * Inv_L + + model->BSIM4V4wxj * Inv_W + + model->BSIM4V4pxj * Inv_LW; + pParam->BSIM4V4vsat = model->BSIM4V4vsat + + model->BSIM4V4lvsat * Inv_L + + model->BSIM4V4wvsat * Inv_W + + model->BSIM4V4pvsat * Inv_LW; + pParam->BSIM4V4at = model->BSIM4V4at + + model->BSIM4V4lat * Inv_L + + model->BSIM4V4wat * Inv_W + + model->BSIM4V4pat * Inv_LW; + pParam->BSIM4V4a0 = model->BSIM4V4a0 + + model->BSIM4V4la0 * Inv_L + + model->BSIM4V4wa0 * Inv_W + + model->BSIM4V4pa0 * Inv_LW; + + pParam->BSIM4V4ags = model->BSIM4V4ags + + model->BSIM4V4lags * Inv_L + + model->BSIM4V4wags * Inv_W + + model->BSIM4V4pags * Inv_LW; + + pParam->BSIM4V4a1 = model->BSIM4V4a1 + + model->BSIM4V4la1 * Inv_L + + model->BSIM4V4wa1 * Inv_W + + model->BSIM4V4pa1 * Inv_LW; + pParam->BSIM4V4a2 = model->BSIM4V4a2 + + model->BSIM4V4la2 * Inv_L + + model->BSIM4V4wa2 * Inv_W + + model->BSIM4V4pa2 * Inv_LW; + pParam->BSIM4V4keta = model->BSIM4V4keta + + model->BSIM4V4lketa * Inv_L + + model->BSIM4V4wketa * Inv_W + + model->BSIM4V4pketa * Inv_LW; + pParam->BSIM4V4nsub = model->BSIM4V4nsub + + model->BSIM4V4lnsub * Inv_L + + model->BSIM4V4wnsub * Inv_W + + model->BSIM4V4pnsub * Inv_LW; + pParam->BSIM4V4ndep = model->BSIM4V4ndep + + model->BSIM4V4lndep * Inv_L + + model->BSIM4V4wndep * Inv_W + + model->BSIM4V4pndep * Inv_LW; + pParam->BSIM4V4nsd = model->BSIM4V4nsd + + model->BSIM4V4lnsd * Inv_L + + model->BSIM4V4wnsd * Inv_W + + model->BSIM4V4pnsd * Inv_LW; + pParam->BSIM4V4phin = model->BSIM4V4phin + + model->BSIM4V4lphin * Inv_L + + model->BSIM4V4wphin * Inv_W + + model->BSIM4V4pphin * Inv_LW; + pParam->BSIM4V4ngate = model->BSIM4V4ngate + + model->BSIM4V4lngate * Inv_L + + model->BSIM4V4wngate * Inv_W + + model->BSIM4V4pngate * Inv_LW; + pParam->BSIM4V4gamma1 = model->BSIM4V4gamma1 + + model->BSIM4V4lgamma1 * Inv_L + + model->BSIM4V4wgamma1 * Inv_W + + model->BSIM4V4pgamma1 * Inv_LW; + pParam->BSIM4V4gamma2 = model->BSIM4V4gamma2 + + model->BSIM4V4lgamma2 * Inv_L + + model->BSIM4V4wgamma2 * Inv_W + + model->BSIM4V4pgamma2 * Inv_LW; + pParam->BSIM4V4vbx = model->BSIM4V4vbx + + model->BSIM4V4lvbx * Inv_L + + model->BSIM4V4wvbx * Inv_W + + model->BSIM4V4pvbx * Inv_LW; + pParam->BSIM4V4vbm = model->BSIM4V4vbm + + model->BSIM4V4lvbm * Inv_L + + model->BSIM4V4wvbm * Inv_W + + model->BSIM4V4pvbm * Inv_LW; + pParam->BSIM4V4xt = model->BSIM4V4xt + + model->BSIM4V4lxt * Inv_L + + model->BSIM4V4wxt * Inv_W + + model->BSIM4V4pxt * Inv_LW; + pParam->BSIM4V4vfb = model->BSIM4V4vfb + + model->BSIM4V4lvfb * Inv_L + + model->BSIM4V4wvfb * Inv_W + + model->BSIM4V4pvfb * Inv_LW; + pParam->BSIM4V4k1 = model->BSIM4V4k1 + + model->BSIM4V4lk1 * Inv_L + + model->BSIM4V4wk1 * Inv_W + + model->BSIM4V4pk1 * Inv_LW; + pParam->BSIM4V4kt1 = model->BSIM4V4kt1 + + model->BSIM4V4lkt1 * Inv_L + + model->BSIM4V4wkt1 * Inv_W + + model->BSIM4V4pkt1 * Inv_LW; + pParam->BSIM4V4kt1l = model->BSIM4V4kt1l + + model->BSIM4V4lkt1l * Inv_L + + model->BSIM4V4wkt1l * Inv_W + + model->BSIM4V4pkt1l * Inv_LW; + pParam->BSIM4V4k2 = model->BSIM4V4k2 + + model->BSIM4V4lk2 * Inv_L + + model->BSIM4V4wk2 * Inv_W + + model->BSIM4V4pk2 * Inv_LW; + pParam->BSIM4V4kt2 = model->BSIM4V4kt2 + + model->BSIM4V4lkt2 * Inv_L + + model->BSIM4V4wkt2 * Inv_W + + model->BSIM4V4pkt2 * Inv_LW; + pParam->BSIM4V4k3 = model->BSIM4V4k3 + + model->BSIM4V4lk3 * Inv_L + + model->BSIM4V4wk3 * Inv_W + + model->BSIM4V4pk3 * Inv_LW; + pParam->BSIM4V4k3b = model->BSIM4V4k3b + + model->BSIM4V4lk3b * Inv_L + + model->BSIM4V4wk3b * Inv_W + + model->BSIM4V4pk3b * Inv_LW; + pParam->BSIM4V4w0 = model->BSIM4V4w0 + + model->BSIM4V4lw0 * Inv_L + + model->BSIM4V4ww0 * Inv_W + + model->BSIM4V4pw0 * Inv_LW; + pParam->BSIM4V4lpe0 = model->BSIM4V4lpe0 + + model->BSIM4V4llpe0 * Inv_L + + model->BSIM4V4wlpe0 * Inv_W + + model->BSIM4V4plpe0 * Inv_LW; + pParam->BSIM4V4lpeb = model->BSIM4V4lpeb + + model->BSIM4V4llpeb * Inv_L + + model->BSIM4V4wlpeb * Inv_W + + model->BSIM4V4plpeb * Inv_LW; + pParam->BSIM4V4dvtp0 = model->BSIM4V4dvtp0 + + model->BSIM4V4ldvtp0 * Inv_L + + model->BSIM4V4wdvtp0 * Inv_W + + model->BSIM4V4pdvtp0 * Inv_LW; + pParam->BSIM4V4dvtp1 = model->BSIM4V4dvtp1 + + model->BSIM4V4ldvtp1 * Inv_L + + model->BSIM4V4wdvtp1 * Inv_W + + model->BSIM4V4pdvtp1 * Inv_LW; + pParam->BSIM4V4dvt0 = model->BSIM4V4dvt0 + + model->BSIM4V4ldvt0 * Inv_L + + model->BSIM4V4wdvt0 * Inv_W + + model->BSIM4V4pdvt0 * Inv_LW; + pParam->BSIM4V4dvt1 = model->BSIM4V4dvt1 + + model->BSIM4V4ldvt1 * Inv_L + + model->BSIM4V4wdvt1 * Inv_W + + model->BSIM4V4pdvt1 * Inv_LW; + pParam->BSIM4V4dvt2 = model->BSIM4V4dvt2 + + model->BSIM4V4ldvt2 * Inv_L + + model->BSIM4V4wdvt2 * Inv_W + + model->BSIM4V4pdvt2 * Inv_LW; + pParam->BSIM4V4dvt0w = model->BSIM4V4dvt0w + + model->BSIM4V4ldvt0w * Inv_L + + model->BSIM4V4wdvt0w * Inv_W + + model->BSIM4V4pdvt0w * Inv_LW; + pParam->BSIM4V4dvt1w = model->BSIM4V4dvt1w + + model->BSIM4V4ldvt1w * Inv_L + + model->BSIM4V4wdvt1w * Inv_W + + model->BSIM4V4pdvt1w * Inv_LW; + pParam->BSIM4V4dvt2w = model->BSIM4V4dvt2w + + model->BSIM4V4ldvt2w * Inv_L + + model->BSIM4V4wdvt2w * Inv_W + + model->BSIM4V4pdvt2w * Inv_LW; + pParam->BSIM4V4drout = model->BSIM4V4drout + + model->BSIM4V4ldrout * Inv_L + + model->BSIM4V4wdrout * Inv_W + + model->BSIM4V4pdrout * Inv_LW; + pParam->BSIM4V4dsub = model->BSIM4V4dsub + + model->BSIM4V4ldsub * Inv_L + + model->BSIM4V4wdsub * Inv_W + + model->BSIM4V4pdsub * Inv_LW; + pParam->BSIM4V4vth0 = model->BSIM4V4vth0 + + model->BSIM4V4lvth0 * Inv_L + + model->BSIM4V4wvth0 * Inv_W + + model->BSIM4V4pvth0 * Inv_LW; + pParam->BSIM4V4ua = model->BSIM4V4ua + + model->BSIM4V4lua * Inv_L + + model->BSIM4V4wua * Inv_W + + model->BSIM4V4pua * Inv_LW; + pParam->BSIM4V4ua1 = model->BSIM4V4ua1 + + model->BSIM4V4lua1 * Inv_L + + model->BSIM4V4wua1 * Inv_W + + model->BSIM4V4pua1 * Inv_LW; + pParam->BSIM4V4ub = model->BSIM4V4ub + + model->BSIM4V4lub * Inv_L + + model->BSIM4V4wub * Inv_W + + model->BSIM4V4pub * Inv_LW; + pParam->BSIM4V4ub1 = model->BSIM4V4ub1 + + model->BSIM4V4lub1 * Inv_L + + model->BSIM4V4wub1 * Inv_W + + model->BSIM4V4pub1 * Inv_LW; + pParam->BSIM4V4uc = model->BSIM4V4uc + + model->BSIM4V4luc * Inv_L + + model->BSIM4V4wuc * Inv_W + + model->BSIM4V4puc * Inv_LW; + pParam->BSIM4V4uc1 = model->BSIM4V4uc1 + + model->BSIM4V4luc1 * Inv_L + + model->BSIM4V4wuc1 * Inv_W + + model->BSIM4V4puc1 * Inv_LW; + pParam->BSIM4V4eu = model->BSIM4V4eu + + model->BSIM4V4leu * Inv_L + + model->BSIM4V4weu * Inv_W + + model->BSIM4V4peu * Inv_LW; + pParam->BSIM4V4u0 = model->BSIM4V4u0 + + model->BSIM4V4lu0 * Inv_L + + model->BSIM4V4wu0 * Inv_W + + model->BSIM4V4pu0 * Inv_LW; + pParam->BSIM4V4ute = model->BSIM4V4ute + + model->BSIM4V4lute * Inv_L + + model->BSIM4V4wute * Inv_W + + model->BSIM4V4pute * Inv_LW; + pParam->BSIM4V4voff = model->BSIM4V4voff + + model->BSIM4V4lvoff * Inv_L + + model->BSIM4V4wvoff * Inv_W + + model->BSIM4V4pvoff * Inv_LW; + pParam->BSIM4V4minv = model->BSIM4V4minv + + model->BSIM4V4lminv * Inv_L + + model->BSIM4V4wminv * Inv_W + + model->BSIM4V4pminv * Inv_LW; + pParam->BSIM4V4fprout = model->BSIM4V4fprout + + model->BSIM4V4lfprout * Inv_L + + model->BSIM4V4wfprout * Inv_W + + model->BSIM4V4pfprout * Inv_LW; + pParam->BSIM4V4pdits = model->BSIM4V4pdits + + model->BSIM4V4lpdits * Inv_L + + model->BSIM4V4wpdits * Inv_W + + model->BSIM4V4ppdits * Inv_LW; + pParam->BSIM4V4pditsd = model->BSIM4V4pditsd + + model->BSIM4V4lpditsd * Inv_L + + model->BSIM4V4wpditsd * Inv_W + + model->BSIM4V4ppditsd * Inv_LW; + pParam->BSIM4V4delta = model->BSIM4V4delta + + model->BSIM4V4ldelta * Inv_L + + model->BSIM4V4wdelta * Inv_W + + model->BSIM4V4pdelta * Inv_LW; + pParam->BSIM4V4rdsw = model->BSIM4V4rdsw + + model->BSIM4V4lrdsw * Inv_L + + model->BSIM4V4wrdsw * Inv_W + + model->BSIM4V4prdsw * Inv_LW; + pParam->BSIM4V4rdw = model->BSIM4V4rdw + + model->BSIM4V4lrdw * Inv_L + + model->BSIM4V4wrdw * Inv_W + + model->BSIM4V4prdw * Inv_LW; + pParam->BSIM4V4rsw = model->BSIM4V4rsw + + model->BSIM4V4lrsw * Inv_L + + model->BSIM4V4wrsw * Inv_W + + model->BSIM4V4prsw * Inv_LW; + pParam->BSIM4V4prwg = model->BSIM4V4prwg + + model->BSIM4V4lprwg * Inv_L + + model->BSIM4V4wprwg * Inv_W + + model->BSIM4V4pprwg * Inv_LW; + pParam->BSIM4V4prwb = model->BSIM4V4prwb + + model->BSIM4V4lprwb * Inv_L + + model->BSIM4V4wprwb * Inv_W + + model->BSIM4V4pprwb * Inv_LW; + pParam->BSIM4V4prt = model->BSIM4V4prt + + model->BSIM4V4lprt * Inv_L + + model->BSIM4V4wprt * Inv_W + + model->BSIM4V4pprt * Inv_LW; + pParam->BSIM4V4eta0 = model->BSIM4V4eta0 + + model->BSIM4V4leta0 * Inv_L + + model->BSIM4V4weta0 * Inv_W + + model->BSIM4V4peta0 * Inv_LW; + pParam->BSIM4V4etab = model->BSIM4V4etab + + model->BSIM4V4letab * Inv_L + + model->BSIM4V4wetab * Inv_W + + model->BSIM4V4petab * Inv_LW; + pParam->BSIM4V4pclm = model->BSIM4V4pclm + + model->BSIM4V4lpclm * Inv_L + + model->BSIM4V4wpclm * Inv_W + + model->BSIM4V4ppclm * Inv_LW; + pParam->BSIM4V4pdibl1 = model->BSIM4V4pdibl1 + + model->BSIM4V4lpdibl1 * Inv_L + + model->BSIM4V4wpdibl1 * Inv_W + + model->BSIM4V4ppdibl1 * Inv_LW; + pParam->BSIM4V4pdibl2 = model->BSIM4V4pdibl2 + + model->BSIM4V4lpdibl2 * Inv_L + + model->BSIM4V4wpdibl2 * Inv_W + + model->BSIM4V4ppdibl2 * Inv_LW; + pParam->BSIM4V4pdiblb = model->BSIM4V4pdiblb + + model->BSIM4V4lpdiblb * Inv_L + + model->BSIM4V4wpdiblb * Inv_W + + model->BSIM4V4ppdiblb * Inv_LW; + pParam->BSIM4V4pscbe1 = model->BSIM4V4pscbe1 + + model->BSIM4V4lpscbe1 * Inv_L + + model->BSIM4V4wpscbe1 * Inv_W + + model->BSIM4V4ppscbe1 * Inv_LW; + pParam->BSIM4V4pscbe2 = model->BSIM4V4pscbe2 + + model->BSIM4V4lpscbe2 * Inv_L + + model->BSIM4V4wpscbe2 * Inv_W + + model->BSIM4V4ppscbe2 * Inv_LW; + pParam->BSIM4V4pvag = model->BSIM4V4pvag + + model->BSIM4V4lpvag * Inv_L + + model->BSIM4V4wpvag * Inv_W + + model->BSIM4V4ppvag * Inv_LW; + pParam->BSIM4V4wr = model->BSIM4V4wr + + model->BSIM4V4lwr * Inv_L + + model->BSIM4V4wwr * Inv_W + + model->BSIM4V4pwr * Inv_LW; + pParam->BSIM4V4dwg = model->BSIM4V4dwg + + model->BSIM4V4ldwg * Inv_L + + model->BSIM4V4wdwg * Inv_W + + model->BSIM4V4pdwg * Inv_LW; + pParam->BSIM4V4dwb = model->BSIM4V4dwb + + model->BSIM4V4ldwb * Inv_L + + model->BSIM4V4wdwb * Inv_W + + model->BSIM4V4pdwb * Inv_LW; + pParam->BSIM4V4b0 = model->BSIM4V4b0 + + model->BSIM4V4lb0 * Inv_L + + model->BSIM4V4wb0 * Inv_W + + model->BSIM4V4pb0 * Inv_LW; + pParam->BSIM4V4b1 = model->BSIM4V4b1 + + model->BSIM4V4lb1 * Inv_L + + model->BSIM4V4wb1 * Inv_W + + model->BSIM4V4pb1 * Inv_LW; + pParam->BSIM4V4alpha0 = model->BSIM4V4alpha0 + + model->BSIM4V4lalpha0 * Inv_L + + model->BSIM4V4walpha0 * Inv_W + + model->BSIM4V4palpha0 * Inv_LW; + pParam->BSIM4V4alpha1 = model->BSIM4V4alpha1 + + model->BSIM4V4lalpha1 * Inv_L + + model->BSIM4V4walpha1 * Inv_W + + model->BSIM4V4palpha1 * Inv_LW; + pParam->BSIM4V4beta0 = model->BSIM4V4beta0 + + model->BSIM4V4lbeta0 * Inv_L + + model->BSIM4V4wbeta0 * Inv_W + + model->BSIM4V4pbeta0 * Inv_LW; + pParam->BSIM4V4agidl = model->BSIM4V4agidl + + model->BSIM4V4lagidl * Inv_L + + model->BSIM4V4wagidl * Inv_W + + model->BSIM4V4pagidl * Inv_LW; + pParam->BSIM4V4bgidl = model->BSIM4V4bgidl + + model->BSIM4V4lbgidl * Inv_L + + model->BSIM4V4wbgidl * Inv_W + + model->BSIM4V4pbgidl * Inv_LW; + pParam->BSIM4V4cgidl = model->BSIM4V4cgidl + + model->BSIM4V4lcgidl * Inv_L + + model->BSIM4V4wcgidl * Inv_W + + model->BSIM4V4pcgidl * Inv_LW; + pParam->BSIM4V4egidl = model->BSIM4V4egidl + + model->BSIM4V4legidl * Inv_L + + model->BSIM4V4wegidl * Inv_W + + model->BSIM4V4pegidl * Inv_LW; + pParam->BSIM4V4aigc = model->BSIM4V4aigc + + model->BSIM4V4laigc * Inv_L + + model->BSIM4V4waigc * Inv_W + + model->BSIM4V4paigc * Inv_LW; + pParam->BSIM4V4bigc = model->BSIM4V4bigc + + model->BSIM4V4lbigc * Inv_L + + model->BSIM4V4wbigc * Inv_W + + model->BSIM4V4pbigc * Inv_LW; + pParam->BSIM4V4cigc = model->BSIM4V4cigc + + model->BSIM4V4lcigc * Inv_L + + model->BSIM4V4wcigc * Inv_W + + model->BSIM4V4pcigc * Inv_LW; + pParam->BSIM4V4aigsd = model->BSIM4V4aigsd + + model->BSIM4V4laigsd * Inv_L + + model->BSIM4V4waigsd * Inv_W + + model->BSIM4V4paigsd * Inv_LW; + pParam->BSIM4V4bigsd = model->BSIM4V4bigsd + + model->BSIM4V4lbigsd * Inv_L + + model->BSIM4V4wbigsd * Inv_W + + model->BSIM4V4pbigsd * Inv_LW; + pParam->BSIM4V4cigsd = model->BSIM4V4cigsd + + model->BSIM4V4lcigsd * Inv_L + + model->BSIM4V4wcigsd * Inv_W + + model->BSIM4V4pcigsd * Inv_LW; + pParam->BSIM4V4aigbacc = model->BSIM4V4aigbacc + + model->BSIM4V4laigbacc * Inv_L + + model->BSIM4V4waigbacc * Inv_W + + model->BSIM4V4paigbacc * Inv_LW; + pParam->BSIM4V4bigbacc = model->BSIM4V4bigbacc + + model->BSIM4V4lbigbacc * Inv_L + + model->BSIM4V4wbigbacc * Inv_W + + model->BSIM4V4pbigbacc * Inv_LW; + pParam->BSIM4V4cigbacc = model->BSIM4V4cigbacc + + model->BSIM4V4lcigbacc * Inv_L + + model->BSIM4V4wcigbacc * Inv_W + + model->BSIM4V4pcigbacc * Inv_LW; + pParam->BSIM4V4aigbinv = model->BSIM4V4aigbinv + + model->BSIM4V4laigbinv * Inv_L + + model->BSIM4V4waigbinv * Inv_W + + model->BSIM4V4paigbinv * Inv_LW; + pParam->BSIM4V4bigbinv = model->BSIM4V4bigbinv + + model->BSIM4V4lbigbinv * Inv_L + + model->BSIM4V4wbigbinv * Inv_W + + model->BSIM4V4pbigbinv * Inv_LW; + pParam->BSIM4V4cigbinv = model->BSIM4V4cigbinv + + model->BSIM4V4lcigbinv * Inv_L + + model->BSIM4V4wcigbinv * Inv_W + + model->BSIM4V4pcigbinv * Inv_LW; + pParam->BSIM4V4nigc = model->BSIM4V4nigc + + model->BSIM4V4lnigc * Inv_L + + model->BSIM4V4wnigc * Inv_W + + model->BSIM4V4pnigc * Inv_LW; + pParam->BSIM4V4nigbacc = model->BSIM4V4nigbacc + + model->BSIM4V4lnigbacc * Inv_L + + model->BSIM4V4wnigbacc * Inv_W + + model->BSIM4V4pnigbacc * Inv_LW; + pParam->BSIM4V4nigbinv = model->BSIM4V4nigbinv + + model->BSIM4V4lnigbinv * Inv_L + + model->BSIM4V4wnigbinv * Inv_W + + model->BSIM4V4pnigbinv * Inv_LW; + pParam->BSIM4V4ntox = model->BSIM4V4ntox + + model->BSIM4V4lntox * Inv_L + + model->BSIM4V4wntox * Inv_W + + model->BSIM4V4pntox * Inv_LW; + pParam->BSIM4V4eigbinv = model->BSIM4V4eigbinv + + model->BSIM4V4leigbinv * Inv_L + + model->BSIM4V4weigbinv * Inv_W + + model->BSIM4V4peigbinv * Inv_LW; + pParam->BSIM4V4pigcd = model->BSIM4V4pigcd + + model->BSIM4V4lpigcd * Inv_L + + model->BSIM4V4wpigcd * Inv_W + + model->BSIM4V4ppigcd * Inv_LW; + pParam->BSIM4V4poxedge = model->BSIM4V4poxedge + + model->BSIM4V4lpoxedge * Inv_L + + model->BSIM4V4wpoxedge * Inv_W + + model->BSIM4V4ppoxedge * Inv_LW; + pParam->BSIM4V4xrcrg1 = model->BSIM4V4xrcrg1 + + model->BSIM4V4lxrcrg1 * Inv_L + + model->BSIM4V4wxrcrg1 * Inv_W + + model->BSIM4V4pxrcrg1 * Inv_LW; + pParam->BSIM4V4xrcrg2 = model->BSIM4V4xrcrg2 + + model->BSIM4V4lxrcrg2 * Inv_L + + model->BSIM4V4wxrcrg2 * Inv_W + + model->BSIM4V4pxrcrg2 * Inv_LW; + pParam->BSIM4V4lambda = model->BSIM4V4lambda + + model->BSIM4V4llambda * Inv_L + + model->BSIM4V4wlambda * Inv_W + + model->BSIM4V4plambda * Inv_LW; + pParam->BSIM4V4vtl = model->BSIM4V4vtl + + model->BSIM4V4lvtl * Inv_L + + model->BSIM4V4wvtl * Inv_W + + model->BSIM4V4pvtl * Inv_LW; + pParam->BSIM4V4xn = model->BSIM4V4xn + + model->BSIM4V4lxn * Inv_L + + model->BSIM4V4wxn * Inv_W + + model->BSIM4V4pxn * Inv_LW; + pParam->BSIM4V4vfbsdoff = model->BSIM4V4vfbsdoff + + model->BSIM4V4lvfbsdoff * Inv_L + + model->BSIM4V4wvfbsdoff * Inv_W + + model->BSIM4V4pvfbsdoff * Inv_LW; + + pParam->BSIM4V4cgsl = model->BSIM4V4cgsl + + model->BSIM4V4lcgsl * Inv_L + + model->BSIM4V4wcgsl * Inv_W + + model->BSIM4V4pcgsl * Inv_LW; + pParam->BSIM4V4cgdl = model->BSIM4V4cgdl + + model->BSIM4V4lcgdl * Inv_L + + model->BSIM4V4wcgdl * Inv_W + + model->BSIM4V4pcgdl * Inv_LW; + pParam->BSIM4V4ckappas = model->BSIM4V4ckappas + + model->BSIM4V4lckappas * Inv_L + + model->BSIM4V4wckappas * Inv_W + + model->BSIM4V4pckappas * Inv_LW; + pParam->BSIM4V4ckappad = model->BSIM4V4ckappad + + model->BSIM4V4lckappad * Inv_L + + model->BSIM4V4wckappad * Inv_W + + model->BSIM4V4pckappad * Inv_LW; + pParam->BSIM4V4cf = model->BSIM4V4cf + + model->BSIM4V4lcf * Inv_L + + model->BSIM4V4wcf * Inv_W + + model->BSIM4V4pcf * Inv_LW; + pParam->BSIM4V4clc = model->BSIM4V4clc + + model->BSIM4V4lclc * Inv_L + + model->BSIM4V4wclc * Inv_W + + model->BSIM4V4pclc * Inv_LW; + pParam->BSIM4V4cle = model->BSIM4V4cle + + model->BSIM4V4lcle * Inv_L + + model->BSIM4V4wcle * Inv_W + + model->BSIM4V4pcle * Inv_LW; + pParam->BSIM4V4vfbcv = model->BSIM4V4vfbcv + + model->BSIM4V4lvfbcv * Inv_L + + model->BSIM4V4wvfbcv * Inv_W + + model->BSIM4V4pvfbcv * Inv_LW; + pParam->BSIM4V4acde = model->BSIM4V4acde + + model->BSIM4V4lacde * Inv_L + + model->BSIM4V4wacde * Inv_W + + model->BSIM4V4pacde * Inv_LW; + pParam->BSIM4V4moin = model->BSIM4V4moin + + model->BSIM4V4lmoin * Inv_L + + model->BSIM4V4wmoin * Inv_W + + model->BSIM4V4pmoin * Inv_LW; + pParam->BSIM4V4noff = model->BSIM4V4noff + + model->BSIM4V4lnoff * Inv_L + + model->BSIM4V4wnoff * Inv_W + + model->BSIM4V4pnoff * Inv_LW; + pParam->BSIM4V4voffcv = model->BSIM4V4voffcv + + model->BSIM4V4lvoffcv * Inv_L + + model->BSIM4V4wvoffcv * Inv_W + + model->BSIM4V4pvoffcv * Inv_LW; + + pParam->BSIM4V4abulkCVfactor = 1.0 + pow((pParam->BSIM4V4clc + / pParam->BSIM4V4leffCV), + pParam->BSIM4V4cle); + + T0 = (TRatio - 1.0); + + PowWeffWr = pow(pParam->BSIM4V4weffCJ * 1.0e6, pParam->BSIM4V4wr) * here->BSIM4V4nf; + + T1 = T2 = T3 = T4 = 0.0; + if(model->BSIM4V4tempMod == 0) { + pParam->BSIM4V4ua = pParam->BSIM4V4ua + pParam->BSIM4V4ua1 * T0; + pParam->BSIM4V4ub = pParam->BSIM4V4ub + pParam->BSIM4V4ub1 * T0; + pParam->BSIM4V4uc = pParam->BSIM4V4uc + pParam->BSIM4V4uc1 * T0; + pParam->BSIM4V4vsattemp = pParam->BSIM4V4vsat - pParam->BSIM4V4at * T0; + T10 = pParam->BSIM4V4prt * T0; + if(model->BSIM4V4rdsMod) { + /* External Rd(V) */ + T1 = pParam->BSIM4V4rdw + T10; + T2 = model->BSIM4V4rdwmin + T10; + /* External Rs(V) */ + T3 = pParam->BSIM4V4rsw + T10; + T4 = model->BSIM4V4rswmin + T10; + } + /* Internal Rds(V) in IV */ + pParam->BSIM4V4rds0 = (pParam->BSIM4V4rdsw + T10) + * here->BSIM4V4nf / PowWeffWr; + pParam->BSIM4V4rdswmin = (model->BSIM4V4rdswmin + T10) + * here->BSIM4V4nf / PowWeffWr; + } else { /* tempMod = 1 */ + pParam->BSIM4V4ua = pParam->BSIM4V4ua * (1.0 + pParam->BSIM4V4ua1 * delTemp) ; + pParam->BSIM4V4ub = pParam->BSIM4V4ub * (1.0 + pParam->BSIM4V4ub1 * delTemp); + pParam->BSIM4V4uc = pParam->BSIM4V4uc * (1.0 + pParam->BSIM4V4uc1 * delTemp); + pParam->BSIM4V4vsattemp = pParam->BSIM4V4vsat * (1.0 - pParam->BSIM4V4at * delTemp); + T10 = 1.0 + pParam->BSIM4V4prt * delTemp; + if(model->BSIM4V4rdsMod) { + /* External Rd(V) */ + T1 = pParam->BSIM4V4rdw * T10; + T2 = model->BSIM4V4rdwmin * T10; + /* External Rs(V) */ + T3 = pParam->BSIM4V4rsw * T10; + T4 = model->BSIM4V4rswmin * T10; + } + /* Internal Rds(V) in IV */ + pParam->BSIM4V4rds0 = pParam->BSIM4V4rdsw * T10 * here->BSIM4V4nf / PowWeffWr; + pParam->BSIM4V4rdswmin = model->BSIM4V4rdswmin * T10 * here->BSIM4V4nf / PowWeffWr; + } + if (T1 < 0.0) + { T1 = 0.0; + printf("Warning: Rdw at current temperature is negative; set to 0.\n"); + } + if (T2 < 0.0) + { T2 = 0.0; + printf("Warning: Rdwmin at current temperature is negative; set to 0.\n"); + } + pParam->BSIM4V4rd0 = T1 / PowWeffWr; + pParam->BSIM4V4rdwmin = T2 / PowWeffWr; + if (T3 < 0.0) + { T3 = 0.0; + printf("Warning: Rsw at current temperature is negative; set to 0.\n"); + } + if (T4 < 0.0) + { T4 = 0.0; + printf("Warning: Rswmin at current temperature is negative; set to 0.\n"); + } + pParam->BSIM4V4rs0 = T3 / PowWeffWr; + pParam->BSIM4V4rswmin = T4 / PowWeffWr; + + if (pParam->BSIM4V4u0 > 1.0) + pParam->BSIM4V4u0 = pParam->BSIM4V4u0 / 1.0e4; + + pParam->BSIM4V4u0temp = pParam->BSIM4V4u0 + * pow(TRatio, pParam->BSIM4V4ute); + if (pParam->BSIM4V4eu < 0.0) + { pParam->BSIM4V4eu = 0.0; + printf("Warning: eu has been negative; reset to 0.0.\n"); + } + + /* Source End Velocity Limit */ + if((model->BSIM4V4vtlGiven) && (model->BSIM4V4vtl > 0.0) ) + { + if(model->BSIM4V4lc < 0.0) pParam->BSIM4V4lc = 0.0; + else pParam->BSIM4V4lc = model->BSIM4V4lc ; + T0 = pParam->BSIM4V4leff / (pParam->BSIM4V4xn * pParam->BSIM4V4leff + pParam->BSIM4V4lc); + pParam->BSIM4V4tfactor = (1.0 - T0) / (1.0 + T0 ); + } + + pParam->BSIM4V4cgdo = (model->BSIM4V4cgdo + pParam->BSIM4V4cf) + * pParam->BSIM4V4weffCV; + pParam->BSIM4V4cgso = (model->BSIM4V4cgso + pParam->BSIM4V4cf) + * pParam->BSIM4V4weffCV; + pParam->BSIM4V4cgbo = model->BSIM4V4cgbo * pParam->BSIM4V4leffCV * here->BSIM4V4nf; + + if (!model->BSIM4V4ndepGiven && model->BSIM4V4gamma1Given) + { T0 = pParam->BSIM4V4gamma1 * model->BSIM4V4coxe; + pParam->BSIM4V4ndep = 3.01248e22 * T0 * T0; + } + + pParam->BSIM4V4phi = Vtm0 * log(pParam->BSIM4V4ndep / ni) + + pParam->BSIM4V4phin + 0.4; + + pParam->BSIM4V4sqrtPhi = sqrt(pParam->BSIM4V4phi); + pParam->BSIM4V4phis3 = pParam->BSIM4V4sqrtPhi * pParam->BSIM4V4phi; + + pParam->BSIM4V4Xdep0 = sqrt(2.0 * EPSSI / (Charge_q + * pParam->BSIM4V4ndep * 1.0e6)) + * pParam->BSIM4V4sqrtPhi; + pParam->BSIM4V4sqrtXdep0 = sqrt(pParam->BSIM4V4Xdep0); + pParam->BSIM4V4litl = sqrt(3.0 * pParam->BSIM4V4xj + * model->BSIM4V4toxe); + pParam->BSIM4V4vbi = Vtm0 * log(pParam->BSIM4V4nsd + * pParam->BSIM4V4ndep / (ni * ni)); + + if (pParam->BSIM4V4ngate > 0.0) + { pParam->BSIM4V4vfbsd = Vtm0 * log(pParam->BSIM4V4ngate + / pParam->BSIM4V4nsd); + } + else + pParam->BSIM4V4vfbsd = 0.0; + + pParam->BSIM4V4cdep0 = sqrt(Charge_q * EPSSI + * pParam->BSIM4V4ndep * 1.0e6 / 2.0 + / pParam->BSIM4V4phi); + + pParam->BSIM4V4ToxRatio = exp(pParam->BSIM4V4ntox + * log(model->BSIM4V4toxref / model->BSIM4V4toxe)) + / model->BSIM4V4toxe / model->BSIM4V4toxe; + pParam->BSIM4V4ToxRatioEdge = exp(pParam->BSIM4V4ntox + * log(model->BSIM4V4toxref + / (model->BSIM4V4toxe * pParam->BSIM4V4poxedge))) + / model->BSIM4V4toxe / model->BSIM4V4toxe + / pParam->BSIM4V4poxedge / pParam->BSIM4V4poxedge; + pParam->BSIM4V4Aechvb = (model->BSIM4V4type == NMOS) ? 4.97232e-7 : 3.42537e-7; + pParam->BSIM4V4Bechvb = (model->BSIM4V4type == NMOS) ? 7.45669e11 : 1.16645e12; + pParam->BSIM4V4AechvbEdge = pParam->BSIM4V4Aechvb * pParam->BSIM4V4weff + * pParam->BSIM4V4dlcig * pParam->BSIM4V4ToxRatioEdge; + pParam->BSIM4V4BechvbEdge = -pParam->BSIM4V4Bechvb + * model->BSIM4V4toxe * pParam->BSIM4V4poxedge; + pParam->BSIM4V4Aechvb *= pParam->BSIM4V4weff * pParam->BSIM4V4leff + * pParam->BSIM4V4ToxRatio; + pParam->BSIM4V4Bechvb *= -model->BSIM4V4toxe; + + + pParam->BSIM4V4mstar = 0.5 + atan(pParam->BSIM4V4minv) / PI; + pParam->BSIM4V4voffcbn = pParam->BSIM4V4voff + model->BSIM4V4voffl / pParam->BSIM4V4leff; + + pParam->BSIM4V4ldeb = sqrt(EPSSI * Vtm0 / (Charge_q + * pParam->BSIM4V4ndep * 1.0e6)) / 3.0; + pParam->BSIM4V4acde *= pow((pParam->BSIM4V4ndep / 2.0e16), -0.25); + + + if (model->BSIM4V4k1Given || model->BSIM4V4k2Given) + { if (!model->BSIM4V4k1Given) + { fprintf(stdout, "Warning: k1 should be specified with k2.\n"); + pParam->BSIM4V4k1 = 0.53; + } + if (!model->BSIM4V4k2Given) + { fprintf(stdout, "Warning: k2 should be specified with k1.\n"); + pParam->BSIM4V4k2 = -0.0186; + } + if (model->BSIM4V4nsubGiven) + fprintf(stdout, "Warning: nsub is ignored because k1 or k2 is given.\n"); + if (model->BSIM4V4xtGiven) + fprintf(stdout, "Warning: xt is ignored because k1 or k2 is given.\n"); + if (model->BSIM4V4vbxGiven) + fprintf(stdout, "Warning: vbx is ignored because k1 or k2 is given.\n"); + if (model->BSIM4V4gamma1Given) + fprintf(stdout, "Warning: gamma1 is ignored because k1 or k2 is given.\n"); + if (model->BSIM4V4gamma2Given) + fprintf(stdout, "Warning: gamma2 is ignored because k1 or k2 is given.\n"); + } + else + { if (!model->BSIM4V4vbxGiven) + pParam->BSIM4V4vbx = pParam->BSIM4V4phi - 7.7348e-4 + * pParam->BSIM4V4ndep + * pParam->BSIM4V4xt * pParam->BSIM4V4xt; + if (pParam->BSIM4V4vbx > 0.0) + pParam->BSIM4V4vbx = -pParam->BSIM4V4vbx; + if (pParam->BSIM4V4vbm > 0.0) + pParam->BSIM4V4vbm = -pParam->BSIM4V4vbm; + + if (!model->BSIM4V4gamma1Given) + pParam->BSIM4V4gamma1 = 5.753e-12 + * sqrt(pParam->BSIM4V4ndep) + / model->BSIM4V4coxe; + if (!model->BSIM4V4gamma2Given) + pParam->BSIM4V4gamma2 = 5.753e-12 + * sqrt(pParam->BSIM4V4nsub) + / model->BSIM4V4coxe; + + T0 = pParam->BSIM4V4gamma1 - pParam->BSIM4V4gamma2; + T1 = sqrt(pParam->BSIM4V4phi - pParam->BSIM4V4vbx) + - pParam->BSIM4V4sqrtPhi; + T2 = sqrt(pParam->BSIM4V4phi * (pParam->BSIM4V4phi + - pParam->BSIM4V4vbm)) - pParam->BSIM4V4phi; + pParam->BSIM4V4k2 = T0 * T1 / (2.0 * T2 + pParam->BSIM4V4vbm); + pParam->BSIM4V4k1 = pParam->BSIM4V4gamma2 - 2.0 + * pParam->BSIM4V4k2 * sqrt(pParam->BSIM4V4phi + - pParam->BSIM4V4vbm); + } + + if (pParam->BSIM4V4k2 < 0.0) + { T0 = 0.5 * pParam->BSIM4V4k1 / pParam->BSIM4V4k2; + pParam->BSIM4V4vbsc = 0.9 * (pParam->BSIM4V4phi - T0 * T0); + if (pParam->BSIM4V4vbsc > -3.0) + pParam->BSIM4V4vbsc = -3.0; + else if (pParam->BSIM4V4vbsc < -30.0) + pParam->BSIM4V4vbsc = -30.0; + } + else + { pParam->BSIM4V4vbsc = -30.0; + } + if (pParam->BSIM4V4vbsc > pParam->BSIM4V4vbm) + pParam->BSIM4V4vbsc = pParam->BSIM4V4vbm; + + if (!model->BSIM4V4vfbGiven) + { if (model->BSIM4V4vth0Given) + { pParam->BSIM4V4vfb = model->BSIM4V4type * pParam->BSIM4V4vth0 + - pParam->BSIM4V4phi - pParam->BSIM4V4k1 + * pParam->BSIM4V4sqrtPhi; + } + else + { pParam->BSIM4V4vfb = -1.0; + } + } + if (!model->BSIM4V4vth0Given) + { pParam->BSIM4V4vth0 = model->BSIM4V4type * (pParam->BSIM4V4vfb + + pParam->BSIM4V4phi + pParam->BSIM4V4k1 + * pParam->BSIM4V4sqrtPhi); + } + + pParam->BSIM4V4k1ox = pParam->BSIM4V4k1 * model->BSIM4V4toxe + / model->BSIM4V4toxm; + pParam->BSIM4V4k2ox = pParam->BSIM4V4k2 * model->BSIM4V4toxe + / model->BSIM4V4toxm; + + T3 = model->BSIM4V4type * pParam->BSIM4V4vth0 + - pParam->BSIM4V4vfb - pParam->BSIM4V4phi; + T4 = T3 + T3; + T5 = 2.5 * T3; + pParam->BSIM4V4vtfbphi1 = (model->BSIM4V4type == NMOS) ? T4 : T5; + if (pParam->BSIM4V4vtfbphi1 < 0.0) + pParam->BSIM4V4vtfbphi1 = 0.0; + + pParam->BSIM4V4vtfbphi2 = 4.0 * T3; + if (pParam->BSIM4V4vtfbphi2 < 0.0) + pParam->BSIM4V4vtfbphi2 = 0.0; + + tmp = sqrt(EPSSI / (model->BSIM4V4epsrox * EPS0) + * model->BSIM4V4toxe * pParam->BSIM4V4Xdep0); + T0 = pParam->BSIM4V4dsub * pParam->BSIM4V4leff / tmp; + if (T0 < EXP_THRESHOLD) + { T1 = exp(T0); + T2 = T1 - 1.0; + T3 = T2 * T2; + T4 = T3 + 2.0 * T1 * MIN_EXP; + pParam->BSIM4V4theta0vb0 = T1 / T4; + } + else + pParam->BSIM4V4theta0vb0 = 1.0 / (MAX_EXP - 2.0); + + T0 = pParam->BSIM4V4drout * pParam->BSIM4V4leff / tmp; + if (T0 < EXP_THRESHOLD) + { T1 = exp(T0); + T2 = T1 - 1.0; + T3 = T2 * T2; + T4 = T3 + 2.0 * T1 * MIN_EXP; + T5 = T1 / T4; + } + else + T5 = 1.0 / (MAX_EXP - 2.0); /* 3.0 * MIN_EXP omitted */ + pParam->BSIM4V4thetaRout = pParam->BSIM4V4pdibl1 * T5 + + pParam->BSIM4V4pdibl2; + + tmp = sqrt(pParam->BSIM4V4Xdep0); + tmp1 = pParam->BSIM4V4vbi - pParam->BSIM4V4phi; + tmp2 = model->BSIM4V4factor1 * tmp; + + T0 = pParam->BSIM4V4dvt1w * pParam->BSIM4V4weff + * pParam->BSIM4V4leff / tmp2; + if (T0 < EXP_THRESHOLD) + { T1 = exp(T0); + T2 = T1 - 1.0; + T3 = T2 * T2; + T4 = T3 + 2.0 * T1 * MIN_EXP; + T8 = T1 / T4; + } + else + T8 = 1.0 / (MAX_EXP - 2.0); + T0 = pParam->BSIM4V4dvt0w * T8; + T8 = T0 * tmp1; + + T0 = pParam->BSIM4V4dvt1 * pParam->BSIM4V4leff / tmp2; + if (T0 < EXP_THRESHOLD) + { T1 = exp(T0); + T2 = T1 - 1.0; + T3 = T2 * T2; + T4 = T3 + 2.0 * T1 * MIN_EXP; + T9 = T1 / T4; + } + else + T9 = 1.0 / (MAX_EXP - 2.0); + T9 = pParam->BSIM4V4dvt0 * T9 * tmp1; + + T4 = model->BSIM4V4toxe * pParam->BSIM4V4phi + / (pParam->BSIM4V4weff + pParam->BSIM4V4w0); + + T0 = sqrt(1.0 + pParam->BSIM4V4lpe0 / pParam->BSIM4V4leff); + T5 = pParam->BSIM4V4k1ox * (T0 - 1.0) * pParam->BSIM4V4sqrtPhi + + (pParam->BSIM4V4kt1 + pParam->BSIM4V4kt1l / pParam->BSIM4V4leff) + * (TRatio - 1.0); + + tmp3 = model->BSIM4V4type * pParam->BSIM4V4vth0 + - T8 - T9 + pParam->BSIM4V4k3 * T4 + T5; + pParam->BSIM4V4vfbzb = tmp3 - pParam->BSIM4V4phi - pParam->BSIM4V4k1 + * pParam->BSIM4V4sqrtPhi; /* End of vfbzb */ + + /* stress effect */ + T0 = pow(Lnew, model->BSIM4V4llodku0); + W_tmp = Wnew + model->BSIM4V4wlod; + T1 = pow(W_tmp, model->BSIM4V4wlodku0); + tmp1 = model->BSIM4V4lku0 / T0 + model->BSIM4V4wku0 / T1 + + model->BSIM4V4pku0 / (T0 * T1); + pParam->BSIM4V4ku0 = 1.0 + tmp1; + + T0 = pow(Lnew, model->BSIM4V4llodvth); + T1 = pow(W_tmp, model->BSIM4V4wlodvth); + tmp1 = model->BSIM4V4lkvth0 / T0 + model->BSIM4V4wkvth0 / T1 + + model->BSIM4V4pkvth0 / (T0 * T1); + pParam->BSIM4V4kvth0 = 1.0 + tmp1; + pParam->BSIM4V4kvth0 = sqrt(pParam->BSIM4V4kvth0*pParam->BSIM4V4kvth0 + DELTA); + + T0 = (TRatio - 1.0); + pParam->BSIM4V4ku0temp = pParam->BSIM4V4ku0 * (1.0 + model->BSIM4V4tku0 *T0) + DELTA; + + Inv_saref = 1.0/(model->BSIM4V4saref + 0.5*Ldrn); + Inv_sbref = 1.0/(model->BSIM4V4sbref + 0.5*Ldrn); + pParam->BSIM4V4inv_od_ref = Inv_saref + Inv_sbref; + pParam->BSIM4V4rho_ref = model->BSIM4V4ku0 / pParam->BSIM4V4ku0temp * pParam->BSIM4V4inv_od_ref; + + } /* End of SizeNotFound */ + + /* stress effect */ + if( (here->BSIM4V4sa > 0.0) && (here->BSIM4V4sb > 0.0) && + ((here->BSIM4V4nf == 1.0) || ((here->BSIM4V4nf > 1.0) && (here->BSIM4V4sd > 0.0))) ) + { Inv_sa = 0; + Inv_sb = 0; + + if (model->BSIM4V4wlod < 0.0) + { fprintf(stderr, "Warning: WLOD = %g is less than 0. Set to 0.0\n",model->BSIM4V4wlod); + model->BSIM4V4wlod = 0.0; + } + if (model->BSIM4V4kvsat < -1.0 ) + { fprintf(stderr, "Warning: KVSAT = %g is too small; Reset to -1.0.\n",model->BSIM4V4kvsat); + model->BSIM4V4kvsat = -1.0; + } + if (model->BSIM4V4kvsat > 1.0) + { fprintf(stderr, "Warning: KVSAT = %g is too big; Reset to 1.0.\n",model->BSIM4V4kvsat); + model->BSIM4V4kvsat = 1.0; + } + + for(i = 0; i < here->BSIM4V4nf; i++){ + T0 = 1.0 / here->BSIM4V4nf / (here->BSIM4V4sa + 0.5*Ldrn + i * (here->BSIM4V4sd +Ldrn)); + T1 = 1.0 / here->BSIM4V4nf / (here->BSIM4V4sb + 0.5*Ldrn + i * (here->BSIM4V4sd +Ldrn)); + Inv_sa += T0; + Inv_sb += T1; + } + Inv_ODeff = Inv_sa + Inv_sb; + rho = model->BSIM4V4ku0 / pParam->BSIM4V4ku0temp * Inv_ODeff; + T0 = (1.0 + rho)/(1.0 + pParam->BSIM4V4rho_ref); + here->BSIM4V4u0temp = pParam->BSIM4V4u0temp * T0; + + T1 = (1.0 + model->BSIM4V4kvsat * rho)/(1.0 + model->BSIM4V4kvsat * pParam->BSIM4V4rho_ref); + here->BSIM4V4vsattemp = pParam->BSIM4V4vsattemp * T1; + + OD_offset = Inv_ODeff - pParam->BSIM4V4inv_od_ref; + dvth0_lod = model->BSIM4V4kvth0 / pParam->BSIM4V4kvth0 * OD_offset; + dk2_lod = model->BSIM4V4stk2 / pow(pParam->BSIM4V4kvth0, model->BSIM4V4lodk2) * + OD_offset; + deta0_lod = model->BSIM4V4steta0 / pow(pParam->BSIM4V4kvth0, model->BSIM4V4lodeta0) * + OD_offset; + here->BSIM4V4vth0 = pParam->BSIM4V4vth0 + dvth0_lod; + + if (!model->BSIM4V4vfbGiven && !model->BSIM4V4vth0Given) + here->BSIM4V4vfb = -1.0; + else + here->BSIM4V4vfb = pParam->BSIM4V4vfb + model->BSIM4V4type * dvth0_lod; + here->BSIM4V4vfbzb = pParam->BSIM4V4vfbzb + model->BSIM4V4type * dvth0_lod; + + T3 = model->BSIM4V4type * here->BSIM4V4vth0 + - here->BSIM4V4vfb - pParam->BSIM4V4phi; + T4 = T3 + T3; + T5 = 2.5 * T3; + here->BSIM4V4vtfbphi1 = (model->BSIM4V4type == NMOS) ? T4 : T5; + if (here->BSIM4V4vtfbphi1 < 0.0) + here->BSIM4V4vtfbphi1 = 0.0; + + here->BSIM4V4vtfbphi2 = 4.0 * T3; + if (here->BSIM4V4vtfbphi2 < 0.0) + here->BSIM4V4vtfbphi2 = 0.0; + + here->BSIM4V4k2 = pParam->BSIM4V4k2 + dk2_lod; + if (here->BSIM4V4k2 < 0.0) + { T0 = 0.5 * pParam->BSIM4V4k1 / here->BSIM4V4k2; + here->BSIM4V4vbsc = 0.9 * (pParam->BSIM4V4phi - T0 * T0); + if (here->BSIM4V4vbsc > -3.0) + here->BSIM4V4vbsc = -3.0; + else if (here->BSIM4V4vbsc < -30.0) + here->BSIM4V4vbsc = -30.0; + } + else + here->BSIM4V4vbsc = -30.0; + if (here->BSIM4V4vbsc > pParam->BSIM4V4vbm) + here->BSIM4V4vbsc = pParam->BSIM4V4vbm; + here->BSIM4V4k2ox = here->BSIM4V4k2 * model->BSIM4V4toxe + / model->BSIM4V4toxm; + + here->BSIM4V4eta0 = pParam->BSIM4V4eta0 + deta0_lod; + } else { + here->BSIM4V4u0temp = pParam->BSIM4V4u0temp; + here->BSIM4V4vth0 = pParam->BSIM4V4vth0; + here->BSIM4V4vsattemp = pParam->BSIM4V4vsattemp; + here->BSIM4V4vfb = pParam->BSIM4V4vfb; + here->BSIM4V4vfbzb = pParam->BSIM4V4vfbzb; + here->BSIM4V4vtfbphi1 = pParam->BSIM4V4vtfbphi1; + here->BSIM4V4vtfbphi2 = pParam->BSIM4V4vtfbphi2; + here->BSIM4V4k2 = pParam->BSIM4V4k2; + here->BSIM4V4vbsc = pParam->BSIM4V4vbsc; + here->BSIM4V4k2ox = pParam->BSIM4V4k2ox; + here->BSIM4V4eta0 = pParam->BSIM4V4eta0; + } + + here->BSIM4V4cgso = pParam->BSIM4V4cgso; + here->BSIM4V4cgdo = pParam->BSIM4V4cgdo; + + if (here->BSIM4V4rbodyMod) + { if (here->BSIM4V4rbdb < 1.0e-3) + here->BSIM4V4grbdb = 1.0e3; /* in mho */ + else + here->BSIM4V4grbdb = model->BSIM4V4gbmin + 1.0 / here->BSIM4V4rbdb; + if (here->BSIM4V4rbpb < 1.0e-3) + here->BSIM4V4grbpb = 1.0e3; + else + here->BSIM4V4grbpb = model->BSIM4V4gbmin + 1.0 / here->BSIM4V4rbpb; + if (here->BSIM4V4rbps < 1.0e-3) + here->BSIM4V4grbps = 1.0e3; + else + here->BSIM4V4grbps = model->BSIM4V4gbmin + 1.0 / here->BSIM4V4rbps; + if (here->BSIM4V4rbsb < 1.0e-3) + here->BSIM4V4grbsb = 1.0e3; + else + here->BSIM4V4grbsb = model->BSIM4V4gbmin + 1.0 / here->BSIM4V4rbsb; + if (here->BSIM4V4rbpd < 1.0e-3) + here->BSIM4V4grbpd = 1.0e3; + else + here->BSIM4V4grbpd = model->BSIM4V4gbmin + 1.0 / here->BSIM4V4rbpd; + } + + + /* + * Process geomertry dependent parasitics + */ + + here->BSIM4V4grgeltd = model->BSIM4V4rshg * (model->BSIM4V4xgw + + pParam->BSIM4V4weffCJ / 3.0 / model->BSIM4V4ngcon) / + (model->BSIM4V4ngcon * here->BSIM4V4nf * + (Lnew - model->BSIM4V4xgl)); + if (here->BSIM4V4grgeltd > 0.0) + here->BSIM4V4grgeltd = 1.0 / here->BSIM4V4grgeltd; + else + { here->BSIM4V4grgeltd = 1.0e3; /* mho */ + if (here->BSIM4V4rgateMod != 0) + printf("Warning: The gate conductance reset to 1.0e3 mho.\n"); + } + + DMCGeff = model->BSIM4V4dmcg - model->BSIM4V4dmcgt; + DMCIeff = model->BSIM4V4dmci; + DMDGeff = model->BSIM4V4dmdg - model->BSIM4V4dmcgt; + + if (here->BSIM4V4sourcePerimeterGiven) + { if (model->BSIM4V4perMod == 0) + here->BSIM4V4Pseff = here->BSIM4V4sourcePerimeter; + else + here->BSIM4V4Pseff = here->BSIM4V4sourcePerimeter + - pParam->BSIM4V4weffCJ * here->BSIM4V4nf; + } + else + BSIM4V4PAeffGeo(here->BSIM4V4nf, here->BSIM4V4geoMod, here->BSIM4V4min, + pParam->BSIM4V4weffCJ, DMCGeff, DMCIeff, DMDGeff, + &(here->BSIM4V4Pseff), &dumPd, &dumAs, &dumAd); + + if (here->BSIM4V4drainPerimeterGiven) + { if (model->BSIM4V4perMod == 0) + here->BSIM4V4Pdeff = here->BSIM4V4drainPerimeter; + else + here->BSIM4V4Pdeff = here->BSIM4V4drainPerimeter + - pParam->BSIM4V4weffCJ * here->BSIM4V4nf; + } + else + BSIM4V4PAeffGeo(here->BSIM4V4nf, here->BSIM4V4geoMod, here->BSIM4V4min, + pParam->BSIM4V4weffCJ, DMCGeff, DMCIeff, DMDGeff, + &dumPs, &(here->BSIM4V4Pdeff), &dumAs, &dumAd); + + if (here->BSIM4V4sourceAreaGiven) + here->BSIM4V4Aseff = here->BSIM4V4sourceArea; + else + BSIM4V4PAeffGeo(here->BSIM4V4nf, here->BSIM4V4geoMod, here->BSIM4V4min, + pParam->BSIM4V4weffCJ, DMCGeff, DMCIeff, DMDGeff, + &dumPs, &dumPd, &(here->BSIM4V4Aseff), &dumAd); + + if (here->BSIM4V4drainAreaGiven) + here->BSIM4V4Adeff = here->BSIM4V4drainArea; + else + BSIM4V4PAeffGeo(here->BSIM4V4nf, here->BSIM4V4geoMod, here->BSIM4V4min, + pParam->BSIM4V4weffCJ, DMCGeff, DMCIeff, DMDGeff, + &dumPs, &dumPd, &dumAs, &(here->BSIM4V4Adeff)); + + /* Processing S/D resistance and conductance below */ + if(here->BSIM4V4sNodePrime != here->BSIM4V4sNode) + { + here->BSIM4V4sourceConductance = 0.0; + if(here->BSIM4V4sourceSquaresGiven) + { + here->BSIM4V4sourceConductance = model->BSIM4V4sheetResistance + * here->BSIM4V4sourceSquares; + } else if (here->BSIM4V4rgeoMod > 0) + { + BSIM4V4RdseffGeo(here->BSIM4V4nf, here->BSIM4V4geoMod, + here->BSIM4V4rgeoMod, here->BSIM4V4min, + pParam->BSIM4V4weffCJ, model->BSIM4V4sheetResistance, + DMCGeff, DMCIeff, DMDGeff, 1, &(here->BSIM4V4sourceConductance)); + } else + { + here->BSIM4V4sourceConductance = 0.0; + } + + if (here->BSIM4V4sourceConductance > 0.0) + here->BSIM4V4sourceConductance = 1.0 + / here->BSIM4V4sourceConductance; + else + { + here->BSIM4V4sourceConductance = 1.0e3; /* mho */ + printf ("Warning: Source conductance reset to 1.0e3 mho.\n"); + } + } else + { + here->BSIM4V4sourceConductance = 0.0; + } + + if(here->BSIM4V4dNodePrime != here->BSIM4V4dNode) + { + here->BSIM4V4drainConductance = 0.0; + if(here->BSIM4V4drainSquaresGiven) + { + here->BSIM4V4drainConductance = model->BSIM4V4sheetResistance + * here->BSIM4V4drainSquares; + } else if (here->BSIM4V4rgeoMod > 0) + { + BSIM4V4RdseffGeo(here->BSIM4V4nf, here->BSIM4V4geoMod, + here->BSIM4V4rgeoMod, here->BSIM4V4min, + pParam->BSIM4V4weffCJ, model->BSIM4V4sheetResistance, + DMCGeff, DMCIeff, DMDGeff, 0, &(here->BSIM4V4drainConductance)); + } else + { + here->BSIM4V4drainConductance = 0.0; + } + + if (here->BSIM4V4drainConductance > 0.0) + here->BSIM4V4drainConductance = 1.0 + / here->BSIM4V4drainConductance; + else + { + here->BSIM4V4drainConductance = 1.0e3; /* mho */ + printf ("Warning: Drain conductance reset to 1.0e3 mho.\n"); + } + } else + { + here->BSIM4V4drainConductance = 0.0; + } + + /* End of Rsd processing */ + + + Nvtms = model->BSIM4V4vtm * model->BSIM4V4SjctEmissionCoeff; + if ((here->BSIM4V4Aseff <= 0.0) && (here->BSIM4V4Pseff <= 0.0)) + { SourceSatCurrent = 1.0e-14; + } + else + { SourceSatCurrent = here->BSIM4V4Aseff * model->BSIM4V4SjctTempSatCurDensity + + here->BSIM4V4Pseff * model->BSIM4V4SjctSidewallTempSatCurDensity + + pParam->BSIM4V4weffCJ * here->BSIM4V4nf + * model->BSIM4V4SjctGateSidewallTempSatCurDensity; + } + if (SourceSatCurrent > 0.0) + { switch(model->BSIM4V4dioMod) + { case 0: + if ((model->BSIM4V4bvs / Nvtms) > EXP_THRESHOLD) + here->BSIM4V4XExpBVS = model->BSIM4V4xjbvs * MIN_EXP; + else + here->BSIM4V4XExpBVS = model->BSIM4V4xjbvs * exp(-model->BSIM4V4bvs / Nvtms); + break; + case 1: + BSIM4V4DioIjthVjmEval(Nvtms, model->BSIM4V4ijthsfwd, SourceSatCurrent, + 0.0, &(here->BSIM4V4vjsmFwd)); + here->BSIM4V4IVjsmFwd = SourceSatCurrent * exp(here->BSIM4V4vjsmFwd / Nvtms); + break; + case 2: + if ((model->BSIM4V4bvs / Nvtms) > EXP_THRESHOLD) + { here->BSIM4V4XExpBVS = model->BSIM4V4xjbvs * MIN_EXP; + tmp = MIN_EXP; + } + else + { here->BSIM4V4XExpBVS = exp(-model->BSIM4V4bvs / Nvtms); + tmp = here->BSIM4V4XExpBVS; + here->BSIM4V4XExpBVS *= model->BSIM4V4xjbvs; + } + + BSIM4V4DioIjthVjmEval(Nvtms, model->BSIM4V4ijthsfwd, SourceSatCurrent, + here->BSIM4V4XExpBVS, &(here->BSIM4V4vjsmFwd)); + T0 = exp(here->BSIM4V4vjsmFwd / Nvtms); + here->BSIM4V4IVjsmFwd = SourceSatCurrent * (T0 - here->BSIM4V4XExpBVS / T0 + + here->BSIM4V4XExpBVS - 1.0); + here->BSIM4V4SslpFwd = SourceSatCurrent + * (T0 + here->BSIM4V4XExpBVS / T0) / Nvtms; + + T2 = model->BSIM4V4ijthsrev / SourceSatCurrent; + if (T2 < 1.0) + { T2 = 10.0; + fprintf(stderr, "Warning: ijthsrev too small and set to 10 times IsbSat.\n"); + } + here->BSIM4V4vjsmRev = -model->BSIM4V4bvs + - Nvtms * log((T2 - 1.0) / model->BSIM4V4xjbvs); + T1 = model->BSIM4V4xjbvs * exp(-(model->BSIM4V4bvs + + here->BSIM4V4vjsmRev) / Nvtms); + here->BSIM4V4IVjsmRev = SourceSatCurrent * (1.0 + T1); + here->BSIM4V4SslpRev = -SourceSatCurrent * T1 / Nvtms; + break; + default: + printf("Specified dioMod = %d not matched\n", model->BSIM4V4dioMod); + } + } + + Nvtmd = model->BSIM4V4vtm * model->BSIM4V4DjctEmissionCoeff; + if ((here->BSIM4V4Adeff <= 0.0) && (here->BSIM4V4Pdeff <= 0.0)) + { DrainSatCurrent = 1.0e-14; + } + else + { DrainSatCurrent = here->BSIM4V4Adeff * model->BSIM4V4DjctTempSatCurDensity + + here->BSIM4V4Pdeff * model->BSIM4V4DjctSidewallTempSatCurDensity + + pParam->BSIM4V4weffCJ * here->BSIM4V4nf + * model->BSIM4V4DjctGateSidewallTempSatCurDensity; + } + if (DrainSatCurrent > 0.0) + { switch(model->BSIM4V4dioMod) + { case 0: + if ((model->BSIM4V4bvd / Nvtmd) > EXP_THRESHOLD) + here->BSIM4V4XExpBVD = model->BSIM4V4xjbvd * MIN_EXP; + else + here->BSIM4V4XExpBVD = model->BSIM4V4xjbvd * exp(-model->BSIM4V4bvd / Nvtmd); + break; + case 1: + BSIM4V4DioIjthVjmEval(Nvtmd, model->BSIM4V4ijthdfwd, DrainSatCurrent, + 0.0, &(here->BSIM4V4vjdmFwd)); + here->BSIM4V4IVjdmFwd = DrainSatCurrent * exp(here->BSIM4V4vjdmFwd / Nvtmd); + break; + case 2: + if ((model->BSIM4V4bvd / Nvtmd) > EXP_THRESHOLD) + { here->BSIM4V4XExpBVD = model->BSIM4V4xjbvd * MIN_EXP; + tmp = MIN_EXP; + } + else + { here->BSIM4V4XExpBVD = exp(-model->BSIM4V4bvd / Nvtmd); + tmp = here->BSIM4V4XExpBVD; + here->BSIM4V4XExpBVD *= model->BSIM4V4xjbvd; + } + + BSIM4V4DioIjthVjmEval(Nvtmd, model->BSIM4V4ijthdfwd, DrainSatCurrent, + here->BSIM4V4XExpBVD, &(here->BSIM4V4vjdmFwd)); + T0 = exp(here->BSIM4V4vjdmFwd / Nvtmd); + here->BSIM4V4IVjdmFwd = DrainSatCurrent * (T0 - here->BSIM4V4XExpBVD / T0 + + here->BSIM4V4XExpBVD - 1.0); + here->BSIM4V4DslpFwd = DrainSatCurrent + * (T0 + here->BSIM4V4XExpBVD / T0) / Nvtmd; + + T2 = model->BSIM4V4ijthdrev / DrainSatCurrent; + if (T2 < 1.0) + { T2 = 10.0; + fprintf(stderr, "Warning: ijthdrev too small and set to 10 times IdbSat.\n"); + } + here->BSIM4V4vjdmRev = -model->BSIM4V4bvd + - Nvtmd * log((T2 - 1.0) / model->BSIM4V4xjbvd); /* bugfix */ + T1 = model->BSIM4V4xjbvd * exp(-(model->BSIM4V4bvd + + here->BSIM4V4vjdmRev) / Nvtmd); + here->BSIM4V4IVjdmRev = DrainSatCurrent * (1.0 + T1); + here->BSIM4V4DslpRev = -DrainSatCurrent * T1 / Nvtmd; + break; + default: + printf("Specified dioMod = %d not matched\n", model->BSIM4V4dioMod); + } + } + + /* GEDL current reverse bias */ + T0 = (TRatio - 1.0); + model->BSIM4V4njtstemp = model->BSIM4V4njts * (1.0 + model->BSIM4V4tnjts * T0); + model->BSIM4V4njtsswtemp = model->BSIM4V4njtssw * (1.0 + model->BSIM4V4tnjtssw * T0); + model->BSIM4V4njtsswgtemp = model->BSIM4V4njtsswg * (1.0 + model->BSIM4V4tnjtsswg * T0); + T7 = Eg0 / model->BSIM4V4vtm * T0; + T9 = model->BSIM4V4xtss * T7; + DEXP(T9, T1); + T9 = model->BSIM4V4xtsd * T7; + DEXP(T9, T2); + T9 = model->BSIM4V4xtssws * T7; + DEXP(T9, T3); + T9 = model->BSIM4V4xtsswd * T7; + DEXP(T9, T4); + T9 = model->BSIM4V4xtsswgs * T7; + DEXP(T9, T5); + T9 = model->BSIM4V4xtsswgd * T7; + DEXP(T9, T6); + + T10 = pParam->BSIM4V4weffCJ * here->BSIM4V4nf; + here->BSIM4V4SjctTempRevSatCur = T1 * here->BSIM4V4Aseff * model->BSIM4V4jtss; + here->BSIM4V4DjctTempRevSatCur = T2 * here->BSIM4V4Adeff * model->BSIM4V4jtsd; + here->BSIM4V4SswTempRevSatCur = T3 * here->BSIM4V4Pseff * model->BSIM4V4jtssws; + here->BSIM4V4DswTempRevSatCur = T4 * here->BSIM4V4Pdeff * model->BSIM4V4jtsswd; + here->BSIM4V4SswgTempRevSatCur = T5 * T10 * model->BSIM4V4jtsswgs; + here->BSIM4V4DswgTempRevSatCur = T6 * T10 * model->BSIM4V4jtsswgd; + + + if (BSIM4V4checkModel(model, here, ckt)) + { IFuid namarray[2]; + namarray[0] = model->BSIM4V4modName; + namarray[1] = here->BSIM4V4name; + (*(SPfrontEnd->IFerror)) (ERR_FATAL, "Fatal error(s) detected during BSIM4.4.0 parameter checking for %s in model %s", namarray); + return(E_BADPARM); + } + } /* End instance */ + } + return(OK); +} diff --git a/src/spicelib/devices/bsim4v4/b4v4trunc.c b/src/spicelib/devices/bsim4v4/b4v4trunc.c new file mode 100644 index 000000000..ca4df4653 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/b4v4trunc.c @@ -0,0 +1,58 @@ +/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****/ + +/********** + * Copyright 2004 Regents of the University of California. All rights reserved. + * File: b4trunc.c of BSIM4.4.0. + * Author: 2000 Weidong Liu + * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. + * Project Director: Prof. Chenming Hu. + **********/ + +#include "ngspice.h" +#include "cktdefs.h" +#include "bsim4v4def.h" +#include "sperror.h" +#include "suffix.h" + +int +BSIM4V4trunc(inModel,ckt,timeStep) +GENmodel *inModel; +CKTcircuit *ckt; +double *timeStep; +{ +BSIM4V4model *model = (BSIM4V4model*)inModel; +BSIM4V4instance *here; + +#ifdef STEPDEBUG + double debugtemp; +#endif /* STEPDEBUG */ + + for (; model != NULL; model = model->BSIM4V4nextModel) + { for (here = model->BSIM4V4instances; here != NULL; + here = here->BSIM4V4nextInstance) + { + if (here->BSIM4V4owner != ARCHme) continue; +#ifdef STEPDEBUG + debugtemp = *timeStep; +#endif /* STEPDEBUG */ + CKTterr(here->BSIM4V4qb,ckt,timeStep); + CKTterr(here->BSIM4V4qg,ckt,timeStep); + CKTterr(here->BSIM4V4qd,ckt,timeStep); + if (here->BSIM4V4trnqsMod) + CKTterr(here->BSIM4V4qcdump,ckt,timeStep); + if (here->BSIM4V4rbodyMod) + { CKTterr(here->BSIM4V4qbs,ckt,timeStep); + CKTterr(here->BSIM4V4qbd,ckt,timeStep); + } + if (here->BSIM4V4rgateMod == 3) + CKTterr(here->BSIM4V4qgmid,ckt,timeStep); +#ifdef STEPDEBUG + if(debugtemp != *timeStep) + { printf("device %s reduces step from %g to %g\n", + here->BSIM4V4name,debugtemp,*timeStep); + } +#endif /* STEPDEBUG */ + } + } + return(OK); +} diff --git a/src/spicelib/devices/bsim4v4/bsim4v4def.h b/src/spicelib/devices/bsim4v4/bsim4v4def.h new file mode 100644 index 000000000..17bbb1c5d --- /dev/null +++ b/src/spicelib/devices/bsim4v4/bsim4v4def.h @@ -0,0 +1,2935 @@ +/********** +Copyright 2004 Regents of the University of California. All rights reserved. +Author: 2000 Weidong Liu. +Modified by Xuemei Xi, 11/15/2002. +Modified by Xuemei Xi, 05/09/2003. +Modified by Xuemei Xi, 03/04/2004. +File: bsim4v4def.h +**********/ + +#ifndef BSIM4V4 +#define BSIM4V4 + +#include "ifsim.h" +#include "gendefs.h" +#include "cktdefs.h" +#include "complex.h" +#include "noisedef.h" + +typedef struct sBSIM4V4instance +{ + struct sBSIM4V4model *BSIM4V4modPtr; + struct sBSIM4V4instance *BSIM4V4nextInstance; + IFuid BSIM4V4name; + int BSIM4V4owner; /* Number of owner process */ + int BSIM4V4states; /* index into state table for this device */ + int BSIM4V4dNode; + int BSIM4V4gNodeExt; + int BSIM4V4sNode; + int BSIM4V4bNode; + int BSIM4V4dNodePrime; + int BSIM4V4gNodePrime; + int BSIM4V4gNodeMid; + int BSIM4V4sNodePrime; + int BSIM4V4bNodePrime; + int BSIM4V4dbNode; + int BSIM4V4sbNode; + int BSIM4V4qNode; + + double BSIM4V4ueff; + double BSIM4V4thetavth; + double BSIM4V4von; + double BSIM4V4vdsat; + double BSIM4V4cgdo; + double BSIM4V4qgdo; + double BSIM4V4cgso; + double BSIM4V4qgso; + double BSIM4V4grbsb; + double BSIM4V4grbdb; + double BSIM4V4grbpb; + double BSIM4V4grbps; + double BSIM4V4grbpd; + + double BSIM4V4vjsmFwd; + double BSIM4V4vjsmRev; + double BSIM4V4vjdmFwd; + double BSIM4V4vjdmRev; + double BSIM4V4XExpBVS; + double BSIM4V4XExpBVD; + double BSIM4V4SslpFwd; + double BSIM4V4SslpRev; + double BSIM4V4DslpFwd; + double BSIM4V4DslpRev; + double BSIM4V4IVjsmFwd; + double BSIM4V4IVjsmRev; + double BSIM4V4IVjdmFwd; + double BSIM4V4IVjdmRev; + + double BSIM4V4grgeltd; + double BSIM4V4Pseff; + double BSIM4V4Pdeff; + double BSIM4V4Aseff; + double BSIM4V4Adeff; + + double BSIM4V4l; + double BSIM4V4w; + double BSIM4V4drainArea; + double BSIM4V4sourceArea; + double BSIM4V4drainSquares; + double BSIM4V4sourceSquares; + double BSIM4V4drainPerimeter; + double BSIM4V4sourcePerimeter; + double BSIM4V4sourceConductance; + double BSIM4V4drainConductance; + /* stress effect instance param */ + double BSIM4V4sa; + double BSIM4V4sb; + double BSIM4V4sd; + + double BSIM4V4rbdb; + double BSIM4V4rbsb; + double BSIM4V4rbpb; + double BSIM4V4rbps; + double BSIM4V4rbpd; + + /* added here to account stress effect instance dependence */ + double BSIM4V4u0temp; + double BSIM4V4vsattemp; + double BSIM4V4vth0; + double BSIM4V4vfb; + double BSIM4V4vfbzb; + double BSIM4V4vtfbphi1; + double BSIM4V4vtfbphi2; + double BSIM4V4k2; + double BSIM4V4vbsc; + double BSIM4V4k2ox; + double BSIM4V4eta0; + + double BSIM4V4icVDS; + double BSIM4V4icVGS; + double BSIM4V4icVBS; + double BSIM4V4nf; + double BSIM4V4m; + int BSIM4V4off; + int BSIM4V4mode; + int BSIM4V4trnqsMod; + int BSIM4V4acnqsMod; + int BSIM4V4rbodyMod; + int BSIM4V4rgateMod; + int BSIM4V4geoMod; + int BSIM4V4rgeoMod; + int BSIM4V4min; + + + /* OP point */ + double BSIM4V4Vgsteff; + double BSIM4V4vgs_eff; + double BSIM4V4vgd_eff; + double BSIM4V4dvgs_eff_dvg; + double BSIM4V4dvgd_eff_dvg; + double BSIM4V4Vdseff; + double BSIM4V4nstar; + double BSIM4V4Abulk; + double BSIM4V4EsatL; + double BSIM4V4AbovVgst2Vtm; + double BSIM4V4qinv; + double BSIM4V4cd; + double BSIM4V4cbs; + double BSIM4V4cbd; + double BSIM4V4csub; + double BSIM4V4Igidl; + double BSIM4V4Igisl; + double BSIM4V4gm; + double BSIM4V4gds; + double BSIM4V4gmbs; + double BSIM4V4gbd; + double BSIM4V4gbs; + + double BSIM4V4gbbs; + double BSIM4V4gbgs; + double BSIM4V4gbds; + double BSIM4V4ggidld; + double BSIM4V4ggidlg; + double BSIM4V4ggidls; + double BSIM4V4ggidlb; + double BSIM4V4ggisld; + double BSIM4V4ggislg; + double BSIM4V4ggisls; + double BSIM4V4ggislb; + + double BSIM4V4Igcs; + double BSIM4V4gIgcsg; + double BSIM4V4gIgcsd; + double BSIM4V4gIgcss; + double BSIM4V4gIgcsb; + double BSIM4V4Igcd; + double BSIM4V4gIgcdg; + double BSIM4V4gIgcdd; + double BSIM4V4gIgcds; + double BSIM4V4gIgcdb; + + double BSIM4V4Igs; + double BSIM4V4gIgsg; + double BSIM4V4gIgss; + double BSIM4V4Igd; + double BSIM4V4gIgdg; + double BSIM4V4gIgdd; + + double BSIM4V4Igb; + double BSIM4V4gIgbg; + double BSIM4V4gIgbd; + double BSIM4V4gIgbs; + double BSIM4V4gIgbb; + + double BSIM4V4grdsw; + double BSIM4V4IdovVds; + double BSIM4V4gcrg; + double BSIM4V4gcrgd; + double BSIM4V4gcrgg; + double BSIM4V4gcrgs; + double BSIM4V4gcrgb; + + double BSIM4V4gstot; + double BSIM4V4gstotd; + double BSIM4V4gstotg; + double BSIM4V4gstots; + double BSIM4V4gstotb; + + double BSIM4V4gdtot; + double BSIM4V4gdtotd; + double BSIM4V4gdtotg; + double BSIM4V4gdtots; + double BSIM4V4gdtotb; + + double BSIM4V4cggb; + double BSIM4V4cgdb; + double BSIM4V4cgsb; + double BSIM4V4cbgb; + double BSIM4V4cbdb; + double BSIM4V4cbsb; + double BSIM4V4cdgb; + double BSIM4V4cddb; + double BSIM4V4cdsb; + double BSIM4V4csgb; + double BSIM4V4csdb; + double BSIM4V4cssb; + double BSIM4V4cgbb; + double BSIM4V4cdbb; + double BSIM4V4csbb; + double BSIM4V4cbbb; + double BSIM4V4capbd; + double BSIM4V4capbs; + + double BSIM4V4cqgb; + double BSIM4V4cqdb; + double BSIM4V4cqsb; + double BSIM4V4cqbb; + + double BSIM4V4qgate; + double BSIM4V4qbulk; + double BSIM4V4qdrn; + double BSIM4V4qsrc; + + double BSIM4V4qchqs; + double BSIM4V4taunet; + double BSIM4V4gtau; + double BSIM4V4gtg; + double BSIM4V4gtd; + double BSIM4V4gts; + double BSIM4V4gtb; + double BSIM4V4SjctTempRevSatCur; + double BSIM4V4DjctTempRevSatCur; + double BSIM4V4SswTempRevSatCur; + double BSIM4V4DswTempRevSatCur; + double BSIM4V4SswgTempRevSatCur; + double BSIM4V4DswgTempRevSatCur; + + struct bsim4SizeDependParam *pParam; + + unsigned BSIM4V4lGiven :1; + unsigned BSIM4V4wGiven :1; + unsigned BSIM4V4mGiven :1; + unsigned BSIM4V4nfGiven :1; + unsigned BSIM4V4minGiven :1; + unsigned BSIM4V4drainAreaGiven :1; + unsigned BSIM4V4sourceAreaGiven :1; + unsigned BSIM4V4drainSquaresGiven :1; + unsigned BSIM4V4sourceSquaresGiven :1; + unsigned BSIM4V4drainPerimeterGiven :1; + unsigned BSIM4V4sourcePerimeterGiven :1; + unsigned BSIM4V4saGiven :1; + unsigned BSIM4V4sbGiven :1; + unsigned BSIM4V4sdGiven :1; + unsigned BSIM4V4rbdbGiven :1; + unsigned BSIM4V4rbsbGiven :1; + unsigned BSIM4V4rbpbGiven :1; + unsigned BSIM4V4rbpdGiven :1; + unsigned BSIM4V4rbpsGiven :1; + unsigned BSIM4V4icVDSGiven :1; + unsigned BSIM4V4icVGSGiven :1; + unsigned BSIM4V4icVBSGiven :1; + unsigned BSIM4V4trnqsModGiven :1; + unsigned BSIM4V4acnqsModGiven :1; + unsigned BSIM4V4rbodyModGiven :1; + unsigned BSIM4V4rgateModGiven :1; + unsigned BSIM4V4geoModGiven :1; + unsigned BSIM4V4rgeoModGiven :1; + + + double *BSIM4V4DPdPtr; + double *BSIM4V4DPdpPtr; + double *BSIM4V4DPgpPtr; + double *BSIM4V4DPgmPtr; + double *BSIM4V4DPspPtr; + double *BSIM4V4DPbpPtr; + double *BSIM4V4DPdbPtr; + + double *BSIM4V4DdPtr; + double *BSIM4V4DdpPtr; + + double *BSIM4V4GPdpPtr; + double *BSIM4V4GPgpPtr; + double *BSIM4V4GPgmPtr; + double *BSIM4V4GPgePtr; + double *BSIM4V4GPspPtr; + double *BSIM4V4GPbpPtr; + + double *BSIM4V4GMdpPtr; + double *BSIM4V4GMgpPtr; + double *BSIM4V4GMgmPtr; + double *BSIM4V4GMgePtr; + double *BSIM4V4GMspPtr; + double *BSIM4V4GMbpPtr; + + double *BSIM4V4GEdpPtr; + double *BSIM4V4GEgpPtr; + double *BSIM4V4GEgmPtr; + double *BSIM4V4GEgePtr; + double *BSIM4V4GEspPtr; + double *BSIM4V4GEbpPtr; + + double *BSIM4V4SPdpPtr; + double *BSIM4V4SPgpPtr; + double *BSIM4V4SPgmPtr; + double *BSIM4V4SPsPtr; + double *BSIM4V4SPspPtr; + double *BSIM4V4SPbpPtr; + double *BSIM4V4SPsbPtr; + + double *BSIM4V4SspPtr; + double *BSIM4V4SsPtr; + + double *BSIM4V4BPdpPtr; + double *BSIM4V4BPgpPtr; + double *BSIM4V4BPgmPtr; + double *BSIM4V4BPspPtr; + double *BSIM4V4BPdbPtr; + double *BSIM4V4BPbPtr; + double *BSIM4V4BPsbPtr; + double *BSIM4V4BPbpPtr; + + double *BSIM4V4DBdpPtr; + double *BSIM4V4DBdbPtr; + double *BSIM4V4DBbpPtr; + double *BSIM4V4DBbPtr; + + double *BSIM4V4SBspPtr; + double *BSIM4V4SBbpPtr; + double *BSIM4V4SBbPtr; + double *BSIM4V4SBsbPtr; + + double *BSIM4V4BdbPtr; + double *BSIM4V4BbpPtr; + double *BSIM4V4BsbPtr; + double *BSIM4V4BbPtr; + + double *BSIM4V4DgpPtr; + double *BSIM4V4DspPtr; + double *BSIM4V4DbpPtr; + double *BSIM4V4SdpPtr; + double *BSIM4V4SgpPtr; + double *BSIM4V4SbpPtr; + + double *BSIM4V4QdpPtr; + double *BSIM4V4QgpPtr; + double *BSIM4V4QspPtr; + double *BSIM4V4QbpPtr; + double *BSIM4V4QqPtr; + double *BSIM4V4DPqPtr; + double *BSIM4V4GPqPtr; + double *BSIM4V4SPqPtr; + + +#define BSIM4V4vbd BSIM4V4states+ 0 +#define BSIM4V4vbs BSIM4V4states+ 1 +#define BSIM4V4vgs BSIM4V4states+ 2 +#define BSIM4V4vds BSIM4V4states+ 3 +#define BSIM4V4vdbs BSIM4V4states+ 4 +#define BSIM4V4vdbd BSIM4V4states+ 5 +#define BSIM4V4vsbs BSIM4V4states+ 6 +#define BSIM4V4vges BSIM4V4states+ 7 +#define BSIM4V4vgms BSIM4V4states+ 8 +#define BSIM4V4vses BSIM4V4states+ 9 +#define BSIM4V4vdes BSIM4V4states+ 10 + +#define BSIM4V4qb BSIM4V4states+ 11 +#define BSIM4V4cqb BSIM4V4states+ 12 +#define BSIM4V4qg BSIM4V4states+ 13 +#define BSIM4V4cqg BSIM4V4states+ 14 +#define BSIM4V4qd BSIM4V4states+ 15 +#define BSIM4V4cqd BSIM4V4states+ 16 +#define BSIM4V4qgmid BSIM4V4states+ 17 +#define BSIM4V4cqgmid BSIM4V4states+ 18 + +#define BSIM4V4qbs BSIM4V4states+ 19 +#define BSIM4V4cqbs BSIM4V4states+ 20 +#define BSIM4V4qbd BSIM4V4states+ 21 +#define BSIM4V4cqbd BSIM4V4states+ 22 + +#define BSIM4V4qcheq BSIM4V4states+ 23 +#define BSIM4V4cqcheq BSIM4V4states+ 24 +#define BSIM4V4qcdump BSIM4V4states+ 25 +#define BSIM4V4cqcdump BSIM4V4states+ 26 +#define BSIM4V4qdef BSIM4V4states+ 27 +#define BSIM4V4qs BSIM4V4states+ 28 + +#define BSIM4V4numStates 29 + + +/* indices to the array of BSIM4V4 NOISE SOURCES */ + +#define BSIM4V4RDNOIZ 0 +#define BSIM4V4RSNOIZ 1 +#define BSIM4V4RGNOIZ 2 +#define BSIM4V4RBPSNOIZ 3 +#define BSIM4V4RBPDNOIZ 4 +#define BSIM4V4RBPBNOIZ 5 +#define BSIM4V4RBSBNOIZ 6 +#define BSIM4V4RBDBNOIZ 7 +#define BSIM4V4IDNOIZ 8 +#define BSIM4V4FLNOIZ 9 +#define BSIM4V4IGSNOIZ 10 +#define BSIM4V4IGDNOIZ 11 +#define BSIM4V4IGBNOIZ 12 +#define BSIM4V4TOTNOIZ 13 + +#define BSIM4V4NSRCS 14 /* Number of BSIM4V4 noise sources */ + +#ifndef NONOISE + double BSIM4V4nVar[NSTATVARS][BSIM4V4NSRCS]; +#else /* NONOISE */ + double **BSIM4V4nVar; +#endif /* NONOISE */ + +} BSIM4V4instance ; + +struct bsim4SizeDependParam +{ + double Width; + double Length; + double NFinger; + + double BSIM4V4cdsc; + double BSIM4V4cdscb; + double BSIM4V4cdscd; + double BSIM4V4cit; + double BSIM4V4nfactor; + double BSIM4V4xj; + double BSIM4V4vsat; + double BSIM4V4at; + double BSIM4V4a0; + double BSIM4V4ags; + double BSIM4V4a1; + double BSIM4V4a2; + double BSIM4V4keta; + double BSIM4V4nsub; + double BSIM4V4ndep; + double BSIM4V4nsd; + double BSIM4V4phin; + double BSIM4V4ngate; + double BSIM4V4gamma1; + double BSIM4V4gamma2; + double BSIM4V4vbx; + double BSIM4V4vbi; + double BSIM4V4vbm; + double BSIM4V4vbsc; + double BSIM4V4xt; + double BSIM4V4phi; + double BSIM4V4litl; + double BSIM4V4k1; + double BSIM4V4kt1; + double BSIM4V4kt1l; + double BSIM4V4kt2; + double BSIM4V4k2; + double BSIM4V4k3; + double BSIM4V4k3b; + double BSIM4V4w0; + double BSIM4V4dvtp0; + double BSIM4V4dvtp1; + double BSIM4V4lpe0; + double BSIM4V4lpeb; + double BSIM4V4dvt0; + double BSIM4V4dvt1; + double BSIM4V4dvt2; + double BSIM4V4dvt0w; + double BSIM4V4dvt1w; + double BSIM4V4dvt2w; + double BSIM4V4drout; + double BSIM4V4dsub; + double BSIM4V4vth0; + double BSIM4V4ua; + double BSIM4V4ua1; + double BSIM4V4ub; + double BSIM4V4ub1; + double BSIM4V4uc; + double BSIM4V4uc1; + double BSIM4V4u0; + double BSIM4V4eu; + double BSIM4V4ute; + double BSIM4V4voff; + double BSIM4V4minv; + double BSIM4V4vfb; + double BSIM4V4delta; + double BSIM4V4rdsw; + double BSIM4V4rds0; + double BSIM4V4rs0; + double BSIM4V4rd0; + double BSIM4V4rsw; + double BSIM4V4rdw; + double BSIM4V4prwg; + double BSIM4V4prwb; + double BSIM4V4prt; + double BSIM4V4eta0; + double BSIM4V4etab; + double BSIM4V4pclm; + double BSIM4V4pdibl1; + double BSIM4V4pdibl2; + double BSIM4V4pdiblb; + double BSIM4V4fprout; + double BSIM4V4pdits; + double BSIM4V4pditsd; + double BSIM4V4pscbe1; + double BSIM4V4pscbe2; + double BSIM4V4pvag; + double BSIM4V4wr; + double BSIM4V4dwg; + double BSIM4V4dwb; + double BSIM4V4b0; + double BSIM4V4b1; + double BSIM4V4alpha0; + double BSIM4V4alpha1; + double BSIM4V4beta0; + double BSIM4V4agidl; + double BSIM4V4bgidl; + double BSIM4V4cgidl; + double BSIM4V4egidl; + double BSIM4V4aigc; + double BSIM4V4bigc; + double BSIM4V4cigc; + double BSIM4V4aigsd; + double BSIM4V4bigsd; + double BSIM4V4cigsd; + double BSIM4V4aigbacc; + double BSIM4V4bigbacc; + double BSIM4V4cigbacc; + double BSIM4V4aigbinv; + double BSIM4V4bigbinv; + double BSIM4V4cigbinv; + double BSIM4V4nigc; + double BSIM4V4nigbacc; + double BSIM4V4nigbinv; + double BSIM4V4ntox; + double BSIM4V4eigbinv; + double BSIM4V4pigcd; + double BSIM4V4poxedge; + double BSIM4V4xrcrg1; + double BSIM4V4xrcrg2; + double BSIM4V4lambda; /* overshoot */ + double BSIM4V4vtl; /* thermal velocity limit */ + double BSIM4V4xn; /* back scattering parameter */ + double BSIM4V4lc; /* back scattering parameter */ + double BSIM4V4tfactor; /* ballistic transportation factor */ + double BSIM4V4vfbsdoff; /* S/D flatband offset voltage */ + +/* added for stress effect */ + double BSIM4V4ku0; + double BSIM4V4kvth0; + double BSIM4V4ku0temp; + double BSIM4V4rho_ref; + double BSIM4V4inv_od_ref; + + /* CV model */ + double BSIM4V4cgsl; + double BSIM4V4cgdl; + double BSIM4V4ckappas; + double BSIM4V4ckappad; + double BSIM4V4cf; + double BSIM4V4clc; + double BSIM4V4cle; + double BSIM4V4vfbcv; + double BSIM4V4noff; + double BSIM4V4voffcv; + double BSIM4V4acde; + double BSIM4V4moin; + +/* Pre-calculated constants */ + + double BSIM4V4dw; + double BSIM4V4dl; + double BSIM4V4leff; + double BSIM4V4weff; + + double BSIM4V4dwc; + double BSIM4V4dlc; + double BSIM4V4dlcig; + double BSIM4V4dwj; + double BSIM4V4leffCV; + double BSIM4V4weffCV; + double BSIM4V4weffCJ; + double BSIM4V4abulkCVfactor; + double BSIM4V4cgso; + double BSIM4V4cgdo; + double BSIM4V4cgbo; + + double BSIM4V4u0temp; + double BSIM4V4vsattemp; + double BSIM4V4sqrtPhi; + double BSIM4V4phis3; + double BSIM4V4Xdep0; + double BSIM4V4sqrtXdep0; + double BSIM4V4theta0vb0; + double BSIM4V4thetaRout; + double BSIM4V4mstar; + double BSIM4V4voffcbn; + double BSIM4V4rdswmin; + double BSIM4V4rdwmin; + double BSIM4V4rswmin; + double BSIM4V4vfbsd; + + double BSIM4V4cof1; + double BSIM4V4cof2; + double BSIM4V4cof3; + double BSIM4V4cof4; + double BSIM4V4cdep0; + double BSIM4V4vfbzb; + double BSIM4V4vtfbphi1; + double BSIM4V4vtfbphi2; + double BSIM4V4ToxRatio; + double BSIM4V4Aechvb; + double BSIM4V4Bechvb; + double BSIM4V4ToxRatioEdge; + double BSIM4V4AechvbEdge; + double BSIM4V4BechvbEdge; + double BSIM4V4ldeb; + double BSIM4V4k1ox; + double BSIM4V4k2ox; + + struct bsim4SizeDependParam *pNext; +}; + + +typedef struct sBSIM4V4model +{ + int BSIM4V4modType; + struct sBSIM4V4model *BSIM4V4nextModel; + BSIM4V4instance *BSIM4V4instances; + IFuid BSIM4V4modName; + int BSIM4V4type; + + int BSIM4V4mobMod; + int BSIM4V4capMod; + int BSIM4V4dioMod; + int BSIM4V4trnqsMod; + int BSIM4V4acnqsMod; + int BSIM4V4fnoiMod; + int BSIM4V4tnoiMod; + int BSIM4V4rdsMod; + int BSIM4V4rbodyMod; + int BSIM4V4rgateMod; + int BSIM4V4perMod; + int BSIM4V4geoMod; + int BSIM4V4igcMod; + int BSIM4V4igbMod; + int BSIM4V4tempMod; + int BSIM4V4binUnit; + int BSIM4V4paramChk; + char *BSIM4V4version; + double BSIM4V4toxe; + double BSIM4V4toxp; + double BSIM4V4toxm; + double BSIM4V4dtox; + double BSIM4V4epsrox; + double BSIM4V4cdsc; + double BSIM4V4cdscb; + double BSIM4V4cdscd; + double BSIM4V4cit; + double BSIM4V4nfactor; + double BSIM4V4xj; + double BSIM4V4vsat; + double BSIM4V4at; + double BSIM4V4a0; + double BSIM4V4ags; + double BSIM4V4a1; + double BSIM4V4a2; + double BSIM4V4keta; + double BSIM4V4nsub; + double BSIM4V4ndep; + double BSIM4V4nsd; + double BSIM4V4phin; + double BSIM4V4ngate; + double BSIM4V4gamma1; + double BSIM4V4gamma2; + double BSIM4V4vbx; + double BSIM4V4vbm; + double BSIM4V4xt; + double BSIM4V4k1; + double BSIM4V4kt1; + double BSIM4V4kt1l; + double BSIM4V4kt2; + double BSIM4V4k2; + double BSIM4V4k3; + double BSIM4V4k3b; + double BSIM4V4w0; + double BSIM4V4dvtp0; + double BSIM4V4dvtp1; + double BSIM4V4lpe0; + double BSIM4V4lpeb; + double BSIM4V4dvt0; + double BSIM4V4dvt1; + double BSIM4V4dvt2; + double BSIM4V4dvt0w; + double BSIM4V4dvt1w; + double BSIM4V4dvt2w; + double BSIM4V4drout; + double BSIM4V4dsub; + double BSIM4V4vth0; + double BSIM4V4eu; + double BSIM4V4ua; + double BSIM4V4ua1; + double BSIM4V4ub; + double BSIM4V4ub1; + double BSIM4V4uc; + double BSIM4V4uc1; + double BSIM4V4u0; + double BSIM4V4ute; + double BSIM4V4voff; + double BSIM4V4minv; + double BSIM4V4voffl; + double BSIM4V4delta; + double BSIM4V4rdsw; + double BSIM4V4rdswmin; + double BSIM4V4rdwmin; + double BSIM4V4rswmin; + double BSIM4V4rsw; + double BSIM4V4rdw; + double BSIM4V4prwg; + double BSIM4V4prwb; + double BSIM4V4prt; + double BSIM4V4eta0; + double BSIM4V4etab; + double BSIM4V4pclm; + double BSIM4V4pdibl1; + double BSIM4V4pdibl2; + double BSIM4V4pdiblb; + double BSIM4V4fprout; + double BSIM4V4pdits; + double BSIM4V4pditsd; + double BSIM4V4pditsl; + double BSIM4V4pscbe1; + double BSIM4V4pscbe2; + double BSIM4V4pvag; + double BSIM4V4wr; + double BSIM4V4dwg; + double BSIM4V4dwb; + double BSIM4V4b0; + double BSIM4V4b1; + double BSIM4V4alpha0; + double BSIM4V4alpha1; + double BSIM4V4beta0; + double BSIM4V4agidl; + double BSIM4V4bgidl; + double BSIM4V4cgidl; + double BSIM4V4egidl; + double BSIM4V4aigc; + double BSIM4V4bigc; + double BSIM4V4cigc; + double BSIM4V4aigsd; + double BSIM4V4bigsd; + double BSIM4V4cigsd; + double BSIM4V4aigbacc; + double BSIM4V4bigbacc; + double BSIM4V4cigbacc; + double BSIM4V4aigbinv; + double BSIM4V4bigbinv; + double BSIM4V4cigbinv; + double BSIM4V4nigc; + double BSIM4V4nigbacc; + double BSIM4V4nigbinv; + double BSIM4V4ntox; + double BSIM4V4eigbinv; + double BSIM4V4pigcd; + double BSIM4V4poxedge; + double BSIM4V4toxref; + double BSIM4V4ijthdfwd; + double BSIM4V4ijthsfwd; + double BSIM4V4ijthdrev; + double BSIM4V4ijthsrev; + double BSIM4V4xjbvd; + double BSIM4V4xjbvs; + double BSIM4V4bvd; + double BSIM4V4bvs; + + double BSIM4V4jtss; + double BSIM4V4jtsd; + double BSIM4V4jtssws; + double BSIM4V4jtsswd; + double BSIM4V4jtsswgs; + double BSIM4V4jtsswgd; + double BSIM4V4njts; + double BSIM4V4njtssw; + double BSIM4V4njtsswg; + double BSIM4V4xtss; + double BSIM4V4xtsd; + double BSIM4V4xtssws; + double BSIM4V4xtsswd; + double BSIM4V4xtsswgs; + double BSIM4V4xtsswgd; + double BSIM4V4tnjts; + double BSIM4V4tnjtssw; + double BSIM4V4tnjtsswg; + double BSIM4V4vtss; + double BSIM4V4vtsd; + double BSIM4V4vtssws; + double BSIM4V4vtsswd; + double BSIM4V4vtsswgs; + double BSIM4V4vtsswgd; + + double BSIM4V4xrcrg1; + double BSIM4V4xrcrg2; + double BSIM4V4lambda; + double BSIM4V4vtl; + double BSIM4V4lc; + double BSIM4V4xn; + double BSIM4V4vfbsdoff; /* S/D flatband offset voltage */ + double BSIM4V4lintnoi; /* lint offset for noise calculation */ + + double BSIM4V4vfb; + double BSIM4V4gbmin; + double BSIM4V4rbdb; + double BSIM4V4rbsb; + double BSIM4V4rbpb; + double BSIM4V4rbps; + double BSIM4V4rbpd; + double BSIM4V4tnoia; + double BSIM4V4tnoib; + double BSIM4V4rnoia; + double BSIM4V4rnoib; + double BSIM4V4ntnoi; + + /* CV model and Parasitics */ + double BSIM4V4cgsl; + double BSIM4V4cgdl; + double BSIM4V4ckappas; + double BSIM4V4ckappad; + double BSIM4V4cf; + double BSIM4V4vfbcv; + double BSIM4V4clc; + double BSIM4V4cle; + double BSIM4V4dwc; + double BSIM4V4dlc; + double BSIM4V4xw; + double BSIM4V4xl; + double BSIM4V4dlcig; + double BSIM4V4dwj; + double BSIM4V4noff; + double BSIM4V4voffcv; + double BSIM4V4acde; + double BSIM4V4moin; + double BSIM4V4tcj; + double BSIM4V4tcjsw; + double BSIM4V4tcjswg; + double BSIM4V4tpb; + double BSIM4V4tpbsw; + double BSIM4V4tpbswg; + double BSIM4V4dmcg; + double BSIM4V4dmci; + double BSIM4V4dmdg; + double BSIM4V4dmcgt; + double BSIM4V4xgw; + double BSIM4V4xgl; + double BSIM4V4rshg; + double BSIM4V4ngcon; + + /* Length Dependence */ + double BSIM4V4lcdsc; + double BSIM4V4lcdscb; + double BSIM4V4lcdscd; + double BSIM4V4lcit; + double BSIM4V4lnfactor; + double BSIM4V4lxj; + double BSIM4V4lvsat; + double BSIM4V4lat; + double BSIM4V4la0; + double BSIM4V4lags; + double BSIM4V4la1; + double BSIM4V4la2; + double BSIM4V4lketa; + double BSIM4V4lnsub; + double BSIM4V4lndep; + double BSIM4V4lnsd; + double BSIM4V4lphin; + double BSIM4V4lngate; + double BSIM4V4lgamma1; + double BSIM4V4lgamma2; + double BSIM4V4lvbx; + double BSIM4V4lvbm; + double BSIM4V4lxt; + double BSIM4V4lk1; + double BSIM4V4lkt1; + double BSIM4V4lkt1l; + double BSIM4V4lkt2; + double BSIM4V4lk2; + double BSIM4V4lk3; + double BSIM4V4lk3b; + double BSIM4V4lw0; + double BSIM4V4ldvtp0; + double BSIM4V4ldvtp1; + double BSIM4V4llpe0; + double BSIM4V4llpeb; + double BSIM4V4ldvt0; + double BSIM4V4ldvt1; + double BSIM4V4ldvt2; + double BSIM4V4ldvt0w; + double BSIM4V4ldvt1w; + double BSIM4V4ldvt2w; + double BSIM4V4ldrout; + double BSIM4V4ldsub; + double BSIM4V4lvth0; + double BSIM4V4lua; + double BSIM4V4lua1; + double BSIM4V4lub; + double BSIM4V4lub1; + double BSIM4V4luc; + double BSIM4V4luc1; + double BSIM4V4lu0; + double BSIM4V4leu; + double BSIM4V4lute; + double BSIM4V4lvoff; + double BSIM4V4lminv; + double BSIM4V4ldelta; + double BSIM4V4lrdsw; + double BSIM4V4lrsw; + double BSIM4V4lrdw; + double BSIM4V4lprwg; + double BSIM4V4lprwb; + double BSIM4V4lprt; + double BSIM4V4leta0; + double BSIM4V4letab; + double BSIM4V4lpclm; + double BSIM4V4lpdibl1; + double BSIM4V4lpdibl2; + double BSIM4V4lpdiblb; + double BSIM4V4lfprout; + double BSIM4V4lpdits; + double BSIM4V4lpditsd; + double BSIM4V4lpscbe1; + double BSIM4V4lpscbe2; + double BSIM4V4lpvag; + double BSIM4V4lwr; + double BSIM4V4ldwg; + double BSIM4V4ldwb; + double BSIM4V4lb0; + double BSIM4V4lb1; + double BSIM4V4lalpha0; + double BSIM4V4lalpha1; + double BSIM4V4lbeta0; + double BSIM4V4lvfb; + double BSIM4V4lagidl; + double BSIM4V4lbgidl; + double BSIM4V4lcgidl; + double BSIM4V4legidl; + double BSIM4V4laigc; + double BSIM4V4lbigc; + double BSIM4V4lcigc; + double BSIM4V4laigsd; + double BSIM4V4lbigsd; + double BSIM4V4lcigsd; + double BSIM4V4laigbacc; + double BSIM4V4lbigbacc; + double BSIM4V4lcigbacc; + double BSIM4V4laigbinv; + double BSIM4V4lbigbinv; + double BSIM4V4lcigbinv; + double BSIM4V4lnigc; + double BSIM4V4lnigbacc; + double BSIM4V4lnigbinv; + double BSIM4V4lntox; + double BSIM4V4leigbinv; + double BSIM4V4lpigcd; + double BSIM4V4lpoxedge; + double BSIM4V4lxrcrg1; + double BSIM4V4lxrcrg2; + double BSIM4V4llambda; + double BSIM4V4lvtl; + double BSIM4V4lxn; + double BSIM4V4lvfbsdoff; + + /* CV model */ + double BSIM4V4lcgsl; + double BSIM4V4lcgdl; + double BSIM4V4lckappas; + double BSIM4V4lckappad; + double BSIM4V4lcf; + double BSIM4V4lclc; + double BSIM4V4lcle; + double BSIM4V4lvfbcv; + double BSIM4V4lnoff; + double BSIM4V4lvoffcv; + double BSIM4V4lacde; + double BSIM4V4lmoin; + + /* Width Dependence */ + double BSIM4V4wcdsc; + double BSIM4V4wcdscb; + double BSIM4V4wcdscd; + double BSIM4V4wcit; + double BSIM4V4wnfactor; + double BSIM4V4wxj; + double BSIM4V4wvsat; + double BSIM4V4wat; + double BSIM4V4wa0; + double BSIM4V4wags; + double BSIM4V4wa1; + double BSIM4V4wa2; + double BSIM4V4wketa; + double BSIM4V4wnsub; + double BSIM4V4wndep; + double BSIM4V4wnsd; + double BSIM4V4wphin; + double BSIM4V4wngate; + double BSIM4V4wgamma1; + double BSIM4V4wgamma2; + double BSIM4V4wvbx; + double BSIM4V4wvbm; + double BSIM4V4wxt; + double BSIM4V4wk1; + double BSIM4V4wkt1; + double BSIM4V4wkt1l; + double BSIM4V4wkt2; + double BSIM4V4wk2; + double BSIM4V4wk3; + double BSIM4V4wk3b; + double BSIM4V4ww0; + double BSIM4V4wdvtp0; + double BSIM4V4wdvtp1; + double BSIM4V4wlpe0; + double BSIM4V4wlpeb; + double BSIM4V4wdvt0; + double BSIM4V4wdvt1; + double BSIM4V4wdvt2; + double BSIM4V4wdvt0w; + double BSIM4V4wdvt1w; + double BSIM4V4wdvt2w; + double BSIM4V4wdrout; + double BSIM4V4wdsub; + double BSIM4V4wvth0; + double BSIM4V4wua; + double BSIM4V4wua1; + double BSIM4V4wub; + double BSIM4V4wub1; + double BSIM4V4wuc; + double BSIM4V4wuc1; + double BSIM4V4wu0; + double BSIM4V4weu; + double BSIM4V4wute; + double BSIM4V4wvoff; + double BSIM4V4wminv; + double BSIM4V4wdelta; + double BSIM4V4wrdsw; + double BSIM4V4wrsw; + double BSIM4V4wrdw; + double BSIM4V4wprwg; + double BSIM4V4wprwb; + double BSIM4V4wprt; + double BSIM4V4weta0; + double BSIM4V4wetab; + double BSIM4V4wpclm; + double BSIM4V4wpdibl1; + double BSIM4V4wpdibl2; + double BSIM4V4wpdiblb; + double BSIM4V4wfprout; + double BSIM4V4wpdits; + double BSIM4V4wpditsd; + double BSIM4V4wpscbe1; + double BSIM4V4wpscbe2; + double BSIM4V4wpvag; + double BSIM4V4wwr; + double BSIM4V4wdwg; + double BSIM4V4wdwb; + double BSIM4V4wb0; + double BSIM4V4wb1; + double BSIM4V4walpha0; + double BSIM4V4walpha1; + double BSIM4V4wbeta0; + double BSIM4V4wvfb; + double BSIM4V4wagidl; + double BSIM4V4wbgidl; + double BSIM4V4wcgidl; + double BSIM4V4wegidl; + double BSIM4V4waigc; + double BSIM4V4wbigc; + double BSIM4V4wcigc; + double BSIM4V4waigsd; + double BSIM4V4wbigsd; + double BSIM4V4wcigsd; + double BSIM4V4waigbacc; + double BSIM4V4wbigbacc; + double BSIM4V4wcigbacc; + double BSIM4V4waigbinv; + double BSIM4V4wbigbinv; + double BSIM4V4wcigbinv; + double BSIM4V4wnigc; + double BSIM4V4wnigbacc; + double BSIM4V4wnigbinv; + double BSIM4V4wntox; + double BSIM4V4weigbinv; + double BSIM4V4wpigcd; + double BSIM4V4wpoxedge; + double BSIM4V4wxrcrg1; + double BSIM4V4wxrcrg2; + double BSIM4V4wlambda; + double BSIM4V4wvtl; + double BSIM4V4wxn; + double BSIM4V4wvfbsdoff; + + /* CV model */ + double BSIM4V4wcgsl; + double BSIM4V4wcgdl; + double BSIM4V4wckappas; + double BSIM4V4wckappad; + double BSIM4V4wcf; + double BSIM4V4wclc; + double BSIM4V4wcle; + double BSIM4V4wvfbcv; + double BSIM4V4wnoff; + double BSIM4V4wvoffcv; + double BSIM4V4wacde; + double BSIM4V4wmoin; + + /* Cross-term Dependence */ + double BSIM4V4pcdsc; + double BSIM4V4pcdscb; + double BSIM4V4pcdscd; + double BSIM4V4pcit; + double BSIM4V4pnfactor; + double BSIM4V4pxj; + double BSIM4V4pvsat; + double BSIM4V4pat; + double BSIM4V4pa0; + double BSIM4V4pags; + double BSIM4V4pa1; + double BSIM4V4pa2; + double BSIM4V4pketa; + double BSIM4V4pnsub; + double BSIM4V4pndep; + double BSIM4V4pnsd; + double BSIM4V4pphin; + double BSIM4V4pngate; + double BSIM4V4pgamma1; + double BSIM4V4pgamma2; + double BSIM4V4pvbx; + double BSIM4V4pvbm; + double BSIM4V4pxt; + double BSIM4V4pk1; + double BSIM4V4pkt1; + double BSIM4V4pkt1l; + double BSIM4V4pkt2; + double BSIM4V4pk2; + double BSIM4V4pk3; + double BSIM4V4pk3b; + double BSIM4V4pw0; + double BSIM4V4pdvtp0; + double BSIM4V4pdvtp1; + double BSIM4V4plpe0; + double BSIM4V4plpeb; + double BSIM4V4pdvt0; + double BSIM4V4pdvt1; + double BSIM4V4pdvt2; + double BSIM4V4pdvt0w; + double BSIM4V4pdvt1w; + double BSIM4V4pdvt2w; + double BSIM4V4pdrout; + double BSIM4V4pdsub; + double BSIM4V4pvth0; + double BSIM4V4pua; + double BSIM4V4pua1; + double BSIM4V4pub; + double BSIM4V4pub1; + double BSIM4V4puc; + double BSIM4V4puc1; + double BSIM4V4pu0; + double BSIM4V4peu; + double BSIM4V4pute; + double BSIM4V4pvoff; + double BSIM4V4pminv; + double BSIM4V4pdelta; + double BSIM4V4prdsw; + double BSIM4V4prsw; + double BSIM4V4prdw; + double BSIM4V4pprwg; + double BSIM4V4pprwb; + double BSIM4V4pprt; + double BSIM4V4peta0; + double BSIM4V4petab; + double BSIM4V4ppclm; + double BSIM4V4ppdibl1; + double BSIM4V4ppdibl2; + double BSIM4V4ppdiblb; + double BSIM4V4pfprout; + double BSIM4V4ppdits; + double BSIM4V4ppditsd; + double BSIM4V4ppscbe1; + double BSIM4V4ppscbe2; + double BSIM4V4ppvag; + double BSIM4V4pwr; + double BSIM4V4pdwg; + double BSIM4V4pdwb; + double BSIM4V4pb0; + double BSIM4V4pb1; + double BSIM4V4palpha0; + double BSIM4V4palpha1; + double BSIM4V4pbeta0; + double BSIM4V4pvfb; + double BSIM4V4pagidl; + double BSIM4V4pbgidl; + double BSIM4V4pcgidl; + double BSIM4V4pegidl; + double BSIM4V4paigc; + double BSIM4V4pbigc; + double BSIM4V4pcigc; + double BSIM4V4paigsd; + double BSIM4V4pbigsd; + double BSIM4V4pcigsd; + double BSIM4V4paigbacc; + double BSIM4V4pbigbacc; + double BSIM4V4pcigbacc; + double BSIM4V4paigbinv; + double BSIM4V4pbigbinv; + double BSIM4V4pcigbinv; + double BSIM4V4pnigc; + double BSIM4V4pnigbacc; + double BSIM4V4pnigbinv; + double BSIM4V4pntox; + double BSIM4V4peigbinv; + double BSIM4V4ppigcd; + double BSIM4V4ppoxedge; + double BSIM4V4pxrcrg1; + double BSIM4V4pxrcrg2; + double BSIM4V4plambda; + double BSIM4V4pvtl; + double BSIM4V4pxn; + double BSIM4V4pvfbsdoff; + + /* CV model */ + double BSIM4V4pcgsl; + double BSIM4V4pcgdl; + double BSIM4V4pckappas; + double BSIM4V4pckappad; + double BSIM4V4pcf; + double BSIM4V4pclc; + double BSIM4V4pcle; + double BSIM4V4pvfbcv; + double BSIM4V4pnoff; + double BSIM4V4pvoffcv; + double BSIM4V4pacde; + double BSIM4V4pmoin; + + double BSIM4V4tnom; + double BSIM4V4cgso; + double BSIM4V4cgdo; + double BSIM4V4cgbo; + double BSIM4V4xpart; + double BSIM4V4cFringOut; + double BSIM4V4cFringMax; + + double BSIM4V4sheetResistance; + double BSIM4V4SjctSatCurDensity; + double BSIM4V4DjctSatCurDensity; + double BSIM4V4SjctSidewallSatCurDensity; + double BSIM4V4DjctSidewallSatCurDensity; + double BSIM4V4SjctGateSidewallSatCurDensity; + double BSIM4V4DjctGateSidewallSatCurDensity; + double BSIM4V4SbulkJctPotential; + double BSIM4V4DbulkJctPotential; + double BSIM4V4SbulkJctBotGradingCoeff; + double BSIM4V4DbulkJctBotGradingCoeff; + double BSIM4V4SbulkJctSideGradingCoeff; + double BSIM4V4DbulkJctSideGradingCoeff; + double BSIM4V4SbulkJctGateSideGradingCoeff; + double BSIM4V4DbulkJctGateSideGradingCoeff; + double BSIM4V4SsidewallJctPotential; + double BSIM4V4DsidewallJctPotential; + double BSIM4V4SGatesidewallJctPotential; + double BSIM4V4DGatesidewallJctPotential; + double BSIM4V4SunitAreaJctCap; + double BSIM4V4DunitAreaJctCap; + double BSIM4V4SunitLengthSidewallJctCap; + double BSIM4V4DunitLengthSidewallJctCap; + double BSIM4V4SunitLengthGateSidewallJctCap; + double BSIM4V4DunitLengthGateSidewallJctCap; + double BSIM4V4SjctEmissionCoeff; + double BSIM4V4DjctEmissionCoeff; + double BSIM4V4SjctTempExponent; + double BSIM4V4DjctTempExponent; + double BSIM4V4njtstemp; + double BSIM4V4njtsswtemp; + double BSIM4V4njtsswgtemp; + + double BSIM4V4Lint; + double BSIM4V4Ll; + double BSIM4V4Llc; + double BSIM4V4Lln; + double BSIM4V4Lw; + double BSIM4V4Lwc; + double BSIM4V4Lwn; + double BSIM4V4Lwl; + double BSIM4V4Lwlc; + double BSIM4V4Lmin; + double BSIM4V4Lmax; + + double BSIM4V4Wint; + double BSIM4V4Wl; + double BSIM4V4Wlc; + double BSIM4V4Wln; + double BSIM4V4Ww; + double BSIM4V4Wwc; + double BSIM4V4Wwn; + double BSIM4V4Wwl; + double BSIM4V4Wwlc; + double BSIM4V4Wmin; + double BSIM4V4Wmax; + + /* added for stress effect */ + double BSIM4V4saref; + double BSIM4V4sbref; + double BSIM4V4wlod; + double BSIM4V4ku0; + double BSIM4V4kvsat; + double BSIM4V4kvth0; + double BSIM4V4tku0; + double BSIM4V4llodku0; + double BSIM4V4wlodku0; + double BSIM4V4llodvth; + double BSIM4V4wlodvth; + double BSIM4V4lku0; + double BSIM4V4wku0; + double BSIM4V4pku0; + double BSIM4V4lkvth0; + double BSIM4V4wkvth0; + double BSIM4V4pkvth0; + double BSIM4V4stk2; + double BSIM4V4lodk2; + double BSIM4V4steta0; + double BSIM4V4lodeta0; + + + +/* Pre-calculated constants + * move to size-dependent param */ + double BSIM4V4vtm; + double BSIM4V4vtm0; + double BSIM4V4coxe; + double BSIM4V4coxp; + double BSIM4V4cof1; + double BSIM4V4cof2; + double BSIM4V4cof3; + double BSIM4V4cof4; + double BSIM4V4vcrit; + double BSIM4V4factor1; + double BSIM4V4PhiBS; + double BSIM4V4PhiBSWS; + double BSIM4V4PhiBSWGS; + double BSIM4V4SjctTempSatCurDensity; + double BSIM4V4SjctSidewallTempSatCurDensity; + double BSIM4V4SjctGateSidewallTempSatCurDensity; + double BSIM4V4PhiBD; + double BSIM4V4PhiBSWD; + double BSIM4V4PhiBSWGD; + double BSIM4V4DjctTempSatCurDensity; + double BSIM4V4DjctSidewallTempSatCurDensity; + double BSIM4V4DjctGateSidewallTempSatCurDensity; + double BSIM4V4SunitAreaTempJctCap; + double BSIM4V4DunitAreaTempJctCap; + double BSIM4V4SunitLengthSidewallTempJctCap; + double BSIM4V4DunitLengthSidewallTempJctCap; + double BSIM4V4SunitLengthGateSidewallTempJctCap; + double BSIM4V4DunitLengthGateSidewallTempJctCap; + + double BSIM4V4oxideTrapDensityA; + double BSIM4V4oxideTrapDensityB; + double BSIM4V4oxideTrapDensityC; + double BSIM4V4em; + double BSIM4V4ef; + double BSIM4V4af; + double BSIM4V4kf; + + int BSIM4V4rgeomod; + + /* strain parameters */ + double BSIM4V4stimod; + double BSIM4V4sa0; + double BSIM4V4sb0; + + struct bsim4SizeDependParam *pSizeDependParamKnot; + + /* Flags */ + unsigned BSIM4V4rgeomodGiven :1; + unsigned BSIM4V4stimodGiven :1; + unsigned BSIM4V4sa0Given :1; + unsigned BSIM4V4sb0Given :1; + + unsigned BSIM4V4mobModGiven :1; + unsigned BSIM4V4binUnitGiven :1; + unsigned BSIM4V4capModGiven :1; + unsigned BSIM4V4dioModGiven :1; + unsigned BSIM4V4rdsModGiven :1; + unsigned BSIM4V4rbodyModGiven :1; + unsigned BSIM4V4rgateModGiven :1; + unsigned BSIM4V4perModGiven :1; + unsigned BSIM4V4geoModGiven :1; + unsigned BSIM4V4paramChkGiven :1; + unsigned BSIM4V4trnqsModGiven :1; + unsigned BSIM4V4acnqsModGiven :1; + unsigned BSIM4V4fnoiModGiven :1; + unsigned BSIM4V4tnoiModGiven :1; + unsigned BSIM4V4igcModGiven :1; + unsigned BSIM4V4igbModGiven :1; + unsigned BSIM4V4tempModGiven :1; + unsigned BSIM4V4typeGiven :1; + unsigned BSIM4V4toxrefGiven :1; + unsigned BSIM4V4toxeGiven :1; + unsigned BSIM4V4toxpGiven :1; + unsigned BSIM4V4toxmGiven :1; + unsigned BSIM4V4dtoxGiven :1; + unsigned BSIM4V4epsroxGiven :1; + unsigned BSIM4V4versionGiven :1; + unsigned BSIM4V4cdscGiven :1; + unsigned BSIM4V4cdscbGiven :1; + unsigned BSIM4V4cdscdGiven :1; + unsigned BSIM4V4citGiven :1; + unsigned BSIM4V4nfactorGiven :1; + unsigned BSIM4V4xjGiven :1; + unsigned BSIM4V4vsatGiven :1; + unsigned BSIM4V4atGiven :1; + unsigned BSIM4V4a0Given :1; + unsigned BSIM4V4agsGiven :1; + unsigned BSIM4V4a1Given :1; + unsigned BSIM4V4a2Given :1; + unsigned BSIM4V4ketaGiven :1; + unsigned BSIM4V4nsubGiven :1; + unsigned BSIM4V4ndepGiven :1; + unsigned BSIM4V4nsdGiven :1; + unsigned BSIM4V4phinGiven :1; + unsigned BSIM4V4ngateGiven :1; + unsigned BSIM4V4gamma1Given :1; + unsigned BSIM4V4gamma2Given :1; + unsigned BSIM4V4vbxGiven :1; + unsigned BSIM4V4vbmGiven :1; + unsigned BSIM4V4xtGiven :1; + unsigned BSIM4V4k1Given :1; + unsigned BSIM4V4kt1Given :1; + unsigned BSIM4V4kt1lGiven :1; + unsigned BSIM4V4kt2Given :1; + unsigned BSIM4V4k2Given :1; + unsigned BSIM4V4k3Given :1; + unsigned BSIM4V4k3bGiven :1; + unsigned BSIM4V4w0Given :1; + unsigned BSIM4V4dvtp0Given :1; + unsigned BSIM4V4dvtp1Given :1; + unsigned BSIM4V4lpe0Given :1; + unsigned BSIM4V4lpebGiven :1; + unsigned BSIM4V4dvt0Given :1; + unsigned BSIM4V4dvt1Given :1; + unsigned BSIM4V4dvt2Given :1; + unsigned BSIM4V4dvt0wGiven :1; + unsigned BSIM4V4dvt1wGiven :1; + unsigned BSIM4V4dvt2wGiven :1; + unsigned BSIM4V4droutGiven :1; + unsigned BSIM4V4dsubGiven :1; + unsigned BSIM4V4vth0Given :1; + unsigned BSIM4V4euGiven :1; + unsigned BSIM4V4uaGiven :1; + unsigned BSIM4V4ua1Given :1; + unsigned BSIM4V4ubGiven :1; + unsigned BSIM4V4ub1Given :1; + unsigned BSIM4V4ucGiven :1; + unsigned BSIM4V4uc1Given :1; + unsigned BSIM4V4u0Given :1; + unsigned BSIM4V4uteGiven :1; + unsigned BSIM4V4voffGiven :1; + unsigned BSIM4V4vofflGiven :1; + unsigned BSIM4V4minvGiven :1; + unsigned BSIM4V4rdswGiven :1; + unsigned BSIM4V4rdswminGiven :1; + unsigned BSIM4V4rdwminGiven :1; + unsigned BSIM4V4rswminGiven :1; + unsigned BSIM4V4rswGiven :1; + unsigned BSIM4V4rdwGiven :1; + unsigned BSIM4V4prwgGiven :1; + unsigned BSIM4V4prwbGiven :1; + unsigned BSIM4V4prtGiven :1; + unsigned BSIM4V4eta0Given :1; + unsigned BSIM4V4etabGiven :1; + unsigned BSIM4V4pclmGiven :1; + unsigned BSIM4V4pdibl1Given :1; + unsigned BSIM4V4pdibl2Given :1; + unsigned BSIM4V4pdiblbGiven :1; + unsigned BSIM4V4fproutGiven :1; + unsigned BSIM4V4pditsGiven :1; + unsigned BSIM4V4pditsdGiven :1; + unsigned BSIM4V4pditslGiven :1; + unsigned BSIM4V4pscbe1Given :1; + unsigned BSIM4V4pscbe2Given :1; + unsigned BSIM4V4pvagGiven :1; + unsigned BSIM4V4deltaGiven :1; + unsigned BSIM4V4wrGiven :1; + unsigned BSIM4V4dwgGiven :1; + unsigned BSIM4V4dwbGiven :1; + unsigned BSIM4V4b0Given :1; + unsigned BSIM4V4b1Given :1; + unsigned BSIM4V4alpha0Given :1; + unsigned BSIM4V4alpha1Given :1; + unsigned BSIM4V4beta0Given :1; + unsigned BSIM4V4agidlGiven :1; + unsigned BSIM4V4bgidlGiven :1; + unsigned BSIM4V4cgidlGiven :1; + unsigned BSIM4V4egidlGiven :1; + unsigned BSIM4V4aigcGiven :1; + unsigned BSIM4V4bigcGiven :1; + unsigned BSIM4V4cigcGiven :1; + unsigned BSIM4V4aigsdGiven :1; + unsigned BSIM4V4bigsdGiven :1; + unsigned BSIM4V4cigsdGiven :1; + unsigned BSIM4V4aigbaccGiven :1; + unsigned BSIM4V4bigbaccGiven :1; + unsigned BSIM4V4cigbaccGiven :1; + unsigned BSIM4V4aigbinvGiven :1; + unsigned BSIM4V4bigbinvGiven :1; + unsigned BSIM4V4cigbinvGiven :1; + unsigned BSIM4V4nigcGiven :1; + unsigned BSIM4V4nigbinvGiven :1; + unsigned BSIM4V4nigbaccGiven :1; + unsigned BSIM4V4ntoxGiven :1; + unsigned BSIM4V4eigbinvGiven :1; + unsigned BSIM4V4pigcdGiven :1; + unsigned BSIM4V4poxedgeGiven :1; + unsigned BSIM4V4ijthdfwdGiven :1; + unsigned BSIM4V4ijthsfwdGiven :1; + unsigned BSIM4V4ijthdrevGiven :1; + unsigned BSIM4V4ijthsrevGiven :1; + unsigned BSIM4V4xjbvdGiven :1; + unsigned BSIM4V4xjbvsGiven :1; + unsigned BSIM4V4bvdGiven :1; + unsigned BSIM4V4bvsGiven :1; + + unsigned BSIM4V4jtssGiven :1; + unsigned BSIM4V4jtsdGiven :1; + unsigned BSIM4V4jtsswsGiven :1; + unsigned BSIM4V4jtsswdGiven :1; + unsigned BSIM4V4jtsswgsGiven :1; + unsigned BSIM4V4jtsswgdGiven :1; + unsigned BSIM4V4njtsGiven :1; + unsigned BSIM4V4njtsswGiven :1; + unsigned BSIM4V4njtsswgGiven :1; + unsigned BSIM4V4xtssGiven :1; + unsigned BSIM4V4xtsdGiven :1; + unsigned BSIM4V4xtsswsGiven :1; + unsigned BSIM4V4xtsswdGiven :1; + unsigned BSIM4V4xtsswgsGiven :1; + unsigned BSIM4V4xtsswgdGiven :1; + unsigned BSIM4V4tnjtsGiven :1; + unsigned BSIM4V4tnjtsswGiven :1; + unsigned BSIM4V4tnjtsswgGiven :1; + unsigned BSIM4V4vtssGiven :1; + unsigned BSIM4V4vtsdGiven :1; + unsigned BSIM4V4vtsswsGiven :1; + unsigned BSIM4V4vtsswdGiven :1; + unsigned BSIM4V4vtsswgsGiven :1; + unsigned BSIM4V4vtsswgdGiven :1; + + unsigned BSIM4V4vfbGiven :1; + unsigned BSIM4V4gbminGiven :1; + unsigned BSIM4V4rbdbGiven :1; + unsigned BSIM4V4rbsbGiven :1; + unsigned BSIM4V4rbpsGiven :1; + unsigned BSIM4V4rbpdGiven :1; + unsigned BSIM4V4rbpbGiven :1; + unsigned BSIM4V4xrcrg1Given :1; + unsigned BSIM4V4xrcrg2Given :1; + unsigned BSIM4V4tnoiaGiven :1; + unsigned BSIM4V4tnoibGiven :1; + unsigned BSIM4V4rnoiaGiven :1; + unsigned BSIM4V4rnoibGiven :1; + unsigned BSIM4V4ntnoiGiven :1; + + unsigned BSIM4V4lambdaGiven :1; + unsigned BSIM4V4vtlGiven :1; + unsigned BSIM4V4lcGiven :1; + unsigned BSIM4V4xnGiven :1; + unsigned BSIM4V4vfbsdoffGiven :1; + unsigned BSIM4V4lintnoiGiven :1; + + /* CV model and parasitics */ + unsigned BSIM4V4cgslGiven :1; + unsigned BSIM4V4cgdlGiven :1; + unsigned BSIM4V4ckappasGiven :1; + unsigned BSIM4V4ckappadGiven :1; + unsigned BSIM4V4cfGiven :1; + unsigned BSIM4V4vfbcvGiven :1; + unsigned BSIM4V4clcGiven :1; + unsigned BSIM4V4cleGiven :1; + unsigned BSIM4V4dwcGiven :1; + unsigned BSIM4V4dlcGiven :1; + unsigned BSIM4V4xwGiven :1; + unsigned BSIM4V4xlGiven :1; + unsigned BSIM4V4dlcigGiven :1; + unsigned BSIM4V4dwjGiven :1; + unsigned BSIM4V4noffGiven :1; + unsigned BSIM4V4voffcvGiven :1; + unsigned BSIM4V4acdeGiven :1; + unsigned BSIM4V4moinGiven :1; + unsigned BSIM4V4tcjGiven :1; + unsigned BSIM4V4tcjswGiven :1; + unsigned BSIM4V4tcjswgGiven :1; + unsigned BSIM4V4tpbGiven :1; + unsigned BSIM4V4tpbswGiven :1; + unsigned BSIM4V4tpbswgGiven :1; + unsigned BSIM4V4dmcgGiven :1; + unsigned BSIM4V4dmciGiven :1; + unsigned BSIM4V4dmdgGiven :1; + unsigned BSIM4V4dmcgtGiven :1; + unsigned BSIM4V4xgwGiven :1; + unsigned BSIM4V4xglGiven :1; + unsigned BSIM4V4rshgGiven :1; + unsigned BSIM4V4ngconGiven :1; + + + /* Length dependence */ + unsigned BSIM4V4lcdscGiven :1; + unsigned BSIM4V4lcdscbGiven :1; + unsigned BSIM4V4lcdscdGiven :1; + unsigned BSIM4V4lcitGiven :1; + unsigned BSIM4V4lnfactorGiven :1; + unsigned BSIM4V4lxjGiven :1; + unsigned BSIM4V4lvsatGiven :1; + unsigned BSIM4V4latGiven :1; + unsigned BSIM4V4la0Given :1; + unsigned BSIM4V4lagsGiven :1; + unsigned BSIM4V4la1Given :1; + unsigned BSIM4V4la2Given :1; + unsigned BSIM4V4lketaGiven :1; + unsigned BSIM4V4lnsubGiven :1; + unsigned BSIM4V4lndepGiven :1; + unsigned BSIM4V4lnsdGiven :1; + unsigned BSIM4V4lphinGiven :1; + unsigned BSIM4V4lngateGiven :1; + unsigned BSIM4V4lgamma1Given :1; + unsigned BSIM4V4lgamma2Given :1; + unsigned BSIM4V4lvbxGiven :1; + unsigned BSIM4V4lvbmGiven :1; + unsigned BSIM4V4lxtGiven :1; + unsigned BSIM4V4lk1Given :1; + unsigned BSIM4V4lkt1Given :1; + unsigned BSIM4V4lkt1lGiven :1; + unsigned BSIM4V4lkt2Given :1; + unsigned BSIM4V4lk2Given :1; + unsigned BSIM4V4lk3Given :1; + unsigned BSIM4V4lk3bGiven :1; + unsigned BSIM4V4lw0Given :1; + unsigned BSIM4V4ldvtp0Given :1; + unsigned BSIM4V4ldvtp1Given :1; + unsigned BSIM4V4llpe0Given :1; + unsigned BSIM4V4llpebGiven :1; + unsigned BSIM4V4ldvt0Given :1; + unsigned BSIM4V4ldvt1Given :1; + unsigned BSIM4V4ldvt2Given :1; + unsigned BSIM4V4ldvt0wGiven :1; + unsigned BSIM4V4ldvt1wGiven :1; + unsigned BSIM4V4ldvt2wGiven :1; + unsigned BSIM4V4ldroutGiven :1; + unsigned BSIM4V4ldsubGiven :1; + unsigned BSIM4V4lvth0Given :1; + unsigned BSIM4V4luaGiven :1; + unsigned BSIM4V4lua1Given :1; + unsigned BSIM4V4lubGiven :1; + unsigned BSIM4V4lub1Given :1; + unsigned BSIM4V4lucGiven :1; + unsigned BSIM4V4luc1Given :1; + unsigned BSIM4V4lu0Given :1; + unsigned BSIM4V4leuGiven :1; + unsigned BSIM4V4luteGiven :1; + unsigned BSIM4V4lvoffGiven :1; + unsigned BSIM4V4lminvGiven :1; + unsigned BSIM4V4lrdswGiven :1; + unsigned BSIM4V4lrswGiven :1; + unsigned BSIM4V4lrdwGiven :1; + unsigned BSIM4V4lprwgGiven :1; + unsigned BSIM4V4lprwbGiven :1; + unsigned BSIM4V4lprtGiven :1; + unsigned BSIM4V4leta0Given :1; + unsigned BSIM4V4letabGiven :1; + unsigned BSIM4V4lpclmGiven :1; + unsigned BSIM4V4lpdibl1Given :1; + unsigned BSIM4V4lpdibl2Given :1; + unsigned BSIM4V4lpdiblbGiven :1; + unsigned BSIM4V4lfproutGiven :1; + unsigned BSIM4V4lpditsGiven :1; + unsigned BSIM4V4lpditsdGiven :1; + unsigned BSIM4V4lpscbe1Given :1; + unsigned BSIM4V4lpscbe2Given :1; + unsigned BSIM4V4lpvagGiven :1; + unsigned BSIM4V4ldeltaGiven :1; + unsigned BSIM4V4lwrGiven :1; + unsigned BSIM4V4ldwgGiven :1; + unsigned BSIM4V4ldwbGiven :1; + unsigned BSIM4V4lb0Given :1; + unsigned BSIM4V4lb1Given :1; + unsigned BSIM4V4lalpha0Given :1; + unsigned BSIM4V4lalpha1Given :1; + unsigned BSIM4V4lbeta0Given :1; + unsigned BSIM4V4lvfbGiven :1; + unsigned BSIM4V4lagidlGiven :1; + unsigned BSIM4V4lbgidlGiven :1; + unsigned BSIM4V4lcgidlGiven :1; + unsigned BSIM4V4legidlGiven :1; + unsigned BSIM4V4laigcGiven :1; + unsigned BSIM4V4lbigcGiven :1; + unsigned BSIM4V4lcigcGiven :1; + unsigned BSIM4V4laigsdGiven :1; + unsigned BSIM4V4lbigsdGiven :1; + unsigned BSIM4V4lcigsdGiven :1; + unsigned BSIM4V4laigbaccGiven :1; + unsigned BSIM4V4lbigbaccGiven :1; + unsigned BSIM4V4lcigbaccGiven :1; + unsigned BSIM4V4laigbinvGiven :1; + unsigned BSIM4V4lbigbinvGiven :1; + unsigned BSIM4V4lcigbinvGiven :1; + unsigned BSIM4V4lnigcGiven :1; + unsigned BSIM4V4lnigbinvGiven :1; + unsigned BSIM4V4lnigbaccGiven :1; + unsigned BSIM4V4lntoxGiven :1; + unsigned BSIM4V4leigbinvGiven :1; + unsigned BSIM4V4lpigcdGiven :1; + unsigned BSIM4V4lpoxedgeGiven :1; + unsigned BSIM4V4lxrcrg1Given :1; + unsigned BSIM4V4lxrcrg2Given :1; + unsigned BSIM4V4llambdaGiven :1; + unsigned BSIM4V4lvtlGiven :1; + unsigned BSIM4V4lxnGiven :1; + unsigned BSIM4V4lvfbsdoffGiven :1; + + /* CV model */ + unsigned BSIM4V4lcgslGiven :1; + unsigned BSIM4V4lcgdlGiven :1; + unsigned BSIM4V4lckappasGiven :1; + unsigned BSIM4V4lckappadGiven :1; + unsigned BSIM4V4lcfGiven :1; + unsigned BSIM4V4lclcGiven :1; + unsigned BSIM4V4lcleGiven :1; + unsigned BSIM4V4lvfbcvGiven :1; + unsigned BSIM4V4lnoffGiven :1; + unsigned BSIM4V4lvoffcvGiven :1; + unsigned BSIM4V4lacdeGiven :1; + unsigned BSIM4V4lmoinGiven :1; + + /* Width dependence */ + unsigned BSIM4V4wcdscGiven :1; + unsigned BSIM4V4wcdscbGiven :1; + unsigned BSIM4V4wcdscdGiven :1; + unsigned BSIM4V4wcitGiven :1; + unsigned BSIM4V4wnfactorGiven :1; + unsigned BSIM4V4wxjGiven :1; + unsigned BSIM4V4wvsatGiven :1; + unsigned BSIM4V4watGiven :1; + unsigned BSIM4V4wa0Given :1; + unsigned BSIM4V4wagsGiven :1; + unsigned BSIM4V4wa1Given :1; + unsigned BSIM4V4wa2Given :1; + unsigned BSIM4V4wketaGiven :1; + unsigned BSIM4V4wnsubGiven :1; + unsigned BSIM4V4wndepGiven :1; + unsigned BSIM4V4wnsdGiven :1; + unsigned BSIM4V4wphinGiven :1; + unsigned BSIM4V4wngateGiven :1; + unsigned BSIM4V4wgamma1Given :1; + unsigned BSIM4V4wgamma2Given :1; + unsigned BSIM4V4wvbxGiven :1; + unsigned BSIM4V4wvbmGiven :1; + unsigned BSIM4V4wxtGiven :1; + unsigned BSIM4V4wk1Given :1; + unsigned BSIM4V4wkt1Given :1; + unsigned BSIM4V4wkt1lGiven :1; + unsigned BSIM4V4wkt2Given :1; + unsigned BSIM4V4wk2Given :1; + unsigned BSIM4V4wk3Given :1; + unsigned BSIM4V4wk3bGiven :1; + unsigned BSIM4V4ww0Given :1; + unsigned BSIM4V4wdvtp0Given :1; + unsigned BSIM4V4wdvtp1Given :1; + unsigned BSIM4V4wlpe0Given :1; + unsigned BSIM4V4wlpebGiven :1; + unsigned BSIM4V4wdvt0Given :1; + unsigned BSIM4V4wdvt1Given :1; + unsigned BSIM4V4wdvt2Given :1; + unsigned BSIM4V4wdvt0wGiven :1; + unsigned BSIM4V4wdvt1wGiven :1; + unsigned BSIM4V4wdvt2wGiven :1; + unsigned BSIM4V4wdroutGiven :1; + unsigned BSIM4V4wdsubGiven :1; + unsigned BSIM4V4wvth0Given :1; + unsigned BSIM4V4wuaGiven :1; + unsigned BSIM4V4wua1Given :1; + unsigned BSIM4V4wubGiven :1; + unsigned BSIM4V4wub1Given :1; + unsigned BSIM4V4wucGiven :1; + unsigned BSIM4V4wuc1Given :1; + unsigned BSIM4V4wu0Given :1; + unsigned BSIM4V4weuGiven :1; + unsigned BSIM4V4wuteGiven :1; + unsigned BSIM4V4wvoffGiven :1; + unsigned BSIM4V4wminvGiven :1; + unsigned BSIM4V4wrdswGiven :1; + unsigned BSIM4V4wrswGiven :1; + unsigned BSIM4V4wrdwGiven :1; + unsigned BSIM4V4wprwgGiven :1; + unsigned BSIM4V4wprwbGiven :1; + unsigned BSIM4V4wprtGiven :1; + unsigned BSIM4V4weta0Given :1; + unsigned BSIM4V4wetabGiven :1; + unsigned BSIM4V4wpclmGiven :1; + unsigned BSIM4V4wpdibl1Given :1; + unsigned BSIM4V4wpdibl2Given :1; + unsigned BSIM4V4wpdiblbGiven :1; + unsigned BSIM4V4wfproutGiven :1; + unsigned BSIM4V4wpditsGiven :1; + unsigned BSIM4V4wpditsdGiven :1; + unsigned BSIM4V4wpscbe1Given :1; + unsigned BSIM4V4wpscbe2Given :1; + unsigned BSIM4V4wpvagGiven :1; + unsigned BSIM4V4wdeltaGiven :1; + unsigned BSIM4V4wwrGiven :1; + unsigned BSIM4V4wdwgGiven :1; + unsigned BSIM4V4wdwbGiven :1; + unsigned BSIM4V4wb0Given :1; + unsigned BSIM4V4wb1Given :1; + unsigned BSIM4V4walpha0Given :1; + unsigned BSIM4V4walpha1Given :1; + unsigned BSIM4V4wbeta0Given :1; + unsigned BSIM4V4wvfbGiven :1; + unsigned BSIM4V4wagidlGiven :1; + unsigned BSIM4V4wbgidlGiven :1; + unsigned BSIM4V4wcgidlGiven :1; + unsigned BSIM4V4wegidlGiven :1; + unsigned BSIM4V4waigcGiven :1; + unsigned BSIM4V4wbigcGiven :1; + unsigned BSIM4V4wcigcGiven :1; + unsigned BSIM4V4waigsdGiven :1; + unsigned BSIM4V4wbigsdGiven :1; + unsigned BSIM4V4wcigsdGiven :1; + unsigned BSIM4V4waigbaccGiven :1; + unsigned BSIM4V4wbigbaccGiven :1; + unsigned BSIM4V4wcigbaccGiven :1; + unsigned BSIM4V4waigbinvGiven :1; + unsigned BSIM4V4wbigbinvGiven :1; + unsigned BSIM4V4wcigbinvGiven :1; + unsigned BSIM4V4wnigcGiven :1; + unsigned BSIM4V4wnigbinvGiven :1; + unsigned BSIM4V4wnigbaccGiven :1; + unsigned BSIM4V4wntoxGiven :1; + unsigned BSIM4V4weigbinvGiven :1; + unsigned BSIM4V4wpigcdGiven :1; + unsigned BSIM4V4wpoxedgeGiven :1; + unsigned BSIM4V4wxrcrg1Given :1; + unsigned BSIM4V4wxrcrg2Given :1; + unsigned BSIM4V4wlambdaGiven :1; + unsigned BSIM4V4wvtlGiven :1; + unsigned BSIM4V4wxnGiven :1; + unsigned BSIM4V4wvfbsdoffGiven :1; + + /* CV model */ + unsigned BSIM4V4wcgslGiven :1; + unsigned BSIM4V4wcgdlGiven :1; + unsigned BSIM4V4wckappasGiven :1; + unsigned BSIM4V4wckappadGiven :1; + unsigned BSIM4V4wcfGiven :1; + unsigned BSIM4V4wclcGiven :1; + unsigned BSIM4V4wcleGiven :1; + unsigned BSIM4V4wvfbcvGiven :1; + unsigned BSIM4V4wnoffGiven :1; + unsigned BSIM4V4wvoffcvGiven :1; + unsigned BSIM4V4wacdeGiven :1; + unsigned BSIM4V4wmoinGiven :1; + + /* Cross-term dependence */ + unsigned BSIM4V4pcdscGiven :1; + unsigned BSIM4V4pcdscbGiven :1; + unsigned BSIM4V4pcdscdGiven :1; + unsigned BSIM4V4pcitGiven :1; + unsigned BSIM4V4pnfactorGiven :1; + unsigned BSIM4V4pxjGiven :1; + unsigned BSIM4V4pvsatGiven :1; + unsigned BSIM4V4patGiven :1; + unsigned BSIM4V4pa0Given :1; + unsigned BSIM4V4pagsGiven :1; + unsigned BSIM4V4pa1Given :1; + unsigned BSIM4V4pa2Given :1; + unsigned BSIM4V4pketaGiven :1; + unsigned BSIM4V4pnsubGiven :1; + unsigned BSIM4V4pndepGiven :1; + unsigned BSIM4V4pnsdGiven :1; + unsigned BSIM4V4pphinGiven :1; + unsigned BSIM4V4pngateGiven :1; + unsigned BSIM4V4pgamma1Given :1; + unsigned BSIM4V4pgamma2Given :1; + unsigned BSIM4V4pvbxGiven :1; + unsigned BSIM4V4pvbmGiven :1; + unsigned BSIM4V4pxtGiven :1; + unsigned BSIM4V4pk1Given :1; + unsigned BSIM4V4pkt1Given :1; + unsigned BSIM4V4pkt1lGiven :1; + unsigned BSIM4V4pkt2Given :1; + unsigned BSIM4V4pk2Given :1; + unsigned BSIM4V4pk3Given :1; + unsigned BSIM4V4pk3bGiven :1; + unsigned BSIM4V4pw0Given :1; + unsigned BSIM4V4pdvtp0Given :1; + unsigned BSIM4V4pdvtp1Given :1; + unsigned BSIM4V4plpe0Given :1; + unsigned BSIM4V4plpebGiven :1; + unsigned BSIM4V4pdvt0Given :1; + unsigned BSIM4V4pdvt1Given :1; + unsigned BSIM4V4pdvt2Given :1; + unsigned BSIM4V4pdvt0wGiven :1; + unsigned BSIM4V4pdvt1wGiven :1; + unsigned BSIM4V4pdvt2wGiven :1; + unsigned BSIM4V4pdroutGiven :1; + unsigned BSIM4V4pdsubGiven :1; + unsigned BSIM4V4pvth0Given :1; + unsigned BSIM4V4puaGiven :1; + unsigned BSIM4V4pua1Given :1; + unsigned BSIM4V4pubGiven :1; + unsigned BSIM4V4pub1Given :1; + unsigned BSIM4V4pucGiven :1; + unsigned BSIM4V4puc1Given :1; + unsigned BSIM4V4pu0Given :1; + unsigned BSIM4V4peuGiven :1; + unsigned BSIM4V4puteGiven :1; + unsigned BSIM4V4pvoffGiven :1; + unsigned BSIM4V4pminvGiven :1; + unsigned BSIM4V4prdswGiven :1; + unsigned BSIM4V4prswGiven :1; + unsigned BSIM4V4prdwGiven :1; + unsigned BSIM4V4pprwgGiven :1; + unsigned BSIM4V4pprwbGiven :1; + unsigned BSIM4V4pprtGiven :1; + unsigned BSIM4V4peta0Given :1; + unsigned BSIM4V4petabGiven :1; + unsigned BSIM4V4ppclmGiven :1; + unsigned BSIM4V4ppdibl1Given :1; + unsigned BSIM4V4ppdibl2Given :1; + unsigned BSIM4V4ppdiblbGiven :1; + unsigned BSIM4V4pfproutGiven :1; + unsigned BSIM4V4ppditsGiven :1; + unsigned BSIM4V4ppditsdGiven :1; + unsigned BSIM4V4ppscbe1Given :1; + unsigned BSIM4V4ppscbe2Given :1; + unsigned BSIM4V4ppvagGiven :1; + unsigned BSIM4V4pdeltaGiven :1; + unsigned BSIM4V4pwrGiven :1; + unsigned BSIM4V4pdwgGiven :1; + unsigned BSIM4V4pdwbGiven :1; + unsigned BSIM4V4pb0Given :1; + unsigned BSIM4V4pb1Given :1; + unsigned BSIM4V4palpha0Given :1; + unsigned BSIM4V4palpha1Given :1; + unsigned BSIM4V4pbeta0Given :1; + unsigned BSIM4V4pvfbGiven :1; + unsigned BSIM4V4pagidlGiven :1; + unsigned BSIM4V4pbgidlGiven :1; + unsigned BSIM4V4pcgidlGiven :1; + unsigned BSIM4V4pegidlGiven :1; + unsigned BSIM4V4paigcGiven :1; + unsigned BSIM4V4pbigcGiven :1; + unsigned BSIM4V4pcigcGiven :1; + unsigned BSIM4V4paigsdGiven :1; + unsigned BSIM4V4pbigsdGiven :1; + unsigned BSIM4V4pcigsdGiven :1; + unsigned BSIM4V4paigbaccGiven :1; + unsigned BSIM4V4pbigbaccGiven :1; + unsigned BSIM4V4pcigbaccGiven :1; + unsigned BSIM4V4paigbinvGiven :1; + unsigned BSIM4V4pbigbinvGiven :1; + unsigned BSIM4V4pcigbinvGiven :1; + unsigned BSIM4V4pnigcGiven :1; + unsigned BSIM4V4pnigbinvGiven :1; + unsigned BSIM4V4pnigbaccGiven :1; + unsigned BSIM4V4pntoxGiven :1; + unsigned BSIM4V4peigbinvGiven :1; + unsigned BSIM4V4ppigcdGiven :1; + unsigned BSIM4V4ppoxedgeGiven :1; + unsigned BSIM4V4pxrcrg1Given :1; + unsigned BSIM4V4pxrcrg2Given :1; + unsigned BSIM4V4plambdaGiven :1; + unsigned BSIM4V4pvtlGiven :1; + unsigned BSIM4V4pxnGiven :1; + unsigned BSIM4V4pvfbsdoffGiven :1; + + /* CV model */ + unsigned BSIM4V4pcgslGiven :1; + unsigned BSIM4V4pcgdlGiven :1; + unsigned BSIM4V4pckappasGiven :1; + unsigned BSIM4V4pckappadGiven :1; + unsigned BSIM4V4pcfGiven :1; + unsigned BSIM4V4pclcGiven :1; + unsigned BSIM4V4pcleGiven :1; + unsigned BSIM4V4pvfbcvGiven :1; + unsigned BSIM4V4pnoffGiven :1; + unsigned BSIM4V4pvoffcvGiven :1; + unsigned BSIM4V4pacdeGiven :1; + unsigned BSIM4V4pmoinGiven :1; + + unsigned BSIM4V4useFringeGiven :1; + + unsigned BSIM4V4tnomGiven :1; + unsigned BSIM4V4cgsoGiven :1; + unsigned BSIM4V4cgdoGiven :1; + unsigned BSIM4V4cgboGiven :1; + unsigned BSIM4V4xpartGiven :1; + unsigned BSIM4V4sheetResistanceGiven :1; + + unsigned BSIM4V4SjctSatCurDensityGiven :1; + unsigned BSIM4V4SjctSidewallSatCurDensityGiven :1; + unsigned BSIM4V4SjctGateSidewallSatCurDensityGiven :1; + unsigned BSIM4V4SbulkJctPotentialGiven :1; + unsigned BSIM4V4SbulkJctBotGradingCoeffGiven :1; + unsigned BSIM4V4SsidewallJctPotentialGiven :1; + unsigned BSIM4V4SGatesidewallJctPotentialGiven :1; + unsigned BSIM4V4SbulkJctSideGradingCoeffGiven :1; + unsigned BSIM4V4SunitAreaJctCapGiven :1; + unsigned BSIM4V4SunitLengthSidewallJctCapGiven :1; + unsigned BSIM4V4SbulkJctGateSideGradingCoeffGiven :1; + unsigned BSIM4V4SunitLengthGateSidewallJctCapGiven :1; + unsigned BSIM4V4SjctEmissionCoeffGiven :1; + unsigned BSIM4V4SjctTempExponentGiven :1; + + unsigned BSIM4V4DjctSatCurDensityGiven :1; + unsigned BSIM4V4DjctSidewallSatCurDensityGiven :1; + unsigned BSIM4V4DjctGateSidewallSatCurDensityGiven :1; + unsigned BSIM4V4DbulkJctPotentialGiven :1; + unsigned BSIM4V4DbulkJctBotGradingCoeffGiven :1; + unsigned BSIM4V4DsidewallJctPotentialGiven :1; + unsigned BSIM4V4DGatesidewallJctPotentialGiven :1; + unsigned BSIM4V4DbulkJctSideGradingCoeffGiven :1; + unsigned BSIM4V4DunitAreaJctCapGiven :1; + unsigned BSIM4V4DunitLengthSidewallJctCapGiven :1; + unsigned BSIM4V4DbulkJctGateSideGradingCoeffGiven :1; + unsigned BSIM4V4DunitLengthGateSidewallJctCapGiven :1; + unsigned BSIM4V4DjctEmissionCoeffGiven :1; + unsigned BSIM4V4DjctTempExponentGiven :1; + + unsigned BSIM4V4oxideTrapDensityAGiven :1; + unsigned BSIM4V4oxideTrapDensityBGiven :1; + unsigned BSIM4V4oxideTrapDensityCGiven :1; + unsigned BSIM4V4emGiven :1; + unsigned BSIM4V4efGiven :1; + unsigned BSIM4V4afGiven :1; + unsigned BSIM4V4kfGiven :1; + + unsigned BSIM4V4LintGiven :1; + unsigned BSIM4V4LlGiven :1; + unsigned BSIM4V4LlcGiven :1; + unsigned BSIM4V4LlnGiven :1; + unsigned BSIM4V4LwGiven :1; + unsigned BSIM4V4LwcGiven :1; + unsigned BSIM4V4LwnGiven :1; + unsigned BSIM4V4LwlGiven :1; + unsigned BSIM4V4LwlcGiven :1; + unsigned BSIM4V4LminGiven :1; + unsigned BSIM4V4LmaxGiven :1; + + unsigned BSIM4V4WintGiven :1; + unsigned BSIM4V4WlGiven :1; + unsigned BSIM4V4WlcGiven :1; + unsigned BSIM4V4WlnGiven :1; + unsigned BSIM4V4WwGiven :1; + unsigned BSIM4V4WwcGiven :1; + unsigned BSIM4V4WwnGiven :1; + unsigned BSIM4V4WwlGiven :1; + unsigned BSIM4V4WwlcGiven :1; + unsigned BSIM4V4WminGiven :1; + unsigned BSIM4V4WmaxGiven :1; + + /* added for stress effect */ + unsigned BSIM4V4sarefGiven :1; + unsigned BSIM4V4sbrefGiven :1; + unsigned BSIM4V4wlodGiven :1; + unsigned BSIM4V4ku0Given :1; + unsigned BSIM4V4kvsatGiven :1; + unsigned BSIM4V4kvth0Given :1; + unsigned BSIM4V4tku0Given :1; + unsigned BSIM4V4llodku0Given :1; + unsigned BSIM4V4wlodku0Given :1; + unsigned BSIM4V4llodvthGiven :1; + unsigned BSIM4V4wlodvthGiven :1; + unsigned BSIM4V4lku0Given :1; + unsigned BSIM4V4wku0Given :1; + unsigned BSIM4V4pku0Given :1; + unsigned BSIM4V4lkvth0Given :1; + unsigned BSIM4V4wkvth0Given :1; + unsigned BSIM4V4pkvth0Given :1; + unsigned BSIM4V4stk2Given :1; + unsigned BSIM4V4lodk2Given :1; + unsigned BSIM4V4steta0Given :1; + unsigned BSIM4V4lodeta0Given :1; + + +} BSIM4V4model; + + +#ifndef NMOS +#define NMOS 1 +#define PMOS -1 +#endif /*NMOS*/ + + +/* Instance parameters */ +#define BSIM4V4_W 1 +#define BSIM4V4_L 2 +#define BSIM4V4_AS 3 +#define BSIM4V4_AD 4 +#define BSIM4V4_PS 5 +#define BSIM4V4_PD 6 +#define BSIM4V4_NRS 7 +#define BSIM4V4_NRD 8 +#define BSIM4V4_OFF 9 +#define BSIM4V4_IC 10 +#define BSIM4V4_IC_VDS 11 +#define BSIM4V4_IC_VGS 12 +#define BSIM4V4_IC_VBS 13 +#define BSIM4V4_TRNQSMOD 14 +#define BSIM4V4_RBODYMOD 15 +#define BSIM4V4_RGATEMOD 16 +#define BSIM4V4_GEOMOD 17 +#define BSIM4V4_RGEOMOD 18 +#define BSIM4V4_NF 19 +#define BSIM4V4_MIN 20 +#define BSIM4V4_ACNQSMOD 22 +#define BSIM4V4_RBDB 23 +#define BSIM4V4_RBSB 24 +#define BSIM4V4_RBPB 25 +#define BSIM4V4_RBPS 26 +#define BSIM4V4_RBPD 27 +#define BSIM4V4_SA 28 +#define BSIM4V4_SB 29 +#define BSIM4V4_SD 30 +#define BSIM4V4_M 31 + +/* Global parameters */ +#define BSIM4V4_MOD_TEMPMOD 89 +#define BSIM4V4_MOD_IGCMOD 90 +#define BSIM4V4_MOD_IGBMOD 91 +#define BSIM4V4_MOD_ACNQSMOD 92 +#define BSIM4V4_MOD_FNOIMOD 93 +#define BSIM4V4_MOD_RDSMOD 94 +#define BSIM4V4_MOD_DIOMOD 96 +#define BSIM4V4_MOD_PERMOD 97 +#define BSIM4V4_MOD_GEOMOD 98 +#define BSIM4V4_MOD_RGATEMOD 99 +#define BSIM4V4_MOD_RBODYMOD 100 +#define BSIM4V4_MOD_CAPMOD 101 +#define BSIM4V4_MOD_TRNQSMOD 102 +#define BSIM4V4_MOD_MOBMOD 103 +#define BSIM4V4_MOD_TNOIMOD 104 +#define BSIM4V4_MOD_TOXE 105 +#define BSIM4V4_MOD_CDSC 106 +#define BSIM4V4_MOD_CDSCB 107 +#define BSIM4V4_MOD_CIT 108 +#define BSIM4V4_MOD_NFACTOR 109 +#define BSIM4V4_MOD_XJ 110 +#define BSIM4V4_MOD_VSAT 111 +#define BSIM4V4_MOD_AT 112 +#define BSIM4V4_MOD_A0 113 +#define BSIM4V4_MOD_A1 114 +#define BSIM4V4_MOD_A2 115 +#define BSIM4V4_MOD_KETA 116 +#define BSIM4V4_MOD_NSUB 117 +#define BSIM4V4_MOD_NDEP 118 +#define BSIM4V4_MOD_NGATE 120 +#define BSIM4V4_MOD_GAMMA1 121 +#define BSIM4V4_MOD_GAMMA2 122 +#define BSIM4V4_MOD_VBX 123 +#define BSIM4V4_MOD_BINUNIT 124 +#define BSIM4V4_MOD_VBM 125 +#define BSIM4V4_MOD_XT 126 +#define BSIM4V4_MOD_K1 129 +#define BSIM4V4_MOD_KT1 130 +#define BSIM4V4_MOD_KT1L 131 +#define BSIM4V4_MOD_K2 132 +#define BSIM4V4_MOD_KT2 133 +#define BSIM4V4_MOD_K3 134 +#define BSIM4V4_MOD_K3B 135 +#define BSIM4V4_MOD_W0 136 +#define BSIM4V4_MOD_LPE0 137 +#define BSIM4V4_MOD_DVT0 138 +#define BSIM4V4_MOD_DVT1 139 +#define BSIM4V4_MOD_DVT2 140 +#define BSIM4V4_MOD_DVT0W 141 +#define BSIM4V4_MOD_DVT1W 142 +#define BSIM4V4_MOD_DVT2W 143 +#define BSIM4V4_MOD_DROUT 144 +#define BSIM4V4_MOD_DSUB 145 +#define BSIM4V4_MOD_VTH0 146 +#define BSIM4V4_MOD_UA 147 +#define BSIM4V4_MOD_UA1 148 +#define BSIM4V4_MOD_UB 149 +#define BSIM4V4_MOD_UB1 150 +#define BSIM4V4_MOD_UC 151 +#define BSIM4V4_MOD_UC1 152 +#define BSIM4V4_MOD_U0 153 +#define BSIM4V4_MOD_UTE 154 +#define BSIM4V4_MOD_VOFF 155 +#define BSIM4V4_MOD_DELTA 156 +#define BSIM4V4_MOD_RDSW 157 +#define BSIM4V4_MOD_PRT 158 +#define BSIM4V4_MOD_LDD 159 +#define BSIM4V4_MOD_ETA 160 +#define BSIM4V4_MOD_ETA0 161 +#define BSIM4V4_MOD_ETAB 162 +#define BSIM4V4_MOD_PCLM 163 +#define BSIM4V4_MOD_PDIBL1 164 +#define BSIM4V4_MOD_PDIBL2 165 +#define BSIM4V4_MOD_PSCBE1 166 +#define BSIM4V4_MOD_PSCBE2 167 +#define BSIM4V4_MOD_PVAG 168 +#define BSIM4V4_MOD_WR 169 +#define BSIM4V4_MOD_DWG 170 +#define BSIM4V4_MOD_DWB 171 +#define BSIM4V4_MOD_B0 172 +#define BSIM4V4_MOD_B1 173 +#define BSIM4V4_MOD_ALPHA0 174 +#define BSIM4V4_MOD_BETA0 175 +#define BSIM4V4_MOD_PDIBLB 178 +#define BSIM4V4_MOD_PRWG 179 +#define BSIM4V4_MOD_PRWB 180 +#define BSIM4V4_MOD_CDSCD 181 +#define BSIM4V4_MOD_AGS 182 +#define BSIM4V4_MOD_FRINGE 184 +#define BSIM4V4_MOD_CGSL 186 +#define BSIM4V4_MOD_CGDL 187 +#define BSIM4V4_MOD_CKAPPAS 188 +#define BSIM4V4_MOD_CF 189 +#define BSIM4V4_MOD_CLC 190 +#define BSIM4V4_MOD_CLE 191 +#define BSIM4V4_MOD_PARAMCHK 192 +#define BSIM4V4_MOD_VERSION 193 +#define BSIM4V4_MOD_VFBCV 194 +#define BSIM4V4_MOD_ACDE 195 +#define BSIM4V4_MOD_MOIN 196 +#define BSIM4V4_MOD_NOFF 197 +#define BSIM4V4_MOD_IJTHDFWD 198 +#define BSIM4V4_MOD_ALPHA1 199 +#define BSIM4V4_MOD_VFB 200 +#define BSIM4V4_MOD_TOXM 201 +#define BSIM4V4_MOD_TCJ 202 +#define BSIM4V4_MOD_TCJSW 203 +#define BSIM4V4_MOD_TCJSWG 204 +#define BSIM4V4_MOD_TPB 205 +#define BSIM4V4_MOD_TPBSW 206 +#define BSIM4V4_MOD_TPBSWG 207 +#define BSIM4V4_MOD_VOFFCV 208 +#define BSIM4V4_MOD_GBMIN 209 +#define BSIM4V4_MOD_RBDB 210 +#define BSIM4V4_MOD_RBSB 211 +#define BSIM4V4_MOD_RBPB 212 +#define BSIM4V4_MOD_RBPS 213 +#define BSIM4V4_MOD_RBPD 214 +#define BSIM4V4_MOD_DMCG 215 +#define BSIM4V4_MOD_DMCI 216 +#define BSIM4V4_MOD_DMDG 217 +#define BSIM4V4_MOD_XGW 218 +#define BSIM4V4_MOD_XGL 219 +#define BSIM4V4_MOD_RSHG 220 +#define BSIM4V4_MOD_NGCON 221 +#define BSIM4V4_MOD_AGIDL 222 +#define BSIM4V4_MOD_BGIDL 223 +#define BSIM4V4_MOD_EGIDL 224 +#define BSIM4V4_MOD_IJTHSFWD 225 +#define BSIM4V4_MOD_XJBVD 226 +#define BSIM4V4_MOD_XJBVS 227 +#define BSIM4V4_MOD_BVD 228 +#define BSIM4V4_MOD_BVS 229 +#define BSIM4V4_MOD_TOXP 230 +#define BSIM4V4_MOD_DTOX 231 +#define BSIM4V4_MOD_XRCRG1 232 +#define BSIM4V4_MOD_XRCRG2 233 +#define BSIM4V4_MOD_EU 234 +#define BSIM4V4_MOD_IJTHSREV 235 +#define BSIM4V4_MOD_IJTHDREV 236 +#define BSIM4V4_MOD_MINV 237 +#define BSIM4V4_MOD_VOFFL 238 +#define BSIM4V4_MOD_PDITS 239 +#define BSIM4V4_MOD_PDITSD 240 +#define BSIM4V4_MOD_PDITSL 241 +#define BSIM4V4_MOD_TNOIA 242 +#define BSIM4V4_MOD_TNOIB 243 +#define BSIM4V4_MOD_NTNOI 244 +#define BSIM4V4_MOD_FPROUT 245 +#define BSIM4V4_MOD_LPEB 246 +#define BSIM4V4_MOD_DVTP0 247 +#define BSIM4V4_MOD_DVTP1 248 +#define BSIM4V4_MOD_CGIDL 249 +#define BSIM4V4_MOD_PHIN 250 +#define BSIM4V4_MOD_RDSWMIN 251 +#define BSIM4V4_MOD_RSW 252 +#define BSIM4V4_MOD_RDW 253 +#define BSIM4V4_MOD_RDWMIN 254 +#define BSIM4V4_MOD_RSWMIN 255 +#define BSIM4V4_MOD_NSD 256 +#define BSIM4V4_MOD_CKAPPAD 257 +#define BSIM4V4_MOD_DMCGT 258 +#define BSIM4V4_MOD_AIGC 259 +#define BSIM4V4_MOD_BIGC 260 +#define BSIM4V4_MOD_CIGC 261 +#define BSIM4V4_MOD_AIGBACC 262 +#define BSIM4V4_MOD_BIGBACC 263 +#define BSIM4V4_MOD_CIGBACC 264 +#define BSIM4V4_MOD_AIGBINV 265 +#define BSIM4V4_MOD_BIGBINV 266 +#define BSIM4V4_MOD_CIGBINV 267 +#define BSIM4V4_MOD_NIGC 268 +#define BSIM4V4_MOD_NIGBACC 269 +#define BSIM4V4_MOD_NIGBINV 270 +#define BSIM4V4_MOD_NTOX 271 +#define BSIM4V4_MOD_TOXREF 272 +#define BSIM4V4_MOD_EIGBINV 273 +#define BSIM4V4_MOD_PIGCD 274 +#define BSIM4V4_MOD_POXEDGE 275 +#define BSIM4V4_MOD_EPSROX 276 +#define BSIM4V4_MOD_AIGSD 277 +#define BSIM4V4_MOD_BIGSD 278 +#define BSIM4V4_MOD_CIGSD 279 +#define BSIM4V4_MOD_JSWGS 280 +#define BSIM4V4_MOD_JSWGD 281 +#define BSIM4V4_MOD_LAMBDA 282 +#define BSIM4V4_MOD_VTL 283 +#define BSIM4V4_MOD_LC 284 +#define BSIM4V4_MOD_XN 285 +#define BSIM4V4_MOD_RNOIA 286 +#define BSIM4V4_MOD_RNOIB 287 +#define BSIM4V4_MOD_VFBSDOFF 288 +#define BSIM4V4_MOD_LINTNOI 289 + +/* Length dependence */ +#define BSIM4V4_MOD_LCDSC 301 +#define BSIM4V4_MOD_LCDSCB 302 +#define BSIM4V4_MOD_LCIT 303 +#define BSIM4V4_MOD_LNFACTOR 304 +#define BSIM4V4_MOD_LXJ 305 +#define BSIM4V4_MOD_LVSAT 306 +#define BSIM4V4_MOD_LAT 307 +#define BSIM4V4_MOD_LA0 308 +#define BSIM4V4_MOD_LA1 309 +#define BSIM4V4_MOD_LA2 310 +#define BSIM4V4_MOD_LKETA 311 +#define BSIM4V4_MOD_LNSUB 312 +#define BSIM4V4_MOD_LNDEP 313 +#define BSIM4V4_MOD_LNGATE 315 +#define BSIM4V4_MOD_LGAMMA1 316 +#define BSIM4V4_MOD_LGAMMA2 317 +#define BSIM4V4_MOD_LVBX 318 +#define BSIM4V4_MOD_LVBM 320 +#define BSIM4V4_MOD_LXT 322 +#define BSIM4V4_MOD_LK1 325 +#define BSIM4V4_MOD_LKT1 326 +#define BSIM4V4_MOD_LKT1L 327 +#define BSIM4V4_MOD_LK2 328 +#define BSIM4V4_MOD_LKT2 329 +#define BSIM4V4_MOD_LK3 330 +#define BSIM4V4_MOD_LK3B 331 +#define BSIM4V4_MOD_LW0 332 +#define BSIM4V4_MOD_LLPE0 333 +#define BSIM4V4_MOD_LDVT0 334 +#define BSIM4V4_MOD_LDVT1 335 +#define BSIM4V4_MOD_LDVT2 336 +#define BSIM4V4_MOD_LDVT0W 337 +#define BSIM4V4_MOD_LDVT1W 338 +#define BSIM4V4_MOD_LDVT2W 339 +#define BSIM4V4_MOD_LDROUT 340 +#define BSIM4V4_MOD_LDSUB 341 +#define BSIM4V4_MOD_LVTH0 342 +#define BSIM4V4_MOD_LUA 343 +#define BSIM4V4_MOD_LUA1 344 +#define BSIM4V4_MOD_LUB 345 +#define BSIM4V4_MOD_LUB1 346 +#define BSIM4V4_MOD_LUC 347 +#define BSIM4V4_MOD_LUC1 348 +#define BSIM4V4_MOD_LU0 349 +#define BSIM4V4_MOD_LUTE 350 +#define BSIM4V4_MOD_LVOFF 351 +#define BSIM4V4_MOD_LDELTA 352 +#define BSIM4V4_MOD_LRDSW 353 +#define BSIM4V4_MOD_LPRT 354 +#define BSIM4V4_MOD_LLDD 355 +#define BSIM4V4_MOD_LETA 356 +#define BSIM4V4_MOD_LETA0 357 +#define BSIM4V4_MOD_LETAB 358 +#define BSIM4V4_MOD_LPCLM 359 +#define BSIM4V4_MOD_LPDIBL1 360 +#define BSIM4V4_MOD_LPDIBL2 361 +#define BSIM4V4_MOD_LPSCBE1 362 +#define BSIM4V4_MOD_LPSCBE2 363 +#define BSIM4V4_MOD_LPVAG 364 +#define BSIM4V4_MOD_LWR 365 +#define BSIM4V4_MOD_LDWG 366 +#define BSIM4V4_MOD_LDWB 367 +#define BSIM4V4_MOD_LB0 368 +#define BSIM4V4_MOD_LB1 369 +#define BSIM4V4_MOD_LALPHA0 370 +#define BSIM4V4_MOD_LBETA0 371 +#define BSIM4V4_MOD_LPDIBLB 374 +#define BSIM4V4_MOD_LPRWG 375 +#define BSIM4V4_MOD_LPRWB 376 +#define BSIM4V4_MOD_LCDSCD 377 +#define BSIM4V4_MOD_LAGS 378 + +#define BSIM4V4_MOD_LFRINGE 381 +#define BSIM4V4_MOD_LCGSL 383 +#define BSIM4V4_MOD_LCGDL 384 +#define BSIM4V4_MOD_LCKAPPAS 385 +#define BSIM4V4_MOD_LCF 386 +#define BSIM4V4_MOD_LCLC 387 +#define BSIM4V4_MOD_LCLE 388 +#define BSIM4V4_MOD_LVFBCV 389 +#define BSIM4V4_MOD_LACDE 390 +#define BSIM4V4_MOD_LMOIN 391 +#define BSIM4V4_MOD_LNOFF 392 +#define BSIM4V4_MOD_LALPHA1 394 +#define BSIM4V4_MOD_LVFB 395 +#define BSIM4V4_MOD_LVOFFCV 396 +#define BSIM4V4_MOD_LAGIDL 397 +#define BSIM4V4_MOD_LBGIDL 398 +#define BSIM4V4_MOD_LEGIDL 399 +#define BSIM4V4_MOD_LXRCRG1 400 +#define BSIM4V4_MOD_LXRCRG2 401 +#define BSIM4V4_MOD_LEU 402 +#define BSIM4V4_MOD_LMINV 403 +#define BSIM4V4_MOD_LPDITS 404 +#define BSIM4V4_MOD_LPDITSD 405 +#define BSIM4V4_MOD_LFPROUT 406 +#define BSIM4V4_MOD_LLPEB 407 +#define BSIM4V4_MOD_LDVTP0 408 +#define BSIM4V4_MOD_LDVTP1 409 +#define BSIM4V4_MOD_LCGIDL 410 +#define BSIM4V4_MOD_LPHIN 411 +#define BSIM4V4_MOD_LRSW 412 +#define BSIM4V4_MOD_LRDW 413 +#define BSIM4V4_MOD_LNSD 414 +#define BSIM4V4_MOD_LCKAPPAD 415 +#define BSIM4V4_MOD_LAIGC 416 +#define BSIM4V4_MOD_LBIGC 417 +#define BSIM4V4_MOD_LCIGC 418 +#define BSIM4V4_MOD_LAIGBACC 419 +#define BSIM4V4_MOD_LBIGBACC 420 +#define BSIM4V4_MOD_LCIGBACC 421 +#define BSIM4V4_MOD_LAIGBINV 422 +#define BSIM4V4_MOD_LBIGBINV 423 +#define BSIM4V4_MOD_LCIGBINV 424 +#define BSIM4V4_MOD_LNIGC 425 +#define BSIM4V4_MOD_LNIGBACC 426 +#define BSIM4V4_MOD_LNIGBINV 427 +#define BSIM4V4_MOD_LNTOX 428 +#define BSIM4V4_MOD_LEIGBINV 429 +#define BSIM4V4_MOD_LPIGCD 430 +#define BSIM4V4_MOD_LPOXEDGE 431 +#define BSIM4V4_MOD_LAIGSD 432 +#define BSIM4V4_MOD_LBIGSD 433 +#define BSIM4V4_MOD_LCIGSD 434 + +#define BSIM4V4_MOD_LLAMBDA 435 +#define BSIM4V4_MOD_LVTL 436 +#define BSIM4V4_MOD_LXN 437 +#define BSIM4V4_MOD_LVFBSDOFF 438 + +/* Width dependence */ +#define BSIM4V4_MOD_WCDSC 481 +#define BSIM4V4_MOD_WCDSCB 482 +#define BSIM4V4_MOD_WCIT 483 +#define BSIM4V4_MOD_WNFACTOR 484 +#define BSIM4V4_MOD_WXJ 485 +#define BSIM4V4_MOD_WVSAT 486 +#define BSIM4V4_MOD_WAT 487 +#define BSIM4V4_MOD_WA0 488 +#define BSIM4V4_MOD_WA1 489 +#define BSIM4V4_MOD_WA2 490 +#define BSIM4V4_MOD_WKETA 491 +#define BSIM4V4_MOD_WNSUB 492 +#define BSIM4V4_MOD_WNDEP 493 +#define BSIM4V4_MOD_WNGATE 495 +#define BSIM4V4_MOD_WGAMMA1 496 +#define BSIM4V4_MOD_WGAMMA2 497 +#define BSIM4V4_MOD_WVBX 498 +#define BSIM4V4_MOD_WVBM 500 +#define BSIM4V4_MOD_WXT 502 +#define BSIM4V4_MOD_WK1 505 +#define BSIM4V4_MOD_WKT1 506 +#define BSIM4V4_MOD_WKT1L 507 +#define BSIM4V4_MOD_WK2 508 +#define BSIM4V4_MOD_WKT2 509 +#define BSIM4V4_MOD_WK3 510 +#define BSIM4V4_MOD_WK3B 511 +#define BSIM4V4_MOD_WW0 512 +#define BSIM4V4_MOD_WLPE0 513 +#define BSIM4V4_MOD_WDVT0 514 +#define BSIM4V4_MOD_WDVT1 515 +#define BSIM4V4_MOD_WDVT2 516 +#define BSIM4V4_MOD_WDVT0W 517 +#define BSIM4V4_MOD_WDVT1W 518 +#define BSIM4V4_MOD_WDVT2W 519 +#define BSIM4V4_MOD_WDROUT 520 +#define BSIM4V4_MOD_WDSUB 521 +#define BSIM4V4_MOD_WVTH0 522 +#define BSIM4V4_MOD_WUA 523 +#define BSIM4V4_MOD_WUA1 524 +#define BSIM4V4_MOD_WUB 525 +#define BSIM4V4_MOD_WUB1 526 +#define BSIM4V4_MOD_WUC 527 +#define BSIM4V4_MOD_WUC1 528 +#define BSIM4V4_MOD_WU0 529 +#define BSIM4V4_MOD_WUTE 530 +#define BSIM4V4_MOD_WVOFF 531 +#define BSIM4V4_MOD_WDELTA 532 +#define BSIM4V4_MOD_WRDSW 533 +#define BSIM4V4_MOD_WPRT 534 +#define BSIM4V4_MOD_WLDD 535 +#define BSIM4V4_MOD_WETA 536 +#define BSIM4V4_MOD_WETA0 537 +#define BSIM4V4_MOD_WETAB 538 +#define BSIM4V4_MOD_WPCLM 539 +#define BSIM4V4_MOD_WPDIBL1 540 +#define BSIM4V4_MOD_WPDIBL2 541 +#define BSIM4V4_MOD_WPSCBE1 542 +#define BSIM4V4_MOD_WPSCBE2 543 +#define BSIM4V4_MOD_WPVAG 544 +#define BSIM4V4_MOD_WWR 545 +#define BSIM4V4_MOD_WDWG 546 +#define BSIM4V4_MOD_WDWB 547 +#define BSIM4V4_MOD_WB0 548 +#define BSIM4V4_MOD_WB1 549 +#define BSIM4V4_MOD_WALPHA0 550 +#define BSIM4V4_MOD_WBETA0 551 +#define BSIM4V4_MOD_WPDIBLB 554 +#define BSIM4V4_MOD_WPRWG 555 +#define BSIM4V4_MOD_WPRWB 556 +#define BSIM4V4_MOD_WCDSCD 557 +#define BSIM4V4_MOD_WAGS 558 + +#define BSIM4V4_MOD_WFRINGE 561 +#define BSIM4V4_MOD_WCGSL 563 +#define BSIM4V4_MOD_WCGDL 564 +#define BSIM4V4_MOD_WCKAPPAS 565 +#define BSIM4V4_MOD_WCF 566 +#define BSIM4V4_MOD_WCLC 567 +#define BSIM4V4_MOD_WCLE 568 +#define BSIM4V4_MOD_WVFBCV 569 +#define BSIM4V4_MOD_WACDE 570 +#define BSIM4V4_MOD_WMOIN 571 +#define BSIM4V4_MOD_WNOFF 572 +#define BSIM4V4_MOD_WALPHA1 574 +#define BSIM4V4_MOD_WVFB 575 +#define BSIM4V4_MOD_WVOFFCV 576 +#define BSIM4V4_MOD_WAGIDL 577 +#define BSIM4V4_MOD_WBGIDL 578 +#define BSIM4V4_MOD_WEGIDL 579 +#define BSIM4V4_MOD_WXRCRG1 580 +#define BSIM4V4_MOD_WXRCRG2 581 +#define BSIM4V4_MOD_WEU 582 +#define BSIM4V4_MOD_WMINV 583 +#define BSIM4V4_MOD_WPDITS 584 +#define BSIM4V4_MOD_WPDITSD 585 +#define BSIM4V4_MOD_WFPROUT 586 +#define BSIM4V4_MOD_WLPEB 587 +#define BSIM4V4_MOD_WDVTP0 588 +#define BSIM4V4_MOD_WDVTP1 589 +#define BSIM4V4_MOD_WCGIDL 590 +#define BSIM4V4_MOD_WPHIN 591 +#define BSIM4V4_MOD_WRSW 592 +#define BSIM4V4_MOD_WRDW 593 +#define BSIM4V4_MOD_WNSD 594 +#define BSIM4V4_MOD_WCKAPPAD 595 +#define BSIM4V4_MOD_WAIGC 596 +#define BSIM4V4_MOD_WBIGC 597 +#define BSIM4V4_MOD_WCIGC 598 +#define BSIM4V4_MOD_WAIGBACC 599 +#define BSIM4V4_MOD_WBIGBACC 600 +#define BSIM4V4_MOD_WCIGBACC 601 +#define BSIM4V4_MOD_WAIGBINV 602 +#define BSIM4V4_MOD_WBIGBINV 603 +#define BSIM4V4_MOD_WCIGBINV 604 +#define BSIM4V4_MOD_WNIGC 605 +#define BSIM4V4_MOD_WNIGBACC 606 +#define BSIM4V4_MOD_WNIGBINV 607 +#define BSIM4V4_MOD_WNTOX 608 +#define BSIM4V4_MOD_WEIGBINV 609 +#define BSIM4V4_MOD_WPIGCD 610 +#define BSIM4V4_MOD_WPOXEDGE 611 +#define BSIM4V4_MOD_WAIGSD 612 +#define BSIM4V4_MOD_WBIGSD 613 +#define BSIM4V4_MOD_WCIGSD 614 +#define BSIM4V4_MOD_WLAMBDA 615 +#define BSIM4V4_MOD_WVTL 616 +#define BSIM4V4_MOD_WXN 617 +#define BSIM4V4_MOD_WVFBSDOFF 618 + +/* Cross-term dependence */ +#define BSIM4V4_MOD_PCDSC 661 +#define BSIM4V4_MOD_PCDSCB 662 +#define BSIM4V4_MOD_PCIT 663 +#define BSIM4V4_MOD_PNFACTOR 664 +#define BSIM4V4_MOD_PXJ 665 +#define BSIM4V4_MOD_PVSAT 666 +#define BSIM4V4_MOD_PAT 667 +#define BSIM4V4_MOD_PA0 668 +#define BSIM4V4_MOD_PA1 669 +#define BSIM4V4_MOD_PA2 670 +#define BSIM4V4_MOD_PKETA 671 +#define BSIM4V4_MOD_PNSUB 672 +#define BSIM4V4_MOD_PNDEP 673 +#define BSIM4V4_MOD_PNGATE 675 +#define BSIM4V4_MOD_PGAMMA1 676 +#define BSIM4V4_MOD_PGAMMA2 677 +#define BSIM4V4_MOD_PVBX 678 + +#define BSIM4V4_MOD_PVBM 680 + +#define BSIM4V4_MOD_PXT 682 +#define BSIM4V4_MOD_PK1 685 +#define BSIM4V4_MOD_PKT1 686 +#define BSIM4V4_MOD_PKT1L 687 +#define BSIM4V4_MOD_PK2 688 +#define BSIM4V4_MOD_PKT2 689 +#define BSIM4V4_MOD_PK3 690 +#define BSIM4V4_MOD_PK3B 691 +#define BSIM4V4_MOD_PW0 692 +#define BSIM4V4_MOD_PLPE0 693 + +#define BSIM4V4_MOD_PDVT0 694 +#define BSIM4V4_MOD_PDVT1 695 +#define BSIM4V4_MOD_PDVT2 696 + +#define BSIM4V4_MOD_PDVT0W 697 +#define BSIM4V4_MOD_PDVT1W 698 +#define BSIM4V4_MOD_PDVT2W 699 + +#define BSIM4V4_MOD_PDROUT 700 +#define BSIM4V4_MOD_PDSUB 701 +#define BSIM4V4_MOD_PVTH0 702 +#define BSIM4V4_MOD_PUA 703 +#define BSIM4V4_MOD_PUA1 704 +#define BSIM4V4_MOD_PUB 705 +#define BSIM4V4_MOD_PUB1 706 +#define BSIM4V4_MOD_PUC 707 +#define BSIM4V4_MOD_PUC1 708 +#define BSIM4V4_MOD_PU0 709 +#define BSIM4V4_MOD_PUTE 710 +#define BSIM4V4_MOD_PVOFF 711 +#define BSIM4V4_MOD_PDELTA 712 +#define BSIM4V4_MOD_PRDSW 713 +#define BSIM4V4_MOD_PPRT 714 +#define BSIM4V4_MOD_PLDD 715 +#define BSIM4V4_MOD_PETA 716 +#define BSIM4V4_MOD_PETA0 717 +#define BSIM4V4_MOD_PETAB 718 +#define BSIM4V4_MOD_PPCLM 719 +#define BSIM4V4_MOD_PPDIBL1 720 +#define BSIM4V4_MOD_PPDIBL2 721 +#define BSIM4V4_MOD_PPSCBE1 722 +#define BSIM4V4_MOD_PPSCBE2 723 +#define BSIM4V4_MOD_PPVAG 724 +#define BSIM4V4_MOD_PWR 725 +#define BSIM4V4_MOD_PDWG 726 +#define BSIM4V4_MOD_PDWB 727 +#define BSIM4V4_MOD_PB0 728 +#define BSIM4V4_MOD_PB1 729 +#define BSIM4V4_MOD_PALPHA0 730 +#define BSIM4V4_MOD_PBETA0 731 +#define BSIM4V4_MOD_PPDIBLB 734 + +#define BSIM4V4_MOD_PPRWG 735 +#define BSIM4V4_MOD_PPRWB 736 + +#define BSIM4V4_MOD_PCDSCD 737 +#define BSIM4V4_MOD_PAGS 738 + +#define BSIM4V4_MOD_PFRINGE 741 +#define BSIM4V4_MOD_PCGSL 743 +#define BSIM4V4_MOD_PCGDL 744 +#define BSIM4V4_MOD_PCKAPPAS 745 +#define BSIM4V4_MOD_PCF 746 +#define BSIM4V4_MOD_PCLC 747 +#define BSIM4V4_MOD_PCLE 748 +#define BSIM4V4_MOD_PVFBCV 749 +#define BSIM4V4_MOD_PACDE 750 +#define BSIM4V4_MOD_PMOIN 751 +#define BSIM4V4_MOD_PNOFF 752 +#define BSIM4V4_MOD_PALPHA1 754 +#define BSIM4V4_MOD_PVFB 755 +#define BSIM4V4_MOD_PVOFFCV 756 +#define BSIM4V4_MOD_PAGIDL 757 +#define BSIM4V4_MOD_PBGIDL 758 +#define BSIM4V4_MOD_PEGIDL 759 +#define BSIM4V4_MOD_PXRCRG1 760 +#define BSIM4V4_MOD_PXRCRG2 761 +#define BSIM4V4_MOD_PEU 762 +#define BSIM4V4_MOD_PMINV 763 +#define BSIM4V4_MOD_PPDITS 764 +#define BSIM4V4_MOD_PPDITSD 765 +#define BSIM4V4_MOD_PFPROUT 766 +#define BSIM4V4_MOD_PLPEB 767 +#define BSIM4V4_MOD_PDVTP0 768 +#define BSIM4V4_MOD_PDVTP1 769 +#define BSIM4V4_MOD_PCGIDL 770 +#define BSIM4V4_MOD_PPHIN 771 +#define BSIM4V4_MOD_PRSW 772 +#define BSIM4V4_MOD_PRDW 773 +#define BSIM4V4_MOD_PNSD 774 +#define BSIM4V4_MOD_PCKAPPAD 775 +#define BSIM4V4_MOD_PAIGC 776 +#define BSIM4V4_MOD_PBIGC 777 +#define BSIM4V4_MOD_PCIGC 778 +#define BSIM4V4_MOD_PAIGBACC 779 +#define BSIM4V4_MOD_PBIGBACC 780 +#define BSIM4V4_MOD_PCIGBACC 781 +#define BSIM4V4_MOD_PAIGBINV 782 +#define BSIM4V4_MOD_PBIGBINV 783 +#define BSIM4V4_MOD_PCIGBINV 784 +#define BSIM4V4_MOD_PNIGC 785 +#define BSIM4V4_MOD_PNIGBACC 786 +#define BSIM4V4_MOD_PNIGBINV 787 +#define BSIM4V4_MOD_PNTOX 788 +#define BSIM4V4_MOD_PEIGBINV 789 +#define BSIM4V4_MOD_PPIGCD 790 +#define BSIM4V4_MOD_PPOXEDGE 791 +#define BSIM4V4_MOD_PAIGSD 792 +#define BSIM4V4_MOD_PBIGSD 793 +#define BSIM4V4_MOD_PCIGSD 794 + +#define BSIM4V4_MOD_SAREF 795 +#define BSIM4V4_MOD_SBREF 796 +#define BSIM4V4_MOD_KU0 797 +#define BSIM4V4_MOD_KVSAT 798 +#define BSIM4V4_MOD_TKU0 799 +#define BSIM4V4_MOD_LLODKU0 800 +#define BSIM4V4_MOD_WLODKU0 801 +#define BSIM4V4_MOD_LLODVTH 802 +#define BSIM4V4_MOD_WLODVTH 803 +#define BSIM4V4_MOD_LKU0 804 +#define BSIM4V4_MOD_WKU0 805 +#define BSIM4V4_MOD_PKU0 806 +#define BSIM4V4_MOD_KVTH0 807 +#define BSIM4V4_MOD_LKVTH0 808 +#define BSIM4V4_MOD_WKVTH0 809 +#define BSIM4V4_MOD_PKVTH0 810 +#define BSIM4V4_MOD_WLOD 811 +#define BSIM4V4_MOD_STK2 812 +#define BSIM4V4_MOD_LODK2 813 +#define BSIM4V4_MOD_STETA0 814 +#define BSIM4V4_MOD_LODETA0 815 + +#define BSIM4V4_MOD_PLAMBDA 825 +#define BSIM4V4_MOD_PVTL 826 +#define BSIM4V4_MOD_PXN 827 +#define BSIM4V4_MOD_PVFBSDOFF 828 + +#define BSIM4V4_MOD_TNOM 831 +#define BSIM4V4_MOD_CGSO 832 +#define BSIM4V4_MOD_CGDO 833 +#define BSIM4V4_MOD_CGBO 834 +#define BSIM4V4_MOD_XPART 835 +#define BSIM4V4_MOD_RSH 836 +#define BSIM4V4_MOD_JSS 837 +#define BSIM4V4_MOD_PBS 838 +#define BSIM4V4_MOD_MJS 839 +#define BSIM4V4_MOD_PBSWS 840 +#define BSIM4V4_MOD_MJSWS 841 +#define BSIM4V4_MOD_CJS 842 +#define BSIM4V4_MOD_CJSWS 843 +#define BSIM4V4_MOD_NMOS 844 +#define BSIM4V4_MOD_PMOS 845 +#define BSIM4V4_MOD_NOIA 846 +#define BSIM4V4_MOD_NOIB 847 +#define BSIM4V4_MOD_NOIC 848 +#define BSIM4V4_MOD_LINT 849 +#define BSIM4V4_MOD_LL 850 +#define BSIM4V4_MOD_LLN 851 +#define BSIM4V4_MOD_LW 852 +#define BSIM4V4_MOD_LWN 853 +#define BSIM4V4_MOD_LWL 854 +#define BSIM4V4_MOD_LMIN 855 +#define BSIM4V4_MOD_LMAX 856 +#define BSIM4V4_MOD_WINT 857 +#define BSIM4V4_MOD_WL 858 +#define BSIM4V4_MOD_WLN 859 +#define BSIM4V4_MOD_WW 860 +#define BSIM4V4_MOD_WWN 861 +#define BSIM4V4_MOD_WWL 862 +#define BSIM4V4_MOD_WMIN 863 +#define BSIM4V4_MOD_WMAX 864 +#define BSIM4V4_MOD_DWC 865 +#define BSIM4V4_MOD_DLC 866 +#define BSIM4V4_MOD_XL 867 +#define BSIM4V4_MOD_XW 868 +#define BSIM4V4_MOD_EM 869 +#define BSIM4V4_MOD_EF 870 +#define BSIM4V4_MOD_AF 871 +#define BSIM4V4_MOD_KF 872 +#define BSIM4V4_MOD_NJS 873 +#define BSIM4V4_MOD_XTIS 874 +#define BSIM4V4_MOD_PBSWGS 875 +#define BSIM4V4_MOD_MJSWGS 876 +#define BSIM4V4_MOD_CJSWGS 877 +#define BSIM4V4_MOD_JSWS 878 +#define BSIM4V4_MOD_LLC 879 +#define BSIM4V4_MOD_LWC 880 +#define BSIM4V4_MOD_LWLC 881 +#define BSIM4V4_MOD_WLC 882 +#define BSIM4V4_MOD_WWC 883 +#define BSIM4V4_MOD_WWLC 884 +#define BSIM4V4_MOD_DWJ 885 +#define BSIM4V4_MOD_JSD 886 +#define BSIM4V4_MOD_PBD 887 +#define BSIM4V4_MOD_MJD 888 +#define BSIM4V4_MOD_PBSWD 889 +#define BSIM4V4_MOD_MJSWD 890 +#define BSIM4V4_MOD_CJD 891 +#define BSIM4V4_MOD_CJSWD 892 +#define BSIM4V4_MOD_NJD 893 +#define BSIM4V4_MOD_XTID 894 +#define BSIM4V4_MOD_PBSWGD 895 +#define BSIM4V4_MOD_MJSWGD 896 +#define BSIM4V4_MOD_CJSWGD 897 +#define BSIM4V4_MOD_JSWD 898 +#define BSIM4V4_MOD_DLCIG 899 + +/* trap-assisted tunneling */ + +#define BSIM4V4_MOD_JTSS 900 +#define BSIM4V4_MOD_JTSD 901 +#define BSIM4V4_MOD_JTSSWS 902 +#define BSIM4V4_MOD_JTSSWD 903 +#define BSIM4V4_MOD_JTSSWGS 904 +#define BSIM4V4_MOD_JTSSWGD 905 +#define BSIM4V4_MOD_NJTS 906 +#define BSIM4V4_MOD_NJTSSW 907 +#define BSIM4V4_MOD_NJTSSWG 908 +#define BSIM4V4_MOD_XTSS 909 +#define BSIM4V4_MOD_XTSD 910 +#define BSIM4V4_MOD_XTSSWS 911 +#define BSIM4V4_MOD_XTSSWD 912 +#define BSIM4V4_MOD_XTSSWGS 913 +#define BSIM4V4_MOD_XTSSWGD 914 +#define BSIM4V4_MOD_TNJTS 915 +#define BSIM4V4_MOD_TNJTSSW 916 +#define BSIM4V4_MOD_TNJTSSWG 917 +#define BSIM4V4_MOD_VTSS 918 +#define BSIM4V4_MOD_VTSD 919 +#define BSIM4V4_MOD_VTSSWS 920 +#define BSIM4V4_MOD_VTSSWD 921 +#define BSIM4V4_MOD_VTSSWGS 922 +#define BSIM4V4_MOD_VTSSWGD 923 + +#define BSIM4V4_MOD_STIMOD 930 +#define BSIM4V4_MOD_SA0 931 +#define BSIM4V4_MOD_SB0 932 + +#define BSIM4V4_MOD_RGEOMOD 933 + +/* device questions */ +#define BSIM4V4_DNODE 945 +#define BSIM4V4_GNODEEXT 946 +#define BSIM4V4_SNODE 947 +#define BSIM4V4_BNODE 948 +#define BSIM4V4_DNODEPRIME 949 +#define BSIM4V4_GNODEPRIME 950 +#define BSIM4V4_GNODEMIDE 951 +#define BSIM4V4_GNODEMID 952 +#define BSIM4V4_SNODEPRIME 953 +#define BSIM4V4_BNODEPRIME 954 +#define BSIM4V4_DBNODE 955 +#define BSIM4V4_SBNODE 956 +#define BSIM4V4_VBD 957 +#define BSIM4V4_VBS 958 +#define BSIM4V4_VGS 959 +#define BSIM4V4_VDS 960 +#define BSIM4V4_CD 961 +#define BSIM4V4_CBS 962 +#define BSIM4V4_CBD 963 +#define BSIM4V4_GM 964 +#define BSIM4V4_GDS 965 +#define BSIM4V4_GMBS 966 +#define BSIM4V4_GBD 967 +#define BSIM4V4_GBS 968 +#define BSIM4V4_QB 969 +#define BSIM4V4_CQB 970 +#define BSIM4V4_QG 971 +#define BSIM4V4_CQG 972 +#define BSIM4V4_QD 973 +#define BSIM4V4_CQD 974 +#define BSIM4V4_CGGB 975 +#define BSIM4V4_CGDB 976 +#define BSIM4V4_CGSB 977 +#define BSIM4V4_CBGB 978 +#define BSIM4V4_CAPBD 979 +#define BSIM4V4_CQBD 980 +#define BSIM4V4_CAPBS 981 +#define BSIM4V4_CQBS 982 +#define BSIM4V4_CDGB 983 +#define BSIM4V4_CDDB 984 +#define BSIM4V4_CDSB 985 +#define BSIM4V4_VON 986 +#define BSIM4V4_VDSAT 987 +#define BSIM4V4_QBS 988 +#define BSIM4V4_QBD 989 +#define BSIM4V4_SOURCECONDUCT 990 +#define BSIM4V4_DRAINCONDUCT 991 +#define BSIM4V4_CBDB 992 +#define BSIM4V4_CBSB 993 +#define BSIM4V4_CSUB 994 +#define BSIM4V4_QINV 995 +#define BSIM4V4_IGIDL 996 +#define BSIM4V4_CSGB 997 +#define BSIM4V4_CSDB 998 +#define BSIM4V4_CSSB 999 +#define BSIM4V4_CGBB 1000 +#define BSIM4V4_CDBB 1001 +#define BSIM4V4_CSBB 1002 +#define BSIM4V4_CBBB 1003 +#define BSIM4V4_QS 1004 +#define BSIM4V4_IGISL 1005 +#define BSIM4V4_IGS 1006 +#define BSIM4V4_IGD 1007 +#define BSIM4V4_IGB 1008 +#define BSIM4V4_IGCS 1009 +#define BSIM4V4_IGCD 1010 + +# +#include "bsim4v4ext.h" + + +extern void BSIM4V4evaluate(double,double,double,BSIM4V4instance*,BSIM4V4model*, + double*,double*,double*, double*, double*, double*, double*, + double*, double*, double*, double*, double*, double*, double*, + double*, double*, double*, double*, CKTcircuit*); +extern int BSIM4V4debug(BSIM4V4model*, BSIM4V4instance*, CKTcircuit*, int); +extern int BSIM4V4checkModel(BSIM4V4model*, BSIM4V4instance*, CKTcircuit*); + +#endif /*BSIM4V4*/ diff --git a/src/spicelib/devices/bsim4v4/bsim4v4ext.h b/src/spicelib/devices/bsim4v4/bsim4v4ext.h new file mode 100644 index 000000000..b1476968e --- /dev/null +++ b/src/spicelib/devices/bsim4v4/bsim4v4ext.h @@ -0,0 +1,33 @@ +/********** +Copyright 2004 Regents of the University of California. All rights reserved. +Author: 2000 Weidong Liu +Author: 2001- Xuemei Xi +File: bsim4ext.h +**********/ + + +extern int BSIM4V4acLoad(GENmodel *,CKTcircuit*); +extern int BSIM4V4ask(CKTcircuit *,GENinstance*,int,IFvalue*,IFvalue*); +extern int BSIM4V4convTest(GENmodel *,CKTcircuit*); +extern int BSIM4V4delete(GENmodel*,IFuid,GENinstance**); +extern void BSIM4V4destroy(GENmodel**); +extern int BSIM4V4getic(GENmodel*,CKTcircuit*); +extern int BSIM4V4load(GENmodel*,CKTcircuit*); +extern int BSIM4V4mAsk(CKTcircuit*,GENmodel *,int, IFvalue*); +extern int BSIM4V4mDelete(GENmodel**,IFuid,GENmodel*); +extern int BSIM4V4mParam(int,IFvalue*,GENmodel*); +extern void BSIM4V4mosCap(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 BSIM4V4param(int,IFvalue*,GENinstance*,IFvalue*); +extern int BSIM4V4pzLoad(GENmodel*,CKTcircuit*,SPcomplex*); +extern int BSIM4V4setup(SMPmatrix*,GENmodel*,CKTcircuit*,int*); +extern int BSIM4V4temp(GENmodel*,CKTcircuit*); +extern int BSIM4V4trunc(GENmodel*,CKTcircuit*,double*); +extern int BSIM4V4noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); +extern int BSIM4V4unsetup(GENmodel*,CKTcircuit*); + + diff --git a/src/spicelib/devices/bsim4v4/bsim4v4init.c b/src/spicelib/devices/bsim4v4/bsim4v4init.c new file mode 100644 index 000000000..09db8effa --- /dev/null +++ b/src/spicelib/devices/bsim4v4/bsim4v4init.c @@ -0,0 +1,83 @@ +#include "config.h" + +#include "devdefs.h" + +#include "bsim4v4itf.h" +#include "bsim4v4ext.h" +#include "bsim4v4init.h" + + +SPICEdev BSIM4V4info = { + { + "BSIM4v4", + "Berkeley Short Channel IGFET Model-4", + + &BSIM4V4nSize, + &BSIM4V4nSize, + BSIM4V4names, + + &BSIM4V4pTSize, + BSIM4V4pTable, + + &BSIM4V4mPTSize, + BSIM4V4mPTable, + +#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 + }, + + BSIM4V4param, /* DEVparam */ + BSIM4V4mParam, /* DEVmodParam */ + BSIM4V4load, /* DEVload */ + BSIM4V4setup, /* DEVsetup */ + BSIM4V4unsetup, /* DEVunsetup */ + BSIM4V4setup, /* DEVpzSetup */ + BSIM4V4temp, /* DEVtemperature */ + BSIM4V4trunc, /* DEVtrunc */ + NULL, /* DEVfindBranch */ + BSIM4V4acLoad, /* DEVacLoad */ + NULL, /* DEVaccept */ + BSIM4V4destroy, /* DEVdestroy */ + BSIM4V4mDelete, /* DEVmodDelete */ + BSIM4V4delete, /* DEVdelete */ + BSIM4V4getic, /* DEVsetic */ + BSIM4V4ask, /* DEVask */ + BSIM4V4mAsk, /* DEVmodAsk */ + BSIM4V4pzLoad, /* DEVpzLoad */ + BSIM4V4convTest, /* DEVconvTest */ + NULL, /* DEVsenSetup */ + NULL, /* DEVsenLoad */ + NULL, /* DEVsenUpdate */ + NULL, /* DEVsenAcLoad */ + NULL, /* DEVsenPrint */ + NULL, /* DEVsenTrunc */ + NULL, /* DEVdisto */ + BSIM4V4noise, /* DEVnoise */ +#ifdef CIDER + NULL, /* DEVdump */ + NULL, /* DEVacct */ +#endif + &BSIM4V4iSize, /* DEVinstSize */ + &BSIM4V4mSize /* DEVmodSize */ +}; + + +SPICEdev * +get_bsim4v4_info(void) +{ + return &BSIM4V4info; +} diff --git a/src/spicelib/devices/bsim4v4/bsim4v4init.h b/src/spicelib/devices/bsim4v4/bsim4v4init.h new file mode 100644 index 000000000..823759cf7 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/bsim4v4init.h @@ -0,0 +1,13 @@ +#ifndef _BSIM4V4INIT_H +#define _BSIM4V4INIT_H + +extern IFparm BSIM4V4pTable[ ]; +extern IFparm BSIM4V4mPTable[ ]; +extern char *BSIM4V4names[ ]; +extern int BSIM4V4pTSize; +extern int BSIM4V4mPTSize; +extern int BSIM4V4nSize; +extern int BSIM4V4iSize; +extern int BSIM4V4mSize; + +#endif diff --git a/src/spicelib/devices/bsim4v4/bsim4v4itf.h b/src/spicelib/devices/bsim4v4/bsim4v4itf.h new file mode 100644 index 000000000..3191da0d9 --- /dev/null +++ b/src/spicelib/devices/bsim4v4/bsim4v4itf.h @@ -0,0 +1,13 @@ +/********** +Copyright 2004 Regents of the University of California. All rights reserved. +Author: 2000 Weidong Liu. +Author: 2001- Xuemei Xi +File: bsim4itf.h +**********/ + +#ifndef DEV_BSIM4V4 +#define DEV_BSIM4V4 + +SPICEdev *get_bsim4v4_info(void); + +#endif diff --git a/src/spicelib/devices/dev.c b/src/spicelib/devices/dev.c index abc898362..f5be04c12 100644 --- a/src/spicelib/devices/dev.c +++ b/src/spicelib/devices/dev.c @@ -80,8 +80,9 @@ int add_udn(int,Evt_Udn_Info_t **); #include "bsim3v1/bsim3v1itf.h" #include "bsim3v1a/bsim3v1aitf.h" #include "bsim3v1s/bsim3v1sitf.h" -#include "bsim3soi/b3soiitf.h" #include "bsim4/bsim4itf.h" +#include "bsim4v4/bsim4v4itf.h" +#include "bsim3soi/b3soiitf.h" #include "bsim3soi_pd/b3soipditf.h" #include "bsim3soi_fd/b3soifditf.h" #include "bsim3soi_dd/b3soidditf.h" @@ -137,9 +138,9 @@ int add_udn(int,Evt_Udn_Info_t **); /*saj in xspice the DEVices size can be varied so DEVNUM is an int*/ #ifdef XSPICE - static int DEVNUM = 60; + static int DEVNUM = 61; #else - #define DEVNUM 60 + #define DEVNUM 61 #endif /*Make this dynamic for later attempt to make all devices dynamic*/ @@ -188,75 +189,76 @@ spice_init_devices(void) DEVices[10] = get_bsim3v1s_info(); DEVices[11] = get_b3soi_info(); DEVices[12] = get_bsim4_info(); - DEVices[13] = get_b3soipd_info(); - DEVices[14] = get_b3soifd_info(); - DEVices[15] = get_b3soidd_info(); - DEVices[16] = get_cap_info(); - DEVices[17] = get_cccs_info(); - DEVices[18] = get_ccvs_info(); - DEVices[19] = get_cpl_info(); - DEVices[20] = get_csw_info(); - DEVices[21] = get_dio_info(); - DEVices[22] = get_hfeta_info(); - DEVices[23] = get_hfet2_info(); - DEVices[24] = get_hsm1_info(); - DEVices[25] = get_ind_info(); - DEVices[26] = get_mut_info(); - DEVices[27] = get_isrc_info(); - DEVices[28] = get_jfet_info(); - DEVices[29] = get_jfet2_info(); - DEVices[30] = get_ltra_info(); - DEVices[31] = get_mes_info(); - DEVices[32] = get_mesa_info(); - DEVices[33] = get_mos1_info(); - DEVices[34] = get_mos2_info(); - DEVices[35] = get_mos3_info(); - DEVices[36] = get_mos6_info(); - DEVices[37] = get_mos9_info(); - DEVices[38] = get_res_info(); - DEVices[39] = get_soi3_info(); - DEVices[40] = get_sw_info(); - DEVices[41] = get_tra_info(); - DEVices[42] = get_txl_info(); - DEVices[43] = get_vbic_info(); - DEVices[44] = get_vccs_info(); - DEVices[45] = get_vcvs_info(); - DEVices[46] = get_vsrc_info(); + DEVices[13] = get_bsim4v4_info(); + DEVices[14] = get_b3soipd_info(); + DEVices[15] = get_b3soifd_info(); + DEVices[16] = get_b3soidd_info(); + DEVices[17] = get_cap_info(); + DEVices[18] = get_cccs_info(); + DEVices[19] = get_ccvs_info(); + DEVices[20] = get_cpl_info(); + DEVices[21] = get_csw_info(); + DEVices[22] = get_dio_info(); + DEVices[23] = get_hfeta_info(); + DEVices[24] = get_hfet2_info(); + DEVices[25] = get_hsm1_info(); + DEVices[26] = get_ind_info(); + DEVices[27] = get_mut_info(); + DEVices[28] = get_isrc_info(); + DEVices[29] = get_jfet_info(); + DEVices[30] = get_jfet2_info(); + DEVices[31] = get_ltra_info(); + DEVices[32] = get_mes_info(); + DEVices[33] = get_mesa_info(); + DEVices[34] = get_mos1_info(); + DEVices[35] = get_mos2_info(); + DEVices[36] = get_mos3_info(); + DEVices[37] = get_mos6_info(); + DEVices[38] = get_mos9_info(); + DEVices[39] = get_res_info(); + DEVices[40] = get_soi3_info(); + DEVices[41] = get_sw_info(); + DEVices[42] = get_tra_info(); + DEVices[43] = get_txl_info(); + DEVices[44] = get_vbic_info(); + DEVices[45] = get_vccs_info(); + DEVices[46] = get_vcvs_info(); + DEVices[47] = get_vsrc_info(); #ifdef CIDER - DEVices[47] = get_nbjt_info(); - DEVices[48] = get_nbjt2_info(); - DEVices[49] = get_numd_info(); - DEVices[50] = get_numd2_info(); - DEVices[51] = get_numos_info(); + DEVices[48] = get_nbjt_info(); + DEVices[49] = get_nbjt2_info(); + DEVices[50] = get_numd_info(); + DEVices[51] = get_numd2_info(); + DEVices[52] = get_numos_info(); #else - DEVices[47] = NULL; DEVices[48] = NULL; DEVices[49] = NULL; DEVices[50] = NULL; - DEVices[51] = NULL; + DEVices[51] = NULL; + DEVices[52] = NULL; #endif #ifdef ADMS - DEVices[52] = get_hicum0_info(); - DEVices[53] = get_hicum2_info(); - DEVices[54] = get_mextram_info(); - DEVices[55] = get_ekv_info(); - DEVices[56] = get_psp102_info(); + DEVices[53] = get_hicum0_info(); + DEVices[54] = get_hicum2_info(); + DEVices[55] = get_mextram_info(); + DEVices[56] = get_ekv_info(); + DEVices[57] = get_psp102_info(); #else - DEVices[52] = NULL; DEVices[53] = NULL; DEVices[54] = NULL; DEVices[55] = NULL; DEVices[56] = NULL; + DEVices[57] = NULL; #endif #ifdef NDEV /* NDEV */ - DEVices[57] = get_ndev_info(); + DEVices[58] = get_ndev_info(); #else - DEVices[57] = NULL; -#endif DEVices[58] = NULL; +#endif DEVices[59] = NULL; + DEVices[60] = NULL; return; } @@ -280,11 +282,11 @@ SPICEdev ** devices(void) /*not yet usable*/ #ifdef ADMS -#define DEVICES_USED {"asrc", "bjt", "bjt2", "vbic", "bsim1", "bsim2", "bsim3", "bsim3v2", "bsim3v1", "bsim4", "bsim3soipd", "bsim3soifd", "bsim3soidd", \ +#define DEVICES_USED {"asrc", "bjt", "bjt2", "vbic", "bsim1", "bsim2", "bsim3", "bsim3v2", "bsim3v1", "bsim4", "bsim4v4", "bsim3soipd", "bsim3soifd", "bsim3soidd", \ "cap", "cccs", "ccvs", "csw", "dio", "hfet", "hfet2", "ind", "isrc", "jfet", "ltra", "mes", "mesa" ,"mos1", "mos2", "mos3", \ "mos6", "mos9", "res", "soi3", "sw", "tra", "urc", "vccs", "vcvs", "vsrc", "hicum0", "hicum2", "mextram", "ekv", "psp102"} #else -#define DEVICES_USED {"asrc", "bjt", "bjt2", "vbic", "bsim1", "bsim2", "bsim3", "bsim3v2", "bsim3v1", "bsim4", "bsim3soipd", "bsim3soifd", "bsim3soidd", \ +#define DEVICES_USED {"asrc", "bjt", "bjt2", "vbic", "bsim1", "bsim2", "bsim3", "bsim3v2", "bsim3v1", "bsim4", "bsim4v4", "bsim3soipd", "bsim3soifd", "bsim3soidd", \ "cap", "cccs", "ccvs", "csw", "dio", "hfet", "hfet2", "ind", "isrc", "jfet", "ltra", "mes", "mesa" ,"mos1", "mos2", "mos3", \ "mos6", "mos9", "res", "soi3", "sw", "tra", "urc", "vccs", "vcvs", "vsrc"} #endif diff --git a/src/spicelib/parser/inp2m.c b/src/spicelib/parser/inp2m.c index abdac3962..62bab078d 100644 --- a/src/spicelib/parser/inp2m.c +++ b/src/spicelib/parser/inp2m.c @@ -215,6 +215,7 @@ INP2M (void *ckt, INPtables * tab, card * current) && thismodel->INPmodType != INPtypelook ("B3SOIFD") && thismodel->INPmodType != INPtypelook ("B3SOIDD") && thismodel->INPmodType != INPtypelook ("BSIM4") + && thismodel->INPmodType != INPtypelook ("BSIM4v4") && thismodel->INPmodType != INPtypelook ("BSIM3v0") && thismodel->INPmodType != INPtypelook ("BSIM3v1") && thismodel->INPmodType != INPtypelook ("BSIM3v1S") diff --git a/src/spicelib/parser/inpdomod.c b/src/spicelib/parser/inpdomod.c index 81d0c4a39..863bf07e2 100644 --- a/src/spicelib/parser/inpdomod.c +++ b/src/spicelib/parser/inpdomod.c @@ -281,17 +281,18 @@ char *INPdomodel(void *ckt, card * image, INPtables * tab) ("Device type BSIM3 not available in this binary\n"); } break; - case 9: type = INPtypelook("Mos9"); - if(type < 0) { - err = INPmkTemp - ("Device type MOS9 not available in this binary\n"); - } - break; - + if(type < 0) { + err = INPmkTemp + ("Device type MOS9 not available in this binary\n"); + } + break; case 14: type = INPtypelook("BSIM4"); + if ( (strstr( ver, "4.4")) || (strstr( ver, "4.4.0")) ) { + type = INPtypelook("BSIM4v4"); + } if (type < 0) { err = INPmkTemp diff --git a/src/spicelib/parser/inpgmod.c b/src/spicelib/parser/inpgmod.c index 812bfdc49..3bc41d5a2 100644 --- a/src/spicelib/parser/inpgmod.c +++ b/src/spicelib/parser/inpgmod.c @@ -208,7 +208,7 @@ INPgetModBin( void* ckt, char* name, INPmodel** model, INPtables* tab, char* lin for ( modtmp = modtab; modtmp != (INPmodel*)NULL; modtmp = modtmp->INPnextModel ) { if ( modtmp->INPmodType != INPtypelook( "BSIM3" ) && modtmp->INPmodType != INPtypelook( "BSIM4" ) && - modtmp->INPmodType != INPtypelook( "BSIM4v5" ) && modtmp->INPmodType != INPtypelook( "BSIM4v6" ) ) + modtmp->INPmodType != INPtypelook( "BSIM4v4" ) && modtmp->INPmodType != INPtypelook( "BSIM4v6" ) ) continue; if ( parse_line( modtmp->INPmodLine->line, model_tokens, 4, parse_values, parse_found ) != TRUE )