Browse Source

bsim4 update to version 4.8.3

pre-master-46
dwarning 8 months ago
committed by Holger Vogt
parent
commit
a0c7af575d
  1. 46
      src/spicelib/devices/bsim4/b4.c
  2. 322
      src/spicelib/devices/bsim4/b4acld.c
  3. 124
      src/spicelib/devices/bsim4/b4ask.c
  4. 146
      src/spicelib/devices/bsim4/b4check.c
  5. 23
      src/spicelib/devices/bsim4/b4cvtest.c
  6. 38
      src/spicelib/devices/bsim4/b4geo.c
  7. 19
      src/spicelib/devices/bsim4/b4getic.c
  8. 634
      src/spicelib/devices/bsim4/b4ld.c
  9. 102
      src/spicelib/devices/bsim4/b4mask.c
  10. 18
      src/spicelib/devices/bsim4/b4mdel.c
  11. 68
      src/spicelib/devices/bsim4/b4mpar.c
  12. 122
      src/spicelib/devices/bsim4/b4noi.c
  13. 46
      src/spicelib/devices/bsim4/b4par.c
  14. 419
      src/spicelib/devices/bsim4/b4pzld.c
  15. 107
      src/spicelib/devices/bsim4/b4set.c
  16. 144
      src/spicelib/devices/bsim4/b4temp.c
  17. 19
      src/spicelib/devices/bsim4/b4trunc.c
  18. 124
      src/spicelib/devices/bsim4/bsim4def.h
  19. 18
      src/spicelib/devices/bsim4/bsim4ext.h
  20. 18
      src/spicelib/devices/bsim4/bsim4itf.h

46
src/spicelib/devices/bsim4/b4.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,8 +17,12 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
#include "ngspice/devdefs.h"
#include "bsim4def.h"
@ -58,10 +55,9 @@ IOP( "rbps", BSIM4_RBPS, IF_REAL , "Body resistance"),
IOP( "rbpd", BSIM4_RBPD, IF_REAL , "Body resistance"),
IOP( "delvto", BSIM4_DELVTO, IF_REAL , "Zero bias threshold voltage variation"),
IOPR("delvt0", BSIM4_DELVTO, IF_REAL , "Zero bias threshold voltage variation"),
IOP( "mulu0", BSIM4_MULU0, IF_REAL, "Low field mobility multiplier"),
IOP( "xgw", BSIM4_XGW, IF_REAL, "Distance from gate contact center to device edge"),
IOP( "ngcon", BSIM4_NGCON, IF_REAL, "Number of gate contacts"),
IOP( "wnflag", BSIM4_WNFLAG, IF_INTEGER, "W/NF device flag for bin selection"),
IOP( "trnqsmod", BSIM4_TRNQSMOD, IF_INTEGER, "Transient NQS model selector"),
IOP( "acnqsmod", BSIM4_ACNQSMOD, IF_INTEGER, "AC NQS model selector"),
@ -69,6 +65,10 @@ IOP( "rbodymod", BSIM4_RBODYMOD, IF_INTEGER, "Distributed body R model selector"
IOP( "rgatemod", BSIM4_RGATEMOD, IF_INTEGER, "Gate resistance model selector"),
IOP( "geomod", BSIM4_GEOMOD, IF_INTEGER, "Geometry dependent parasitics model selector"),
IOP( "rgeomod", BSIM4_RGEOMOD, IF_INTEGER, "S/D resistance and contact model selector"),
IOP( "mult_i", BSIM4_MULT_I, IF_REAL, "Variability in current"),
IOP( "mult_q", BSIM4_MULT_Q, IF_REAL, "Variability in charge"),
IOP( "mult_fn", BSIM4_MULT_FN, IF_REAL, "Variability in flicker noise"),
IP( "ic", BSIM4_IC, IF_REALVEC , "Vector of DS,GS,BS initial voltages"),
OP( "gmbs", BSIM4_GMBS, IF_REAL, "Gmb"),
OP( "gm", BSIM4_GM, IF_REAL, "Gm"),
@ -138,7 +138,6 @@ IOP( "rbodymod", BSIM4_MOD_RBODYMOD, IF_INTEGER, "Distributed body R model selec
IOP( "rgatemod", BSIM4_MOD_RGATEMOD, IF_INTEGER, "Gate R model selector"),
IOP( "permod", BSIM4_MOD_PERMOD, IF_INTEGER, "Pd and Ps model selector"),
IOP( "geomod", BSIM4_MOD_GEOMOD, IF_INTEGER, "Geometry dependent parasitics model selector"),
IOP( "rgeomod", BSIM4_MOD_RGEOMOD, IF_INTEGER, "S/D resistance and contact model selector"),
IOP( "fnoimod", BSIM4_MOD_FNOIMOD, IF_INTEGER, "Flicker noise model selector"),
IOP( "tnoimod", BSIM4_MOD_TNOIMOD, IF_INTEGER, "Thermal noise model selector"),
IOP( "mtrlmod", BSIM4_MOD_MTRLMOD, IF_INTEGER, "parameter for non-silicon substrate or metal gate selector"),
@ -176,6 +175,7 @@ IOP( "ags", BSIM4_MOD_AGS, IF_REAL, "Gate bias coefficient of Abulk."),
IOP( "a1", BSIM4_MOD_A1, IF_REAL, "Non-saturation effect coefficient"),
IOP( "a2", BSIM4_MOD_A2, IF_REAL, "Non-saturation effect coefficient"),
IOP( "keta", BSIM4_MOD_KETA, IF_REAL, "Body-bias coefficient of non-uniform depletion width effect."),
IOP( "ketac", BSIM4_MOD_KETAC, IF_REAL, "Body-bias coefficient of non-uniform depletion width effect in dynamic evaluation."),
IOP( "phig", BSIM4_MOD_PHIG, IF_REAL, "Work function of gate"),
IOP( "epsrgate", BSIM4_MOD_EPSRGATE, IF_REAL, "Dielectric constant of gate relative to vacuum"),
IOP( "easub",BSIM4_MOD_EASUB, IF_REAL, "Electron affinity of substrate"),
@ -442,7 +442,7 @@ IOP( "jtssws", BSIM4_MOD_JTSSWS, IF_REAL, "Source STI sidewall trap-assisted sat
IOP( "jtsswd", BSIM4_MOD_JTSSWD, IF_REAL, "Drain STI sidewall trap-assisted saturation current density"),
IOP( "jtsswgs", BSIM4_MOD_JTSSWGS, IF_REAL, "Source gate-edge sidewall trap-assisted saturation current density"),
IOP( "jtsswgd", BSIM4_MOD_JTSSWGD, IF_REAL, "Drain gate-edge sidewall trap-assisted saturation current density"),
IOP( "jtweff", BSIM4_MOD_JTWEFF, IF_REAL, "TAT current width dependence"),
IOP( "jtweff", BSIM4_MOD_JTWEFF, IF_REAL, "TAT current width dependance"),
IOP( "njts", BSIM4_MOD_NJTS, IF_REAL, "Non-ideality factor for bottom junction"),
IOP( "njtssw", BSIM4_MOD_NJTSSW, IF_REAL, "Non-ideality factor for STI sidewall junction"),
IOP( "njtsswg", BSIM4_MOD_NJTSSWG, IF_REAL, "Non-ideality factor for gate-edge sidewall junction"),
@ -519,6 +519,7 @@ IOP( "lags", BSIM4_MOD_LAGS, IF_REAL, "Length dependence of ags"),
IOP( "la1", BSIM4_MOD_LA1, IF_REAL, "Length dependence of a1"),
IOP( "la2", BSIM4_MOD_LA2, IF_REAL, "Length dependence of a2"),
IOP( "lketa", BSIM4_MOD_LKETA, IF_REAL, "Length dependence of keta"),
IOP( "lketac", BSIM4_MOD_LKETAC, IF_REAL, "Length dependence of ketac"),
IOP( "lnsub", BSIM4_MOD_LNSUB, IF_REAL, "Length dependence of nsub"),
IOP( "lndep", BSIM4_MOD_LNDEP, IF_REAL, "Length dependence of ndep"),
IOP( "lnsd", BSIM4_MOD_LNSD, IF_REAL, "Length dependence of nsd"),
@ -553,8 +554,8 @@ IOP( "ldvt1w", BSIM4_MOD_LDVT1W, IF_REAL, "Length dependence of dvt1w"),
IOP( "ldvt2w", BSIM4_MOD_LDVT2W, IF_REAL, "Length dependence of dvt2w"),
IOP( "ldrout", BSIM4_MOD_LDROUT, IF_REAL, "Length dependence of drout"),
IOP( "ldsub", BSIM4_MOD_LDSUB, IF_REAL, "Length dependence of dsub"),
IOP( "lvth0", BSIM4_MOD_LVTH0, IF_REAL,"Length dependence of vth0"),
IOPR("lvtho", BSIM4_MOD_LVTH0, IF_REAL,"Length dependence of vtho"),
IOP( "lvth0", BSIM4_MOD_LVTH0, IF_REAL,"Length dependence of vto"),
IOPR("lvtho", BSIM4_MOD_LVTH0, IF_REAL,"Length dependence of vto"),
IOP( "lua", BSIM4_MOD_LUA, IF_REAL, "Length dependence of ua"),
IOP( "lua1", BSIM4_MOD_LUA1, IF_REAL, "Length dependence of ua1"),
IOP( "lub", BSIM4_MOD_LUB, IF_REAL, "Length dependence of ub"),
@ -681,6 +682,7 @@ IOP( "wags", BSIM4_MOD_WAGS, IF_REAL, "Width dependence of ags"),
IOP( "wa1", BSIM4_MOD_WA1, IF_REAL, "Width dependence of a1"),
IOP( "wa2", BSIM4_MOD_WA2, IF_REAL, "Width dependence of a2"),
IOP( "wketa", BSIM4_MOD_WKETA, IF_REAL, "Width dependence of keta"),
IOP( "wketac", BSIM4_MOD_WKETAC, IF_REAL, "Width dependence of ketac"),
IOP( "wnsub", BSIM4_MOD_WNSUB, IF_REAL, "Width dependence of nsub"),
IOP( "wndep", BSIM4_MOD_WNDEP, IF_REAL, "Width dependence of ndep"),
IOP( "wnsd", BSIM4_MOD_WNSD, IF_REAL, "Width dependence of nsd"),
@ -715,8 +717,8 @@ IOP( "wdvt1w", BSIM4_MOD_WDVT1W, IF_REAL, "Width dependence of dvt1w"),
IOP( "wdvt2w", BSIM4_MOD_WDVT2W, IF_REAL, "Width dependence of dvt2w"),
IOP( "wdrout", BSIM4_MOD_WDROUT, IF_REAL, "Width dependence of drout"),
IOP( "wdsub", BSIM4_MOD_WDSUB, IF_REAL, "Width dependence of dsub"),
IOP( "wvth0", BSIM4_MOD_WVTH0, IF_REAL,"Width dependence of vth0"),
IOPR("wvtho", BSIM4_MOD_WVTH0, IF_REAL,"Width dependence of vtho"),
IOP( "wvth0", BSIM4_MOD_WVTH0, IF_REAL,"Width dependence of vto"),
IOPR("wvtho", BSIM4_MOD_WVTH0, IF_REAL,"Width dependence of vto"),
IOP( "wua", BSIM4_MOD_WUA, IF_REAL, "Width dependence of ua"),
IOP( "wua1", BSIM4_MOD_WUA1, IF_REAL, "Width dependence of ua1"),
IOP( "wub", BSIM4_MOD_WUB, IF_REAL, "Width dependence of ub"),
@ -842,6 +844,7 @@ IOP( "pags", BSIM4_MOD_PAGS, IF_REAL, "Cross-term dependence of ags"),
IOP( "pa1", BSIM4_MOD_PA1, IF_REAL, "Cross-term dependence of a1"),
IOP( "pa2", BSIM4_MOD_PA2, IF_REAL, "Cross-term dependence of a2"),
IOP( "pketa", BSIM4_MOD_PKETA, IF_REAL, "Cross-term dependence of keta"),
IOP( "pketac", BSIM4_MOD_PKETAC, IF_REAL, "Cross-term dependence of ketac"),
IOP( "pnsub", BSIM4_MOD_PNSUB, IF_REAL, "Cross-term dependence of nsub"),
IOP( "pndep", BSIM4_MOD_PNDEP, IF_REAL, "Cross-term dependence of ndep"),
IOP( "pnsd", BSIM4_MOD_PNSD, IF_REAL, "Cross-term dependence of nsd"),
@ -876,8 +879,8 @@ IOP( "pdvt1w", BSIM4_MOD_PDVT1W, IF_REAL, "Cross-term dependence of dvt1w"),
IOP( "pdvt2w", BSIM4_MOD_PDVT2W, IF_REAL, "Cross-term dependence of dvt2w"),
IOP( "pdrout", BSIM4_MOD_PDROUT, IF_REAL, "Cross-term dependence of drout"),
IOP( "pdsub", BSIM4_MOD_PDSUB, IF_REAL, "Cross-term dependence of dsub"),
IOP( "pvth0", BSIM4_MOD_PVTH0, IF_REAL,"Cross-term dependence of vth0"),
IOPR("pvtho", BSIM4_MOD_PVTH0, IF_REAL,"Cross-term dependence of vtho"),
IOP( "pvth0", BSIM4_MOD_PVTH0, IF_REAL,"Cross-term dependence of vto"),
IOPR("pvtho", BSIM4_MOD_PVTH0, IF_REAL,"Cross-term dependence of vto"),
IOP( "pua", BSIM4_MOD_PUA, IF_REAL, "Cross-term dependence of ua"),
IOP( "pua1", BSIM4_MOD_PUA1, IF_REAL, "Cross-term dependence of ua1"),
IOP( "pub", BSIM4_MOD_PUB, IF_REAL, "Cross-term dependence of ub"),
@ -1076,3 +1079,4 @@ int BSIM4pTSize = NUMELEMS(BSIM4pTable);
int BSIM4mPTSize = NUMELEMS(BSIM4mPTable);
int BSIM4iSize = sizeof(BSIM4instance);
int BSIM4mSize = sizeof(BSIM4model);

322
src/spicelib/devices/bsim4/b4acld.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,15 +17,18 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
#include "ngspice/cktdefs.h"
#include "bsim4def.h"
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
int
BSIM4acLoad(
GENmodel *inModel,
@ -68,15 +64,13 @@ double FwdSumr, RevSumr, Gmr, Gmbsr;
double FwdSumi, RevSumi, Gmi, Gmbsi;
struct bsim4SizeDependParam *pParam;
double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls;
double m;
double m, mult_i, mult_q;
omega = ckt->CKTomega;
for (; model != NULL; model = BSIM4nextModel(model))
{ for (here = BSIM4instances(model); here!= NULL;
here = BSIM4nextInstance(here))
{
pParam = here->pParam;
{ pParam = here->pParam;
capbd = here->BSIM4capbd;
capbs = here->BSIM4capbs;
cgso = here->BSIM4cgso;
@ -468,6 +462,8 @@ double m;
* Loading AC matrix
*/
m = here->BSIM4m;
mult_i = here->BSIM4mult_i;
mult_q = here->BSIM4mult_q;
if (!model->BSIM4rdsMod)
{ gdpr = here->BSIM4drainConductance;
@ -486,121 +482,121 @@ double m;
geltd = here->BSIM4grgeltd;
if (here->BSIM4rgateMod == 1)
{ *(here->BSIM4GEgePtr) += m * geltd;
*(here->BSIM4GPgePtr) -= m * geltd;
*(here->BSIM4GEgpPtr) -= m * geltd;
*(here->BSIM4GPgpPtr +1) += m * xcggbr;
*(here->BSIM4GPgpPtr) += m * (geltd + xcggbi + gIgtotg);
*(here->BSIM4GPdpPtr +1) += m * xcgdbr;
*(here->BSIM4GPdpPtr) += m * (xcgdbi + gIgtotd);
*(here->BSIM4GPspPtr +1) += m * xcgsbr;
*(here->BSIM4GPspPtr) += m * (xcgsbi + gIgtots);
*(here->BSIM4GPbpPtr +1) += m * xcgbbr;
*(here->BSIM4GPbpPtr) += m * (xcgbbi + gIgtotb);
{ *(here->BSIM4GEgePtr) += mult_i * geltd;
*(here->BSIM4GPgePtr) -= mult_i * geltd;
*(here->BSIM4GEgpPtr) -= mult_i * geltd;
*(here->BSIM4GPgpPtr +1) += mult_q * xcggbr;
*(here->BSIM4GPgpPtr) += mult_i * (geltd + gIgtotg) + mult_q * xcggbi;
*(here->BSIM4GPdpPtr +1) += mult_q * xcgdbr;
*(here->BSIM4GPdpPtr) += mult_q * xcgdbi + mult_i * gIgtotd;
*(here->BSIM4GPspPtr +1) += mult_q * xcgsbr;
*(here->BSIM4GPspPtr) += mult_q * xcgsbi + mult_i * gIgtots;
*(here->BSIM4GPbpPtr +1) += mult_q * xcgbbr;
*(here->BSIM4GPbpPtr) += mult_q * xcgbbi + mult_i * gIgtotb;
} /* WDLiu: gcrg already subtracted from all gcrgg below */
else if (here->BSIM4rgateMod == 2)
{ *(here->BSIM4GEgePtr) += m * gcrg;
*(here->BSIM4GEgpPtr) += m * gcrgg;
*(here->BSIM4GEdpPtr) += m * gcrgd;
*(here->BSIM4GEspPtr) += m * gcrgs;
*(here->BSIM4GEbpPtr) += m * gcrgb;
*(here->BSIM4GPgePtr) -= m * gcrg;
*(here->BSIM4GPgpPtr +1) += m * xcggbr;
*(here->BSIM4GPgpPtr) -= m * (gcrgg - xcggbi - gIgtotg);
*(here->BSIM4GPdpPtr +1) += m * xcgdbr;
*(here->BSIM4GPdpPtr) -= m * (gcrgd - xcgdbi - gIgtotd);
*(here->BSIM4GPspPtr +1) += m * xcgsbr;
*(here->BSIM4GPspPtr) -= m * (gcrgs - xcgsbi - gIgtots);
*(here->BSIM4GPbpPtr +1) += m * xcgbbr;
*(here->BSIM4GPbpPtr) -= m * (gcrgb - xcgbbi - gIgtotb);
{ *(here->BSIM4GEgePtr) += mult_i * gcrg;
*(here->BSIM4GEgpPtr) += mult_i * gcrgg;
*(here->BSIM4GEdpPtr) += mult_i * gcrgd;
*(here->BSIM4GEspPtr) += mult_i * gcrgs;
*(here->BSIM4GEbpPtr) += mult_i * gcrgb;
*(here->BSIM4GPgePtr) -= mult_i * gcrg;
*(here->BSIM4GPgpPtr +1) += mult_q * xcggbr;
*(here->BSIM4GPgpPtr) -= mult_i * (gcrgg - gIgtotg) - mult_q * xcggbi;
*(here->BSIM4GPdpPtr +1) += mult_q * xcgdbr;
*(here->BSIM4GPdpPtr) -= mult_i * (gcrgd - gIgtotd) - mult_q * xcgdbi;
*(here->BSIM4GPspPtr +1) += mult_q * xcgsbr;
*(here->BSIM4GPspPtr) -= mult_i * (gcrgs - gIgtots) - mult_q * xcgsbi;
*(here->BSIM4GPbpPtr +1) += mult_q * xcgbbr;
*(here->BSIM4GPbpPtr) -= mult_i * (gcrgb - gIgtotb) - mult_q * xcgbbi;
}
else if (here->BSIM4rgateMod == 3)
{ *(here->BSIM4GEgePtr) += m * geltd;
*(here->BSIM4GEgmPtr) -= m * geltd;
*(here->BSIM4GMgePtr) -= m * geltd;
*(here->BSIM4GMgmPtr) += m * (geltd + gcrg);
*(here->BSIM4GMgmPtr +1) += m * xcgmgmb;
*(here->BSIM4GMdpPtr) += m * gcrgd;
*(here->BSIM4GMdpPtr +1) += m * xcgmdb;
*(here->BSIM4GMgpPtr) += m * gcrgg;
*(here->BSIM4GMspPtr) += m * gcrgs;
*(here->BSIM4GMspPtr +1) += m * xcgmsb;
*(here->BSIM4GMbpPtr) += m * gcrgb;
*(here->BSIM4GMbpPtr +1) += m * xcgmbb;
*(here->BSIM4DPgmPtr +1) += m * xcdgmb;
*(here->BSIM4GPgmPtr) -= m * gcrg;
*(here->BSIM4SPgmPtr +1) += m * xcsgmb;
*(here->BSIM4BPgmPtr +1) += m * xcbgmb;
*(here->BSIM4GPgpPtr) -= m * (gcrgg - xcggbi - gIgtotg);
*(here->BSIM4GPgpPtr +1) += m * xcggbr;
*(here->BSIM4GPdpPtr) -= m * (gcrgd - xcgdbi - gIgtotd);
*(here->BSIM4GPdpPtr +1) += m * xcgdbr;
*(here->BSIM4GPspPtr) -= m * (gcrgs - xcgsbi - gIgtots);
*(here->BSIM4GPspPtr +1) += m * xcgsbr;
*(here->BSIM4GPbpPtr) -= m * (gcrgb - xcgbbi - gIgtotb);
*(here->BSIM4GPbpPtr +1) += m * xcgbbr;
{ *(here->BSIM4GEgePtr) += mult_i * geltd;
*(here->BSIM4GEgmPtr) -= mult_i * geltd;
*(here->BSIM4GMgePtr) -= mult_i * geltd;
*(here->BSIM4GMgmPtr) += mult_i * (geltd + gcrg);
*(here->BSIM4GMgmPtr +1) += mult_q * xcgmgmb;
*(here->BSIM4GMdpPtr) += mult_i * gcrgd;
*(here->BSIM4GMdpPtr +1) += mult_q * xcgmdb;
*(here->BSIM4GMgpPtr) += mult_i * gcrgg;
*(here->BSIM4GMspPtr) += mult_i * gcrgs;
*(here->BSIM4GMspPtr +1) += mult_q * xcgmsb;
*(here->BSIM4GMbpPtr) += mult_i * gcrgb;
*(here->BSIM4GMbpPtr +1) += mult_q * xcgmbb;
*(here->BSIM4DPgmPtr +1) += mult_q * xcdgmb;
*(here->BSIM4GPgmPtr) -= mult_i * gcrg;
*(here->BSIM4SPgmPtr +1) += mult_q * xcsgmb;
*(here->BSIM4BPgmPtr +1) += mult_q * xcbgmb;
*(here->BSIM4GPgpPtr) -= mult_i * (gcrgg - gIgtotg) - mult_q * xcggbi;
*(here->BSIM4GPgpPtr +1) += mult_q * xcggbr;
*(here->BSIM4GPdpPtr) -= mult_i * (gcrgd - gIgtotd) - mult_q * xcgdbi;
*(here->BSIM4GPdpPtr +1) += mult_q * xcgdbr;
*(here->BSIM4GPspPtr) -= mult_i * (gcrgs - gIgtots) - mult_q * xcgsbi;
*(here->BSIM4GPspPtr +1) += mult_q * xcgsbr;
*(here->BSIM4GPbpPtr) -= mult_i * (gcrgb - gIgtotb) - mult_q * xcgbbi;
*(here->BSIM4GPbpPtr +1) += mult_q * xcgbbr;
}
else
{ *(here->BSIM4GPgpPtr +1) += m * xcggbr;
*(here->BSIM4GPgpPtr) += m * (xcggbi + gIgtotg);
*(here->BSIM4GPdpPtr +1) += m * xcgdbr;
*(here->BSIM4GPdpPtr) += m * (xcgdbi + gIgtotd);
*(here->BSIM4GPspPtr +1) += m * xcgsbr;
*(here->BSIM4GPspPtr) += m * (xcgsbi + gIgtots);
*(here->BSIM4GPbpPtr +1) += m * xcgbbr;
*(here->BSIM4GPbpPtr) += m * (xcgbbi + gIgtotb);
{ *(here->BSIM4GPgpPtr +1) += mult_q * xcggbr;
*(here->BSIM4GPgpPtr) += mult_q * xcggbi + mult_i * gIgtotg;
*(here->BSIM4GPdpPtr +1) += mult_q * xcgdbr;
*(here->BSIM4GPdpPtr) += mult_q * xcgdbi + mult_i * gIgtotd;
*(here->BSIM4GPspPtr +1) += mult_q * xcgsbr;
*(here->BSIM4GPspPtr) += mult_q * xcgsbi + mult_i * gIgtots;
*(here->BSIM4GPbpPtr +1) += mult_q * xcgbbr;
*(here->BSIM4GPbpPtr) += mult_q * xcgbbi + mult_i * gIgtotb;
}
if (model->BSIM4rdsMod)
{ (*(here->BSIM4DgpPtr) += m * gdtotg);
(*(here->BSIM4DspPtr) += m * gdtots);
(*(here->BSIM4DbpPtr) += m * gdtotb);
(*(here->BSIM4SdpPtr) += m * gstotd);
(*(here->BSIM4SgpPtr) += m * gstotg);
(*(here->BSIM4SbpPtr) += m * gstotb);
}
*(here->BSIM4DPdpPtr +1) += m * (xcddbr + gdsi + RevSumi);
*(here->BSIM4DPdpPtr) += m * (gdpr + xcddbi + gdsr + here->BSIM4gbd
- gdtotd + RevSumr + gbdpdp - gIdtotd);
*(here->BSIM4DPdPtr) -= m * (gdpr + gdtot);
*(here->BSIM4DPgpPtr +1) += m * (xcdgbr + Gmi);
*(here->BSIM4DPgpPtr) += m * (Gmr + xcdgbi - gdtotg + gbdpg - gIdtotg);
*(here->BSIM4DPspPtr +1) += m * (xcdsbr - gdsi - FwdSumi);
*(here->BSIM4DPspPtr) -= m * (gdsr - xcdsbi + FwdSumr + gdtots - gbdpsp + gIdtots);
*(here->BSIM4DPbpPtr +1) += m * (xcdbbr + Gmbsi);
*(here->BSIM4DPbpPtr) -= m * (gjbd + gdtotb - xcdbbi - Gmbsr - gbdpb + gIdtotb);
*(here->BSIM4DdpPtr) -= m * (gdpr - gdtotd);
*(here->BSIM4DdPtr) += m * (gdpr + gdtot);
*(here->BSIM4SPdpPtr +1) += m * (xcsdbr - gdsi - RevSumi);
*(here->BSIM4SPdpPtr) -= m * (gdsr - xcsdbi + gstotd + RevSumr - gbspdp + gIstotd);
*(here->BSIM4SPgpPtr +1) += m * (xcsgbr - Gmi);
*(here->BSIM4SPgpPtr) -= m * (Gmr - xcsgbi + gstotg - gbspg + gIstotg);
*(here->BSIM4SPspPtr +1) += m * (xcssbr + gdsi + FwdSumi);
*(here->BSIM4SPspPtr) += m * (gspr + xcssbi + gdsr + here->BSIM4gbs
- gstots + FwdSumr + gbspsp - gIstots);
*(here->BSIM4SPsPtr) -= m * (gspr + gstot);
*(here->BSIM4SPbpPtr +1) += m * (xcsbbr - Gmbsi);
*(here->BSIM4SPbpPtr) -= m * (gjbs + gstotb - xcsbbi + Gmbsr - gbspb + gIstotb);
*(here->BSIM4SspPtr) -= m * (gspr - gstots);
*(here->BSIM4SsPtr) += m * (gspr + gstot);
*(here->BSIM4BPdpPtr +1) += m * xcbdb;
*(here->BSIM4BPdpPtr) -= m * (gjbd - gbbdp + gIbtotd);
*(here->BSIM4BPgpPtr +1) += m * xcbgb;
*(here->BSIM4BPgpPtr) -= m * (here->BSIM4gbgs + gIbtotg);
*(here->BSIM4BPspPtr +1) += m * xcbsb;
*(here->BSIM4BPspPtr) -= m * (gjbs - gbbsp + gIbtots);
*(here->BSIM4BPbpPtr +1) += m * xcbbb;
*(here->BSIM4BPbpPtr) += m * (gjbd + gjbs - here->BSIM4gbbs
{ (*(here->BSIM4DgpPtr) += mult_i * gdtotg);
(*(here->BSIM4DspPtr) += mult_i * gdtots);
(*(here->BSIM4DbpPtr) += mult_i * gdtotb);
(*(here->BSIM4SdpPtr) += mult_i * gstotd);
(*(here->BSIM4SgpPtr) += mult_i * gstotg);
(*(here->BSIM4SbpPtr) += mult_i * gstotb);
}
*(here->BSIM4DPdpPtr +1) += mult_q * xcddbr + mult_i * (gdsi + RevSumi);
*(here->BSIM4DPdpPtr) += + mult_i * (gdpr + gdsr + here->BSIM4gbd
- gdtotd + RevSumr + gbdpdp - gIdtotd) + mult_q * xcddbi;
*(here->BSIM4DPdPtr) -= mult_i * (gdpr + gdtot);
*(here->BSIM4DPgpPtr +1) += mult_q * xcdgbr + mult_i * Gmi;
*(here->BSIM4DPgpPtr) += mult_i * (Gmr - gdtotg + gbdpg - gIdtotg) + mult_q * xcdgbi;
*(here->BSIM4DPspPtr +1) += mult_q * xcdsbr - mult_i * (gdsi + FwdSumi);
*(here->BSIM4DPspPtr) -= mult_i * (gdsr + FwdSumr + gdtots - gbdpsp + gIdtots) - mult_q * xcdsbi;
*(here->BSIM4DPbpPtr +1) += mult_q * xcdbbr + mult_i * Gmbsi;
*(here->BSIM4DPbpPtr) -= mult_i * (gjbd + gdtotb - Gmbsr - gbdpb + gIdtotb) - mult_q * xcdbbi;
*(here->BSIM4DdpPtr) -= mult_i * (gdpr - gdtotd);
*(here->BSIM4DdPtr) += mult_i * (gdpr + gdtot);
*(here->BSIM4SPdpPtr +1) += mult_q * xcsdbr - mult_i * (gdsi + RevSumi);
*(here->BSIM4SPdpPtr) -= mult_i * (gdsr + gstotd + RevSumr - gbspdp + gIstotd) - mult_q * xcsdbi;
*(here->BSIM4SPgpPtr +1) += mult_q * xcsgbr - mult_i * Gmi;
*(here->BSIM4SPgpPtr) -= mult_i * (Gmr + gstotg - gbspg + gIstotg) - mult_q * xcsgbi;
*(here->BSIM4SPspPtr +1) += mult_q * xcssbr + mult_i * (gdsi + FwdSumi);
*(here->BSIM4SPspPtr) += mult_i * (gspr + gdsr + here->BSIM4gbs
- gstots + FwdSumr + gbspsp - gIstots) + mult_q * xcssbi;
*(here->BSIM4SPsPtr) -= mult_i * (gspr + gstot);
*(here->BSIM4SPbpPtr +1) += mult_q * xcsbbr - mult_i * Gmbsi;
*(here->BSIM4SPbpPtr) -= mult_i * (gjbs + gstotb + Gmbsr - gbspb + gIstotb) - mult_q * xcsbbi;
*(here->BSIM4SspPtr) -= mult_i * (gspr - gstots);
*(here->BSIM4SsPtr) += mult_i * (gspr + gstot);
*(here->BSIM4BPdpPtr +1) += mult_q * xcbdb;
*(here->BSIM4BPdpPtr) -= mult_i * (gjbd - gbbdp + gIbtotd);
*(here->BSIM4BPgpPtr +1) += mult_q * xcbgb;
*(here->BSIM4BPgpPtr) -= mult_i * (here->BSIM4gbgs + gIbtotg);
*(here->BSIM4BPspPtr +1) += mult_q * xcbsb;
*(here->BSIM4BPspPtr) -= mult_i * (gjbs - gbbsp + gIbtots);
*(here->BSIM4BPbpPtr +1) += mult_q * xcbbb;
*(here->BSIM4BPbpPtr) += mult_i * (gjbd + gjbs - here->BSIM4gbbs
- gIbtotb);
ggidld = here->BSIM4ggidld;
ggidlg = here->BSIM4ggidlg;
@ -610,57 +606,57 @@ double m;
ggislb = here->BSIM4ggislb;
/* stamp gidl */
(*(here->BSIM4DPdpPtr) += m * ggidld);
(*(here->BSIM4DPgpPtr) += m * ggidlg);
(*(here->BSIM4DPspPtr) -= m * ((ggidlg + ggidld) + ggidlb));
(*(here->BSIM4DPbpPtr) += m * ggidlb);
(*(here->BSIM4BPdpPtr) -= m * ggidld);
(*(here->BSIM4BPgpPtr) -= m * ggidlg);
(*(here->BSIM4BPspPtr) += m * ((ggidlg + ggidld) + ggidlb));
(*(here->BSIM4BPbpPtr) -= m * ggidlb);
(*(here->BSIM4DPdpPtr) += mult_i * ggidld);
(*(here->BSIM4DPgpPtr) += mult_i * ggidlg);
(*(here->BSIM4DPspPtr) -= mult_i * ((ggidlg + ggidld) + ggidlb));
(*(here->BSIM4DPbpPtr) += mult_i * ggidlb);
(*(here->BSIM4BPdpPtr) -= mult_i * ggidld);
(*(here->BSIM4BPgpPtr) -= mult_i * ggidlg);
(*(here->BSIM4BPspPtr) += mult_i * ((ggidlg + ggidld) + ggidlb));
(*(here->BSIM4BPbpPtr) -= mult_i * ggidlb);
/* stamp gisl */
(*(here->BSIM4SPdpPtr) -= m * ((ggisls + ggislg) + ggislb));
(*(here->BSIM4SPgpPtr) += m * ggislg);
(*(here->BSIM4SPspPtr) += m * ggisls);
(*(here->BSIM4SPbpPtr) += m * ggislb);
(*(here->BSIM4BPdpPtr) += m * ((ggislg + ggisls) + ggislb));
(*(here->BSIM4BPgpPtr) -= m * ggislg);
(*(here->BSIM4BPspPtr) -= m * ggisls);
(*(here->BSIM4BPbpPtr) -= m * ggislb);
(*(here->BSIM4SPdpPtr) -= mult_i * ((ggisls + ggislg) + ggislb));
(*(here->BSIM4SPgpPtr) += mult_i * ggislg);
(*(here->BSIM4SPspPtr) += mult_i * ggisls);
(*(here->BSIM4SPbpPtr) += mult_i * ggislb);
(*(here->BSIM4BPdpPtr) += mult_i * ((ggislg + ggisls) + ggislb));
(*(here->BSIM4BPgpPtr) -= mult_i * ggislg);
(*(here->BSIM4BPspPtr) -= mult_i * ggisls);
(*(here->BSIM4BPbpPtr) -= mult_i * ggislb);
if (here->BSIM4rbodyMod)
{ (*(here->BSIM4DPdbPtr +1) += m * xcdbdb);
(*(here->BSIM4DPdbPtr) -= m * here->BSIM4gbd);
(*(here->BSIM4SPsbPtr +1) += m * xcsbsb);
(*(here->BSIM4SPsbPtr) -= m * here->BSIM4gbs);
(*(here->BSIM4DBdpPtr +1) += m * xcdbdb);
(*(here->BSIM4DBdpPtr) -= m * here->BSIM4gbd);
(*(here->BSIM4DBdbPtr +1) -= m * xcdbdb);
(*(here->BSIM4DBdbPtr) += m * (here->BSIM4gbd + here->BSIM4grbpd
{ (*(here->BSIM4DPdbPtr +1) += mult_q * xcdbdb);
(*(here->BSIM4DPdbPtr) -= mult_i * here->BSIM4gbd);
(*(here->BSIM4SPsbPtr +1) += mult_q * xcsbsb);
(*(here->BSIM4SPsbPtr) -= mult_i * here->BSIM4gbs);
(*(here->BSIM4DBdpPtr +1) += mult_q * xcdbdb);
(*(here->BSIM4DBdpPtr) -= mult_i * here->BSIM4gbd);
(*(here->BSIM4DBdbPtr +1) -= mult_q * xcdbdb);
(*(here->BSIM4DBdbPtr) += mult_i * (here->BSIM4gbd + here->BSIM4grbpd
+ here->BSIM4grbdb));
(*(here->BSIM4DBbpPtr) -= m * here->BSIM4grbpd);
(*(here->BSIM4DBbPtr) -= m * here->BSIM4grbdb);
(*(here->BSIM4DBbpPtr) -= mult_i * here->BSIM4grbpd);
(*(here->BSIM4DBbPtr) -= mult_i * here->BSIM4grbdb);
(*(here->BSIM4BPdbPtr) -= m * here->BSIM4grbpd);
(*(here->BSIM4BPbPtr) -= m * here->BSIM4grbpb);
(*(here->BSIM4BPsbPtr) -= m * here->BSIM4grbps);
(*(here->BSIM4BPbpPtr) += m * (here->BSIM4grbpd + here->BSIM4grbps
(*(here->BSIM4BPdbPtr) -= mult_i * here->BSIM4grbpd);
(*(here->BSIM4BPbPtr) -= mult_i * here->BSIM4grbpb);
(*(here->BSIM4BPsbPtr) -= mult_i * here->BSIM4grbps);
(*(here->BSIM4BPbpPtr) += mult_i * (here->BSIM4grbpd + here->BSIM4grbps
+ here->BSIM4grbpb));
/* WDLiu: (-here->BSIM4gbbs) already added to BPbpPtr */
(*(here->BSIM4SBspPtr +1) += m * xcsbsb);
(*(here->BSIM4SBspPtr) -= m * here->BSIM4gbs);
(*(here->BSIM4SBbpPtr) -= m * here->BSIM4grbps);
(*(here->BSIM4SBbPtr) -= m * here->BSIM4grbsb);
(*(here->BSIM4SBsbPtr +1) -= m * xcsbsb);
(*(here->BSIM4SBsbPtr) += m * (here->BSIM4gbs
(*(here->BSIM4SBspPtr +1) += mult_q * xcsbsb);
(*(here->BSIM4SBspPtr) -= mult_i * here->BSIM4gbs);
(*(here->BSIM4SBbpPtr) -= mult_i * here->BSIM4grbps);
(*(here->BSIM4SBbPtr) -= mult_i * here->BSIM4grbsb);
(*(here->BSIM4SBsbPtr +1) -= mult_q * xcsbsb);
(*(here->BSIM4SBsbPtr) += mult_i * (here->BSIM4gbs
+ here->BSIM4grbps + here->BSIM4grbsb));
(*(here->BSIM4BdbPtr) -= m * here->BSIM4grbdb);
(*(here->BSIM4BbpPtr) -= m * here->BSIM4grbpb);
(*(here->BSIM4BsbPtr) -= m * here->BSIM4grbsb);
(*(here->BSIM4BbPtr) += m * (here->BSIM4grbsb + here->BSIM4grbdb
(*(here->BSIM4BdbPtr) -= mult_i * here->BSIM4grbdb);
(*(here->BSIM4BbpPtr) -= mult_i * here->BSIM4grbpb);
(*(here->BSIM4BsbPtr) -= mult_i * here->BSIM4grbsb);
(*(here->BSIM4BbPtr) += mult_i * (here->BSIM4grbsb + here->BSIM4grbdb
+ here->BSIM4grbpb));
}

124
src/spicelib/devices/bsim4/b4ask.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,8 +17,12 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
#include "ngspice/ifsim.h"
#include "ngspice/cktdefs.h"
@ -56,6 +53,15 @@ BSIM4instance *here = (BSIM4instance*)inst;
case BSIM4_M:
value->rValue = here->BSIM4m;
return(OK);
case BSIM4_MULT_I:
value->rValue = here->BSIM4mult_i;
return(OK);
case BSIM4_MULT_Q:
value->rValue = here->BSIM4mult_q;
return(OK);
case BSIM4_MULT_FN:
value->rValue = here->BSIM4mult_fn;
return(OK);
case BSIM4_NF:
value->rValue = here->BSIM4nf;
return(OK);
@ -123,12 +129,6 @@ BSIM4instance *here = (BSIM4instance*)inst;
case BSIM4_DELVTO:
value->rValue = here->BSIM4delvto;
return(OK);
case BSIM4_MULU0:
value->rValue = here->BSIM4mulu0;
return(OK);
case BSIM4_WNFLAG:
value->iValue = here->BSIM4wnflag;
return(OK);
case BSIM4_XGW:
value->rValue = here->BSIM4xgw;
return(OK);
@ -197,11 +197,11 @@ BSIM4instance *here = (BSIM4instance*)inst;
return(OK);
case BSIM4_SOURCECONDUCT:
value->rValue = here->BSIM4sourceConductance;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_DRAINCONDUCT:
value->rValue = here->BSIM4drainConductance;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_VBD:
value->rValue = *(ckt->CKTstate0 + here->BSIM4vbd);
@ -217,71 +217,67 @@ BSIM4instance *here = (BSIM4instance*)inst;
return(OK);
case BSIM4_CD:
value->rValue = here->BSIM4cd;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_CBS:
value->rValue = here->BSIM4cbs;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_CBD:
value->rValue = here->BSIM4cbd;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_CSUB:
value->rValue = here->BSIM4csub;
value->rValue *= here->BSIM4m;
return(OK);
case BSIM4_QINV:
value->rValue = here-> BSIM4qinv;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_IGIDL:
value->rValue = here->BSIM4Igidl;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_IGISL:
value->rValue = here->BSIM4Igisl;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_IGS:
value->rValue = here->BSIM4Igs;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_IGD:
value->rValue = here->BSIM4Igd;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_IGB:
value->rValue = here->BSIM4Igb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_IGCS:
value->rValue = here->BSIM4Igcs;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_IGCD:
value->rValue = here->BSIM4Igcd;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_GM:
value->rValue = here->BSIM4gm;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_GDS:
value->rValue = here->BSIM4gds;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_GMBS:
value->rValue = here->BSIM4gmbs;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_GBD:
value->rValue = here->BSIM4gbd;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_GBS:
value->rValue = here->BSIM4gbs;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
/* case BSIM4_QB:
value->rValue = *(ckt->CKTstate0 + here->BSIM4qb);
@ -306,102 +302,104 @@ BSIM4instance *here = (BSIM4instance*)inst;
return(OK); */
case BSIM4_QB:
value->rValue = here->BSIM4qbulk;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_QG:
value->rValue = here->BSIM4qgate;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_QS:
value->rValue = here->BSIM4qsrc;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_QD:
value->rValue = here->BSIM4qdrn;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_QINV:
value->rValue = here->BSIM4qinv;
return(OK);
case BSIM4_QDEF:
value->rValue = *(ckt->CKTstate0 + here->BSIM4qdef);
return(OK);
case BSIM4_GCRG:
value->rValue = here->BSIM4gcrg;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_i;
return(OK);
case BSIM4_GTAU:
value->rValue = here->BSIM4gtau;
value->rValue *= here->BSIM4m;
return(OK);
case BSIM4_CGGB:
value->rValue = here->BSIM4cggb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CGDB:
value->rValue = here->BSIM4cgdb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CGSB:
value->rValue = here->BSIM4cgsb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CDGB:
value->rValue = here->BSIM4cdgb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CDDB:
value->rValue = here->BSIM4cddb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CDSB:
value->rValue = here->BSIM4cdsb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CBGB:
value->rValue = here->BSIM4cbgb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CBDB:
value->rValue = here->BSIM4cbdb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CBSB:
value->rValue = here->BSIM4cbsb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CSGB:
value->rValue = here->BSIM4csgb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CSDB:
value->rValue = here->BSIM4csdb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CSSB:
value->rValue = here->BSIM4cssb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CGBB:
value->rValue = here->BSIM4cgbb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CDBB:
value->rValue = here->BSIM4cdbb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CSBB:
value->rValue = here->BSIM4csbb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CBBB:
value->rValue = here->BSIM4cbbb;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CAPBD:
value->rValue = here->BSIM4capbd;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_CAPBS:
value->rValue = here->BSIM4capbs;
value->rValue *= here->BSIM4m;
value->rValue *= here->BSIM4mult_q;
return(OK);
case BSIM4_VON:
value->rValue = here->BSIM4von;

146
src/spicelib/devices/bsim4/b4check.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
@ -37,11 +33,6 @@ under the License.
#include "ngspice/wordlist.h"
#include "ngspice/cpextern.h"
/* Check for correctness of the BSIM4.8 parameters:
If parameter excursions are found, put the warning or error message into a wordlist.
Only then open a file bsim4.out and print the data into the file. */
int
BSIM4checkModel(
BSIM4model *model,
@ -75,38 +66,42 @@ CKTcircuit *ckt)
wl->wl_word = tprintf("\nChecking parameters for BSIM 4.8 model %s\n", model->BSIM4modName);
if ((strcmp(model->BSIM4version, "4.8.0")) && (strncmp(model->BSIM4version, "4.80", 4)) && (strncmp(model->BSIM4version, "4.8", 3)) &&
(strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)))
(strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) &&
(strcmp(model->BSIM4version, "4.8.3")) && (strncmp(model->BSIM4version, "4.83", 4)))
{
printf("Warning: This model supports BSIM4 version 4.8\n");
printf("You specified a wrong version number. Working now with BSIM4.8.2\n");
printf("You specified a wrong version number. Working now with BSIM4.8.3\n");
wl_append_word(&wl, &wl, tprintf("Warning: This model supports BSIM4 version 4.8\n"));
wl_append_word(&wl, &wl, tprintf("You specified a wrong version number. Working now with BSIM4.8.2.\n"));
wl_append_word(&wl, &wl, tprintf("You specified a wrong version number. Working now with BSIM4.8.3.\n"));
}
if ((here->BSIM4rgateMod == 2) || (here->BSIM4rgateMod == 3))
{ if ((here->BSIM4trnqsMod == 1) || (here->BSIM4acnqsMod == 1)) {
{ if ((here->BSIM4trnqsMod == 1) || (here->BSIM4acnqsMod == 1))
{
wl_append_word(&wl, &wl, tprintf("Warning: You've selected both Rg and charge deficit NQS; select one only.\n"));
}
}
if (model->BSIM4toxe <= 0.0)
{
wl_append_word(&wl, &wl, tprintf("Fatal: Toxe = %g is not positive.\n",
model->BSIM4toxe));
wl_append_word(&wl, &wl, tprintf("Fatal: Toxe = %g is not positive.\n", model->BSIM4toxe));
Fatal_Flag = 1;
}
if (model->BSIM4toxp <= 0.0)
if (here->BSIM4toxp <= 0.0)
{
wl_append_word(&wl, &wl, tprintf("Fatal: Toxp = %g is not positive.\n", model->BSIM4toxp));
wl_append_word(&wl, &wl, tprintf("Fatal: Toxp = %g is not positive.\n", here->BSIM4toxp));
Fatal_Flag = 1;
}
if (model->BSIM4eot <= 0.0)
{
wl_append_word(&wl, &wl, tprintf("Fatal: EOT = %g is not positive.\n", model->BSIM4eot));
Fatal_Flag = 1;
}
if(model->BSIM4tempeot <= 0.0)
{
wl_append_word(&wl, &wl, tprintf("Fatal: TEMPEOT = %g is not positive.\n", model->BSIM4tempeot));
Fatal_Flag = 1;
}
if (model->BSIM4epsrgate < 0.0)
{
wl_append_word(&wl, &wl, tprintf("Fatal: Epsrgate = %g is not positive.\n", model->BSIM4epsrgate));
@ -133,6 +128,7 @@ CKTcircuit *ckt)
wl_append_word(&wl, &wl, tprintf("Fatal: Toxm = %g is not positive.\n", model->BSIM4toxm));
Fatal_Flag = 1;
}
if (model->BSIM4toxref <= 0.0)
{
wl_append_word(&wl, &wl, tprintf("Fatal: Toxref = %g is not positive.\n", model->BSIM4toxref));
@ -171,6 +167,7 @@ CKTcircuit *ckt)
pParam->BSIM4phin, pParam->BSIM4ndep));
Fatal_Flag = 1;
}
if (pParam->BSIM4nsub <= 0.0)
{
wl_append_word(&wl, &wl, tprintf("Fatal: Nsub = %g is not positive.\n",
@ -260,6 +257,7 @@ CKTcircuit *ckt)
wl_append_word(&wl, &wl, tprintf("Fatal: multiplier = %g is not positive.\n", here->BSIM4m));
Fatal_Flag = 1;
}
if (here->BSIM4nf < 1.0)
{
wl_append_word(&wl, &wl, tprintf("Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4nf));
@ -268,8 +266,7 @@ CKTcircuit *ckt)
if((here->BSIM4sa > 0.0) && (here->BSIM4sb > 0.0) &&
((here->BSIM4nf == 1.0) || ((here->BSIM4nf > 1.0) && (here->BSIM4sd > 0.0))) )
{
if (model->BSIM4saref <= 0.0)
{ if (model->BSIM4saref <= 0.0)
{
wl_append_word(&wl, &wl, tprintf("Fatal: SAref = %g is not positive.\n",model->BSIM4saref));
Fatal_Flag = 1;
@ -292,8 +289,7 @@ CKTcircuit *ckt)
Fatal_Flag = 1;
}
if ((here->BSIM4ngcon != 1.0) && (here->BSIM4ngcon != 2.0))
{
here->BSIM4ngcon = 1.0;
{ here->BSIM4ngcon = 1.0;
wl_append_word(&wl, &wl, tprintf("Warning: Ngcon must be equal to one or two; reset to 1.0.\n"));
}
@ -439,9 +435,9 @@ CKTcircuit *ckt)
{
wl_append_word(&wl, &wl, tprintf("Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", model->BSIM4toxe));
}
if (model->BSIM4toxp < 1.0e-10)
if (here->BSIM4toxp < 1.0e-10)
{
wl_append_word(&wl, &wl, tprintf("Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", model->BSIM4toxp));
wl_append_word(&wl, &wl, tprintf("Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", here->BSIM4toxp));
}
if (model->BSIM4toxm < 1.0e-10)
{
@ -603,8 +599,6 @@ CKTcircuit *ckt)
{
wl_append_word(&wl, &wl, tprintf("Warning: Pdibl1 = %g is negative.\n", pParam->BSIM4pdibl1));
}
}
if (pParam->BSIM4pdibl2 < 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: Pdibl2 = %g is negative.\n", pParam->BSIM4pdibl2));
@ -613,8 +607,7 @@ CKTcircuit *ckt)
/* Check stress effect parameters */
if((here->BSIM4sa > 0.0) && (here->BSIM4sb > 0.0) &&
((here->BSIM4nf == 1.0) || ((here->BSIM4nf > 1.0) && (here->BSIM4sd > 0.0))) )
{
if (model->BSIM4lodk2 <= 0.0)
{ if (model->BSIM4lodk2 <= 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: LODK2 = %g is not positive.\n",model->BSIM4lodk2));
}
@ -643,36 +636,45 @@ CKTcircuit *ckt)
}
/* Check body resistance parameters */
if (model->BSIM4rbps0 <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: RBPS0 = %g is not positive.\n", model->BSIM4rbps0));
{
wl_append_word(&wl, &wl, tprintf("Fatal: RBPS0 = %g is not positive.\n", model->BSIM4rbps0));
Fatal_Flag = 1;
}
if (model->BSIM4rbpd0 <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: RBPD0 = %g is not positive.\n", model->BSIM4rbpd0));
{
wl_append_word(&wl, &wl, tprintf("Fatal: RBPD0 = %g is not positive.\n", model->BSIM4rbpd0));
Fatal_Flag = 1;
}
if (model->BSIM4rbpbx0 <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: RBPBX0 = %g is not positive.\n", model->BSIM4rbpbx0));
{
wl_append_word(&wl, &wl, tprintf("Fatal: RBPBX0 = %g is not positive.\n", model->BSIM4rbpbx0));
Fatal_Flag = 1;
}
if (model->BSIM4rbpby0 <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: RBPBY0 = %g is not positive.\n", model->BSIM4rbpby0));
{
wl_append_word(&wl, &wl, tprintf("Fatal: RBPBY0 = %g is not positive.\n", model->BSIM4rbpby0));
Fatal_Flag = 1;
}
if (model->BSIM4rbdbx0 <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: RBDBX0 = %g is not positive.\n", model->BSIM4rbdbx0));
{
wl_append_word(&wl, &wl, tprintf("Fatal: RBDBX0 = %g is not positive.\n", model->BSIM4rbdbx0));
Fatal_Flag = 1;
}
if (model->BSIM4rbdby0 <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: RBDBY0 = %g is not positive.\n", model->BSIM4rbdby0));
{
wl_append_word(&wl, &wl, tprintf("Fatal: RBDBY0 = %g is not positive.\n", model->BSIM4rbdby0));
Fatal_Flag = 1;
}
if (model->BSIM4rbsbx0 <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: RBSBX0 = %g is not positive.\n", model->BSIM4rbsbx0));
{
wl_append_word(&wl, &wl, tprintf("Fatal: RBSBX0 = %g is not positive.\n", model->BSIM4rbsbx0));
Fatal_Flag = 1;
}
if (model->BSIM4rbsby0 <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: RBSBY0 = %g is not positive.\n", model->BSIM4rbsby0));
{
wl_append_word(&wl, &wl, tprintf("Fatal: RBSBY0 = %g is not positive.\n", model->BSIM4rbsby0));
Fatal_Flag = 1;
}
@ -686,7 +688,6 @@ CKTcircuit *ckt)
{
wl_append_word(&wl, &wl, tprintf("Warning: Voffcv = %g is too small.\n", pParam->BSIM4voffcv));
}
if (pParam->BSIM4moin < 5.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: Moin = %g is too small.\n", pParam->BSIM4moin));
@ -723,36 +724,31 @@ CKTcircuit *ckt)
model->BSIM4cgbo = 0.0;
}
if (model->BSIM4tnoiMod == 1){
wl_append_word(&wl, &wl, tprintf("Warning: TNOIMOD=1 is not supported and may be removed from future version.\n"));
wl_append_word(&wl, &wl, tprintf("Warning: TNOIMOD=%d is not supported and may be removed from future version.\n", model->BSIM4tnoiMod));
}
if (model->BSIM4idovvdsc <= 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: idovvdsc = %g is zero or negative.\n", model->BSIM4idovvdsc));
}
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) &&
(strcmp(model->BSIM4version, "4.8.2")) && (strncmp(model->BSIM4version, "4.82", 4)))
{ /* checking for version <= 4.8 */
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) && (strncmp(model->BSIM4version, "4.8", 3)) &&
(strcmp(model->BSIM4version, "4.8.2")) && (strncmp(model->BSIM4version, "4.82", 4)) &&
(strcmp(model->BSIM4version, "4.8.3")) && (strncmp(model->BSIM4version, "4.83", 4)))
{
/* v4.7 */
if (model->BSIM4tnoiMod == 1 || model->BSIM4tnoiMod == 2) {
if (model->BSIM4tnoia < 0.0)
{
if (model->BSIM4tnoia < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4tnoia));
model->BSIM4tnoia = 0.0;
}
if (model->BSIM4tnoib < 0.0)
{
if (model->BSIM4tnoib < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4tnoib));
model->BSIM4tnoib = 0.0;
}
if (model->BSIM4rnoia < 0.0)
{
if (model->BSIM4rnoia < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4rnoia));
model->BSIM4rnoia = 0.0;
}
if (model->BSIM4rnoib < 0.0)
{
if (model->BSIM4rnoib < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4rnoib));
model->BSIM4rnoib = 0.0;
}
@ -761,10 +757,12 @@ CKTcircuit *ckt)
/* v4.7 */
if (model->BSIM4tnoiMod == 2) {
if (model->BSIM4tnoic < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: tnoic = %g is negative. Set to zero.\n", model->BSIM4tnoic));
model->BSIM4tnoic = 0.0;
}
if (model->BSIM4rnoic < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: rnoic = %g is negative. Set to zero.\n", model->BSIM4rnoic));
model->BSIM4rnoic = 0.0;
}
@ -774,24 +772,27 @@ CKTcircuit *ckt)
{
if (model->BSIM4tnoiMod == 1){
if (model->BSIM4tnoia < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4tnoia));
model->BSIM4tnoia = 0.0;
}
if (model->BSIM4tnoib < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4tnoib));
model->BSIM4tnoib = 0.0;
}
if (model->BSIM4rnoia < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4rnoia));
model->BSIM4rnoia = 0.0;
}
if (model->BSIM4rnoib < 0.0) {
wl_append_word(&wl, &wl, tprintf("Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4rnoib));
model->BSIM4rnoib = 0.0;
}
}
}
/* Limits of Njs and Njd modified in BSIM4.7 */
if (model->BSIM4SjctEmissionCoeff < 0.1) {
wl_append_word(&wl, &wl, tprintf("Warning: Njs = %g is less than 0.1. Setting Njs to 0.1.\n", model->BSIM4SjctEmissionCoeff));
@ -800,8 +801,7 @@ CKTcircuit *ckt)
else if (model->BSIM4SjctEmissionCoeff < 0.7) {
wl_append_word(&wl, &wl, tprintf("Warning: Njs = %g is less than 0.7.\n", model->BSIM4SjctEmissionCoeff));
}
if (model->BSIM4DjctEmissionCoeff < 0.1)
{
if (model->BSIM4DjctEmissionCoeff < 0.1) {
wl_append_word(&wl, &wl, tprintf("Warning: Njd = %g is less than 0.1. Setting Njd to 0.1.\n", model->BSIM4DjctEmissionCoeff));
model->BSIM4DjctEmissionCoeff = 0.1;
}
@ -809,15 +809,18 @@ CKTcircuit *ckt)
wl_append_word(&wl, &wl, tprintf("Warning: Njd = %g is less than 0.7.\n", model->BSIM4DjctEmissionCoeff));
}
if (model->BSIM4njtsstemp < 0.0) {
if (model->BSIM4njtsstemp < 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: Njts = %g is negative at temperature = %g.\n",
model->BSIM4njtsstemp, ckt->CKTtemp));
}
if (model->BSIM4njtsswstemp < 0.0) {
if (model->BSIM4njtsswstemp < 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: Njtssw = %g is negative at temperature = %g.\n",
model->BSIM4njtsswstemp, ckt->CKTtemp));
}
if (model->BSIM4njtsswgstemp < 0.0) {
if (model->BSIM4njtsswgstemp < 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: Njtsswg = %g is negative at temperature = %g.\n",
model->BSIM4njtsswgstemp, ckt->CKTtemp));
}
@ -883,26 +886,30 @@ CKTcircuit *ckt)
wl_append_word(&wl, &wl, tprintf("Warning: SCREF = %g is not positive. Set to 1e-6.\n", model->BSIM4scref));
model->BSIM4scref = 1e-6;
}
/*Move these checks to temp.c for sceff calculation*/
/*
if (here->BSIM4sca < 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: SCA = %g is negative. Set to 0.0.\n", here->BSIM4sca));
wl_append_word(&wl, &wl, tprintf("Warning: SCA = %g is negative. Set to 0.0.\n", here->BSIM4sca);
here->BSIM4sca = 0.0;
}
if (here->BSIM4scb < 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: SCB = %g is negative. Set to 0.0.\n", here->BSIM4scb));
wl_append_word(&wl, &wl, tprintf("Warning: SCB = %g is negative. Set to 0.0.\n", here->BSIM4scb);
here->BSIM4scb = 0.0;
}
if (here->BSIM4scc < 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: SCC = %g is negative. Set to 0.0.\n", here->BSIM4scc));
wl_append_word(&wl, &wl, tprintf("Warning: SCC = %g is negative. Set to 0.0.\n", here->BSIM4scc);
here->BSIM4scc = 0.0;
}
if (here->BSIM4sc < 0.0)
{
wl_append_word(&wl, &wl, tprintf("Warning: SC = %g is negative. Set to 0.0.\n", here->BSIM4sc));
wl_append_word(&wl, &wl, tprintf("Warning: SC = %g is negative. Set to 0.0.\n", here->BSIM4sc);
here->BSIM4sc = 0.0;
}
*/
}
}
if (wlstart->wl_next) {
@ -923,7 +930,6 @@ CKTcircuit *ckt)
}
wl_free(wlstart);
return(Fatal_Flag);
}

23
src/spicelib/devices/bsim4/b4cvtest.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,8 +17,12 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
#include "ngspice/cktdefs.h"
#include "bsim4def.h"
@ -35,7 +32,6 @@ under the License.
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
int
BSIM4convTest(
GENmodel *inModel,
@ -57,8 +53,7 @@ double tol0, tol1, tol2, tol3, tol4, tol5, tol6;
for (; model != NULL; model = BSIM4nextModel(model))
{ for (here = BSIM4instances(model); here != NULL ;
here=BSIM4nextInstance(here))
{
vds = model->BSIM4type
{ vds = model->BSIM4type
* (*(ckt->CKTrhsOld + here->BSIM4dNodePrime)
- *(ckt->CKTrhsOld + here->BSIM4sNodePrime));
vgs = model->BSIM4type

38
src/spicelib/devices/bsim4/b4geo.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,12 +17,14 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
#include "bsim4def.h"
static int
BSIM4NumFingerDiff(
double nf,
@ -59,11 +54,9 @@ int NF;
return 0;
}
int
BSIM4PAeffGeo(
double nf,
int geo, int minSD,
double nf, int geo, int minSD,
double Weffcj, double DMCG, double DMCI, double DMDG,
double *Ps, double *Pd, double *As, double *Ad)
{
@ -163,10 +156,8 @@ return 0;
int
BSIM4RdseffGeo(
double nf,
int geo, int rgeo, int minSD,
double Weffcj, double Rsh, double DMCG, double DMCI, double DMDG,
int Type,
double nf, int geo, int rgeo, int minSD,
double Weffcj, double Rsh, double DMCG, double DMCI, double DMDG, int Type,
double *Rtot)
{
double Rint = 0.0, Rend = 0.0;
@ -284,12 +275,9 @@ return 0;
int
BSIM4RdsEndIso(
double Weffcj, double Rsh, double DMCG, double DMCI, double DMDG,
double nuEnd,
int rgeo, int Type,
double *Rend)
double nuEnd, int rgeo, int Type, double *Rend)
{
NG_IGNORE(DMDG);
if (Type == 1)
{ switch(rgeo)
{ case 1:
@ -345,9 +333,7 @@ return 0;
int
BSIM4RdsEndSha(
double Weffcj, double Rsh, double DMCG, double DMCI, double DMDG,
double nuEnd,
int rgeo, int Type,
double *Rend)
double nuEnd, int rgeo, int Type, double *Rend)
{
NG_IGNORE(DMCI);
NG_IGNORE(DMDG);

19
src/spicelib/devices/bsim4/b4getic.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
@ -32,7 +28,6 @@ under the License.
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
int
BSIM4getic(
GENmodel *inModel,

634
src/spicelib/devices/bsim4/b4ld.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,9 +17,10 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
*/
/**** OpenMP support ngspice 06/28/2010 ****/
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
#include "ngspice/cktdefs.h"
@ -97,13 +91,13 @@ CKTcircuit *ckt)
return error;
}
int BSIM4LoadOMP(BSIM4instance *here, CKTcircuit *ckt) {
BSIM4model *model = BSIM4modPtr(here);
#else
BSIM4model *model = (BSIM4model*)inModel;
BSIM4instance *here;
#endif
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;
@ -113,9 +107,6 @@ 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, cseshat, Idedtot, cdedhat;
#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;
@ -123,10 +114,7 @@ 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;
#ifndef PREDICTOR
double xfact;
#endif
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;
@ -191,7 +179,7 @@ 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 tmp, Abulk, dAbulk_dVb, Abulk0, Abulk0_Q, dAbulk0_dVb, dAbulk0_Q_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;
@ -233,7 +221,7 @@ 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, Cgd1, Cgb1, Cbg1, Cbb1, Cbd1, Qac0, Qsub0;
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;
@ -244,10 +232,10 @@ double vs, Fsevl, dvs_dVg, dvs_dVd, dvs_dVb, dFsevl_dVg, dFsevl_dVd, dFsevl_dVb;
double vgdx, vgsx, epssub, toxe, epsrox;
struct bsim4SizeDependParam *pParam;
int ByPass, ChargeComputationNeeded, error, Check, Check1, Check2;
double m;
double m, mult_i, mult_q;
ScalingFactor = 1.0e-9;
/* no integration, if dc sweep, but keep evaluating capacitances */
ChargeComputationNeeded =
((ckt->CKTmode & (MODEDCTRANCURVE | MODEAC | MODETRAN | MODEINITSMSIG)) ||
((ckt->CKTmode & MODETRANOP) && (ckt->CKTmode & MODEUIC)))
@ -1425,12 +1413,34 @@ for (; model != NULL; model = BSIM4nextModel(model))
T0 = (17.0 + 20.0 * T2) * T1;
dT0_dVb = -pParam->BSIM4keta * T1 * T1;
}
dAbulk_dVg *= T0;
dAbulk_dVb = dAbulk_dVb * T0 + Abulk * dT0_dVb;
dAbulk0_Q_dVb = dAbulk0_dVb; // copy before scaling
dAbulk0_dVb = dAbulk0_dVb * T0 + Abulk0 * dT0_dVb;
Abulk *= T0;
Abulk0_Q = Abulk0; // copy before scaling
Abulk0 *= T0;
/* Calculate Abulk0_Q */
if (pParam->BSIM4ketac != pParam->BSIM4keta) {
T2 = pParam->BSIM4ketac * Vbseff;
if (T2 >= -0.9)
{ T0 = 1.0 / (1.0 + T2);
dT0_dVb = -pParam->BSIM4ketac * T0 * T0;
}
else
{ T1 = 1.0 / (0.8 + T2);
T0 = (17.0 + 20.0 * T2) * T1;
dT0_dVb = -pParam->BSIM4ketac * T1 * T1;
}
dAbulk0_Q_dVb = dAbulk0_Q_dVb * T0 + Abulk0_Q * dT0_dVb;
Abulk0_Q *= T0;
} else {
dAbulk0_Q_dVb = dAbulk0_dVb;
Abulk0_Q = Abulk0;
}
/* Mobility calculation */
if (model->BSIM4mtrlMod && model->BSIM4mtrlCompatMod == 0)
T14 = 2.0 * model->BSIM4type *(model->BSIM4phig - model->BSIM4easub - 0.5*model->BSIM4Eg0 + 0.45);
@ -2352,9 +2362,9 @@ for (; model != NULL; model = BSIM4nextModel(model))
T1 = (-vds - vgd_eff - pParam->BSIM4egisl + pParam->BSIM4vfbsd ) / T0;
if ((pParam->BSIM4agisl <= 0.0) || (pParam->BSIM4bgisl <= 0.0)
|| (T1 <= 0.0) || (pParam->BSIM4cgisl <= 0.0) || (vbs > 0.0))
|| (T1 <= 0.0) || (pParam->BSIM4cgisl <= 0.0) || (vbs > 0.0)) {
Igisl = Ggisls = Ggislg = Ggislb = 0.0;
else {
} else {
dT1_dVd = 1.0 / T0;
dT1_dVg = -dvgd_eff_dvg * dT1_dVd;
T2 = pParam->BSIM4bgisl / T1;
@ -2596,10 +2606,10 @@ for (; model != NULL; model = BSIM4nextModel(model))
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;
T2 = Vgs * Vaux;
dT2_dVg = Vaux + Vgs * dVaux_dVg;
dT2_dVd = Vgs * dVaux_dVd;
dT2_dVb = Vgs * dVaux_dVb;
T11 = pParam->BSIM4Aechvb;
T12 = pParam->BSIM4Bechvb;
@ -2804,9 +2814,9 @@ for (; model != NULL; model = BSIM4nextModel(model))
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;
T2 = (Vgs - Vbs) * Vaux;
dT2_dVg = Vaux + (Vgs - Vbs) * dVaux_dVg;
dT2_dVb = -Vaux + (Vgs - Vbs) * dVaux_dVb;
T11 = 4.97232e-7 * pParam->BSIM4weff
* pParam->BSIM4leff * pParam->BSIM4ToxRatio;
@ -2859,10 +2869,10 @@ for (; model != NULL; model = BSIM4nextModel(model))
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;
T2 = (Vgs - Vbs) * Vaux;
dT2_dVg = Vaux + (Vgs - Vbs) * dVaux_dVg;
dT2_dVd = (Vgs - Vbs) * dVaux_dVd;
dT2_dVb = -Vaux + (Vgs - Vbs) * dVaux_dVb;
T11 *= 0.75610;
T12 *= 1.31724;
@ -2963,7 +2973,7 @@ for (; model != NULL; model = BSIM4nextModel(model))
/* Calculations for noise analysis */
if (model->BSIM4tnoiMod == 0)
{ Abulk = Abulk0 * pParam->BSIM4abulkCVfactor;
{ Abulk = Abulk0_Q * pParam->BSIM4abulkCVfactor;
Vdsat = Vgsteff / Abulk;
T0 = Vdsat - Vds - DELTA_4;
T1 = sqrt(T0 * T0 + 4.0 * DELTA_4 * Vdsat);
@ -3070,8 +3080,8 @@ for (; model != NULL; model = BSIM4nextModel(model))
{ One_Third_CoxWL = CoxWL / 3.0;
Two_Third_CoxWL = 2.0 * One_Third_CoxWL;
AbulkCV = Abulk0 * pParam->BSIM4abulkCVfactor;
dAbulkCV_dVb = pParam->BSIM4abulkCVfactor * dAbulk0_dVb*dVbseff_dVb;
AbulkCV = Abulk0_Q * pParam->BSIM4abulkCVfactor;
dAbulkCV_dVb = pParam->BSIM4abulkCVfactor * dAbulk0_Q_dVb*dVbseff_dVb;
dVdsat_dVg = 1.0 / AbulkCV; /*4.6.2*/
Vdsat = Vgst * dVdsat_dVg;
@ -3479,8 +3489,8 @@ for (; model != NULL; model = BSIM4nextModel(model))
dQsub0_dVb = -T2 * (dVfbeff_dVb + dVbseffCV_dVb
+ dVgsteff_dVb);
AbulkCV = Abulk0 * pParam->BSIM4abulkCVfactor;
dAbulkCV_dVb = pParam->BSIM4abulkCVfactor * dAbulk0_dVb;
AbulkCV = Abulk0_Q * pParam->BSIM4abulkCVfactor;
dAbulkCV_dVb = pParam->BSIM4abulkCVfactor * dAbulk0_Q_dVb;
VdsatCV = Vgsteff / AbulkCV;
T0 = VdsatCV - Vds - DELTA_4;
@ -3738,8 +3748,8 @@ for (; model != NULL; model = BSIM4nextModel(model))
dCoxeff_dVg *= dTcen_dVg;
CoxWLcen = CoxWL * Coxeff / model->BSIM4coxe;
AbulkCV = Abulk0 * pParam->BSIM4abulkCVfactor;
dAbulkCV_dVb = pParam->BSIM4abulkCVfactor * dAbulk0_dVb;
AbulkCV = Abulk0_Q * pParam->BSIM4abulkCVfactor;
dAbulkCV_dVb = pParam->BSIM4abulkCVfactor * dAbulk0_Q_dVb;
VdsatCV = VgDP / AbulkCV;
T0 = VdsatCV - Vds - DELTA_4;
@ -4164,9 +4174,8 @@ finished:
here->BSIM4cgso = cgso;
here->BSIM4qgso = qgso;
#ifndef NOBYPASS
line755:
#endif
ag0 = ckt->CKTag[0];
if (here->BSIM4mode > 0)
{ if (here->BSIM4trnqsMod == 0)
@ -4588,10 +4597,6 @@ line755:
if (!ChargeComputationNeeded)
goto line850;
/* no integration, if dc sweep, but keep evaluating capacitances */
if (ckt->CKTmode & MODEDCTRANCURVE)
goto line850;
if (ckt->CKTmode & MODEINITTRAN)
{ *(ckt->CKTstate1 + here->BSIM4qb) =
*(ckt->CKTstate0 + here->BSIM4qb);
@ -4801,9 +4806,9 @@ line900:
gIgtotb = gIstotb + gIdtotb + gIbtotb;
Igtoteq = Istoteq + Idtoteq + Ibtoteq;
}
else
else {
gIgtotg = gIgtotd = gIgtots = gIgtotb = Igtoteq = 0.0;
}
if (here->BSIM4rgateMod == 2)
T0 = vges - vgs;
@ -4970,66 +4975,67 @@ line900:
*/
m = here->BSIM4m;
mult_i = here->BSIM4mult_i;
mult_q = here->BSIM4mult_q;
#ifdef USE_OMP
here->BSIM4rhsdPrime = m * (ceqjd - ceqbd + ceqgdtot
- ceqdrn - ceqqd + Idtoteq);
here->BSIM4rhsgPrime = m * (ceqqg - ceqgcrg + Igtoteq);
here->BSIM4rhsdPrime = (mult_i * (ceqjd - ceqbd + ceqgdtot
- ceqdrn + Idtoteq) - mult_q * ceqqd);
here->BSIM4rhsgPrime = mult_q * ceqqg - mult_i * (ceqgcrg - Igtoteq);
if (here->BSIM4rgateMod == 2)
here->BSIM4rhsgExt = m * ceqgcrg;
here->BSIM4rhsgExt = mult_i * ceqgcrg;
else if (here->BSIM4rgateMod == 3)
here->BSIM4grhsMid = m * (ceqqgmid + ceqgcrg);
here->BSIM4grhsMid = mult_q * ceqqgmid + mult_i * ceqgcrg;
if (!here->BSIM4rbodyMod)
{ here->BSIM4rhsbPrime = m * (ceqbd + ceqbs - ceqjd
- ceqjs - ceqqb + Ibtoteq);
here->BSIM4rhssPrime = m * (ceqdrn - ceqbs + ceqjs
+ ceqqg + ceqqb + ceqqd + ceqqgmid - ceqgstot + Istoteq);
{ here->BSIM4rhsbPrime = (mult_i * (ceqbd + ceqbs - ceqjd
- ceqjs + Ibtoteq) - mult_q * ceqqb);
here->BSIM4rhssPrime = (mult_i * (ceqdrn - ceqbs + ceqjs
- ceqgstot + Istoteq) + mult_q * (ceqqg + ceqqb + ceqqd + ceqqgmid));
}
else
{ here->BSIM4rhsdb = m * (ceqjd + ceqqjd);
here->BSIM4rhsbPrime = m * (ceqbd + ceqbs - ceqqb + Ibtoteq);
here->BSIM4rhssb = m * (ceqjs + ceqqjs);
here->BSIM4rhssPrime = m * (ceqdrn - ceqbs + ceqjs + ceqqd
+ ceqqg + ceqqb + ceqqjd + ceqqjs + ceqqgmid - ceqgstot + Istoteq);
{ here->BSIM4rhsdb = mult_i * (ceqjd + ceqqjd);
here->BSIM4rhsbPrime = (mult_i * (ceqbd + ceqbs + Ibtoteq) - mult_q * ceqqb);
here->BSIM4rhssb = mult_i * (ceqjs + ceqqjs);
here->BSIM4rhssPrime = (mult_i * (ceqdrn - ceqbs + ceqjs - ceqgstot + Istoteq) + mult_q * (ceqqd
+ ceqqg + ceqqb + ceqqjd + ceqqjs + ceqqgmid));
}
if (model->BSIM4rdsMod)
{ here->BSIM4rhsd = m * ceqgdtot;
here->BSIM4rhss = m * ceqgstot;
{ here->BSIM4rhsd = mult_i * ceqgdtot;
here->BSIM4rhss = mult_i * ceqgstot;
}
if (here->BSIM4trnqsMod)
here->BSIM4rhsq = m * (cqcheq - cqdef);
#else
(*(ckt->CKTrhs + here->BSIM4dNodePrime) += m * (ceqjd - ceqbd + ceqgdtot
- ceqdrn - ceqqd + Idtoteq));
(*(ckt->CKTrhs + here->BSIM4gNodePrime) -= m * (ceqqg - ceqgcrg + Igtoteq));
(*(ckt->CKTrhs + here->BSIM4dNodePrime) += (mult_i * (ceqjd - ceqbd + ceqgdtot
- ceqdrn + Idtoteq) - mult_q * ceqqd));
(*(ckt->CKTrhs + here->BSIM4gNodePrime) -= mult_q * ceqqg - mult_i * (ceqgcrg - Igtoteq));
if (here->BSIM4rgateMod == 2)
(*(ckt->CKTrhs + here->BSIM4gNodeExt) -= m * ceqgcrg);
(*(ckt->CKTrhs + here->BSIM4gNodeExt) -= mult_i * ceqgcrg);
else if (here->BSIM4rgateMod == 3)
(*(ckt->CKTrhs + here->BSIM4gNodeMid) -= m * (ceqqgmid + ceqgcrg));
(*(ckt->CKTrhs + here->BSIM4gNodeMid) -= mult_q * ceqqgmid + mult_i * ceqgcrg);
if (!here->BSIM4rbodyMod)
{ (*(ckt->CKTrhs + here->BSIM4bNodePrime) += m * (ceqbd + ceqbs - ceqjd
- ceqjs - ceqqb + Ibtoteq));
(*(ckt->CKTrhs + here->BSIM4sNodePrime) += m * (ceqdrn - ceqbs + ceqjs
+ ceqqg + ceqqb + ceqqd + ceqqgmid - ceqgstot + Istoteq));
{ (*(ckt->CKTrhs + here->BSIM4bNodePrime) += (mult_i * (ceqbd + ceqbs - ceqjd
- ceqjs + Ibtoteq) - mult_q * ceqqb));
(*(ckt->CKTrhs + here->BSIM4sNodePrime) += (mult_i * (ceqdrn - ceqbs + ceqjs
- ceqgstot + Istoteq) + mult_q * (ceqqg + ceqqb + ceqqd + ceqqgmid)));
}
else
{ (*(ckt->CKTrhs + here->BSIM4dbNode) -= m * (ceqjd + ceqqjd));
(*(ckt->CKTrhs + here->BSIM4bNodePrime) += m * (ceqbd + ceqbs - ceqqb + Ibtoteq));
(*(ckt->CKTrhs + here->BSIM4sbNode) -= m * (ceqjs + ceqqjs));
(*(ckt->CKTrhs + here->BSIM4sNodePrime) += m * (ceqdrn - ceqbs + ceqjs + ceqqd
+ ceqqg + ceqqb + ceqqjd + ceqqjs + ceqqgmid - ceqgstot + Istoteq));
{ (*(ckt->CKTrhs + here->BSIM4dbNode) -= mult_i * (ceqjd + ceqqjd));
(*(ckt->CKTrhs + here->BSIM4bNodePrime) += (mult_i * (ceqbd + ceqbs + Ibtoteq) - mult_q * ceqqb));
(*(ckt->CKTrhs + here->BSIM4sbNode) -= mult_i * (ceqjs + ceqqjs));
(*(ckt->CKTrhs + here->BSIM4sNodePrime) += (mult_i * (ceqdrn - ceqbs + ceqjs - ceqgstot + Istoteq) + mult_q * (ceqqd
+ ceqqg + ceqqb + ceqqjd + ceqqjs + ceqqgmid)));
}
if (model->BSIM4rdsMod)
{ (*(ckt->CKTrhs + here->BSIM4dNode) -= m * ceqgdtot);
(*(ckt->CKTrhs + here->BSIM4sNode) += m * ceqgstot);
{ (*(ckt->CKTrhs + here->BSIM4dNode) -= mult_i * ceqgdtot);
(*(ckt->CKTrhs + here->BSIM4sNode) += mult_i * ceqgstot);
}
if (here->BSIM4trnqsMod)
@ -5057,96 +5063,96 @@ line900:
geltd = here->BSIM4grgeltd;
T1 = qdef * here->BSIM4gtau;
#ifdef USE_OMP
if (here->BSIM4rgateMod == 1)
{ here->BSIM4_1 = m * geltd;
here->BSIM4_2 = m * geltd;
here->BSIM4_3 = m * geltd;
here->BSIM4_4 = m * (gcggb + geltd - ggtg + gIgtotg);
here->BSIM4_5 = m * (gcgdb - ggtd + gIgtotd);
here->BSIM4_6 = m * (gcgsb - ggts + gIgtots);
here->BSIM4_7 = m * (gcgbb - ggtb + gIgtotb);
{ here->BSIM4_1 = mult_i * geltd;
here->BSIM4_2 = mult_i * geltd;
here->BSIM4_3 = mult_i * geltd;
here->BSIM4_4 = mult_q * (gcggb - ggtg) + mult_i * (geltd + gIgtotg);
here->BSIM4_5 = mult_q * (gcgdb - ggtd) + mult_i * gIgtotd;
here->BSIM4_6 = mult_q * (gcgsb - ggts) + mult_i * gIgtots;
here->BSIM4_7 = mult_q * (gcgbb - ggtb) + mult_i * gIgtotb;
} /* WDLiu: gcrg already subtracted from all gcrgg below */
else if (here->BSIM4rgateMod == 2)
{ here->BSIM4_8 = m * gcrg;
here->BSIM4_9 = m * gcrgg;
here->BSIM4_10 = m * gcrgd;
here->BSIM4_11 = m * gcrgs;
here->BSIM4_12 = m * gcrgb;
here->BSIM4_13 = m * gcrg;
here->BSIM4_14 = m * (gcggb - gcrgg - ggtg + gIgtotg);
here->BSIM4_15 = m * (gcgdb - gcrgd - ggtd + gIgtotd);
here->BSIM4_16 = m * (gcgsb - gcrgs - ggts + gIgtots);
here->BSIM4_17 = m * (gcgbb - gcrgb - ggtb + gIgtotb);
{ here->BSIM4_8 = mult_i * gcrg;
here->BSIM4_9 = mult_i * gcrgg;
here->BSIM4_10 = mult_i * gcrgd;
here->BSIM4_11 = mult_i * gcrgs;
here->BSIM4_12 = mult_i * gcrgb;
here->BSIM4_13 = mult_i * gcrg;
here->BSIM4_14 = mult_q * (gcggb - ggtg) + mult_i * (gIgtotg - gcrgg);
here->BSIM4_15 = mult_q * (gcgdb - ggtd) + mult_i * (gIgtotd - gcrgd);
here->BSIM4_16 = mult_q * (gcgsb - ggts) + mult_i * (gIgtots - gcrgs);
here->BSIM4_17 = mult_q * (gcgbb - ggtb) + mult_i * (gIgtotb - gcrgb);
}
else if (here->BSIM4rgateMod == 3)
{ here->BSIM4_18 = m * geltd;
here->BSIM4_19 = m * geltd;
here->BSIM4_20 = m * geltd;
here->BSIM4_21 = m * (geltd + gcrg + gcgmgmb);
{ here->BSIM4_18 = mult_i * geltd;
here->BSIM4_19 = mult_i * geltd;
here->BSIM4_20 = mult_i * geltd;
here->BSIM4_21 = mult_i * (geltd + gcrg) + mult_q * gcgmgmb;
here->BSIM4_22 = m * (gcrgd + gcgmdb);
here->BSIM4_23 = m * gcrgg;
here->BSIM4_24 = m * (gcrgs + gcgmsb);
here->BSIM4_25 = m * (gcrgb + gcgmbb);
here->BSIM4_22 = mult_i * gcrgd + mult_q * gcgmdb;
here->BSIM4_23 = mult_i * gcrgg;
here->BSIM4_24 = mult_i * gcrgs + mult_q * gcgmsb;
here->BSIM4_25 = mult_i * gcrgb + mult_q * gcgmbb;
here->BSIM4_26 = m * gcdgmb;
here->BSIM4_27 = m * gcrg;
here->BSIM4_28 = m * gcsgmb;
here->BSIM4_29 = m * gcbgmb;
here->BSIM4_26 = mult_q * gcdgmb;
here->BSIM4_27 = mult_i * gcrg;
here->BSIM4_28 = mult_q * gcsgmb;
here->BSIM4_29 = mult_q * gcbgmb;
here->BSIM4_30 = m * (gcggb - gcrgg - ggtg + gIgtotg);
here->BSIM4_31 = m * (gcgdb - gcrgd - ggtd + gIgtotd);
here->BSIM4_32 = m * (gcgsb - gcrgs - ggts + gIgtots);
here->BSIM4_33 = m * (gcgbb - gcrgb - ggtb + gIgtotb);
here->BSIM4_30 = mult_q * (gcggb - ggtg) + mult_i * (gIgtotg - gcrgg);
here->BSIM4_31 = mult_q * (gcgdb - ggtd) + mult_i * (gIgtotd - gcrgd);
here->BSIM4_32 = mult_q * (gcgsb - ggts) + mult_i * (gIgtots - gcrgs);
here->BSIM4_33 = mult_q * (gcgbb - ggtb) + mult_i * (gIgtotb - gcrgb);
}
else
{ here->BSIM4_34 = m * (gcggb - ggtg + gIgtotg);
here->BSIM4_35 = m * (gcgdb - ggtd + gIgtotd);
here->BSIM4_36 = m * (gcgsb - ggts + gIgtots);
here->BSIM4_37 = m * (gcgbb - ggtb + gIgtotb);
{ here->BSIM4_34 = mult_q * (gcggb - ggtg) + mult_i * gIgtotg;
here->BSIM4_35 = mult_q * (gcgdb - ggtd) + mult_i * gIgtotd;
here->BSIM4_36 = mult_q * (gcgsb - ggts) + mult_i * gIgtots;
here->BSIM4_37 = mult_q * (gcgbb - ggtb) + mult_i * gIgtotb;
}
if (model->BSIM4rdsMod)
{ here->BSIM4_38 = m * gdtotg;
here->BSIM4_39 = m * gdtots;
here->BSIM4_40 = m * gdtotb;
here->BSIM4_41 = m * gstotd;
here->BSIM4_42 = m * gstotg;
here->BSIM4_43 = m * gstotb;
}
here->BSIM4_44 = m * (gdpr + here->BSIM4gds + here->BSIM4gbd + T1 * ddxpart_dVd
- gdtotd + RevSum + gcddb + gbdpdp + dxpart * ggtd - gIdtotd);
here->BSIM4_45 = m * (gdpr + gdtot);
here->BSIM4_46 = m * (Gm + gcdgb - gdtotg + gbdpg - gIdtotg
+ dxpart * ggtg + T1 * ddxpart_dVg);
here->BSIM4_47 = m * (here->BSIM4gds + gdtots - dxpart * ggts + gIdtots
- T1 * ddxpart_dVs + FwdSum - gcdsb - gbdpsp);
here->BSIM4_48 = m * (gjbd + gdtotb - Gmbs - gcdbb - gbdpb + gIdtotb
- T1 * ddxpart_dVb - dxpart * ggtb);
here->BSIM4_49 = m * (gdpr - gdtotd);
here->BSIM4_50 = m * (gdpr + gdtot);
here->BSIM4_51 = m * (here->BSIM4gds + gstotd + RevSum - gcsdb - gbspdp
- T1 * dsxpart_dVd - sxpart * ggtd + gIstotd);
here->BSIM4_52 = m * (gcsgb - Gm - gstotg + gbspg + sxpart * ggtg
+ T1 * dsxpart_dVg - gIstotg);
here->BSIM4_53 = m * (gspr + here->BSIM4gds + here->BSIM4gbs + T1 * dsxpart_dVs
- gstots + FwdSum + gcssb + gbspsp + sxpart * ggts - gIstots);
here->BSIM4_54 = m * (gspr + gstot);
here->BSIM4_55 = m * (gjbs + gstotb + Gmbs - gcsbb - gbspb - sxpart * ggtb
- T1 * dsxpart_dVb + gIstotb);
here->BSIM4_56 = m * (gspr - gstots);
here->BSIM4_57 = m * (gspr + gstot);
here->BSIM4_58 = m * (gcbdb - gjbd + gbbdp - gIbtotd);
here->BSIM4_59 = m * (gcbgb - here->BSIM4gbgs - gIbtotg);
here->BSIM4_60 = m * (gcbsb - gjbs + gbbsp - gIbtots);
here->BSIM4_61 = m * (gjbd + gjbs + gcbbb - here->BSIM4gbbs - gIbtotb);
{ here->BSIM4_38 = mult_i * gdtotg;
here->BSIM4_39 = mult_i * gdtots;
here->BSIM4_40 = mult_i * gdtotb;
here->BSIM4_41 = mult_i * gstotd;
here->BSIM4_42 = mult_i * gstotg;
here->BSIM4_43 = mult_i * gstotb;
}
here->BSIM4_44 = mult_i * (gdpr + here->BSIM4gds + here->BSIM4gbd
- gdtotd + RevSum + gbdpdp - gIdtotd) + mult_q * (T1 * ddxpart_dVd + gcddb + dxpart * ggtd);
here->BSIM4_45 = mult_i * (gdpr + gdtot);
here->BSIM4_46 = mult_i * (Gm - gdtotg + gbdpg - gIdtotg)
+ mult_q * (dxpart * ggtg + T1 * ddxpart_dVg + gcdgb);
here->BSIM4_47 = mult_i * (here->BSIM4gds + gdtots + gIdtots
+ FwdSum - gbdpsp) - mult_q * (dxpart * ggts + T1 * ddxpart_dVs + gcdsb);
here->BSIM4_48 = mult_i * (gjbd + gdtotb - Gmbs - gbdpb + gIdtotb)
- mult_q * (dxpart * ggtb + gcdbb + T1 * ddxpart_dVb);
here->BSIM4_49 = mult_i * (gdpr - gdtotd);
here->BSIM4_50 = mult_i * (gdpr + gdtot);
here->BSIM4_51 = mult_i * (here->BSIM4gds + gstotd + RevSum - gbspdp + gIstotd)
- mult_q * (T1 * dsxpart_dVd + sxpart * ggtd + gcsdb);
here->BSIM4_52 = mult_q * (gcsgb + sxpart * ggtg + T1 * dsxpart_dVg) + mult_i * (gbspg - Gm - gstotg - gIstotg);
here->BSIM4_53 = mult_i * (gspr + here->BSIM4gds + here->BSIM4gbs - gIstots - gstots + FwdSum + gbspsp)
+ mult_q * (sxpart * ggts + T1 * dsxpart_dVs + gcssb);
here->BSIM4_54 = mult_i * (gspr + gstot);
here->BSIM4_55 = mult_i * (gjbs + gstotb + Gmbs - gbspb + gIstotb) - mult_q * (gcsbb + sxpart * ggtb + T1 * dsxpart_dVb);
here->BSIM4_56 = mult_i * (gspr - gstots);
here->BSIM4_57 = mult_i * (gspr + gstot);
here->BSIM4_58 = mult_q * gcbdb - mult_i * (gjbd - gbbdp + gIbtotd);
here->BSIM4_59 = mult_q * gcbgb - mult_i * (here->BSIM4gbgs + gIbtotg);
here->BSIM4_60 = mult_q * gcbsb - mult_i * (gjbs - gbbsp + gIbtots);
here->BSIM4_61 = mult_i * (gjbd + gjbs - here->BSIM4gbbs
- gIbtotb) + mult_q * gcbbb;
ggidld = here->BSIM4ggidld;
ggidlg = here->BSIM4ggidlg;
@ -5156,51 +5162,50 @@ line900:
ggislb = here->BSIM4ggislb;
/* stamp gidl */
here->BSIM4_62 = m * ggidld;
here->BSIM4_63 = m * ggidlg;
here->BSIM4_64 = m * (ggidlg + ggidld + ggidlb);
here->BSIM4_65 = m * ggidlb;
here->BSIM4_66 = m * ggidld;
here->BSIM4_67 = m * ggidlg;
here->BSIM4_68 = m * (ggidlg + ggidld + ggidlb);
here->BSIM4_69 = m * ggidlb;
here->BSIM4_62 = mult_i * ggidld;
here->BSIM4_63 = mult_i * ggidlg;
here->BSIM4_64 = mult_i * (ggidlg + ggidld + ggidlb);
here->BSIM4_65 = mult_i * ggidlb;
here->BSIM4_66 = mult_i * ggidld;
here->BSIM4_67 = mult_i * ggidlg;
here->BSIM4_68 = mult_i * (ggidlg + ggidld + ggidlb);
here->BSIM4_69 = mult_i * ggidlb;
/* stamp gisl */
here->BSIM4_70 = m * (ggisls + ggislg + ggislb);
here->BSIM4_71 = m * ggislg;
here->BSIM4_72 = m * ggisls;
here->BSIM4_73 = m * ggislb;
here->BSIM4_74 = m * (ggislg + ggisls + ggislb);
here->BSIM4_75 = m * ggislg;
here->BSIM4_76 = m * ggisls;
here->BSIM4_77 = m * ggislb;
here->BSIM4_70 = mult_i * (ggisls + ggislg + ggislb);
here->BSIM4_71 = mult_i * ggislg;
here->BSIM4_72 = mult_i * ggisls;
here->BSIM4_73 = mult_i * ggislb;
here->BSIM4_74 = mult_i * (ggislg + ggisls + ggislb);
here->BSIM4_75 = mult_i * ggislg;
here->BSIM4_76 = mult_i * ggisls;
here->BSIM4_77 = mult_i * ggislb;
if (here->BSIM4rbodyMod)
{ here->BSIM4_78 = m * (gcdbdb - here->BSIM4gbd);
here->BSIM4_79 = m * (here->BSIM4gbs - gcsbsb);
here->BSIM4_80 = m * (gcdbdb - here->BSIM4gbd);
here->BSIM4_81 = m * (here->BSIM4gbd - gcdbdb
+ here->BSIM4grbpd + here->BSIM4grbdb);
here->BSIM4_82 = m * here->BSIM4grbpd;
here->BSIM4_83 = m * here->BSIM4grbdb;
here->BSIM4_84 = m * here->BSIM4grbpd;
here->BSIM4_85 = m * here->BSIM4grbpb;
here->BSIM4_86 = m * here->BSIM4grbps;
here->BSIM4_87 = m * (here->BSIM4grbpd + here->BSIM4grbps
{ here->BSIM4_78 = mult_q * gcdbdb - mult_i * here->BSIM4gbd;
here->BSIM4_79 = mult_i * here->BSIM4gbs - mult_q * gcsbsb;
here->BSIM4_80 = mult_q * gcdbdb - mult_i * here->BSIM4gbd;
here->BSIM4_81 = mult_i * (here->BSIM4gbd + here->BSIM4grbpd + here->BSIM4grbdb) - mult_q * gcdbdb;
here->BSIM4_82 = mult_i * here->BSIM4grbpd;
here->BSIM4_83 = mult_i * here->BSIM4grbdb;
here->BSIM4_84 = mult_i * here->BSIM4grbpd;
here->BSIM4_85 = mult_i * here->BSIM4grbpb;
here->BSIM4_86 = mult_i * here->BSIM4grbps;
here->BSIM4_87 = mult_i * (here->BSIM4grbpd + here->BSIM4grbps
+ here->BSIM4grbpb);
/* WDLiu: (gcbbb - here->BSIM4gbbs) already added to BPbpPtr */
here->BSIM4_88 = m * (gcsbsb - here->BSIM4gbs);
here->BSIM4_89 = m * here->BSIM4grbps;
here->BSIM4_90 = m * here->BSIM4grbsb;
here->BSIM4_91 = m * (here->BSIM4gbs - gcsbsb
here->BSIM4_88 = mult_q * gcsbsb - mult_i * here->BSIM4gbs;
here->BSIM4_89 = mult_i * here->BSIM4grbps;
here->BSIM4_90 = mult_i * here->BSIM4grbsb;
here->BSIM4_91 = mult_i * (here->BSIM4gbs - gcsbsb
+ here->BSIM4grbps + here->BSIM4grbsb);
here->BSIM4_92 = m * here->BSIM4grbdb;
here->BSIM4_93 = m * here->BSIM4grbpb;
here->BSIM4_94 = m * here->BSIM4grbsb;
here->BSIM4_95 = m * (here->BSIM4grbsb + here->BSIM4grbdb
here->BSIM4_92 = mult_i * here->BSIM4grbdb;
here->BSIM4_93 = mult_i * here->BSIM4grbpb;
here->BSIM4_94 = mult_i * here->BSIM4grbsb;
here->BSIM4_95 = mult_i * (here->BSIM4grbsb + here->BSIM4grbdb
+ here->BSIM4grbpb);
}
@ -5217,95 +5222,92 @@ line900:
}
#else
if (here->BSIM4rgateMod == 1)
{ (*(here->BSIM4GEgePtr) += m * geltd);
(*(here->BSIM4GPgePtr) -= m * geltd);
(*(here->BSIM4GEgpPtr) -= m * geltd);
(*(here->BSIM4GPgpPtr) += m * (gcggb + geltd - ggtg + gIgtotg));
(*(here->BSIM4GPdpPtr) += m * (gcgdb - ggtd + gIgtotd));
(*(here->BSIM4GPspPtr) += m * (gcgsb - ggts + gIgtots));
(*(here->BSIM4GPbpPtr) += m * (gcgbb - ggtb + gIgtotb));
{ (*(here->BSIM4GEgePtr) += mult_i * geltd);
(*(here->BSIM4GPgePtr) -= mult_i * geltd);
(*(here->BSIM4GEgpPtr) -= mult_i * geltd);
(*(here->BSIM4GPgpPtr) += mult_q * (gcggb - ggtg) + mult_i * (geltd + gIgtotg));
(*(here->BSIM4GPdpPtr) += mult_q * (gcgdb - ggtd) + mult_i * gIgtotd);
(*(here->BSIM4GPspPtr) += mult_q * (gcgsb - ggts) + mult_i * gIgtots);
(*(here->BSIM4GPbpPtr) += mult_q * (gcgbb - ggtb) + mult_i * gIgtotb);
} /* WDLiu: gcrg already subtracted from all gcrgg below */
else if (here->BSIM4rgateMod == 2)
{ (*(here->BSIM4GEgePtr) += m * gcrg);
(*(here->BSIM4GEgpPtr) += m * gcrgg);
(*(here->BSIM4GEdpPtr) += m * gcrgd);
(*(here->BSIM4GEspPtr) += m * gcrgs);
(*(here->BSIM4GEbpPtr) += m * gcrgb);
(*(here->BSIM4GPgePtr) -= m * gcrg);
(*(here->BSIM4GPgpPtr) += m * (gcggb - gcrgg - ggtg + gIgtotg));
(*(here->BSIM4GPdpPtr) += m * (gcgdb - gcrgd - ggtd + gIgtotd));
(*(here->BSIM4GPspPtr) += m * (gcgsb - gcrgs - ggts + gIgtots));
(*(here->BSIM4GPbpPtr) += m * (gcgbb - gcrgb - ggtb + gIgtotb));
{ (*(here->BSIM4GEgePtr) += mult_i * gcrg);
(*(here->BSIM4GEgpPtr) += mult_i * gcrgg);
(*(here->BSIM4GEdpPtr) += mult_i * gcrgd);
(*(here->BSIM4GEspPtr) += mult_i * gcrgs);
(*(here->BSIM4GEbpPtr) += mult_i * gcrgb);
(*(here->BSIM4GPgePtr) -= mult_i * gcrg);
(*(here->BSIM4GPgpPtr) += mult_q * (gcggb - ggtg) + mult_i * (gIgtotg - gcrgg));
(*(here->BSIM4GPdpPtr) += mult_q * (gcgdb - ggtd) + mult_i * (gIgtotd - gcrgd));
(*(here->BSIM4GPspPtr) += mult_q * (gcgsb - ggts) + mult_i * (gIgtots - gcrgs));
(*(here->BSIM4GPbpPtr) += mult_q * (gcgbb - ggtb) + mult_i * (gIgtotb - gcrgb));
}
else if (here->BSIM4rgateMod == 3)
{ (*(here->BSIM4GEgePtr) += m * geltd);
(*(here->BSIM4GEgmPtr) -= m * geltd);
(*(here->BSIM4GMgePtr) -= m * geltd);
(*(here->BSIM4GMgmPtr) += m * (geltd + gcrg + gcgmgmb));
{ (*(here->BSIM4GEgePtr) += mult_i * geltd);
(*(here->BSIM4GEgmPtr) -= mult_i * geltd);
(*(here->BSIM4GMgePtr) -= mult_i * geltd);
(*(here->BSIM4GMgmPtr) += mult_i * (geltd + gcrg) + mult_q * gcgmgmb);
(*(here->BSIM4GMdpPtr) += m * (gcrgd + gcgmdb));
(*(here->BSIM4GMgpPtr) += m * gcrgg);
(*(here->BSIM4GMspPtr) += m * (gcrgs + gcgmsb));
(*(here->BSIM4GMbpPtr) += m * (gcrgb + gcgmbb));
(*(here->BSIM4GMdpPtr) += mult_i * gcrgd + mult_q * gcgmdb);
(*(here->BSIM4GMgpPtr) += mult_i * gcrgg);
(*(here->BSIM4GMspPtr) += mult_i * gcrgs + mult_q * gcgmsb);
(*(here->BSIM4GMbpPtr) += mult_i * gcrgb + mult_q * gcgmbb);
(*(here->BSIM4DPgmPtr) += m * gcdgmb);
(*(here->BSIM4GPgmPtr) -= m * gcrg);
(*(here->BSIM4SPgmPtr) += m * gcsgmb);
(*(here->BSIM4BPgmPtr) += m * gcbgmb);
(*(here->BSIM4DPgmPtr) += mult_q * gcdgmb);
(*(here->BSIM4GPgmPtr) -= mult_i * gcrg);
(*(here->BSIM4SPgmPtr) += mult_q * gcsgmb);
(*(here->BSIM4BPgmPtr) += mult_q * gcbgmb);
(*(here->BSIM4GPgpPtr) += m * (gcggb - gcrgg - ggtg + gIgtotg));
(*(here->BSIM4GPdpPtr) += m * (gcgdb - gcrgd - ggtd + gIgtotd));
(*(here->BSIM4GPspPtr) += m * (gcgsb - gcrgs - ggts + gIgtots));
(*(here->BSIM4GPbpPtr) += m * (gcgbb - gcrgb - ggtb + gIgtotb));
(*(here->BSIM4GPgpPtr) += mult_q * (gcggb - ggtg) + mult_i * (gIgtotg - gcrgg));
(*(here->BSIM4GPdpPtr) += mult_q * (gcgdb - ggtd) + mult_i * (gIgtotd - gcrgd));
(*(here->BSIM4GPspPtr) += mult_q * (gcgsb - ggts) + mult_i * (gIgtots - gcrgs));
(*(here->BSIM4GPbpPtr) += mult_q * (gcgbb - ggtb) + mult_i * (gIgtotb - gcrgb));
}
else
{ (*(here->BSIM4GPgpPtr) += m * (gcggb - ggtg + gIgtotg));
(*(here->BSIM4GPdpPtr) += m * (gcgdb - ggtd + gIgtotd));
(*(here->BSIM4GPspPtr) += m * (gcgsb - ggts + gIgtots));
(*(here->BSIM4GPbpPtr) += m * (gcgbb - ggtb + gIgtotb));
{ (*(here->BSIM4GPgpPtr) += mult_q * (gcggb - ggtg) + mult_i * gIgtotg);
(*(here->BSIM4GPdpPtr) += mult_q * (gcgdb - ggtd) + mult_i * gIgtotd);
(*(here->BSIM4GPspPtr) += mult_q * (gcgsb - ggts) + mult_i * gIgtots);
(*(here->BSIM4GPbpPtr) += mult_q * (gcgbb - ggtb) + mult_i * gIgtotb);
}
if (model->BSIM4rdsMod)
{ (*(here->BSIM4DgpPtr) += m * gdtotg);
(*(here->BSIM4DspPtr) += m * gdtots);
(*(here->BSIM4DbpPtr) += m * gdtotb);
(*(here->BSIM4SdpPtr) += m * gstotd);
(*(here->BSIM4SgpPtr) += m * gstotg);
(*(here->BSIM4SbpPtr) += m * gstotb);
}
(*(here->BSIM4DPdpPtr) += m * (gdpr + here->BSIM4gds + here->BSIM4gbd + T1 * ddxpart_dVd
- gdtotd + RevSum + gcddb + gbdpdp + dxpart * ggtd - gIdtotd));
(*(here->BSIM4DPdPtr) -= m * (gdpr + gdtot));
(*(here->BSIM4DPgpPtr) += m * (Gm + gcdgb - gdtotg + gbdpg - gIdtotg
+ dxpart * ggtg + T1 * ddxpart_dVg));
(*(here->BSIM4DPspPtr) -= m * (here->BSIM4gds + gdtots - dxpart * ggts + gIdtots
- T1 * ddxpart_dVs + FwdSum - gcdsb - gbdpsp));
(*(here->BSIM4DPbpPtr) -= m * (gjbd + gdtotb - Gmbs - gcdbb - gbdpb + gIdtotb
- T1 * ddxpart_dVb - dxpart * ggtb));
(*(here->BSIM4DdpPtr) -= m * (gdpr - gdtotd));
(*(here->BSIM4DdPtr) += m * (gdpr + gdtot));
(*(here->BSIM4SPdpPtr) -= m * (here->BSIM4gds + gstotd + RevSum - gcsdb - gbspdp
- T1 * dsxpart_dVd - sxpart * ggtd + gIstotd));
(*(here->BSIM4SPgpPtr) += m * (gcsgb - Gm - gstotg + gbspg + sxpart * ggtg
+ T1 * dsxpart_dVg - gIstotg));
(*(here->BSIM4SPspPtr) += m * (gspr + here->BSIM4gds + here->BSIM4gbs + T1 * dsxpart_dVs
- gstots + FwdSum + gcssb + gbspsp + sxpart * ggts - gIstots));
(*(here->BSIM4SPsPtr) -= m * (gspr + gstot));
(*(here->BSIM4SPbpPtr) -= m * (gjbs + gstotb + Gmbs - gcsbb - gbspb - sxpart * ggtb
- T1 * dsxpart_dVb + gIstotb));
(*(here->BSIM4SspPtr) -= m * (gspr - gstots));
(*(here->BSIM4SsPtr) += m * (gspr + gstot));
(*(here->BSIM4BPdpPtr) += m * (gcbdb - gjbd + gbbdp - gIbtotd));
(*(here->BSIM4BPgpPtr) += m * (gcbgb - here->BSIM4gbgs - gIbtotg));
(*(here->BSIM4BPspPtr) += m * (gcbsb - gjbs + gbbsp - gIbtots));
(*(here->BSIM4BPbpPtr) += m * (gjbd + gjbs + gcbbb - here->BSIM4gbbs
- gIbtotb));
{ (*(here->BSIM4DgpPtr) += mult_i * gdtotg);
(*(here->BSIM4DspPtr) += mult_i * gdtots);
(*(here->BSIM4DbpPtr) += mult_i * gdtotb);
(*(here->BSIM4SdpPtr) += mult_i * gstotd);
(*(here->BSIM4SgpPtr) += mult_i * gstotg);
(*(here->BSIM4SbpPtr) += mult_i * gstotb);
}
(*(here->BSIM4DPdpPtr) += mult_i * (gdpr + here->BSIM4gds + here->BSIM4gbd
- gdtotd + RevSum + gbdpdp - gIdtotd) + mult_q * (T1 * ddxpart_dVd + gcddb + dxpart * ggtd));
(*(here->BSIM4DPdPtr) -= mult_i * (gdpr + gdtot));
(*(here->BSIM4DPgpPtr) += mult_i * (Gm - gdtotg + gbdpg - gIdtotg)
+ mult_q * (dxpart * ggtg + T1 * ddxpart_dVg + gcdgb));
(*(here->BSIM4DPspPtr) -= mult_i * (here->BSIM4gds + gdtots + gIdtots
+ FwdSum - gbdpsp) - mult_q * (dxpart * ggts + T1 * ddxpart_dVs + gcdsb));
(*(here->BSIM4DPbpPtr) -= mult_i * (gjbd + gdtotb - Gmbs - gbdpb + gIdtotb)
- mult_q * (dxpart * ggtb + gcdbb + T1 * ddxpart_dVb));
(*(here->BSIM4DdpPtr) -= mult_i * (gdpr - gdtotd));
(*(here->BSIM4DdPtr) += mult_i * (gdpr + gdtot));
(*(here->BSIM4SPdpPtr) -= mult_i * (here->BSIM4gds + gstotd + RevSum - gbspdp + gIstotd)
- mult_q * (T1 * dsxpart_dVd + sxpart * ggtd + gcsdb));
(*(here->BSIM4SPgpPtr) += mult_q * (gcsgb + sxpart * ggtg + T1 * dsxpart_dVg) + mult_i * (gbspg - Gm - gstotg - gIstotg));
(*(here->BSIM4SPspPtr) += mult_i * (gspr + here->BSIM4gds + here->BSIM4gbs - gIstots - gstots + FwdSum + gbspsp) + mult_q * (sxpart * ggts + T1 * dsxpart_dVs + gcssb));
(*(here->BSIM4SPsPtr) -= mult_i * (gspr + gstot));
(*(here->BSIM4SPbpPtr) -= mult_i * (gjbs + gstotb + Gmbs - gbspb + gIstotb) - mult_q * (gcsbb + sxpart * ggtb + T1 * dsxpart_dVb));
(*(here->BSIM4SspPtr) -= mult_i * (gspr - gstots));
(*(here->BSIM4SsPtr) += mult_i * (gspr + gstot));
(*(here->BSIM4BPdpPtr) += mult_q * gcbdb - mult_i * (gjbd - gbbdp + gIbtotd));
(*(here->BSIM4BPgpPtr) += mult_q * gcbgb - mult_i * (here->BSIM4gbgs + gIbtotg));
(*(here->BSIM4BPspPtr) += mult_q * gcbsb - mult_i * (gjbs - gbbsp + gIbtots));
(*(here->BSIM4BPbpPtr) += mult_i * (gjbd + gjbs - here->BSIM4gbbs
- gIbtotb) + mult_q * gcbbb);
ggidld = here->BSIM4ggidld;
ggidlg = here->BSIM4ggidlg;
@ -5315,52 +5317,50 @@ line900:
ggislb = here->BSIM4ggislb;
/* stamp gidl */
(*(here->BSIM4DPdpPtr) += m * ggidld);
(*(here->BSIM4DPgpPtr) += m * ggidlg);
(*(here->BSIM4DPspPtr) -= m * (ggidlg + ggidld + ggidlb));
(*(here->BSIM4DPbpPtr) += m * ggidlb);
(*(here->BSIM4BPdpPtr) -= m * ggidld);
(*(here->BSIM4BPgpPtr) -= m * ggidlg);
(*(here->BSIM4BPspPtr) += m * (ggidlg + ggidld + ggidlb));
(*(here->BSIM4BPbpPtr) -= m * ggidlb);
(*(here->BSIM4DPdpPtr) += mult_i * ggidld);
(*(here->BSIM4DPgpPtr) += mult_i * ggidlg);
(*(here->BSIM4DPspPtr) -= mult_i * (ggidlg + ggidld + ggidlb));
(*(here->BSIM4DPbpPtr) += mult_i * ggidlb);
(*(here->BSIM4BPdpPtr) -= mult_i * ggidld);
(*(here->BSIM4BPgpPtr) -= mult_i * ggidlg);
(*(here->BSIM4BPspPtr) += mult_i * (ggidlg + ggidld + ggidlb));
(*(here->BSIM4BPbpPtr) -= mult_i * ggidlb);
/* stamp gisl */
(*(here->BSIM4SPdpPtr) -= m * (ggisls + ggislg + ggislb));
(*(here->BSIM4SPgpPtr) += m * ggislg);
(*(here->BSIM4SPspPtr) += m * ggisls);
(*(here->BSIM4SPbpPtr) += m * ggislb);
(*(here->BSIM4BPdpPtr) += m * (ggislg + ggisls + ggislb));
(*(here->BSIM4BPgpPtr) -= m * ggislg);
(*(here->BSIM4BPspPtr) -= m * ggisls);
(*(here->BSIM4BPbpPtr) -= m * ggislb);
(*(here->BSIM4SPdpPtr) -= mult_i * (ggisls + ggislg + ggislb));
(*(here->BSIM4SPgpPtr) += mult_i * ggislg);
(*(here->BSIM4SPspPtr) += mult_i * ggisls);
(*(here->BSIM4SPbpPtr) += mult_i * ggislb);
(*(here->BSIM4BPdpPtr) += mult_i * (ggislg + ggisls + ggislb));
(*(here->BSIM4BPgpPtr) -= mult_i * ggislg);
(*(here->BSIM4BPspPtr) -= mult_i * ggisls);
(*(here->BSIM4BPbpPtr) -= mult_i * ggislb);
if (here->BSIM4rbodyMod)
{ (*(here->BSIM4DPdbPtr) += m * (gcdbdb - here->BSIM4gbd));
(*(here->BSIM4SPsbPtr) -= m * (here->BSIM4gbs - gcsbsb));
(*(here->BSIM4DBdpPtr) += m * (gcdbdb - here->BSIM4gbd));
(*(here->BSIM4DBdbPtr) += m * (here->BSIM4gbd - gcdbdb
+ here->BSIM4grbpd + here->BSIM4grbdb));
(*(here->BSIM4DBbpPtr) -= m * here->BSIM4grbpd);
(*(here->BSIM4DBbPtr) -= m * here->BSIM4grbdb);
(*(here->BSIM4BPdbPtr) -= m * here->BSIM4grbpd);
(*(here->BSIM4BPbPtr) -= m * here->BSIM4grbpb);
(*(here->BSIM4BPsbPtr) -= m * here->BSIM4grbps);
(*(here->BSIM4BPbpPtr) += m * (here->BSIM4grbpd + here->BSIM4grbps
{ (*(here->BSIM4DPdbPtr) += mult_q * gcdbdb - mult_i * here->BSIM4gbd);
(*(here->BSIM4SPsbPtr) -= mult_i * here->BSIM4gbs - mult_q * gcsbsb);
(*(here->BSIM4DBdpPtr) += mult_q * gcdbdb - mult_i * here->BSIM4gbd);
(*(here->BSIM4DBdbPtr) += mult_i * (here->BSIM4gbd + here->BSIM4grbpd + here->BSIM4grbdb) - mult_q * gcdbdb);
(*(here->BSIM4DBbpPtr) -= mult_i * here->BSIM4grbpd);
(*(here->BSIM4DBbPtr) -= mult_i * here->BSIM4grbdb);
(*(here->BSIM4BPdbPtr) -= mult_i * here->BSIM4grbpd);
(*(here->BSIM4BPbPtr) -= mult_i * here->BSIM4grbpb);
(*(here->BSIM4BPsbPtr) -= mult_i * here->BSIM4grbps);
(*(here->BSIM4BPbpPtr) += mult_i * (here->BSIM4grbpd + here->BSIM4grbps
+ here->BSIM4grbpb));
/* WDLiu: (gcbbb - here->BSIM4gbbs) already added to BPbpPtr */
(*(here->BSIM4SBspPtr) += m * (gcsbsb - here->BSIM4gbs));
(*(here->BSIM4SBbpPtr) -= m * here->BSIM4grbps);
(*(here->BSIM4SBbPtr) -= m * here->BSIM4grbsb);
(*(here->BSIM4SBsbPtr) += m * (here->BSIM4gbs - gcsbsb
+ here->BSIM4grbps + here->BSIM4grbsb));
(*(here->BSIM4SBspPtr) += mult_q * gcsbsb - mult_i * here->BSIM4gbs);
(*(here->BSIM4SBbpPtr) -= mult_i * here->BSIM4grbps);
(*(here->BSIM4SBbPtr) -= mult_i * here->BSIM4grbsb);
(*(here->BSIM4SBsbPtr) += mult_i * (here->BSIM4gbs + here->BSIM4grbps + here->BSIM4grbsb) - mult_q * gcsbsb);
(*(here->BSIM4BdbPtr) -= m * here->BSIM4grbdb);
(*(here->BSIM4BbpPtr) -= m * here->BSIM4grbpb);
(*(here->BSIM4BsbPtr) -= m * here->BSIM4grbsb);
(*(here->BSIM4BbPtr) += m * (here->BSIM4grbsb + here->BSIM4grbdb
(*(here->BSIM4BdbPtr) -= mult_i * here->BSIM4grbdb);
(*(here->BSIM4BbpPtr) -= mult_i * here->BSIM4grbpb);
(*(here->BSIM4BsbPtr) -= mult_i * here->BSIM4grbsb);
(*(here->BSIM4BbPtr) += mult_i * (here->BSIM4grbsb + here->BSIM4grbdb
+ here->BSIM4grbpb));
}
@ -5371,9 +5371,9 @@ line900:
(*(here->BSIM4QspPtr) += m * (ggts - gcqsb));
(*(here->BSIM4QbpPtr) += m * (ggtb - gcqbb));
(*(here->BSIM4DPqPtr) += m * dxpart * here->BSIM4gtau);
(*(here->BSIM4SPqPtr) += m * sxpart * here->BSIM4gtau);
(*(here->BSIM4GPqPtr) -= m * here->BSIM4gtau);
(*(here->BSIM4DPqPtr) += m * (dxpart * here->BSIM4gtau));
(*(here->BSIM4SPqPtr) += m * (sxpart * here->BSIM4gtau));
(*(here->BSIM4GPqPtr) -= m * (here->BSIM4gtau));
}
#endif

102
src/spicelib/devices/bsim4/b4mask.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
@ -91,9 +87,6 @@ IFvalue *value)
case BSIM4_MOD_GEOMOD :
value->iValue = model->BSIM4geoMod;
return(OK);
case BSIM4_MOD_RGEOMOD :
value->iValue = model->BSIM4rgeoMod;
return(OK);
case BSIM4_MOD_MTRLMOD :
value->iValue = model->BSIM4mtrlMod;
return(OK);
@ -210,6 +203,9 @@ IFvalue *value)
case BSIM4_MOD_KETA:
value->rValue = model->BSIM4keta;
return(OK);
case BSIM4_MOD_KETAC:
value->rValue = model->BSIM4ketac;
return(OK);
case BSIM4_MOD_NSUB:
value->rValue = model->BSIM4nsub;
return(OK);
@ -957,12 +953,12 @@ IFvalue *value)
case BSIM4_MOD_XGL:
value->rValue = model->BSIM4xgl;
return(OK);
case BSIM4_MOD_RSHG:
value->rValue = model->BSIM4rshg;
return(OK);
case BSIM4_MOD_NGCON:
value->rValue = model->BSIM4ngcon;
return(OK);
case BSIM4_MOD_RSHG:
value->rValue = model->BSIM4rshg;
return(OK);
case BSIM4_MOD_TCJ:
value->rValue = model->BSIM4tcj;
return(OK);
@ -1022,6 +1018,9 @@ IFvalue *value)
case BSIM4_MOD_LKETA:
value->rValue = model->BSIM4lketa;
return(OK);
case BSIM4_MOD_LKETAC:
value->rValue = model->BSIM4lketac;
return(OK);
case BSIM4_MOD_LNSUB:
value->rValue = model->BSIM4lnsub;
return(OK);
@ -1178,6 +1177,9 @@ IFvalue *value)
case BSIM4_MOD_LTVOFFCV: /* v4.7 temp dep of leakage current */
value->rValue = model->BSIM4ltvoffcv;
return(OK);
case BSIM4_MOD_LINTNOI:
value->rValue = model->BSIM4lintnoi;
return(OK);
case BSIM4_MOD_LMINV:
value->rValue = model->BSIM4lminv;
return(OK);
@ -1391,6 +1393,15 @@ IFvalue *value)
case BSIM4_MOD_LXRCRG2:
value->rValue = model->BSIM4lxrcrg2;
return(OK);
case BSIM4_MOD_LLAMBDA:
value->rValue = model->BSIM4llambda;
return(OK);
case BSIM4_MOD_LVTL:
value->rValue = model->BSIM4lvtl;
return(OK);
case BSIM4_MOD_LXN:
value->rValue = model->BSIM4lxn;
return(OK);
case BSIM4_MOD_LEU:
value->rValue = model->BSIM4leu;
return(OK);
@ -1444,16 +1455,6 @@ IFvalue *value)
value->rValue = model->BSIM4ltvfbsdoff;
return(OK);
case BSIM4_MOD_LLAMBDA:
value->rValue = model->BSIM4llambda;
return(OK);
case BSIM4_MOD_LVTL:
value->rValue = model->BSIM4lvtl;
return(OK);
case BSIM4_MOD_LXN:
value->rValue = model->BSIM4lxn;
return(OK);
/* Width dependence */
case BSIM4_MOD_WCDSC :
value->rValue = model->BSIM4wcdsc;
@ -1494,6 +1495,9 @@ IFvalue *value)
case BSIM4_MOD_WKETA:
value->rValue = model->BSIM4wketa;
return(OK);
case BSIM4_MOD_WKETAC:
value->rValue = model->BSIM4wketac;
return(OK);
case BSIM4_MOD_WNSUB:
value->rValue = model->BSIM4wnsub;
return(OK);
@ -1863,6 +1867,15 @@ IFvalue *value)
case BSIM4_MOD_WXRCRG2:
value->rValue = model->BSIM4wxrcrg2;
return(OK);
case BSIM4_MOD_WLAMBDA:
value->rValue = model->BSIM4wlambda;
return(OK);
case BSIM4_MOD_WVTL:
value->rValue = model->BSIM4wvtl;
return(OK);
case BSIM4_MOD_WXN:
value->rValue = model->BSIM4wxn;
return(OK);
case BSIM4_MOD_WEU:
value->rValue = model->BSIM4weu;
return(OK);
@ -1916,16 +1929,6 @@ IFvalue *value)
value->rValue = model->BSIM4wtvfbsdoff;
return(OK);
case BSIM4_MOD_WLAMBDA:
value->rValue = model->BSIM4wlambda;
return(OK);
case BSIM4_MOD_WVTL:
value->rValue = model->BSIM4wvtl;
return(OK);
case BSIM4_MOD_WXN:
value->rValue = model->BSIM4wxn;
return(OK);
/* Cross-term dependence */
case BSIM4_MOD_PCDSC :
value->rValue = model->BSIM4pcdsc;
@ -1966,6 +1969,9 @@ IFvalue *value)
case BSIM4_MOD_PKETA:
value->rValue = model->BSIM4pketa;
return(OK);
case BSIM4_MOD_PKETAC:
value->rValue = model->BSIM4pketac;
return(OK);
case BSIM4_MOD_PNSUB:
value->rValue = model->BSIM4pnsub;
return(OK);
@ -2335,6 +2341,15 @@ IFvalue *value)
case BSIM4_MOD_PXRCRG2:
value->rValue = model->BSIM4pxrcrg2;
return(OK);
case BSIM4_MOD_PLAMBDA:
value->rValue = model->BSIM4plambda;
return(OK);
case BSIM4_MOD_PVTL:
value->rValue = model->BSIM4pvtl;
return(OK);
case BSIM4_MOD_PXN:
value->rValue = model->BSIM4pxn;
return(OK);
case BSIM4_MOD_PEU:
value->rValue = model->BSIM4peu;
return(OK);
@ -2388,16 +2403,6 @@ IFvalue *value)
value->rValue = model->BSIM4ptvfbsdoff;
return(OK);
case BSIM4_MOD_PLAMBDA:
value->rValue = model->BSIM4plambda;
return(OK);
case BSIM4_MOD_PVTL:
value->rValue = model->BSIM4pvtl;
return(OK);
case BSIM4_MOD_PXN:
value->rValue = model->BSIM4pxn;
return(OK);
case BSIM4_MOD_TNOM :
value->rValue = model->BSIM4tnom;
return(OK);
@ -2500,9 +2505,6 @@ IFvalue *value)
case BSIM4_MOD_XTID:
value->rValue = model->BSIM4DjctTempExponent;
return(OK);
case BSIM4_MOD_LINTNOI:
value->rValue = model->BSIM4lintnoi;
return(OK);
case BSIM4_MOD_LINT:
value->rValue = model->BSIM4Lint;
return(OK);

18
src/spicelib/devices/bsim4/b4mdel.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"

68
src/spicelib/devices/bsim4/b4mpar.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
@ -93,10 +89,6 @@ GENmodel *inMod)
mod->BSIM4geoMod = value->iValue;
mod->BSIM4geoModGiven = TRUE;
break;
case BSIM4_MOD_RGEOMOD :
mod->BSIM4rgeoMod = value->iValue;
mod->BSIM4rgeoModGiven = TRUE;
break;
case BSIM4_MOD_FNOIMOD :
mod->BSIM4fnoiMod = value->iValue;
mod->BSIM4fnoiModGiven = TRUE;
@ -134,6 +126,14 @@ GENmodel *inMod)
mod->BSIM4version = value->sValue;
mod->BSIM4versionGiven = TRUE;
break;
case BSIM4_MOD_GIDLCLAMP : /* gidlclamp introduced in b4mpar.c */
mod->BSIM4gidlclamp = value->rValue;
mod->BSIM4gidlclampGiven = TRUE;
break;
case BSIM4_MOD_IDOVVDSC : /* idovvdsc introduced in b4mpar.c */
mod->BSIM4idovvdsc = value->rValue;
mod->BSIM4idovvdscGiven = TRUE;
break;
case BSIM4_MOD_TOXREF :
mod->BSIM4toxref = value->rValue;
mod->BSIM4toxrefGiven = TRUE;
@ -186,7 +186,6 @@ GENmodel *inMod)
mod->BSIM4epsrox = value->rValue;
mod->BSIM4epsroxGiven = TRUE;
break;
case BSIM4_MOD_CDSC :
mod->BSIM4cdsc = value->rValue;
mod->BSIM4cdscGiven = TRUE;
@ -195,12 +194,10 @@ GENmodel *inMod)
mod->BSIM4cdscb = value->rValue;
mod->BSIM4cdscbGiven = TRUE;
break;
case BSIM4_MOD_CDSCD :
mod->BSIM4cdscd = value->rValue;
mod->BSIM4cdscdGiven = TRUE;
break;
case BSIM4_MOD_CIT :
mod->BSIM4cit = value->rValue;
mod->BSIM4citGiven = TRUE;
@ -243,6 +240,10 @@ GENmodel *inMod)
mod->BSIM4keta = value->rValue;
mod->BSIM4ketaGiven = TRUE;
break;
case BSIM4_MOD_KETAC:
mod->BSIM4ketac = value->rValue;
mod->BSIM4ketacGiven = TRUE;
break;
case BSIM4_MOD_NSUB:
mod->BSIM4nsub = value->rValue;
mod->BSIM4nsubGiven = TRUE;
@ -288,13 +289,13 @@ GENmodel *inMod)
case BSIM4_MOD_NSD:
mod->BSIM4nsd = value->rValue;
mod->BSIM4nsdGiven = TRUE;
if (mod->BSIM4nsd > 1.000001e24)
if (mod->BSIM4nsd > 1.0e23)
mod->BSIM4nsd *= 1.0e-6;
break;
case BSIM4_MOD_NGATE:
mod->BSIM4ngate = value->rValue;
mod->BSIM4ngateGiven = TRUE;
if (mod->BSIM4ngate > 1.000001e24)
if (mod->BSIM4ngate > 1.0e23)
mod->BSIM4ngate *= 1.0e-6;
break;
case BSIM4_MOD_GAMMA1:
@ -525,8 +526,6 @@ GENmodel *inMod)
mod->BSIM4plp = value->rValue;
mod->BSIM4plpGiven = TRUE;
break;
case BSIM4_MOD_VOFF:
mod->BSIM4voff = value->rValue;
mod->BSIM4voffGiven = TRUE;
@ -1121,6 +1120,7 @@ GENmodel *inMod)
mod->BSIM4jtsswgd = value->rValue;
mod->BSIM4jtsswgdGiven = TRUE;
break;
case BSIM4_MOD_JTWEFF :
mod->BSIM4jtweff = value->rValue;
mod->BSIM4jtweffGiven = TRUE;
@ -1499,8 +1499,6 @@ GENmodel *inMod)
mod->BSIM4lcdsc = value->rValue;
mod->BSIM4lcdscGiven = TRUE;
break;
case BSIM4_MOD_LCDSCB :
mod->BSIM4lcdscb = value->rValue;
mod->BSIM4lcdscbGiven = TRUE;
@ -1551,6 +1549,10 @@ GENmodel *inMod)
mod->BSIM4lketa = value->rValue;
mod->BSIM4lketaGiven = TRUE;
break;
case BSIM4_MOD_LKETAC:
mod->BSIM4lketac = value->rValue;
mod->BSIM4lketacGiven = TRUE;
break;
case BSIM4_MOD_LNSUB:
mod->BSIM4lnsub = value->rValue;
mod->BSIM4lnsubGiven = TRUE;
@ -2171,6 +2173,10 @@ GENmodel *inMod)
mod->BSIM4wketa = value->rValue;
mod->BSIM4wketaGiven = TRUE;
break;
case BSIM4_MOD_WKETAC:
mod->BSIM4wketac = value->rValue;
mod->BSIM4wketacGiven = TRUE;
break;
case BSIM4_MOD_WNSUB:
mod->BSIM4wnsub = value->rValue;
mod->BSIM4wnsubGiven = TRUE;
@ -2791,6 +2797,10 @@ GENmodel *inMod)
mod->BSIM4pketa = value->rValue;
mod->BSIM4pketaGiven = TRUE;
break;
case BSIM4_MOD_PKETAC:
mod->BSIM4pketac = value->rValue;
mod->BSIM4pketacGiven = TRUE;
break;
case BSIM4_MOD_PNSUB:
mod->BSIM4pnsub = value->rValue;
mod->BSIM4pnsubGiven = TRUE;
@ -3608,15 +3618,6 @@ GENmodel *inMod)
mod->BSIM4kfGiven = TRUE;
break;
case BSIM4_MOD_GIDLCLAMP:
mod->BSIM4gidlclamp = value->rValue;
mod->BSIM4gidlclampGiven = TRUE;
break;
case BSIM4_MOD_IDOVVDSC:
mod->BSIM4idovvdsc = value->rValue;
mod->BSIM4idovvdscGiven = TRUE;
break;
case BSIM4_MOD_VGS_MAX:
mod->BSIM4vgsMax = value->rValue;
mod->BSIM4vgsMaxGiven = TRUE;
@ -3681,3 +3682,4 @@ GENmodel *inMod)
}

122
src/spicelib/devices/bsim4/b4noi.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
@ -50,7 +46,7 @@ double freq, double temp)
{
struct bsim4SizeDependParam *pParam;
double cd, esat, DelClm, EffFreq, N0, Nl, Leff, Leffsq;
double T0=0.0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Ssi;
double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Ssi;
pParam = here->pParam;
cd = fabs(here->BSIM4cd);
@ -85,7 +81,6 @@ double T0=0.0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Ssi;
return Ssi;
}
int
BSIM4noise (
int mode, int operation,
@ -94,8 +89,6 @@ CKTcircuit *ckt,
Ndata *data,
double *OnDens)
{
NOISEAN *job = (NOISEAN *) ckt->CKTcurJob;
BSIM4model *model = (BSIM4model *)inModel;
BSIM4instance *here;
struct bsim4SizeDependParam *pParam;
@ -113,8 +106,7 @@ double eta, Leff, Lvsat, gamma, delta, epsilon, GammaGd0=0.0;
double npart_c, sigrat=0.0, C0, omega, ctnoi=0.0;
int i;
double m;
double mult_i, mult_fn;
/* define the names of the noise sources */
static char *BSIM4nNames[BSIM4NSRCS] =
@ -138,10 +130,6 @@ double m;
for (; model != NULL; model = BSIM4nextModel(model))
{
if(model->BSIM4tnoiMod != 2) {
noizDens[BSIM4CORLNOIZ] = 0.0;
lnNdens[BSIM4CORLNOIZ] = N_MINLOG;
}
for (here = BSIM4instances(model); here != NULL;
here = BSIM4nextInstance(here))
{ pParam = here->pParam;
@ -150,7 +138,7 @@ double m;
/* see if we have to to produce a summary report */
/* if so, name all the noise generators */
if (job->NStpsSm != 0)
if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0)
{ switch (mode)
{ case N_DENS:
for (i = 0; i < BSIM4NSRCS; i++)
@ -167,7 +155,8 @@ double m;
}
break;
case N_CALC:
m = here->BSIM4m;
mult_i = here->BSIM4mult_i;
mult_fn = here->BSIM4mult_fn;
switch (mode)
{ case N_DENS:
if (model->BSIM4tnoiMod == 0)
@ -230,19 +219,19 @@ double m;
NevalSrc(&noizDens[BSIM4RDNOIZ],
&lnNdens[BSIM4RDNOIZ], ckt, THERMNOISE,
here->BSIM4dNodePrime, here->BSIM4dNode,
gdpr * m);
gdpr * mult_i);
NevalSrc(&noizDens[BSIM4RSNOIZ],
&lnNdens[BSIM4RSNOIZ], ckt, THERMNOISE,
here->BSIM4sNodePrime, here->BSIM4sNode,
gspr * m);
gspr * mult_i);
if (here->BSIM4rgateMod == 1)
{ NevalSrc(&noizDens[BSIM4RGNOIZ],
&lnNdens[BSIM4RGNOIZ], ckt, THERMNOISE,
here->BSIM4gNodePrime, here->BSIM4gNodeExt,
here->BSIM4grgeltd * m);
here->BSIM4grgeltd * mult_i);
}
else if (here->BSIM4rgateMod == 2)
{
@ -251,13 +240,13 @@ double m;
NevalSrc(&noizDens[BSIM4RGNOIZ],
&lnNdens[BSIM4RGNOIZ], ckt, THERMNOISE,
here->BSIM4gNodePrime, here->BSIM4gNodeExt,
here->BSIM4grgeltd * m / T1);
here->BSIM4grgeltd * mult_i/T1);
}
else if (here->BSIM4rgateMod == 3)
{ NevalSrc(&noizDens[BSIM4RGNOIZ],
&lnNdens[BSIM4RGNOIZ], ckt, THERMNOISE,
here->BSIM4gNodeMid, here->BSIM4gNodeExt,
here->BSIM4grgeltd * m);
here->BSIM4grgeltd * mult_i);
}
else
{ noizDens[BSIM4RGNOIZ] = 0.0;
@ -283,38 +272,38 @@ double m;
NevalSrc(&noizDens[BSIM4RBPSNOIZ],
&lnNdens[BSIM4RBPSNOIZ], ckt, THERMNOISE,
here->BSIM4bNodePrime, here->BSIM4sbNode,
here->BSIM4grbps * m);
here->BSIM4grbps * mult_i);
NevalSrc(&noizDens[BSIM4RBPDNOIZ],
&lnNdens[BSIM4RBPDNOIZ], ckt, THERMNOISE,
here->BSIM4bNodePrime, here->BSIM4dbNode,
here->BSIM4grbpd * m);
here->BSIM4grbpd * mult_i);
NevalSrc(&noizDens[BSIM4RBPBNOIZ],
&lnNdens[BSIM4RBPBNOIZ], ckt, THERMNOISE,
here->BSIM4bNodePrime, here->BSIM4bNode,
here->BSIM4grbpb * m);
here->BSIM4grbpb * mult_i);
NevalSrc(&noizDens[BSIM4RBSBNOIZ],
&lnNdens[BSIM4RBSBNOIZ], ckt, THERMNOISE,
here->BSIM4bNode, here->BSIM4sbNode,
here->BSIM4grbsb * m);
here->BSIM4grbsb * mult_i);
NevalSrc(&noizDens[BSIM4RBDBNOIZ],
&lnNdens[BSIM4RBDBNOIZ], ckt, THERMNOISE,
here->BSIM4bNode, here->BSIM4dbNode,
here->BSIM4grbdb * m);
here->BSIM4grbdb * mult_i);
}
if(bodymode == 3)
{
NevalSrc(&noizDens[BSIM4RBPSNOIZ],
&lnNdens[BSIM4RBPSNOIZ], ckt, THERMNOISE,
here->BSIM4bNodePrime, here->BSIM4sbNode,
here->BSIM4grbps * m);
here->BSIM4grbps * mult_i);
NevalSrc(&noizDens[BSIM4RBPDNOIZ],
&lnNdens[BSIM4RBPDNOIZ], ckt, THERMNOISE,
here->BSIM4bNodePrime, here->BSIM4dbNode,
here->BSIM4grbpd * m);
here->BSIM4grbpd * mult_i);
NevalSrc(&noizDens[BSIM4RBPBNOIZ],
&lnNdens[BSIM4RBPBNOIZ], ckt, THERMNOISE,
here->BSIM4bNodePrime, here->BSIM4bNode,
here->BSIM4grbpb * m);
here->BSIM4grbpb * mult_i);
noizDens[BSIM4RBSBNOIZ] = noizDens[BSIM4RBDBNOIZ] = 0.0;
lnNdens[BSIM4RBSBNOIZ] =
log(MAX(noizDens[BSIM4RBSBNOIZ], N_MINLOG));
@ -326,7 +315,7 @@ double m;
NevalSrc(&noizDens[BSIM4RBPBNOIZ],
&lnNdens[BSIM4RBPBNOIZ], ckt, THERMNOISE,
here->BSIM4bNodePrime, here->BSIM4bNode,
here->BSIM4grbpb * m);
here->BSIM4grbpb * mult_i);
noizDens[BSIM4RBPSNOIZ] = noizDens[BSIM4RBPDNOIZ] = 0.0;
noizDens[BSIM4RBSBNOIZ] = noizDens[BSIM4RBDBNOIZ] = 0.0;
lnNdens[BSIM4RBPSNOIZ] =
@ -375,10 +364,12 @@ double m;
delta = (T1 / T3 - (5.0 * T1 + T2) * T4 / (15.0 * T5) + T4 * T4 / (9.0 * T5 * T2)) / (6.0 * T6 * T6 * T6);
T7 = T0 / T2;
epsilon = (T7 - T7 * T7 * T7 / 3.0) / (6.0 * T6);
T8 = here->BSIM4Vgsteff / here->BSIM4EsatL;
T8 *= T8;
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4))) {
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) && (strncmp(model->BSIM4version, "4.8", 3)) &&
(strcmp(model->BSIM4version, "4.8.2")) && (strncmp(model->BSIM4version, "4.82", 4)) &&
(strcmp(model->BSIM4version, "4.8.3")) && (strncmp(model->BSIM4version, "4.83", 4)))
{
npart_c = model->BSIM4rnoic * (1.0 + T8
* model->BSIM4tnoic * Leff);
ctnoi = epsilon / sqrt(gamma * delta)
@ -397,8 +388,7 @@ double m;
sigrat = T0 * sqrt(delta / gamma);
}
else
{
npart_c = model->BSIM4rnoic * (1.0 + T8
{npart_c = model->BSIM4rnoic * (1.0 + T8
* model->BSIM4tnoic * Leff);
/* Limits added for rnoia, rnoib, rnoic, tnoia, tnoib and tnoic in BSIM4.8.1 */
T9 = gamma * delta ;
@ -428,10 +418,12 @@ double m;
sigrat = 0.0;
}
}
switch(model->BSIM4tnoiMod)
{ case 0:
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4))) {
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) && (strncmp(model->BSIM4version, "4.8", 3)) &&
(strcmp(model->BSIM4version, "4.8.2")) && (strncmp(model->BSIM4version, "4.82", 4)) &&
(strcmp(model->BSIM4version, "4.8.3")) && (strncmp(model->BSIM4version, "4.83", 4)))
{
T0 = here->BSIM4ueff * fabs(here->BSIM4qinv);
T1 = T0 * tmp + pParam->BSIM4leff
* pParam->BSIM4leff;
@ -439,7 +431,7 @@ double m;
&lnNdens[BSIM4IDNOIZ], ckt,
THERMNOISE, here->BSIM4dNodePrime,
here->BSIM4sNodePrime,
(T0 / T1) * model->BSIM4ntnoi * m);
(T0 / T1) * model->BSIM4ntnoi * mult_i);
}
else
{
@ -450,14 +442,17 @@ double m;
&lnNdens[BSIM4IDNOIZ], ckt,
THERMNOISE, here->BSIM4dNodePrime,
here->BSIM4sNodePrime,
(T0 / T1) * model->BSIM4ntnoi * m);
(T0 / T1) * model->BSIM4ntnoi * mult_i);
noizDens[BSIM4CORLNOIZ] = 0.0;
lnNdens[BSIM4CORLNOIZ] = log(MAX(noizDens[BSIM4CORLNOIZ], N_MINLOG));
}
break;
case 1:
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4))) {
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) && (strncmp(model->BSIM4version, "4.8", 3)) &&
(strcmp(model->BSIM4version, "4.8.2")) && (strncmp(model->BSIM4version, "4.82", 4)) &&
(strcmp(model->BSIM4version, "4.8.3")) && (strncmp(model->BSIM4version, "4.83", 4)))
{
T0 = here->BSIM4gm + here->BSIM4gmbs + here->BSIM4gds;
T0 *= T0;
igsquare = npart_theta * npart_theta * T0 / here->BSIM4IdovVds;
@ -467,7 +462,7 @@ double m;
NevalSrc(&noizDens[BSIM4IDNOIZ],
&lnNdens[BSIM4IDNOIZ], ckt,
THERMNOISE, here->BSIM4dNodePrime,
here->BSIM4sNodePrime, (T2 - igsquare) * m);
here->BSIM4sNodePrime, (T2 - igsquare) * mult_i);
}
else
{
@ -480,7 +475,7 @@ double m;
NevalSrc(&noizDens[BSIM4IDNOIZ],
&lnNdens[BSIM4IDNOIZ], ckt,
THERMNOISE, here->BSIM4dNodePrime,
here->BSIM4sNodePrime, (T2 - igsquare) * m);
here->BSIM4sNodePrime, (T2 - igsquare) * mult_i);
noizDens[BSIM4CORLNOIZ] = 0.0;
lnNdens[BSIM4CORLNOIZ] = log(MAX(noizDens[BSIM4CORLNOIZ], N_MINLOG));
@ -493,7 +488,7 @@ double m;
NevalSrc(&noizDens[BSIM4IDNOIZ],
&lnNdens[BSIM4IDNOIZ], ckt,
THERMNOISE, here->BSIM4dNodePrime,
here->BSIM4sNodePrime, T2 * T4 * m);
here->BSIM4sNodePrime, T2 * T4 * mult_i);
/* Evaluate output noise due to two correlated noise sources */
omega = 2.0 * M_PI * data->freq;
@ -505,20 +500,20 @@ double m;
NevalSrc2(&noizDens[BSIM4CORLNOIZ],
&lnNdens[BSIM4CORLNOIZ], ckt,
THERMNOISE, here->BSIM4dNodePrime,
here->BSIM4sNodePrime, T2 * T3 * m,
here->BSIM4sNodePrime, T2 * T3 * mult_i,
here->BSIM4gNodePrime,
here->BSIM4sNodePrime,
T2 * T7 * m, 0.5 * M_PI);
T2 * T7 * mult_i, 0.5 * M_PI);
}
else
{
NevalSrc2(&noizDens[BSIM4CORLNOIZ],
&lnNdens[BSIM4CORLNOIZ], ckt,
THERMNOISE, here->BSIM4sNodePrime,
here->BSIM4dNodePrime, T2 * T3 * m,
here->BSIM4dNodePrime, T2 * T3 * mult_i,
here->BSIM4gNodePrime,
here->BSIM4dNodePrime,
T2 * T7 * m, 0.5 * M_PI);
T2 * T7 * mult_i, 0.5 * M_PI);
}
break;
}
@ -529,7 +524,7 @@ double m;
switch(model->BSIM4fnoiMod)
{ case 0:
noizDens[BSIM4FLNOIZ] *= m * model->BSIM4kf
noizDens[BSIM4FLNOIZ] *= mult_fn * model->BSIM4kf
* exp(model->BSIM4af
* log(MAX(fabs(here->BSIM4cd),
N_MINLOG)))
@ -554,7 +549,7 @@ double m;
* here->BSIM4cd;
T1 = Swi + Ssi;
if (T1 > 0.0)
noizDens[BSIM4FLNOIZ] *= m * (Ssi * Swi) / T1;
noizDens[BSIM4FLNOIZ] *= mult_fn * (Ssi * Swi) / T1;
else
noizDens[BSIM4FLNOIZ] *= 0.0;
break;
@ -568,25 +563,25 @@ double m;
NevalSrc(&noizDens[BSIM4IGSNOIZ],
&lnNdens[BSIM4IGSNOIZ], ckt, SHOTNOISE,
here->BSIM4gNodePrime, here->BSIM4sNodePrime,
m * (here->BSIM4Igs + here->BSIM4Igcs));
mult_i * (here->BSIM4Igs + here->BSIM4Igcs));
NevalSrc(&noizDens[BSIM4IGDNOIZ],
&lnNdens[BSIM4IGDNOIZ], ckt, SHOTNOISE,
here->BSIM4gNodePrime, here->BSIM4dNodePrime,
m * (here->BSIM4Igd + here->BSIM4Igcd));
mult_i * (here->BSIM4Igd + here->BSIM4Igcd));
} else {
NevalSrc(&noizDens[BSIM4IGSNOIZ],
&lnNdens[BSIM4IGSNOIZ], ckt, SHOTNOISE,
here->BSIM4gNodePrime, here->BSIM4sNodePrime,
m * (here->BSIM4Igs + here->BSIM4Igcd));
mult_i * (here->BSIM4Igs + here->BSIM4Igcd));
NevalSrc(&noizDens[BSIM4IGDNOIZ],
&lnNdens[BSIM4IGDNOIZ], ckt, SHOTNOISE,
here->BSIM4gNodePrime, here->BSIM4dNodePrime,
m * (here->BSIM4Igd + here->BSIM4Igcs));
mult_i * (here->BSIM4Igd + here->BSIM4Igcs));
}
NevalSrc(&noizDens[BSIM4IGBNOIZ],
&lnNdens[BSIM4IGBNOIZ], ckt, SHOTNOISE,
here->BSIM4gNodePrime, here->BSIM4bNodePrime,
m * here->BSIM4Igb);
mult_i * here->BSIM4Igb);
noizDens[BSIM4TOTNOIZ] = noizDens[BSIM4RDNOIZ]
@ -617,7 +612,7 @@ double m;
if it's the first pass
*/
if (data->freq ==
job->NstartFreq)
((NOISEAN*) ckt->CKTcurJob)->NstartFreq)
{ for (i = 0; i < BSIM4NSRCS; i++)
{ here->BSIM4nVar[OUTNOIZ][i] = 0.0;
here->BSIM4nVar[INNOIZ][i] = 0.0;
@ -643,7 +638,8 @@ double m;
lnNdens[i];
data->outNoiz += tempOnoise;
data->inNoise += tempInoise;
if (job->NStpsSm != 0)
if (((NOISEAN*)
ckt->CKTcurJob)->NStpsSm != 0)
{ here->BSIM4nVar[OUTNOIZ][i]
+= tempOnoise;
here->BSIM4nVar[OUTNOIZ][BSIM4TOTNOIZ]
@ -666,7 +662,7 @@ double m;
break;
case INT_NOIZ:
/* already calculated, just output */
if (job->NStpsSm != 0)
if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0)
{ for (i = 0; i < BSIM4NSRCS; i++)
{ data->outpVector[data->outNumber++]
= here->BSIM4nVar[OUTNOIZ][i];

46
src/spicelib/devices/bsim4/b4par.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
@ -49,8 +45,8 @@ IFvalue *select)
if (!cp_getvar("scale", CP_REAL, &scale, 0))
scale = 1;
switch (param) {
case BSIM4_W:
switch(param)
{ case BSIM4_W:
here->BSIM4w = value->rValue * scale;
here->BSIM4wGiven = TRUE;
break;
@ -62,6 +58,18 @@ IFvalue *select)
here->BSIM4m = value->rValue;
here->BSIM4mGiven = TRUE;
break;
case BSIM4_MULT_I:
here->BSIM4mult_i = value->rValue;
here->BSIM4mult_iGiven = TRUE;
break;
case BSIM4_MULT_Q:
here->BSIM4mult_q = value->rValue;
here->BSIM4mult_qGiven = TRUE;
break;
case BSIM4_MULT_FN:
here->BSIM4mult_fn = value->rValue;
here->BSIM4mult_fnGiven = TRUE;
break;
case BSIM4_NF:
here->BSIM4nf = value->rValue;
here->BSIM4nfGiven = TRUE;
@ -149,14 +157,6 @@ IFvalue *select)
here->BSIM4delvto = value->rValue;
here->BSIM4delvtoGiven = TRUE;
break;
case BSIM4_MULU0:
here->BSIM4mulu0 = value->rValue;
here->BSIM4mulu0Given = TRUE;
break;
case BSIM4_WNFLAG:
here->BSIM4wnflag = value->iValue;
here->BSIM4wnflagGiven = TRUE;
break;
case BSIM4_XGW:
here->BSIM4xgw = value->rValue;
here->BSIM4xgwGiven = TRUE;
@ -204,8 +204,8 @@ IFvalue *select)
case BSIM4_IC:
/* FALLTHROUGH added to suppress GCC warning due to
* -Wimplicit-fallthrough flag */
switch (value->v.numValue) {
case 3:
switch(value->v.numValue)
{ case 3:
here->BSIM4icVBS = *(value->v.vec.rVec+2);
here->BSIM4icVBSGiven = TRUE;
/* FALLTHROUGH */

419
src/spicelib/devices/bsim4/b4pzld.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,8 +17,10 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
*/
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
#include "ngspice/cktdefs.h"
#include "ngspice/complex.h"
@ -64,14 +59,12 @@ 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;
double m, mult_i, mult_q;
for (; model != NULL; model = BSIM4nextModel(model))
{ for (here = BSIM4instances(model); here!= NULL;
here = BSIM4nextInstance(here))
{
pParam = here->pParam;
{ pParam = here->pParam;
capbd = here->BSIM4capbd;
capbs = here->BSIM4capbs;
cgso = here->BSIM4cgso;
@ -501,6 +494,8 @@ double m;
* Loading PZ matrix
*/
m = here->BSIM4m;
mult_i = here->BSIM4mult_i;
mult_q = here->BSIM4mult_q;
if (!model->BSIM4rdsMod)
{ gdpr = here->BSIM4drainConductance;
@ -519,164 +514,164 @@ double m;
geltd = here->BSIM4grgeltd;
if (here->BSIM4rgateMod == 1)
{ *(here->BSIM4GEgePtr) += m * geltd;
*(here->BSIM4GPgePtr) -= m * geltd;
*(here->BSIM4GEgpPtr) -= m * geltd;
*(here->BSIM4GPgpPtr ) += m * xcggb * s->real;
*(here->BSIM4GPgpPtr +1) += m * xcggb * s->imag;
*(here->BSIM4GPgpPtr) += m * (geltd - xgtg + gIgtotg);
*(here->BSIM4GPdpPtr ) += m * xcgdb * s->real;
*(here->BSIM4GPdpPtr +1) += m * xcgdb * s->imag;
*(here->BSIM4GPdpPtr) -= m * (xgtd - gIgtotd);
*(here->BSIM4GPspPtr ) += m * xcgsb * s->real;
*(here->BSIM4GPspPtr +1) += m * xcgsb * s->imag;
*(here->BSIM4GPspPtr) -= m * (xgts - gIgtots);
*(here->BSIM4GPbpPtr ) += m * xcgbb * s->real;
*(here->BSIM4GPbpPtr +1) += m * xcgbb * s->imag;
*(here->BSIM4GPbpPtr) -= m * (xgtb - gIgtotb);
{ *(here->BSIM4GEgePtr) += mult_i * geltd;
*(here->BSIM4GPgePtr) -= mult_i * geltd;
*(here->BSIM4GEgpPtr) -= mult_i * geltd;
*(here->BSIM4GPgpPtr ) += mult_q * xcggb * s->real;
*(here->BSIM4GPgpPtr +1) += mult_q * xcggb * s->imag;
*(here->BSIM4GPgpPtr) += mult_i * (geltd + gIgtotg) - mult_q * xgtg;
*(here->BSIM4GPdpPtr ) += mult_q * xcgdb * s->real;
*(here->BSIM4GPdpPtr +1) += mult_q * xcgdb * s->imag;
*(here->BSIM4GPdpPtr) -= mult_q * xgtd - mult_i * gIgtotd;
*(here->BSIM4GPspPtr ) += mult_q * xcgsb * s->real;
*(here->BSIM4GPspPtr +1) += mult_q * xcgsb * s->imag;
*(here->BSIM4GPspPtr) -= mult_q * xgts - mult_i * gIgtots;
*(here->BSIM4GPbpPtr ) += mult_q * xcgbb * s->real;
*(here->BSIM4GPbpPtr +1) += mult_q * xcgbb * s->imag;
*(here->BSIM4GPbpPtr) -= mult_q * xgtb - mult_i * gIgtotb;
}
else if (here->BSIM4rgateMod == 2)
{ *(here->BSIM4GEgePtr) += m * gcrg;
*(here->BSIM4GEgpPtr) += m * gcrgg;
*(here->BSIM4GEdpPtr) += m * gcrgd;
*(here->BSIM4GEspPtr) += m * gcrgs;
*(here->BSIM4GEbpPtr) += m * gcrgb;
*(here->BSIM4GPgePtr) -= m * gcrg;
*(here->BSIM4GPgpPtr ) += m * xcggb * s->real;
*(here->BSIM4GPgpPtr +1) += m * xcggb * s->imag;
*(here->BSIM4GPgpPtr) -= m * (gcrgg + xgtg - gIgtotg);
*(here->BSIM4GPdpPtr ) += m * xcgdb * s->real;
*(here->BSIM4GPdpPtr +1) += m * xcgdb * s->imag;
*(here->BSIM4GPdpPtr) -= m * (gcrgd + xgtd - gIgtotd);
*(here->BSIM4GPspPtr ) += m * xcgsb * s->real;
*(here->BSIM4GPspPtr +1) += m * xcgsb * s->imag;
*(here->BSIM4GPspPtr) -= m * (gcrgs + xgts - gIgtots);
*(here->BSIM4GPbpPtr ) += m * xcgbb * s->real;
*(here->BSIM4GPbpPtr +1) += m * xcgbb * s->imag;
*(here->BSIM4GPbpPtr) -= m * (gcrgb + xgtb - gIgtotb);
{ *(here->BSIM4GEgePtr) += mult_i * gcrg;
*(here->BSIM4GEgpPtr) += mult_i * gcrgg;
*(here->BSIM4GEdpPtr) += mult_i * gcrgd;
*(here->BSIM4GEspPtr) += mult_i * gcrgs;
*(here->BSIM4GEbpPtr) += mult_i * gcrgb;
*(here->BSIM4GPgePtr) -= mult_i * gcrg;
*(here->BSIM4GPgpPtr ) += mult_q * xcggb * s->real;
*(here->BSIM4GPgpPtr +1) += mult_q * xcggb * s->imag;
*(here->BSIM4GPgpPtr) -= mult_i * (gcrgg - gIgtotg) + mult_q * xgtg;
*(here->BSIM4GPdpPtr ) += mult_q * xcgdb * s->real;
*(here->BSIM4GPdpPtr +1) += mult_q * xcgdb * s->imag;
*(here->BSIM4GPdpPtr) -= mult_i * (gcrgd - gIgtotd) + mult_q * xgtd;
*(here->BSIM4GPspPtr ) += mult_q * xcgsb * s->real;
*(here->BSIM4GPspPtr +1) += mult_q * xcgsb * s->imag;
*(here->BSIM4GPspPtr) -= mult_i * (gcrgs - gIgtots) + mult_q * xgts;
*(here->BSIM4GPbpPtr ) += mult_q * xcgbb * s->real;
*(here->BSIM4GPbpPtr +1) += mult_q * xcgbb * s->imag;
*(here->BSIM4GPbpPtr) -= mult_i * (gcrgb - gIgtotb) + mult_q * xgtb;
}
else if (here->BSIM4rgateMod == 3)
{ *(here->BSIM4GEgePtr) += m * geltd;
*(here->BSIM4GEgmPtr) -= m * geltd;
*(here->BSIM4GMgePtr) -= m * geltd;
*(here->BSIM4GMgmPtr) += m * (geltd + gcrg);
*(here->BSIM4GMgmPtr ) += m * xcgmgmb * s->real;
*(here->BSIM4GMgmPtr +1) += m * xcgmgmb * s->imag;
*(here->BSIM4GMdpPtr) += m * gcrgd;
*(here->BSIM4GMdpPtr ) += m * xcgmdb * s->real;
*(here->BSIM4GMdpPtr +1) += m * xcgmdb * s->imag;
*(here->BSIM4GMgpPtr) += m * gcrgg;
*(here->BSIM4GMspPtr) += m * gcrgs;
*(here->BSIM4GMspPtr ) += m * xcgmsb * s->real;
*(here->BSIM4GMspPtr +1) += m * xcgmsb * s->imag;
*(here->BSIM4GMbpPtr) += m * gcrgb;
*(here->BSIM4GMbpPtr ) += m * xcgmbb * s->real;
*(here->BSIM4GMbpPtr +1) += m * xcgmbb * s->imag;
*(here->BSIM4DPgmPtr ) += m * xcdgmb * s->real;
*(here->BSIM4DPgmPtr +1) += m * xcdgmb * s->imag;
*(here->BSIM4GPgmPtr) -= m * gcrg;
*(here->BSIM4SPgmPtr ) += m * xcsgmb * s->real;
*(here->BSIM4SPgmPtr +1) += m * xcsgmb * s->imag;
*(here->BSIM4BPgmPtr ) += m * xcbgmb * s->real;
*(here->BSIM4BPgmPtr +1) += m * xcbgmb * s->imag;
*(here->BSIM4GPgpPtr) -= m * (gcrgg + xgtg - gIgtotg);
*(here->BSIM4GPgpPtr ) += m * xcggb * s->real;
*(here->BSIM4GPgpPtr +1) += m * xcggb * s->imag;
*(here->BSIM4GPdpPtr) -= m * (gcrgd + xgtd - gIgtotd);
*(here->BSIM4GPdpPtr ) += m * xcgdb * s->real;
*(here->BSIM4GPdpPtr +1) += m * xcgdb * s->imag;
*(here->BSIM4GPspPtr) -= m * (gcrgs + xgts - gIgtots);
*(here->BSIM4GPspPtr ) += m * xcgsb * s->real;
*(here->BSIM4GPspPtr +1) += m * xcgsb * s->imag;
*(here->BSIM4GPbpPtr) -= m * (gcrgb + xgtb - gIgtotb);
*(here->BSIM4GPbpPtr ) += m * xcgbb * s->real;
*(here->BSIM4GPbpPtr +1) += m * xcgbb * s->imag;
{ *(here->BSIM4GEgePtr) += mult_i * geltd;
*(here->BSIM4GEgmPtr) -= mult_i * geltd;
*(here->BSIM4GMgePtr) -= mult_i * geltd;
*(here->BSIM4GMgmPtr) += mult_i * (geltd + gcrg);
*(here->BSIM4GMgmPtr ) += mult_q * xcgmgmb * s->real;
*(here->BSIM4GMgmPtr +1) += mult_q * xcgmgmb * s->imag;
*(here->BSIM4GMdpPtr) += mult_i * gcrgd;
*(here->BSIM4GMdpPtr ) += mult_q * xcgmdb * s->real;
*(here->BSIM4GMdpPtr +1) += mult_q * xcgmdb * s->imag;
*(here->BSIM4GMgpPtr) += mult_i * gcrgg;
*(here->BSIM4GMspPtr) += mult_i * gcrgs;
*(here->BSIM4GMspPtr ) += mult_q * xcgmsb * s->real;
*(here->BSIM4GMspPtr +1) += mult_q * xcgmsb * s->imag;
*(here->BSIM4GMbpPtr) += mult_i * gcrgb;
*(here->BSIM4GMbpPtr ) += mult_q * xcgmbb * s->real;
*(here->BSIM4GMbpPtr +1) += mult_q * xcgmbb * s->imag;
*(here->BSIM4DPgmPtr ) += mult_q * xcdgmb * s->real;
*(here->BSIM4DPgmPtr +1) += mult_q * xcdgmb * s->imag;
*(here->BSIM4GPgmPtr) -= mult_i * gcrg;
*(here->BSIM4SPgmPtr ) += mult_q * xcsgmb * s->real;
*(here->BSIM4SPgmPtr +1) += mult_q * xcsgmb * s->imag;
*(here->BSIM4BPgmPtr ) += mult_q * xcbgmb * s->real;
*(here->BSIM4BPgmPtr +1) += mult_q * xcbgmb * s->imag;
*(here->BSIM4GPgpPtr) -= mult_i * (gcrgg - gIgtotg) + mult_q * xgtg;
*(here->BSIM4GPgpPtr ) += mult_q * xcggb * s->real;
*(here->BSIM4GPgpPtr +1) += mult_q * xcggb * s->imag;
*(here->BSIM4GPdpPtr) -= mult_i * (gcrgd - gIgtotd) + mult_q * xgtd;
*(here->BSIM4GPdpPtr ) += mult_q * xcgdb * s->real;
*(here->BSIM4GPdpPtr +1) += mult_q * xcgdb * s->imag;
*(here->BSIM4GPspPtr) -= mult_i * (gcrgs - gIgtots) + mult_q * xgts;
*(here->BSIM4GPspPtr ) += mult_q * xcgsb * s->real;
*(here->BSIM4GPspPtr +1) += mult_q * xcgsb * s->imag;
*(here->BSIM4GPbpPtr) -= mult_i * (gcrgb - gIgtotb) + mult_q * xgtb;
*(here->BSIM4GPbpPtr ) += mult_q * xcgbb * s->real;
*(here->BSIM4GPbpPtr +1) += mult_q * xcgbb * s->imag;
}
else
{ *(here->BSIM4GPdpPtr ) += m * xcgdb * s->real;
*(here->BSIM4GPdpPtr +1) += m * xcgdb * s->imag;
*(here->BSIM4GPdpPtr) -= m * (xgtd - gIgtotd);
*(here->BSIM4GPgpPtr ) += m * xcggb * s->real;
*(here->BSIM4GPgpPtr +1) += m * xcggb * s->imag;
*(here->BSIM4GPgpPtr) -= m * (xgtg - gIgtotg);
*(here->BSIM4GPspPtr ) += m * xcgsb * s->real;
*(here->BSIM4GPspPtr +1) += m * xcgsb * s->imag;
*(here->BSIM4GPspPtr) -= m * (xgts - gIgtots);
*(here->BSIM4GPbpPtr ) += m * xcgbb * s->real;
*(here->BSIM4GPbpPtr +1) += m * xcgbb * s->imag;
*(here->BSIM4GPbpPtr) -= m * (xgtb - gIgtotb);
{ *(here->BSIM4GPdpPtr ) += mult_q * xcgdb * s->real;
*(here->BSIM4GPdpPtr +1) += mult_q * xcgdb * s->imag;
*(here->BSIM4GPdpPtr) -= mult_q * xgtd - mult_i * gIgtotd;
*(here->BSIM4GPgpPtr ) += mult_q * xcggb * s->real;
*(here->BSIM4GPgpPtr +1) += mult_q * xcggb * s->imag;
*(here->BSIM4GPgpPtr) -= mult_q * xgtg - mult_i * gIgtotg;
*(here->BSIM4GPspPtr ) += mult_q * xcgsb * s->real;
*(here->BSIM4GPspPtr +1) += mult_q * xcgsb * s->imag;
*(here->BSIM4GPspPtr) -= mult_q * xgts - mult_i * gIgtots;
*(here->BSIM4GPbpPtr ) += mult_q * xcgbb * s->real;
*(here->BSIM4GPbpPtr +1) += mult_q * xcgbb * s->imag;
*(here->BSIM4GPbpPtr) -= mult_q * xgtb - mult_i * gIgtotb;
}
if (model->BSIM4rdsMod)
{ (*(here->BSIM4DgpPtr) += m * gdtotg);
(*(here->BSIM4DspPtr) += m * gdtots);
(*(here->BSIM4DbpPtr) += m * gdtotb);
(*(here->BSIM4SdpPtr) += m * gstotd);
(*(here->BSIM4SgpPtr) += m * gstotg);
(*(here->BSIM4SbpPtr) += m * gstotb);
}
*(here->BSIM4DPdpPtr ) += m * xcddb * s->real;
*(here->BSIM4DPdpPtr +1) += m * xcddb * s->imag;
*(here->BSIM4DPdpPtr) += m * (gdpr + gds + here->BSIM4gbd
- gdtotd + RevSum + gbdpdp - gIdtotd
+ dxpart * xgtd + T1 * ddxpart_dVd);
*(here->BSIM4DPdPtr) -= m * (gdpr + gdtot);
*(here->BSIM4DPgpPtr ) += m * xcdgb * s->real;
*(here->BSIM4DPgpPtr +1) += m * xcdgb * s->imag;
*(here->BSIM4DPgpPtr) += m * (Gm - gdtotg + gbdpg - gIdtotg
+ T1 * ddxpart_dVg + dxpart * xgtg);
*(here->BSIM4DPspPtr ) += m * xcdsb * s->real;
*(here->BSIM4DPspPtr +1) += m * xcdsb * s->imag;
*(here->BSIM4DPspPtr) -= m * (gds + FwdSum + gdtots - gbdpsp + gIdtots
- T1 * ddxpart_dVs - dxpart * xgts);
*(here->BSIM4DPbpPtr ) += m * xcdbb * s->real;
*(here->BSIM4DPbpPtr +1) += m * xcdbb * s->imag;
*(here->BSIM4DPbpPtr) -= m * (gjbd + gdtotb - Gmbs - gbdpb + gIdtotb
- T1 * ddxpart_dVb - dxpart * xgtb);
*(here->BSIM4DdpPtr) -= m * (gdpr - gdtotd);
*(here->BSIM4DdPtr) += m * (gdpr + gdtot);
*(here->BSIM4SPdpPtr ) += m * xcsdb * s->real;
*(here->BSIM4SPdpPtr +1) += m * xcsdb * s->imag;
*(here->BSIM4SPdpPtr) -= m * (gds + gstotd + RevSum - gbspdp + gIstotd
- T1 * dsxpart_dVd - sxpart * xgtd);
*(here->BSIM4SPgpPtr ) += m * xcsgb * s->real;
*(here->BSIM4SPgpPtr +1) += m * xcsgb * s->imag;
*(here->BSIM4SPgpPtr) -= m * (Gm + gstotg - gbspg + gIstotg
- T1 * dsxpart_dVg - sxpart * xgtg);
*(here->BSIM4SPspPtr ) += m * xcssb * s->real;
*(here->BSIM4SPspPtr +1) += m * xcssb * s->imag;
*(here->BSIM4SPspPtr) += m * (gspr + gds + here->BSIM4gbs - gIstots
- gstots + FwdSum + gbspsp
+ sxpart * xgts + T1 * dsxpart_dVs);
*(here->BSIM4SPsPtr) -= m * (gspr + gstot);
*(here->BSIM4SPbpPtr ) += m * xcsbb * s->real;
*(here->BSIM4SPbpPtr +1) += m * xcsbb * s->imag;
*(here->BSIM4SPbpPtr) -= m * (gjbs + gstotb + Gmbs - gbspb + gIstotb
- T1 * dsxpart_dVb - sxpart * xgtb);
*(here->BSIM4SspPtr) -= m * (gspr - gstots);
*(here->BSIM4SsPtr) += m * (gspr + gstot);
*(here->BSIM4BPdpPtr ) += m * xcbdb * s->real;
*(here->BSIM4BPdpPtr +1) += m * xcbdb * s->imag;
*(here->BSIM4BPdpPtr) -= m * (gjbd - gbbdp + gIbtotd);
*(here->BSIM4BPgpPtr ) += m * xcbgb * s->real;
*(here->BSIM4BPgpPtr +1) += m * xcbgb * s->imag;
*(here->BSIM4BPgpPtr) -= m * (here->BSIM4gbgs + gIbtotg);
*(here->BSIM4BPspPtr ) += m * xcbsb * s->real;
*(here->BSIM4BPspPtr +1) += m * xcbsb * s->imag;
*(here->BSIM4BPspPtr) -= m * (gjbs - gbbsp + gIbtots);
*(here->BSIM4BPbpPtr ) += m * xcbbb * s->real;
*(here->BSIM4BPbpPtr +1) += m * xcbbb * s->imag;
*(here->BSIM4BPbpPtr) += m * (gjbd + gjbs - here->BSIM4gbbs
{ (*(here->BSIM4DgpPtr) += mult_i * gdtotg);
(*(here->BSIM4DspPtr) += mult_i * gdtots);
(*(here->BSIM4DbpPtr) += mult_i * gdtotb);
(*(here->BSIM4SdpPtr) += mult_i * gstotd);
(*(here->BSIM4SgpPtr) += mult_i * gstotg);
(*(here->BSIM4SbpPtr) += mult_i * gstotb);
}
*(here->BSIM4DPdpPtr ) += mult_q * xcddb * s->real;
*(here->BSIM4DPdpPtr +1) += mult_q * xcddb * s->imag;
*(here->BSIM4DPdpPtr) += mult_i * (gdpr + gds + here->BSIM4gbd
- gdtotd + RevSum + gbdpdp - gIdtotd)
+ mult_q * (dxpart * xgtd + T1 * ddxpart_dVd);
*(here->BSIM4DPdPtr) -= mult_i * (gdpr + gdtot);
*(here->BSIM4DPgpPtr ) += mult_q * xcdgb * s->real;
*(here->BSIM4DPgpPtr +1) += mult_q * xcdgb * s->imag;
*(here->BSIM4DPgpPtr) += mult_i * (Gm - gdtotg + gbdpg - gIdtotg)
+ mult_q * (T1 * ddxpart_dVg + dxpart * xgtg);
*(here->BSIM4DPspPtr ) += mult_q * xcdsb * s->real;
*(here->BSIM4DPspPtr +1) += mult_q * xcdsb * s->imag;
*(here->BSIM4DPspPtr) -= mult_i * (gds + FwdSum + gdtots - gbdpsp + gIdtots)
- mult_q * (T1 * ddxpart_dVs + dxpart * xgts);
*(here->BSIM4DPbpPtr ) += mult_q * xcdbb * s->real;
*(here->BSIM4DPbpPtr +1) += mult_q * xcdbb * s->imag;
*(here->BSIM4DPbpPtr) -= mult_i * (gjbd + gdtotb - Gmbs - gbdpb + gIdtotb)
- mult_q * T1 * (ddxpart_dVb + dxpart * xgtb);
*(here->BSIM4DdpPtr) -= mult_i * (gdpr - gdtotd);
*(here->BSIM4DdPtr) += mult_i * (gdpr + gdtot);
*(here->BSIM4SPdpPtr ) += mult_q * xcsdb * s->real;
*(here->BSIM4SPdpPtr +1) += mult_q * xcsdb * s->imag;
*(here->BSIM4SPdpPtr) -= mult_i * (gds + gstotd + RevSum - gbspdp + gIstotd)
- mult_q * (T1 * dsxpart_dVd + sxpart * xgtd);
*(here->BSIM4SPgpPtr ) += mult_q * xcsgb * s->real;
*(here->BSIM4SPgpPtr +1) += mult_q * xcsgb * s->imag;
*(here->BSIM4SPgpPtr) -= mult_i * (Gm + gstotg - gbspg + gIstotg)
- mult_q * (T1 * dsxpart_dVg + sxpart * xgtg);
*(here->BSIM4SPspPtr ) += mult_q * xcssb * s->real;
*(here->BSIM4SPspPtr +1) += mult_q * xcssb * s->imag;
*(here->BSIM4SPspPtr) += mult_i * (gspr + gds + here->BSIM4gbs - gIstots
- gstots + FwdSum + gbspsp)
+ mult_q * (sxpart * xgts + T1 * dsxpart_dVs);
*(here->BSIM4SPsPtr) -= mult_i * (gspr + gstot);
*(here->BSIM4SPbpPtr ) += mult_q * xcsbb * s->real;
*(here->BSIM4SPbpPtr +1) += mult_q * xcsbb * s->imag;
*(here->BSIM4SPbpPtr) -= mult_i * (gjbs + gstotb + Gmbs - gbspb + gIstotb)
- mult_q * (T1 * dsxpart_dVb + sxpart * xgtb);
*(here->BSIM4SspPtr) -= mult_i * (gspr - gstots);
*(here->BSIM4SsPtr) += mult_i * (gspr + gstot);
*(here->BSIM4BPdpPtr ) += mult_q * xcbdb * s->real;
*(here->BSIM4BPdpPtr +1) += mult_q * xcbdb * s->imag;
*(here->BSIM4BPdpPtr) -= mult_i * (gjbd - gbbdp + gIbtotd);
*(here->BSIM4BPgpPtr ) += mult_q * xcbgb * s->real;
*(here->BSIM4BPgpPtr +1) += mult_q * xcbgb * s->imag;
*(here->BSIM4BPgpPtr) -= mult_i * (here->BSIM4gbgs + gIbtotg);
*(here->BSIM4BPspPtr ) += mult_q * xcbsb * s->real;
*(here->BSIM4BPspPtr +1) += mult_q * xcbsb * s->imag;
*(here->BSIM4BPspPtr) -= mult_i * (gjbs - gbbsp + gIbtots);
*(here->BSIM4BPbpPtr ) += mult_q * xcbbb * s->real;
*(here->BSIM4BPbpPtr +1) += mult_q * xcbbb * s->imag;
*(here->BSIM4BPbpPtr) += mult_i * (gjbd + gjbs - here->BSIM4gbbs
- gIbtotb);
ggidld = here->BSIM4ggidld;
ggidlg = here->BSIM4ggidlg;
@ -686,63 +681,63 @@ double m;
ggislb = here->BSIM4ggislb;
/* stamp gidl */
(*(here->BSIM4DPdpPtr) += m * ggidld);
(*(here->BSIM4DPgpPtr) += m * ggidlg);
(*(here->BSIM4DPspPtr) -= m * ((ggidlg + ggidld) + ggidlb));
(*(here->BSIM4DPbpPtr) += m * ggidlb);
(*(here->BSIM4BPdpPtr) -= m * ggidld);
(*(here->BSIM4BPgpPtr) -= m * ggidlg);
(*(here->BSIM4BPspPtr) += m * ((ggidlg + ggidld) + ggidlb));
(*(here->BSIM4BPbpPtr) -= m * ggidlb);
(*(here->BSIM4DPdpPtr) += mult_i * ggidld);
(*(here->BSIM4DPgpPtr) += mult_i * ggidlg);
(*(here->BSIM4DPspPtr) -= mult_i * ((ggidlg + ggidld) + ggidlb));
(*(here->BSIM4DPbpPtr) += mult_i * ggidlb);
(*(here->BSIM4BPdpPtr) -= mult_i * ggidld);
(*(here->BSIM4BPgpPtr) -= mult_i * ggidlg);
(*(here->BSIM4BPspPtr) += mult_i * ((ggidlg + ggidld) + ggidlb));
(*(here->BSIM4BPbpPtr) -= mult_i * ggidlb);
/* stamp gisl */
(*(here->BSIM4SPdpPtr) -= m * ((ggisls + ggislg) + ggislb));
(*(here->BSIM4SPgpPtr) += m * ggislg);
(*(here->BSIM4SPspPtr) += m * ggisls);
(*(here->BSIM4SPbpPtr) += m * ggislb);
(*(here->BSIM4BPdpPtr) += m * ((ggislg + ggisls) + ggislb));
(*(here->BSIM4BPgpPtr) -= m * ggislg);
(*(here->BSIM4BPspPtr) -= m * ggisls);
(*(here->BSIM4BPbpPtr) -= m * ggislb);
(*(here->BSIM4SPdpPtr) -= mult_i * ((ggisls + ggislg) + ggislb));
(*(here->BSIM4SPgpPtr) += mult_i * ggislg);
(*(here->BSIM4SPspPtr) += mult_i * ggisls);
(*(here->BSIM4SPbpPtr) += mult_i * ggislb);
(*(here->BSIM4BPdpPtr) += mult_i * ((ggislg + ggisls) + ggislb));
(*(here->BSIM4BPgpPtr) -= mult_i * ggislg);
(*(here->BSIM4BPspPtr) -= mult_i * ggisls);
(*(here->BSIM4BPbpPtr) -= mult_i * ggislb);
if (here->BSIM4rbodyMod)
{ (*(here->BSIM4DPdbPtr ) += m * xcdbdb * s->real);
(*(here->BSIM4DPdbPtr +1) += m * xcdbdb * s->imag);
(*(here->BSIM4DPdbPtr) -= m * here->BSIM4gbd);
(*(here->BSIM4SPsbPtr ) += m * xcsbsb * s->real);
(*(here->BSIM4SPsbPtr +1) += m * xcsbsb * s->imag);
(*(here->BSIM4SPsbPtr) -= m * here->BSIM4gbs);
(*(here->BSIM4DBdpPtr ) += m * xcdbdb * s->real);
(*(here->BSIM4DBdpPtr +1) += m * xcdbdb * s->imag);
(*(here->BSIM4DBdpPtr) -= m * here->BSIM4gbd);
(*(here->BSIM4DBdbPtr ) -= m * xcdbdb * s->real);
(*(here->BSIM4DBdbPtr +1) -= m * xcdbdb * s->imag);
(*(here->BSIM4DBdbPtr) += m * (here->BSIM4gbd + here->BSIM4grbpd
{ (*(here->BSIM4DPdbPtr ) += mult_q * xcdbdb * s->real);
(*(here->BSIM4DPdbPtr +1) += mult_q * xcdbdb * s->imag);
(*(here->BSIM4DPdbPtr) -= mult_i * here->BSIM4gbd);
(*(here->BSIM4SPsbPtr ) += mult_q * xcsbsb * s->real);
(*(here->BSIM4SPsbPtr +1) += mult_q * xcsbsb * s->imag);
(*(here->BSIM4SPsbPtr) -= mult_i * here->BSIM4gbs);
(*(here->BSIM4DBdpPtr ) += mult_q * xcdbdb * s->real);
(*(here->BSIM4DBdpPtr +1) += mult_q * xcdbdb * s->imag);
(*(here->BSIM4DBdpPtr) -= mult_i * here->BSIM4gbd);
(*(here->BSIM4DBdbPtr ) -= mult_q * xcdbdb * s->real);
(*(here->BSIM4DBdbPtr +1) -= mult_q * xcdbdb * s->imag);
(*(here->BSIM4DBdbPtr) += mult_i * (here->BSIM4gbd + here->BSIM4grbpd
+ here->BSIM4grbdb));
(*(here->BSIM4DBbpPtr) -= m * here->BSIM4grbpd);
(*(here->BSIM4DBbPtr) -= m * here->BSIM4grbdb);
(*(here->BSIM4DBbpPtr) -= mult_i * here->BSIM4grbpd);
(*(here->BSIM4DBbPtr) -= mult_i * here->BSIM4grbdb);
(*(here->BSIM4BPdbPtr) -= m * here->BSIM4grbpd);
(*(here->BSIM4BPbPtr) -= m * here->BSIM4grbpb);
(*(here->BSIM4BPsbPtr) -= m * here->BSIM4grbps);
(*(here->BSIM4BPbpPtr) += m * (here->BSIM4grbpd + here->BSIM4grbps
(*(here->BSIM4BPdbPtr) -= mult_i * here->BSIM4grbpd);
(*(here->BSIM4BPbPtr) -= mult_i * here->BSIM4grbpb);
(*(here->BSIM4BPsbPtr) -= mult_i * here->BSIM4grbps);
(*(here->BSIM4BPbpPtr) += mult_i * (here->BSIM4grbpd + here->BSIM4grbps
+ here->BSIM4grbpb));
/* WDL: (-here->BSIM4gbbs) already added to BPbpPtr */
(*(here->BSIM4SBspPtr ) += m * xcsbsb * s->real);
(*(here->BSIM4SBspPtr +1) += m * xcsbsb * s->imag);
(*(here->BSIM4SBspPtr) -= m * here->BSIM4gbs);
(*(here->BSIM4SBbpPtr) -= m * here->BSIM4grbps);
(*(here->BSIM4SBbPtr) -= m * here->BSIM4grbsb);
(*(here->BSIM4SBsbPtr ) -= m * xcsbsb * s->real);
(*(here->BSIM4SBsbPtr +1) -= m * xcsbsb * s->imag);
(*(here->BSIM4SBsbPtr) += m * (here->BSIM4gbs
(*(here->BSIM4SBspPtr ) += mult_q * xcsbsb * s->real);
(*(here->BSIM4SBspPtr +1) += mult_q * xcsbsb * s->imag);
(*(here->BSIM4SBspPtr) -= mult_i * here->BSIM4gbs);
(*(here->BSIM4SBbpPtr) -= mult_i * here->BSIM4grbps);
(*(here->BSIM4SBbPtr) -= mult_i * here->BSIM4grbsb);
(*(here->BSIM4SBsbPtr ) -= mult_q * xcsbsb * s->real);
(*(here->BSIM4SBsbPtr +1) -= mult_q * xcsbsb * s->imag);
(*(here->BSIM4SBsbPtr) += mult_i * (here->BSIM4gbs
+ here->BSIM4grbps + here->BSIM4grbsb));
(*(here->BSIM4BdbPtr) -= m * here->BSIM4grbdb);
(*(here->BSIM4BbpPtr) -= m * here->BSIM4grbpb);
(*(here->BSIM4BsbPtr) -= m * here->BSIM4grbsb);
(*(here->BSIM4BbPtr) += m * (here->BSIM4grbsb + here->BSIM4grbdb
(*(here->BSIM4BdbPtr) -= mult_i * here->BSIM4grbdb);
(*(here->BSIM4BbpPtr) -= mult_i * here->BSIM4grbpb);
(*(here->BSIM4BsbPtr) -= mult_i * here->BSIM4grbsb);
(*(here->BSIM4BbPtr) += mult_i * (here->BSIM4grbsb + here->BSIM4grbdb
+ here->BSIM4grbpb));
}

107
src/spicelib/devices/bsim4/b4set.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
@ -144,12 +140,6 @@ BSIM4instance **InstArray;
if (!model->BSIM4geoModGiven)
model->BSIM4geoMod = 0;
if (!model->BSIM4rgeoModGiven)
model->BSIM4rgeoMod = 0;
else if ((model->BSIM4rgeoMod != 0) && (model->BSIM4rgeoMod != 1))
{ model->BSIM4rgeoMod = 1;
printf("Warning: rgeoMod has been set to its default value: 1.\n");
}
if (!model->BSIM4fnoiModGiven)
model->BSIM4fnoiMod = 1;
else if ((model->BSIM4fnoiMod != 0) && (model->BSIM4fnoiMod != 1))
@ -211,9 +201,8 @@ BSIM4instance **InstArray;
{ model->BSIM4tempMod = 0;
printf("Warning: tempMod has been set to its default value: 0.\n");
}
if (!model->BSIM4versionGiven)
model->BSIM4version = copy("4.8.2");
model->BSIM4version = copy("4.8.3");
if (!model->BSIM4toxrefGiven)
model->BSIM4toxref = 30.0e-10;
if (!model->BSIM4eotGiven)
@ -240,7 +229,6 @@ BSIM4instance **InstArray;
model->BSIM4dtox = 0.0;
if (!model->BSIM4epsroxGiven)
model->BSIM4epsrox = 3.9;
if (!model->BSIM4cdscGiven)
model->BSIM4cdsc = 2.4e-4; /* unit Q/V/m^2 */
if (!model->BSIM4cdscbGiven)
@ -267,6 +255,8 @@ BSIM4instance **InstArray;
model->BSIM4a2 = 1.0;
if (!model->BSIM4ketaGiven)
model->BSIM4keta = -0.047; /* unit / V */
if (!model->BSIM4ketacGiven)
model->BSIM4ketac = model->BSIM4keta; /* unit / V */
if (!model->BSIM4nsubGiven)
model->BSIM4nsub = 6.0e16; /* unit 1/cm3 */
if (!model->BSIM4phigGiven)
@ -351,9 +341,11 @@ BSIM4instance **InstArray;
model->BSIM4eu = (model->BSIM4type == NMOS) ? 1.67 : 1.0;
if (!model->BSIM4ucsGiven)
model->BSIM4ucs = (model->BSIM4type == NMOS) ? 1.67 : 1.0;
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) &&
(strcmp(model->BSIM4version, "4.8.2")) && (strncmp(model->BSIM4version, "4.82", 4)))
{ /* check only for version <= 4.80 */
(strcmp(model->BSIM4version, "4.8.2")) && (strncmp(model->BSIM4version, "4.82", 4)) &&
(strcmp(model->BSIM4version, "4.8.3")) && (strncmp(model->BSIM4version, "4.83", 4)))
{
if (!model->BSIM4uaGiven)
model->BSIM4ua = ((model->BSIM4mobMod == 2)) ? 1.0e-15 : 1.0e-9; /* unit m/V */
if (!model->BSIM4ucGiven)
@ -365,12 +357,12 @@ BSIM4instance **InstArray;
{
if (!model->BSIM4uaGiven)
model->BSIM4ua = ((model->BSIM4mobMod == 2 || model->BSIM4mobMod == 6)) ? 1.0e-15 : 1.0e-9; /* unit m/V */
/*printf("warning:ua=%g",model->BSIM4ua);*/
if (!model->BSIM4ucGiven)
model->BSIM4uc = (model->BSIM4mobMod == 1 || model->BSIM4mobMod == 5) ? -0.0465 : -0.0465e-9;
if (!model->BSIM4uc1Given)
model->BSIM4uc1 = (model->BSIM4mobMod == 1 || model->BSIM4mobMod == 5) ? -0.056 : -0.056e-9;
}
if (!model->BSIM4ua1Given)
model->BSIM4ua1 = 1.0e-9; /* unit m/V */
if (!model->BSIM4ubGiven)
@ -535,6 +527,7 @@ BSIM4instance **InstArray;
model->BSIM4kgisl = model->BSIM4kgidl;
if (!model->BSIM4fgislGiven) /* v4.7 New GIDL/GISL */
model->BSIM4fgisl = model->BSIM4fgidl;
if (!model->BSIM4aigcGiven)
model->BSIM4aigc = (model->BSIM4type == NMOS) ? 1.36e-2 : 9.80e-3;
if (!model->BSIM4bigcGiven)
@ -816,6 +809,8 @@ BSIM4instance **InstArray;
model->BSIM4la2 = 0.0;
if (!model->BSIM4lketaGiven)
model->BSIM4lketa = 0.0;
if (!model->BSIM4lketacGiven)
model->BSIM4lketac = model->BSIM4lketa;
if (!model->BSIM4lnsubGiven)
model->BSIM4lnsub = 0.0;
if (!model->BSIM4lndepGiven)
@ -1193,6 +1188,8 @@ BSIM4instance **InstArray;
model->BSIM4wa2 = 0.0;
if (!model->BSIM4wketaGiven)
model->BSIM4wketa = 0.0;
if (!model->BSIM4wketacGiven)
model->BSIM4wketac = model->BSIM4wketa;
if (!model->BSIM4wnsubGiven)
model->BSIM4wnsub = 0.0;
if (!model->BSIM4wndepGiven)
@ -1357,7 +1354,6 @@ BSIM4instance **InstArray;
model->BSIM4wkgidl = 0.0;
if (!model->BSIM4wfgidlGiven) /* v4.7 New GIDL/GISL */
model->BSIM4wfgidl = 0.0;
/*if (!model->BSIM4wagislGiven)
{
if (model->BSIM4wagidlGiven)
@ -1562,7 +1558,6 @@ BSIM4instance **InstArray;
model->BSIM4pat = 0.0;
if (!model->BSIM4pa0Given)
model->BSIM4pa0 = 0.0;
if (!model->BSIM4pagsGiven)
model->BSIM4pags = 0.0;
if (!model->BSIM4pa1Given)
@ -1571,6 +1566,8 @@ BSIM4instance **InstArray;
model->BSIM4pa2 = 0.0;
if (!model->BSIM4pketaGiven)
model->BSIM4pketa = 0.0;
if (!model->BSIM4pketacGiven)
model->BSIM4pketac = model->BSIM4pketa;
if (!model->BSIM4pnsubGiven)
model->BSIM4pnsub = 0.0;
if (!model->BSIM4pndepGiven)
@ -1796,6 +1793,7 @@ BSIM4instance **InstArray;
model->BSIM4pkgisl = model->BSIM4pkgidl;
if (!model->BSIM4pfgislGiven) /* v4.7 New GIDL/GISL */
model->BSIM4pfgisl = model->BSIM4pfgidl;
if (!model->BSIM4paigcGiven)
model->BSIM4paigc = 0.0;
if (!model->BSIM4pbigcGiven)
@ -1895,7 +1893,6 @@ BSIM4instance **InstArray;
model->BSIM4pteta0 = 0.0;
if (!model->BSIM4ptvoffcvGiven) /* v4.7 temp dep of leakage current */
model->BSIM4ptvoffcv = 0.0;
if (!model->BSIM4pcgslGiven)
model->BSIM4pcgsl = 0.0;
if (!model->BSIM4pcgdlGiven)
@ -1920,7 +1917,6 @@ BSIM4instance **InstArray;
model->BSIM4pnoff = 0.0;
if (!model->BSIM4pvoffcvGiven)
model->BSIM4pvoffcv = 0.0;
if (!model->BSIM4gamma1Given)
model->BSIM4gamma1 = 0.0;
if (!model->BSIM4lgamma1Given)
@ -2167,13 +2163,15 @@ BSIM4instance **InstArray;
model->BSIM4vtsswgd = model->BSIM4vtsswgs;
if (!model->BSIM4oxideTrapDensityAGiven)
{ if (model->BSIM4type == NMOS)
{
if (model->BSIM4type == NMOS)
model->BSIM4oxideTrapDensityA = 6.25e41;
else
model->BSIM4oxideTrapDensityA= 6.188e40;
}
if (!model->BSIM4oxideTrapDensityBGiven)
{ if (model->BSIM4type == NMOS)
{
if (model->BSIM4type == NMOS)
model->BSIM4oxideTrapDensityB = 3.125e26;
else
model->BSIM4oxideTrapDensityB = 1.5e25;
@ -2305,11 +2303,9 @@ BSIM4instance **InstArray;
for (here = BSIM4instances(model); here != NULL ;
here=BSIM4nextInstance(here))
{
/* allocate a chunk of the state vector */
{ /* allocate a chunk of the state vector */
here->BSIM4states = *states;
*states += BSIM4numStates;
/* perform the parameter defaulting */
if (!here->BSIM4lGiven)
here->BSIM4l = 5.0e-6;
@ -2317,6 +2313,12 @@ BSIM4instance **InstArray;
here->BSIM4w = 5.0e-6;
if (!here->BSIM4mGiven)
here->BSIM4m = 1.0;
if (!here->BSIM4mult_iGiven)
here->BSIM4mult_i = 1.0;
if (!here->BSIM4mult_qGiven)
here->BSIM4mult_q = 1.0;
if (!here->BSIM4mult_fnGiven)
here->BSIM4mult_fn = here->BSIM4mult_i;
if (!here->BSIM4nfGiven)
here->BSIM4nf = 1.0;
if (!here->BSIM4minGiven)
@ -2352,13 +2354,14 @@ BSIM4instance **InstArray;
here->BSIM4rbpd = model->BSIM4rbpd;
if (!here->BSIM4delvtoGiven)
here->BSIM4delvto = 0.0;
if (!here->BSIM4mulu0Given)
here->BSIM4mulu0 = 1.0;
if (!here->BSIM4xgwGiven)
here->BSIM4xgw = model->BSIM4xgw;
if (!here->BSIM4ngconGiven)
here->BSIM4ngcon = model->BSIM4ngcon;
here->BSIM4mult_i = here->BSIM4mult_i * here->BSIM4m;
here->BSIM4mult_q = here->BSIM4mult_q * here->BSIM4m;
here->BSIM4mult_fn = here->BSIM4mult_fn * here->BSIM4m;
/* Process instance model selectors, some
* may override their global counterparts
@ -2382,15 +2385,8 @@ BSIM4instance **InstArray;
if (!here->BSIM4geoModGiven)
here->BSIM4geoMod = model->BSIM4geoMod;
if (!here->BSIM4rgeoModGiven)
here->BSIM4rgeoMod = model->BSIM4rgeoMod;
else if ((here->BSIM4rgeoMod != 0) && (here->BSIM4rgeoMod != 1))
{ here->BSIM4rgeoMod = model->BSIM4rgeoMod;
printf("Warning: rgeoMod has been set to its global value %d.\n",
model->BSIM4rgeoMod);
}
here->BSIM4rgeoMod = 0;
if (!here->BSIM4trnqsModGiven)
here->BSIM4trnqsMod = model->BSIM4trnqsMod;
else if ((here->BSIM4trnqsMod != 0) && (here->BSIM4trnqsMod != 1))
@ -2439,7 +2435,7 @@ BSIM4instance **InstArray;
} else if (!here->BSIM4drainSquaresGiven
&& (here->BSIM4rgeoMod != 0))
{
BSIM4RdseffGeo(here->BSIM4nf*here->BSIM4m, here->BSIM4geoMod,
BSIM4RdseffGeo(here->BSIM4nf, here->BSIM4geoMod,
here->BSIM4rgeoMod, here->BSIM4min,
here->BSIM4w, model->BSIM4sheetResistance,
DMCGeff, DMCIeff, DMDGeff, 0, &Rtot);
@ -2447,8 +2443,7 @@ BSIM4instance **InstArray;
createNode = 1;
}
}
if ( createNode != 0 )
{ if ( here->BSIM4dNodePrime == 0 )
if ( createNode != 0 && (here->BSIM4dNodePrime == 0))
{ error = CKTmkVolt(ckt,&tmp,here->BSIM4name,"drain");
if(error) return(error);
here->BSIM4dNodePrime = tmp->number;
@ -2463,7 +2458,6 @@ BSIM4instance **InstArray;
}
}
}
}
else
{ here->BSIM4dNodePrime = here->BSIM4dNode;
}
@ -2483,7 +2477,7 @@ BSIM4instance **InstArray;
} else if (!here->BSIM4sourceSquaresGiven
&& (here->BSIM4rgeoMod != 0))
{
BSIM4RdseffGeo(here->BSIM4nf*here->BSIM4m, here->BSIM4geoMod,
BSIM4RdseffGeo(here->BSIM4nf, here->BSIM4geoMod,
here->BSIM4rgeoMod, here->BSIM4min,
here->BSIM4w, model->BSIM4sheetResistance,
DMCGeff, DMCIeff, DMDGeff, 1, &Rtot);
@ -2491,8 +2485,7 @@ BSIM4instance **InstArray;
createNode = 1;
}
}
if ( createNode != 0 )
{ if ( here->BSIM4sNodePrime == 0 )
if ( createNode != 0 && here->BSIM4sNodePrime == 0)
{ error = CKTmkVolt(ckt,&tmp,here->BSIM4name,"source");
if(error) return(error);
here->BSIM4sNodePrime = tmp->number;
@ -2507,12 +2500,10 @@ BSIM4instance **InstArray;
}
}
}
}
else
here->BSIM4sNodePrime = here->BSIM4sNode;
if ( here->BSIM4rgateMod > 0 )
{ if ( here->BSIM4gNodePrime == 0 )
if ((here->BSIM4rgateMod > 0) && (here->BSIM4gNodePrime == 0))
{ error = CKTmkVolt(ckt,&tmp,here->BSIM4name,"gate");
if(error) return(error);
here->BSIM4gNodePrime = tmp->number;
@ -2527,17 +2518,14 @@ BSIM4instance **InstArray;
}
}
}
}
else
here->BSIM4gNodePrime = here->BSIM4gNodeExt;
if ( here->BSIM4rgateMod == 3 )
{ if ( here->BSIM4gNodeMid == 0 )
if ((here->BSIM4rgateMod == 3) && (here->BSIM4gNodeMid == 0))
{ error = CKTmkVolt(ckt,&tmp,here->BSIM4name,"midgate");
if(error) return(error);
here->BSIM4gNodeMid = tmp->number;
}
}
else
here->BSIM4gNodeMid = here->BSIM4gNodeExt;
@ -2575,17 +2563,14 @@ BSIM4instance **InstArray;
= here->BSIM4bNode;
/* NQS node */
if ( here->BSIM4trnqsMod )
{ if ( here->BSIM4qNode == 0 )
if ((here->BSIM4trnqsMod) && (here->BSIM4qNode == 0))
{ error = CKTmkVolt(ckt,&tmp,here->BSIM4name,"charge");
if(error) return(error);
here->BSIM4qNode = tmp->number;
}
}
else
here->BSIM4qNode = 0;
/* set Sparse Matrix Pointers
* macro to make elements with built-in out-of-memory test */
#define TSTALLOC(ptr,first,second) \
@ -2725,7 +2710,6 @@ BSIM4unsetup(
GENmodel *inModel,
CKTcircuit *ckt)
{
#ifndef HAS_BATCHSIM
BSIM4model *model;
BSIM4instance *here;
@ -2780,6 +2764,5 @@ CKTcircuit *ckt)
here->BSIM4dNodePrime = 0;
}
}
#endif
return OK;
}

144
src/spicelib/devices/bsim4/b4temp.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,8 +17,10 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
*/
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
#include "ngspice/smpdefs.h"
#include "ngspice/cktdefs.h"
@ -94,6 +89,7 @@ double n,n0, Vgsteff, Vgs_eff, niter, toxpf, toxpi, Tcen, toxe, epsrox, vddeot;
double vtfbphi2eot, phieot, TempRatioeot, Vtm0eot, Vtmeot,vbieot;
int Size_Not_Found, i;
int Fatal_Flag = 0;
/* loop through all the BSIM4 device models */
for (; model != NULL; model = BSIM4nextModel(model))
@ -139,10 +135,8 @@ int Size_Not_Found, i;
if (!model->BSIM4toxmGiven) /* v4.7 */
model->BSIM4toxm = model->BSIM4toxe;
}
if (!model->BSIM4cfGiven) /* v4.8.2 */
model->BSIM4cf = 2.0 * model->BSIM4epsrox * EPS0 / PI
* log(1.0 + 0.4e-6 / model->BSIM4toxe);
}
else if(model->BSIM4mtrlCompatMod != 0) /* v4.7 */
{
T0 = model->BSIM4epsrox / 3.9;
@ -172,7 +166,9 @@ int Size_Not_Found, i;
toxe = model->BSIM4toxe;
epssub = EPSSI;
}
if(!model->BSIM4cfGiven)
model->BSIM4cf = 2.0 * epsrox * EPS0 / PI
* log(1.0 + 0.4e-6 /toxe);
model->BSIM4coxe = epsrox * EPS0 / toxe;
if(model->BSIM4mtrlMod == 0 || model->BSIM4mtrlCompatMod != 0)
@ -194,13 +190,6 @@ int Size_Not_Found, i;
}
if (!model->BSIM4cgboGiven)
model->BSIM4cgbo = 2.0 * model->BSIM4dwc * model->BSIM4coxe;
struct bsim4SizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct bsim4SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;
@ -351,26 +340,26 @@ int Size_Not_Found, i;
model->BSIM4PhiBSWS = model->BSIM4SsidewallJctPotential
- model->BSIM4tpbsw * delTemp;
if (model->BSIM4PhiBSWS <= 0.01)
if (model->BSIM4PhiBSWS < 0.01)
{ model->BSIM4PhiBSWS = 0.01;
fprintf(stderr, "Temperature effect has caused pbsws to be less than 0.01. Pbsws is clamped to 0.01.\n");
}
model->BSIM4PhiBSWD = model->BSIM4DsidewallJctPotential
- model->BSIM4tpbsw * delTemp;
if (model->BSIM4PhiBSWD <= 0.01)
if (model->BSIM4PhiBSWD < 0.01)
{ model->BSIM4PhiBSWD = 0.01;
fprintf(stderr, "Temperature effect has caused pbswd to be less than 0.01. Pbswd is clamped to 0.01.\n");
}
model->BSIM4PhiBSWGS = model->BSIM4SGatesidewallJctPotential
- model->BSIM4tpbswg * delTemp;
if (model->BSIM4PhiBSWGS <= 0.01)
if (model->BSIM4PhiBSWGS < 0.01)
{ model->BSIM4PhiBSWGS = 0.01;
fprintf(stderr, "Temperature effect has caused pbswgs to be less than 0.01. Pbswgs is clamped to 0.01.\n");
}
model->BSIM4PhiBSWGD = model->BSIM4DGatesidewallJctPotential
- model->BSIM4tpbswg * delTemp;
if (model->BSIM4PhiBSWGD <= 0.01)
if (model->BSIM4PhiBSWGD < 0.01)
{ model->BSIM4PhiBSWGD = 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 */
@ -425,8 +414,7 @@ int Size_Not_Found, i;
/* loop through all the instances of the model */
for (here = BSIM4instances(model); here != NULL;
here = BSIM4nextInstance(here))
{
pSizeDependParamKnot = model->pSizeDependParamKnot;
{ pSizeDependParamKnot = model->pSizeDependParamKnot;
Size_Not_Found = 1;
while ((pSizeDependParamKnot != NULL) && Size_Not_Found)
{ if ((here->BSIM4l == pSizeDependParamKnot->Length)
@ -447,7 +435,8 @@ int Size_Not_Found, i;
Wdrn = here->BSIM4w / here->BSIM4nf;
if (Size_Not_Found)
{ pParam = TMALLOC(struct bsim4SizeDependParam, 1);
{ pParam = (struct bsim4SizeDependParam *)malloc(
sizeof(struct bsim4SizeDependParam));
if (pLastKnot == NULL)
model->pSizeDependParamKnot = pParam;
else
@ -482,46 +471,56 @@ int Size_Not_Found, i;
pParam->BSIM4leff = Lnew - 2.0 * pParam->BSIM4dl;
if (pParam->BSIM4leff <= 0.0)
{
SPfrontEnd->IFerrorf(ERR_FATAL,
{ IFuid namarray[2];
namarray[0] = model->BSIM4modName;
namarray[1] = here->BSIM4name;
(*(SPfrontEnd->IFerror))(ERR_FATAL,
"BSIM4: mosfet %s, model %s: Effective channel length <= 0",
model->BSIM4modName, here->BSIM4name);
namarray);
return(E_BADPARM);
}
pParam->BSIM4weff = Wnew - 2.0 * pParam->BSIM4dw;
if (pParam->BSIM4weff <= 0.0)
{
SPfrontEnd->IFerrorf(ERR_FATAL,
{ IFuid namarray[2];
namarray[0] = model->BSIM4modName;
namarray[1] = here->BSIM4name;
(*(SPfrontEnd->IFerror))(ERR_FATAL,
"BSIM4: mosfet %s, model %s: Effective channel width <= 0",
model->BSIM4modName, here->BSIM4name);
namarray);
return(E_BADPARM);
}
pParam->BSIM4leffCV = Lnew - 2.0 * pParam->BSIM4dlc;
if (pParam->BSIM4leffCV <= 0.0)
{
SPfrontEnd->IFerrorf(ERR_FATAL,
{ IFuid namarray[2];
namarray[0] = model->BSIM4modName;
namarray[1] = here->BSIM4name;
(*(SPfrontEnd->IFerror))(ERR_FATAL,
"BSIM4: mosfet %s, model %s: Effective channel length for C-V <= 0",
model->BSIM4modName, here->BSIM4name);
namarray);
return(E_BADPARM);
}
pParam->BSIM4weffCV = Wnew - 2.0 * pParam->BSIM4dwc;
if (pParam->BSIM4weffCV <= 0.0)
{
SPfrontEnd->IFerrorf(ERR_FATAL,
{ IFuid namarray[2];
namarray[0] = model->BSIM4modName;
namarray[1] = here->BSIM4name;
(*(SPfrontEnd->IFerror))(ERR_FATAL,
"BSIM4: mosfet %s, model %s: Effective channel width for C-V <= 0",
model->BSIM4modName, here->BSIM4name);
namarray);
return(E_BADPARM);
}
pParam->BSIM4weffCJ = Wnew - 2.0 * pParam->BSIM4dwj;
if (pParam->BSIM4weffCJ <= 0.0)
{
SPfrontEnd->IFerrorf(ERR_FATAL,
{ IFuid namarray[2];
namarray[0] = model->BSIM4modName;
namarray[1] = here->BSIM4name;
(*(SPfrontEnd->IFerror))(ERR_FATAL,
"BSIM4: mosfet %s, model %s: Effective channel width for S/D junctions <= 0",
model->BSIM4modName, here->BSIM4name);
namarray);
return(E_BADPARM);
}
@ -598,6 +597,10 @@ int Size_Not_Found, i;
+ model->BSIM4lketa * Inv_L
+ model->BSIM4wketa * Inv_W
+ model->BSIM4pketa * Inv_LW;
pParam->BSIM4ketac = model->BSIM4ketac
+ model->BSIM4lketac * Inv_L
+ model->BSIM4wketac * Inv_W
+ model->BSIM4pketac * Inv_LW;
pParam->BSIM4nsub = model->BSIM4nsub
+ model->BSIM4lnsub * Inv_L
+ model->BSIM4wnsub * Inv_W
@ -1181,7 +1184,6 @@ int Size_Not_Found, i;
+ model->BSIM4lku0we * Inv_L
+ model->BSIM4wku0we * Inv_W
+ model->BSIM4pku0we * Inv_LW;
pParam->BSIM4abulkCVfactor = 1.0 + pow((pParam->BSIM4clc
/ pParam->BSIM4leffCV),
pParam->BSIM4cle);
@ -1316,6 +1318,15 @@ int Size_Not_Found, i;
pParam->BSIM4phi = Vtm0 * log(pParam->BSIM4ndep / ni)
+ pParam->BSIM4phin + 0.4;
if(pParam->BSIM4phi <= 0.0)
{
printf("Fatal: Phi = %g is not positive. Please check Phin and Ndep\n",
pParam->BSIM4phi);
printf(" Phin = %g Ndep = %g \n",
pParam->BSIM4phin, pParam->BSIM4ndep);
Fatal_Flag = 1;
}
pParam->BSIM4sqrtPhi = sqrt(pParam->BSIM4phi);
pParam->BSIM4phis3 = pParam->BSIM4sqrtPhi * pParam->BSIM4phi;
@ -1363,16 +1374,19 @@ int Size_Not_Found, i;
/ (toxe * pParam->BSIM4poxedge)))
/ toxe / toxe
/ pParam->BSIM4poxedge / pParam->BSIM4poxedge;
pParam->BSIM4Aechvb = (model->BSIM4type == NMOS) ? 4.97232e-7 : 3.42537e-7;
pParam->BSIM4Bechvb = (model->BSIM4type == NMOS) ? 7.45669e11 : 1.16645e12;
if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) &&
(strcmp(model->BSIM4version, "4.8.2")) && (strncmp(model->BSIM4version, "4.82", 4)))
(strcmp(model->BSIM4version, "4.8.2")) && (strncmp(model->BSIM4version, "4.82", 4)) &&
(strcmp(model->BSIM4version, "4.8.3")) && (strncmp(model->BSIM4version, "4.83", 4)))
{
pParam->BSIM4AechvbEdgeS = pParam->BSIM4Aechvb * pParam->BSIM4weff
* model->BSIM4dlcig * pParam->BSIM4ToxRatioEdge;
pParam->BSIM4AechvbEdgeD = pParam->BSIM4Aechvb * pParam->BSIM4weff
* model->BSIM4dlcigd * pParam->BSIM4ToxRatioEdge;
}
else
{
@ -1390,6 +1404,7 @@ int Size_Not_Found, i;
}
pParam->BSIM4AechvbEdgeD = pParam->BSIM4Aechvb * pParam->BSIM4weff
* model->BSIM4dlcigd * pParam->BSIM4ToxRatioEdge;
}
pParam->BSIM4BechvbEdge = -pParam->BSIM4Bechvb
@ -1399,6 +1414,8 @@ int Size_Not_Found, i;
pParam->BSIM4Bechvb *= -toxe;
pParam->BSIM4mstar = 0.5 + atan(pParam->BSIM4minv) / PI;
pParam->BSIM4mstarcv = 0.5 + atan(pParam->BSIM4minvcv) / PI;
pParam->BSIM4voffcbn = pParam->BSIM4voff + model->BSIM4voffl / pParam->BSIM4leff;
@ -1411,18 +1428,13 @@ int Size_Not_Found, i;
if (model->BSIM4k1Given || model->BSIM4k2Given)
{ if (!model->BSIM4k1Given)
{
if ((!ckt->CKTcurJob) || (ckt->CKTcurJob->JOBtype < 9)) /* don't print in sensitivity */
fprintf(stdout, "Warning: k1 should be specified with k2.\n");
{ fprintf(stdout, "Warning: k1 should be specified with k2.\n");
pParam->BSIM4k1 = 0.53;
}
if (!model->BSIM4k2Given)
{
if ((!ckt->CKTcurJob) || (ckt->CKTcurJob->JOBtype < 9)) /* don't print in sensitivity */
fprintf(stdout, "Warning: k2 should be specified with k1.\n");
{ fprintf(stdout, "Warning: k2 should be specified with k1.\n");
pParam->BSIM4k2 = -0.0186;
}
if ((!ckt->CKTcurJob) || (ckt->CKTcurJob->JOBtype < 9)) { /* don't print in sensitivity */
if (model->BSIM4nsubGiven)
fprintf(stdout, "Warning: nsub is ignored because k1 or k2 is given.\n");
if (model->BSIM4xtGiven)
@ -1434,7 +1446,6 @@ int Size_Not_Found, i;
if (model->BSIM4gamma2Given)
fprintf(stdout, "Warning: gamma2 is ignored because k1 or k2 is given.\n");
}
}
else
{ if (!model->BSIM4vbxGiven)
pParam->BSIM4vbx = pParam->BSIM4phi - 7.7348e-4
@ -1757,9 +1768,6 @@ int Size_Not_Found, i;
here->BSIM4vth0 += here->BSIM4delvto;
here->BSIM4vfb = pParam->BSIM4vfb + model->BSIM4type * here->BSIM4delvto;
/* low field mobility multiplier */
here->BSIM4u0temp = pParam->BSIM4u0temp * here->BSIM4mulu0;
/* Instance variables calculation */
T3 = model->BSIM4type * here->BSIM4vth0
- here->BSIM4vfb - pParam->BSIM4phi;
@ -1864,6 +1872,7 @@ int Size_Not_Found, i;
here->BSIM4rbpb = rbpbx*rbpby/(rbpbx + rbpby);
}
if ((here->BSIM4rbodyMod == 1 ) || ((here->BSIM4rbodyMod == 2 ) && (bodymode == 5)) )
{ if (here->BSIM4rbdb < 1.0e-3)
here->BSIM4grbdb = 1.0e3; /* in mho */
@ -2267,6 +2276,15 @@ int Size_Not_Found, i;
* pParam->BSIM4ndep / (ni * ni));
phieot = Vtm0eot * log(pParam->BSIM4ndep / ni)
+ pParam->BSIM4phin + 0.4;
if(phieot <= 0.0)
{
printf("Fatal: phieot = %g is not positive. Please Check Phin and Ndep\n",
pParam->BSIM4phi);
printf("phieot = %g Ndep = %g \n",
pParam->BSIM4phin, pParam->BSIM4ndep);
Fatal_Flag = 1;
}
tmp2 = here->BSIM4vfb + phieot;
vddeot = model->BSIM4type * model->BSIM4vddeot;
T0 = model->BSIM4epsrgate * EPS0;
@ -2375,18 +2393,22 @@ int Size_Not_Found, i;
} while ((niter<=4)&&(ABS(toxpf-toxpi)>1e-12));
here->BSIM4toxp = toxpf;
here->BSIM4coxp = epsrox * EPS0 / here->BSIM4toxp;
} else {
here->BSIM4toxp = model->BSIM4toxp;
here->BSIM4coxp = model->BSIM4coxp;
}
if (BSIM4checkModel(model, here, ckt))
{
SPfrontEnd->IFerrorf(ERR_FATAL,
"detected during BSIM4.8.2 parameter checking for \n model %s of device instance %s\n", model->BSIM4modName, here->BSIM4name);
{ IFuid namarray[2];
namarray[0] = model->BSIM4modName;
namarray[1] = here->BSIM4name;
(*(SPfrontEnd->IFerror)) (ERR_FATAL, "Fatal error(s) detected during BSIM4.6.0 parameter checking for %s in model %s", namarray);
return(E_BADPARM);
}
} /* End instance */
}
return(OK);
}

19
src/spicelib/devices/bsim4/b4trunc.c

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#include "ngspice/ngspice.h"
@ -32,7 +28,6 @@ under the License.
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
int
BSIM4trunc(
GENmodel *inModel,

124
src/spicelib/devices/bsim4/bsim4def.h

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#ifndef BSIM4
@ -95,6 +91,7 @@ typedef struct sBSIM4instance
double BSIM4l;
double BSIM4w;
double BSIM4m;
double BSIM4drainArea;
double BSIM4sourceArea;
double BSIM4drainSquares;
@ -103,6 +100,7 @@ typedef struct sBSIM4instance
double BSIM4sourcePerimeter;
double BSIM4sourceConductance;
double BSIM4drainConductance;
/* stress effect instance param */
double BSIM4sa;
double BSIM4sb;
@ -119,12 +117,11 @@ typedef struct sBSIM4instance
double BSIM4rbpd;
double BSIM4delvto;
double BSIM4mulu0;
int BSIM4wnflag;
double BSIM4xgw;
double BSIM4ngcon;
/* added here to account stress effect instance dependence */
double BSIM4u0temp;
double BSIM4vsattemp;
double BSIM4vth0;
@ -142,9 +139,12 @@ typedef struct sBSIM4instance
double BSIM4icVDS;
double BSIM4icVGS;
double BSIM4icVBS;
double BSIM4m;
double BSIM4mult_i;
double BSIM4mult_q;
double BSIM4mult_fn;
double BSIM4nf;
int BSIM4off;
int BSIM4mode;
int BSIM4trnqsMod;
int BSIM4acnqsMod;
@ -286,6 +286,9 @@ typedef struct sBSIM4instance
unsigned BSIM4lGiven :1;
unsigned BSIM4wGiven :1;
unsigned BSIM4mGiven :1;
unsigned BSIM4mult_iGiven :1;
unsigned BSIM4mult_qGiven :1;
unsigned BSIM4mult_fnGiven :1;
unsigned BSIM4nfGiven :1;
unsigned BSIM4minGiven :1;
unsigned BSIM4drainAreaGiven :1;
@ -307,8 +310,6 @@ typedef struct sBSIM4instance
unsigned BSIM4rbpdGiven :1;
unsigned BSIM4rbpsGiven :1;
unsigned BSIM4delvtoGiven :1;
unsigned BSIM4mulu0Given :1;
unsigned BSIM4wnflagGiven :1;
unsigned BSIM4xgwGiven :1;
unsigned BSIM4ngconGiven :1;
unsigned BSIM4icVDSGiven :1;
@ -680,6 +681,7 @@ struct bsim4SizeDependParam
double BSIM4a1;
double BSIM4a2;
double BSIM4keta;
double BSIM4ketac;
double BSIM4nsub;
double BSIM4ndep;
double BSIM4nsd;
@ -927,7 +929,6 @@ typedef struct sBSIM4model
int BSIM4rgateMod;
int BSIM4perMod;
int BSIM4geoMod;
int BSIM4rgeoMod;
int BSIM4mtrlMod;
int BSIM4mtrlCompatMod; /* v4.7 */
int BSIM4gidlMod; /* v4.7 New GIDL/GISL */
@ -962,6 +963,7 @@ typedef struct sBSIM4model
double BSIM4a1;
double BSIM4a2;
double BSIM4keta;
double BSIM4ketac;
double BSIM4nsub;
double BSIM4phig;
double BSIM4epsrgate;
@ -1247,6 +1249,7 @@ typedef struct sBSIM4model
double BSIM4la1;
double BSIM4la2;
double BSIM4lketa;
double BSIM4lketac;
double BSIM4lnsub;
double BSIM4lndep;
double BSIM4lnsd;
@ -1407,6 +1410,7 @@ typedef struct sBSIM4model
double BSIM4wa1;
double BSIM4wa2;
double BSIM4wketa;
double BSIM4wketac;
double BSIM4wnsub;
double BSIM4wndep;
double BSIM4wnsd;
@ -1567,6 +1571,7 @@ typedef struct sBSIM4model
double BSIM4pa1;
double BSIM4pa2;
double BSIM4pketa;
double BSIM4pketac;
double BSIM4pnsub;
double BSIM4pndep;
double BSIM4pnsd;
@ -1823,6 +1828,7 @@ typedef struct sBSIM4model
/* Pre-calculated constants
* move to size-dependent param */
double BSIM4Eg0;
double BSIM4vtm;
double BSIM4vtm0;
@ -1872,6 +1878,7 @@ typedef struct sBSIM4model
double BSIM4vgbrMax;
double BSIM4vbsrMax;
double BSIM4vbdrMax;
double BSIM4gidlclamp;
double BSIM4idovvdsc;
struct bsim4SizeDependParam *pSizeDependParamKnot;
@ -1892,7 +1899,6 @@ typedef struct sBSIM4model
unsigned BSIM4rgateModGiven :1;
unsigned BSIM4perModGiven :1;
unsigned BSIM4geoModGiven :1;
unsigned BSIM4rgeoModGiven :1;
unsigned BSIM4paramChkGiven :1;
unsigned BSIM4trnqsModGiven :1;
unsigned BSIM4acnqsModGiven :1;
@ -1932,6 +1938,7 @@ typedef struct sBSIM4model
unsigned BSIM4a1Given :1;
unsigned BSIM4a2Given :1;
unsigned BSIM4ketaGiven :1;
unsigned BSIM4ketacGiven :1;
unsigned BSIM4nsubGiven :1;
unsigned BSIM4phigGiven :1;
unsigned BSIM4epsrgateGiven :1;
@ -2217,6 +2224,7 @@ typedef struct sBSIM4model
unsigned BSIM4la1Given :1;
unsigned BSIM4la2Given :1;
unsigned BSIM4lketaGiven :1;
unsigned BSIM4lketacGiven :1;
unsigned BSIM4lnsubGiven :1;
unsigned BSIM4lndepGiven :1;
unsigned BSIM4lnsdGiven :1;
@ -2377,6 +2385,7 @@ typedef struct sBSIM4model
unsigned BSIM4wa1Given :1;
unsigned BSIM4wa2Given :1;
unsigned BSIM4wketaGiven :1;
unsigned BSIM4wketacGiven :1;
unsigned BSIM4wnsubGiven :1;
unsigned BSIM4wndepGiven :1;
unsigned BSIM4wnsdGiven :1;
@ -2537,6 +2546,7 @@ typedef struct sBSIM4model
unsigned BSIM4pa1Given :1;
unsigned BSIM4pa2Given :1;
unsigned BSIM4pketaGiven :1;
unsigned BSIM4pketacGiven :1;
unsigned BSIM4pnsubGiven :1;
unsigned BSIM4pndepGiven :1;
unsigned BSIM4pnsdGiven :1;
@ -2807,7 +2817,6 @@ typedef struct sBSIM4model
unsigned BSIM4pku0weGiven :1;
unsigned BSIM4gidlclampGiven :1;
unsigned BSIM4idovvdscGiven :1;
} BSIM4model;
@ -2855,35 +2864,40 @@ typedef struct sBSIM4model
#define BSIM4_SCC 36
#define BSIM4_SC 37
#define BSIM4_M 38
#define BSIM4_MULU0 39
#define BSIM4_WNFLAG 40
#define BSIM4_VGSTEFF 40
#define BSIM4_VDSEFF 41
#define BSIM4_CGSO 42
#define BSIM4_CGDO 43
#define BSIM4_CGBO 44
#define BSIM4_WEFF 45
#define BSIM4_LEFF 46
/* Global parameters */
#define BSIM4_MOD_TEMPEOT 65
#define BSIM4_MOD_LEFFEOT 66
#define BSIM4_MOD_WEFFEOT 67
#define BSIM4_MOD_UCSTE 68
#define BSIM4_MOD_LUCSTE 69
#define BSIM4_MOD_WUCSTE 70
#define BSIM4_MOD_PUCSTE 71
#define BSIM4_MOD_UCS 72
#define BSIM4_MOD_LUCS 73
#define BSIM4_MOD_WUCS 74
#define BSIM4_MOD_PUCS 75
#define BSIM4_MOD_CVCHARGEMOD 76
#define BSIM4_MOD_ADOS 77
#define BSIM4_MOD_BDOS 78
#define BSIM4_MOD_TEMPMOD 79
#define BSIM4_MOD_MTRLMOD 80
#define BSIM4_MOD_IGCMOD 81
#define BSIM4_MOD_IGBMOD 82
#define BSIM4_MOD_ACNQSMOD 83
#define BSIM4_MOD_FNOIMOD 84
#define BSIM4_MOD_RDSMOD 85
#define BSIM4_MOD_DIOMOD 86
#define BSIM4_MOD_PERMOD 87
#define BSIM4_MOD_GEOMOD 88
#define BSIM4_MOD_RGEOMOD 89
#define BSIM4_MOD_TEMPEOT 66
#define BSIM4_MOD_LEFFEOT 67
#define BSIM4_MOD_WEFFEOT 68
#define BSIM4_MOD_UCSTE 69
#define BSIM4_MOD_LUCSTE 70
#define BSIM4_MOD_WUCSTE 71
#define BSIM4_MOD_PUCSTE 72
#define BSIM4_MOD_UCS 73
#define BSIM4_MOD_LUCS 74
#define BSIM4_MOD_WUCS 75
#define BSIM4_MOD_PUCS 76
#define BSIM4_MOD_CVCHARGEMOD 77
#define BSIM4_MOD_ADOS 78
#define BSIM4_MOD_BDOS 79
#define BSIM4_MOD_TEMPMOD 80
#define BSIM4_MOD_MTRLMOD 81
#define BSIM4_MOD_IGCMOD 82
#define BSIM4_MOD_IGBMOD 83
#define BSIM4_MOD_ACNQSMOD 84
#define BSIM4_MOD_FNOIMOD 85
#define BSIM4_MOD_RDSMOD 86
#define BSIM4_MOD_DIOMOD 87
#define BSIM4_MOD_PERMOD 88
#define BSIM4_MOD_GEOMOD 89
#define BSIM4_MOD_RGATEMOD 90
#define BSIM4_MOD_RBODYMOD 91
#define BSIM4_MOD_CAPMOD 92
@ -3864,6 +3878,15 @@ typedef struct sBSIM4model
/* Tuning for noise parameter BSIM4IdovVds (C.K.Dabhi) - request cadence */
#define BSIM4_MOD_IDOVVDSC 1275
/* for dynamic evaluate */
#define BSIM4_MOD_KETAC 1276
#define BSIM4_MOD_LKETAC 1277
#define BSIM4_MOD_WKETAC 1278
#define BSIM4_MOD_PKETAC 1279
#define BSIM4_MULT_I 1280
#define BSIM4_MULT_Q 1281
#define BSIM4_MULT_FN 1282
#define BSIM4_MOD_VGS_MAX 1301
#define BSIM4_MOD_VGD_MAX 1302
#define BSIM4_MOD_VGB_MAX 1303
@ -3876,14 +3899,6 @@ typedef struct sBSIM4model
#define BSIM4_MOD_VBSR_MAX 1310
#define BSIM4_MOD_VBDR_MAX 1311
#define BSIM4_VGSTEFF 1400
#define BSIM4_VDSEFF 1401
#define BSIM4_CGSO 1402
#define BSIM4_CGDO 1403
#define BSIM4_CGBO 1404
#define BSIM4_WEFF 1405
#define BSIM4_LEFF 1406
#include "bsim4ext.h"
extern void BSIM4evaluate(double,double,double,BSIM4instance*,BSIM4model*,
@ -3898,3 +3913,4 @@ extern int BSIM4RdsEndIso(double, double, double, double, double, double, int, i
extern int BSIM4RdsEndSha(double, double, double, double, double, double, int, int, double *);
#endif /*BSIM4*/

18
src/spicelib/devices/bsim4/bsim4ext.h

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
extern int BSIM4acLoad(GENmodel *,CKTcircuit*);

18
src/spicelib/devices/bsim4/bsim4itf.h

@ -1,20 +1,13 @@
/* ******************************************************************************
* BSIM4 4.8.2 released by Chetan Kumar Dabhi 01/01/2020 *
* BSIM4 4.8.3 released on 05/19/2025 *
* BSIM4 Model Equations *
******************************************************************************
******************************************************************************
* Copyright (c) 2020 University of California *
* Copyright (c) 2025 University of California *
* *
* Project Director: Prof. Chenming Hu. *
* Current developers: Chetan Kumar Dabhi (Ph.D. student, IIT Kanpur) *
* Prof. Yogesh Chauhan (IIT Kanpur) *
* Dr. Pragya Kushwaha (Postdoc, UC Berkeley) *
* Dr. Avirup Dasgupta (Postdoc, UC Berkeley) *
* Ming-Yen Kao (Ph.D. student, UC Berkeley) *
* Authors: Gary W. Ng, Weidong Liu, Xuemei Xi, Mohan Dunga, Wenwei Yang *
* Ali Niknejad, Chetan Kumar Dabhi, Yogesh Singh Chauhan, *
* Sayeef Salahuddin, Chenming Hu *
* Project Directors: Prof. Sayeef Salahuddin and Prof. Chenming Hu *
* Developers list: https://www.bsim.berkeley.edu/models/bsim4/auth_bsim4/ *
******************************************************************************/
/*
@ -24,6 +17,9 @@ http://opensource.org/licenses/ECL-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
under the License.
BSIM4 model is supported by the members of Silicon Integration Initiative's Compact Model Coalition. A link to the most recent version of this
standard can be found at: http://www.si2.org/cmc
*/
#ifndef DEV_BSIM4

Loading…
Cancel
Save