From 84c3d3fbc05bebd21e76e6fff941dfa222f10878 Mon Sep 17 00:00:00 2001 From: rouat Date: Sun, 25 Nov 2001 17:56:26 +0000 Subject: [PATCH] Updated BSIM4 model to latest version (BSIM4.2.1) --- src/frontend/ChangeLog | 4 + src/frontend/circuits.h | 23 -- src/frontend/com_state.c | 1 + src/include/ChangeLog | 4 + src/include/ftedefs.h | 26 ++ src/ngspice.idx | Bin 13464 -> 13464 bytes src/spicelib/devices/bsim4/ChangeLog | 4 + src/spicelib/devices/bsim4/b4.c | 47 ++- src/spicelib/devices/bsim4/b4acld.c | 77 ++-- src/spicelib/devices/bsim4/b4ask.c | 78 +++- src/spicelib/devices/bsim4/b4check.c | 111 +++--- src/spicelib/devices/bsim4/b4cvtest.c | 39 +- src/spicelib/devices/bsim4/b4del.c | 12 +- src/spicelib/devices/bsim4/b4dest.c | 12 +- src/spicelib/devices/bsim4/b4geo.c | 14 +- src/spicelib/devices/bsim4/b4getic.c | 16 +- src/spicelib/devices/bsim4/b4ld.c | 553 +++++++++++++++++--------- src/spicelib/devices/bsim4/b4mask.c | 20 +- src/spicelib/devices/bsim4/b4mdel.c | 12 +- src/spicelib/devices/bsim4/b4mpar.c | 20 +- src/spicelib/devices/bsim4/b4noi.c | 31 +- src/spicelib/devices/bsim4/b4par.c | 13 +- src/spicelib/devices/bsim4/b4pzld.c | 83 ++-- src/spicelib/devices/bsim4/b4set.c | 109 +++-- src/spicelib/devices/bsim4/b4temp.c | 175 ++++---- src/spicelib/devices/bsim4/b4trunc.c | 19 +- src/spicelib/devices/bsim4/bsim4def.h | 132 ++++-- src/spicelib/devices/bsim4/bsim4ext.h | 5 +- src/spicelib/devices/bsim4/bsim4itf.h | 82 +++- 29 files changed, 1133 insertions(+), 589 deletions(-) diff --git a/src/frontend/ChangeLog b/src/frontend/ChangeLog index dbd30e98e..a59b5e15f 100644 --- a/src/frontend/ChangeLog +++ b/src/frontend/ChangeLog @@ -1,3 +1,7 @@ +2001-11-25 Emmanuel Rouat + + * circuits.h: transfered definition of sstructire 'circ' to ftedefs.h + 2001-02-07 Paolo Nenzi * outitf.c: From a message Alan sento to the mailing list: diff --git a/src/frontend/circuits.h b/src/frontend/circuits.h index d83d57830..cbfb8bdbd 100644 --- a/src/frontend/circuits.h +++ b/src/frontend/circuits.h @@ -6,30 +6,7 @@ #ifndef CIRCUITS_H_INCLUDED #define CIRCUITS_H_INCLUDED -/* The curcuits that are currently available to the user. */ -struct circ { - char *ci_name; /* What the circuit can be called. */ - char *ci_ckt; /* The CKTcircuit structure. */ - INPtables *ci_symtab; /* The INP symbol table. */ - struct line *ci_deck; /* The input deck. */ - struct line *ci_origdeck;/* The input deck, before subckt expansion. */ - struct line *ci_options;/* The .option cards from the deck... */ - struct variable *ci_vars; /* ... and the parsed versions. */ - bool ci_inprogress; /* We are in a break now. */ - bool ci_runonce; /* So com_run can to a reset if necessary... */ - wordlist *ci_commands; /* Things to do when this circuit is done. */ - struct circ *ci_next; /* The next in the list. */ - char *ci_nodes; /* ccom structs for the nodes... */ - char *ci_devices; /* and devices in the circuit. */ - char *ci_filename; /* Where this circuit came from. */ - char *ci_defTask; /* the default task for this circuit */ - char *ci_specTask; /* the special task for command line jobs */ - char *ci_curTask; /* the most recent task for this circuit */ - char *ci_defOpt; /* the default options anal. for this circuit */ - char *ci_specOpt; /* the special options anal. for command line jobs */ - char *ci_curOpt; /* the most recent options anal. for the circuit */ -} ; struct subcirc { char *sc_name; /* Whatever... */ diff --git a/src/frontend/com_state.c b/src/frontend/com_state.c index d420bda2f..cb8beb128 100644 --- a/src/frontend/com_state.c +++ b/src/frontend/com_state.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "circuits.h" diff --git a/src/include/ChangeLog b/src/include/ChangeLog index a398b3582..7d908a57d 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,7 @@ +2001-11-25 Emmanuel Rouat + + * ftedefs.h: added definition of structure circ (taken from circuits.h) + 2000-09-09 Arno W. Peters * fteext.h: Removed prototype for com_fourier(). Use diff --git a/src/include/ftedefs.h b/src/include/ftedefs.h index c70c27133..5c4fdc702 100644 --- a/src/include/ftedefs.h +++ b/src/include/ftedefs.h @@ -22,6 +22,32 @@ struct save_info { int used; }; +/* The curcuits that are currently available to the user. */ + +struct circ { + char *ci_name; /* What the circuit can be called. */ + char *ci_ckt; /* The CKTcircuit structure. */ + INPtables *ci_symtab; /* The INP symbol table. */ + struct line *ci_deck; /* The input deck. */ + struct line *ci_origdeck;/* The input deck, before subckt expansion. */ + struct line *ci_options;/* The .option cards from the deck... */ + struct variable *ci_vars; /* ... and the parsed versions. */ + bool ci_inprogress; /* We are in a break now. */ + bool ci_runonce; /* So com_run can to a reset if necessary... */ + wordlist *ci_commands; /* Things to do when this circuit is done. */ + struct circ *ci_next; /* The next in the list. */ + char *ci_nodes; /* ccom structs for the nodes... */ + char *ci_devices; /* and devices in the circuit. */ + char *ci_filename; /* Where this circuit came from. */ + char *ci_defTask; /* the default task for this circuit */ + char *ci_specTask; /* the special task for command line jobs */ + char *ci_curTask; /* the most recent task for this circuit */ + char *ci_defOpt; /* the default options anal. for this circuit */ + char *ci_specOpt; /* the special options anal. for command line jobs */ + char *ci_curOpt; /* the most recent options anal. for the circuit */ +} ; + + #define mylog10(xx) (((xx) > 0.0) ? log10(xx) : (- log10(HUGE))) #include "fteext.h" diff --git a/src/ngspice.idx b/src/ngspice.idx index 69f63660e882e05f0d9b05fb0384dd524e3f65e9..6cda8a5f93aa5a0d22140da056c5a64132aa5e99 100644 GIT binary patch delta 817 zcmYL{ZAep57{?#ax!b){w{TRTl`mO3U#3o{O`XclrZV$ozMF(`o3mYs-L+kNr9vcv zghHMQ>4RV&B7&m6^d*X*pa_cWqfj77`5_Vtdl9kjnPT70@Be?EhyQubnO3Hihif_H zNFlE0u$0OY3f&MxlA{4I`Pe3My|WilFLki8r=#jBbr`VD>>Yp z)KeTNT&u_VTt=+Tn7NOc7W}%W$=Vp6AQe;Dl60_x3!x}4Ho@lrCpAG7!d+OhpGk}T z6nbKE5IZyUk|%=+itq+A+&jEM@u(WteHWP-!umWWT8An0MuxF1qfS&p{2a%my>;Zr z2qxz<5)NZ~K9lZ_Qs|E<8lRjD4wb^dv6vji*{oX98OID8Be9b>WMj$XG=;8EG$d=d zY^#>w=@|+>{fe@!j*Ohc!U9IB&SRv2NoOxoXqAtKaJEcOyEsmvS=H2yT^yRgnnFgV zF5!hjmdY+u=<{^>J*>46bF8IP*(S2{3L1-;xcZU;>uugpEo5;XuNE;&(iaMzK%lYR z=O4)SV4A7QZ1_pRtH02gqGdaD04u$CU4Jq6%#u}^Y&drejQ2>8rcr3`OLNB-4x*Co|-2 O*Hv67YY=jG8Q~w$aP46L delta 817 zcmYL{T}YEr7{{NT_uckxYcmZm9BK0-opZYRk4`q<|74v|WU z$e;_!9s=n?km$CLyRL+~2r3c1i=@EtCP59X2rKJ7o8;a3{r}H%_&?7%bJ4lzv){$U zW5)ersw=c|&=-+H(PRh}`Axz%TZR+3TGUF8*Wud|O0GAep_FPI4%r%wj!1H0i%`(a zC_c`BgYj1UP)f<38;i=Q=8Z@8BvDG^7^$B%2|~S(36TUV*1)o#Q9MH&1Oixdk_t;f z4*HW~2z!ij$)mvx#aM$L?hj=tm58Tg-$AC&V|zJO?};1)V`20e+tfWFc21$9q>ZeF zQCmStUm*DzK|h2a|%I#HDz47tWj5Y@uZ0 z7EW5|5zB232AsWKC++UU;yl}|NkjJUpsI?hKfmID20dBTK$hO)OcgbJ+2Ft#2z2`0 z-a(TSb2W|ntz8aW@(ZP-lBrf!PLrzdIAo>d<4>HoQvJ@aL%)If`pLhC%Bf7pwhk{< zQ<8rapHx%T(?TAcefYe(U0qhr1MTW(*>wQ(7Mc3IzFNklCWwnQRIi-k!6hcdP*jR1 z*==gmqO7=F2ho+6U(1NO4IL!)4wr3Ic(B5QI~otOo$DcIjR$WmoDQ*eMZSZqY~n*Z zCDyO_$xa1+mxr!1otX$4c=3ma?*3jU3!sMSV@mKHEG~!KEyL|vDr_{%VmwvHN;Kdb z$xwZkQkbDeMjSX^;(i_F*SC~_tF{g;to%^2Zx*|PXN@iD8HEZ4{*OUaIy5v;r6EsN Maoyg*>k3rx59$%@B>(^b diff --git a/src/spicelib/devices/bsim4/ChangeLog b/src/spicelib/devices/bsim4/ChangeLog index 1a877696d..5f9192965 100644 --- a/src/spicelib/devices/bsim4/ChangeLog +++ b/src/spicelib/devices/bsim4/ChangeLog @@ -1,3 +1,7 @@ +2001-11-25 Emmanuel Rouat + + * *.c *.h: Updated to version BSIM4.2.1 + 2000-04-04 Paolo Nenzi * *.c, *.h: Initial bsim4 support. Modified all files to conform diff --git a/src/spicelib/devices/bsim4/b4.c b/src/spicelib/devices/bsim4/b4.c index 5cb611b83..c07fd939a 100644 --- a/src/spicelib/devices/bsim4/b4.c +++ b/src/spicelib/devices/bsim4/b4.c @@ -1,18 +1,20 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. * - * Modified by Weidong Liu, 10/11/2000. + * Modified by Xuemei Xi, 10/05/2001. **********/ #include "ngspice.h" #include #include "devdefs.h" #include "bsim4def.h" +#include "suffix.h" IFparm BSIM4pTable[] = { /* parameters */ IOP( "l", BSIM4_L, IF_REAL , "Length"), @@ -45,9 +47,42 @@ OP( "gds", BSIM4_GDS, IF_REAL, "Gds"), OP( "vdsat", BSIM4_VDSAT, IF_REAL, "Vdsat"), OP( "vth", BSIM4_VON, IF_REAL, "Vth"), OP( "id", BSIM4_CD, IF_REAL, "Ids"), +OP( "ibd", BSIM4_CBD, IF_REAL, "Ibd"), +OP( "ibs", BSIM4_CBS, IF_REAL, "Ibs"), +OP( "isub", BSIM4_CSUB, IF_REAL, "Isub"), +OP( "igidl", BSIM4_IGIDL, IF_REAL, "Igidl"), +OP( "igisl", BSIM4_IGISL, IF_REAL, "Igisl"), +OP( "igs", BSIM4_IGS, IF_REAL, "Igs"), +OP( "igd", BSIM4_IGD, IF_REAL, "Igd"), +OP( "igb", BSIM4_IGB, IF_REAL, "Igb"), +OP( "igcs", BSIM4_IGCS, IF_REAL, "Igcs"), +OP( "igcd", BSIM4_IGCD, IF_REAL, "Igcd"), OP( "vbs", BSIM4_VBS, IF_REAL, "Vbs"), OP( "vgs", BSIM4_VGS, IF_REAL, "Vgs"), OP( "vds", BSIM4_VDS, IF_REAL, "Vds"), +OP( "cgg", BSIM4_CGGB, IF_REAL, "Cggb"), +OP( "cgs", BSIM4_CGSB, IF_REAL, "Cgsb"), +OP( "cgd", BSIM4_CGDB, IF_REAL, "Cgdb"), +OP( "cbg", BSIM4_CBGB, IF_REAL, "Cbgb"), +OP( "cbd", BSIM4_CBDB, IF_REAL, "Cbdb"), +OP( "cbs", BSIM4_CBSB, IF_REAL, "Cbsb"), +OP( "cdg", BSIM4_CDGB, IF_REAL, "Cdgb"), +OP( "cdd", BSIM4_CDDB, IF_REAL, "Cddb"), +OP( "cds", BSIM4_CDSB, IF_REAL, "Cdsb"), +OP( "csg", BSIM4_CSGB, IF_REAL, "Csgb"), +OP( "csd", BSIM4_CSDB, IF_REAL, "Csdb"), +OP( "css", BSIM4_CSSB, IF_REAL, "Cssb"), +OP( "cgb", BSIM4_CGBB, IF_REAL, "Cgbb"), +OP( "cdb", BSIM4_CDBB, IF_REAL, "Cdbb"), +OP( "csb", BSIM4_CSBB, IF_REAL, "Csbb"), +OP( "cbb", BSIM4_CBBB, IF_REAL, "Cbbb"), +OP( "capbd", BSIM4_CAPBD, IF_REAL, "Capbd"), +OP( "capbs", BSIM4_CAPBS, IF_REAL, "Capbs"), +OP( "qg", BSIM4_QG, IF_REAL, "Qgate"), +OP( "qb", BSIM4_QB, IF_REAL, "Qbulk"), +OP( "qd", BSIM4_QD, IF_REAL, "Qdrain"), +OP( "qs", BSIM4_QS, IF_REAL, "Qsource"), +OP( "qinv", BSIM4_QINV, IF_REAL, "Qinversion"), }; IFparm BSIM4mPTable[] = { /* model parameters */ @@ -256,6 +291,8 @@ IOP( "clc", BSIM4_MOD_CLC, IF_REAL, "Vdsat parameter for C-V model"), IOP( "cle", BSIM4_MOD_CLE, IF_REAL, "Vdsat parameter for C-V model"), IOP( "dwc", BSIM4_MOD_DWC, IF_REAL, "Delta W for C-V model"), IOP( "dlc", BSIM4_MOD_DLC, IF_REAL, "Delta L for C-V model"), +IOP( "xw", BSIM4_MOD_XW, IF_REAL, "W offset for channel width due to mask/etch effect"), +IOP( "xl", BSIM4_MOD_XL, IF_REAL, "L offset for channel length due to mask/etch effect"), IOP( "dlcig", BSIM4_MOD_DLCIG, IF_REAL, "Delta L for Ig model"), IOP( "dwj", BSIM4_MOD_DWJ, IF_REAL, "Delta W for S/D junctions"), diff --git a/src/spicelib/devices/bsim4/b4acld.c b/src/spicelib/devices/bsim4/b4acld.c index 955675668..86e4d38b3 100644 --- a/src/spicelib/devices/bsim4/b4acld.c +++ b/src/spicelib/devices/bsim4/b4acld.c @@ -1,12 +1,13 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4acld.c of BSIM4.1.0. - * Authors: Weidong Liu, Xiaodong Jin, Kanyu M. Cao, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4acld.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. * - * Modified by Weidong Liu, 10/11/2000. + * Modified by Xuemei Xi 10/05/2001 **********/ #include "ngspice.h" @@ -14,15 +15,16 @@ #include "cktdefs.h" #include "bsim4def.h" #include "sperror.h" +#include "suffix.h" int BSIM4acLoad(inModel,ckt) GENmodel *inModel; -CKTcircuit *ckt; +register CKTcircuit *ckt; { -BSIM4model *model = (BSIM4model*)inModel; -BSIM4instance *here; +register BSIM4model *model = (BSIM4model*)inModel; +register BSIM4instance *here; double gjbd, gjbs, geltd, gcrg, gcrgg, gcrgd, gcrgs, gcrgb; double xcbgb, xcbdb, xcbsb, xcbbb; @@ -50,13 +52,13 @@ double gmr, gmi, gmbsr, gmbsi, gdsr, gdsi; double FwdSumr, RevSumr, Gmr, Gmbsr, Gdsr; double FwdSumi, RevSumi, Gmi, Gmbsi, Gdsi; struct bsim4SizeDependParam *pParam; +double ggidld, ggidlg, ggidlb,ggisld, ggislg, ggislb, ggisls; omega = ckt->CKTomega; for (; model != NULL; model = model->BSIM4nextModel) { for (here = model->BSIM4instances; here!= NULL; here = here->BSIM4nextInstance) - { if (here->BSIM4owner != ARCHme) continue; - pParam = here->pParam; + { pParam = here->pParam; capbd = here->BSIM4capbd; capbs = here->BSIM4capbs; cgso = here->BSIM4cgso; @@ -148,13 +150,12 @@ struct bsim4SizeDependParam *pParam; FwdSumi = Gmi + Gmbsi; RevSumi = 0.0; - gbbdp = -(here->BSIM4gbds + here->BSIM4ggidld); - gbbsp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs - - here->BSIM4ggidls; - gbdpg = here->BSIM4gbgs + here->BSIM4ggidlg; - gbdpdp = here->BSIM4gbds + here->BSIM4ggidld; - gbdpb = here->BSIM4gbbs + here->BSIM4ggidlb; - gbdpsp = -(gbdpg + gbdpdp + gbdpb) + here->BSIM4ggidls; + gbbdp = -(here->BSIM4gbds); + gbbsp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs; + gbdpg = here->BSIM4gbgs; + gbdpdp = here->BSIM4gbds; + gbdpb = here->BSIM4gbbs; + gbdpsp = -(gbdpg + gbdpdp + gbdpb); gbspdp = 0.0; gbspg = 0.0; @@ -292,19 +293,18 @@ struct bsim4SizeDependParam *pParam; FwdSumi = 0.0; RevSumi = -(Gmi + Gmbsi); - gbbsp = -(here->BSIM4gbds + here->BSIM4ggidld); - gbbdp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs - - here->BSIM4ggidls; + gbbsp = -(here->BSIM4gbds); + gbbdp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs; gbdpg = 0.0; gbdpsp = 0.0; gbdpb = 0.0; gbdpdp = 0.0; - gbspg = here->BSIM4gbgs + here->BSIM4ggidlg; - gbspsp = here->BSIM4gbds + here->BSIM4ggidld; - gbspb = here->BSIM4gbbs + here->BSIM4ggidlb; - gbspdp = -(gbspg + gbspsp + gbspb) + here->BSIM4ggidls; + gbspg = here->BSIM4gbgs; + gbspsp = here->BSIM4gbds; + gbspb = here->BSIM4gbbs; + gbspdp = -(gbspg + gbspsp + gbspb); if (model->BSIM4igcMod) { gIstotg = here->BSIM4gIgsg + here->BSIM4gIgcdg; @@ -577,12 +577,37 @@ struct bsim4SizeDependParam *pParam; *(here->BSIM4BPdpPtr +1) += xcbdb; *(here->BSIM4BPdpPtr) -= gjbd - gbbdp + gIbtotd; *(here->BSIM4BPgpPtr +1) += xcbgb; - *(here->BSIM4BPgpPtr) -= here->BSIM4gbgs + here->BSIM4ggidlg + gIbtotg; + *(here->BSIM4BPgpPtr) -= here->BSIM4gbgs + gIbtotg; *(here->BSIM4BPspPtr +1) += xcbsb; *(here->BSIM4BPspPtr) -= gjbs - gbbsp + gIbtots; *(here->BSIM4BPbpPtr +1) += xcbbb; *(here->BSIM4BPbpPtr) += gjbd + gjbs - here->BSIM4gbbs - - here->BSIM4ggidlb - gIbtotb; + - gIbtotb; + ggidld = here->BSIM4ggidld; + ggidlg = here->BSIM4ggidlg; + ggidlb = here->BSIM4ggidlb; + ggislg = here->BSIM4ggislg; + ggisls = here->BSIM4ggisls; + ggislb = here->BSIM4ggislb; + + /* stamp gidl */ + (*(here->BSIM4DPdpPtr) += ggidld); + (*(here->BSIM4DPgpPtr) += ggidlg); + (*(here->BSIM4DPspPtr) -= (ggidlg + ggidld) + ggidlb); + (*(here->BSIM4DPbpPtr) += ggidlb); + (*(here->BSIM4BPdpPtr) -= ggidld); + (*(here->BSIM4BPgpPtr) -= ggidlg); + (*(here->BSIM4BPspPtr) += (ggidlg + ggidld) + ggidlb); + (*(here->BSIM4BPbpPtr) -= ggidlb); + /* stamp gisl */ + (*(here->BSIM4SPdpPtr) -= (ggisls + ggislg) + ggislb); + (*(here->BSIM4SPgpPtr) += ggislg); + (*(here->BSIM4SPspPtr) += ggisls); + (*(here->BSIM4SPbpPtr) += ggislb); + (*(here->BSIM4BPdpPtr) += (ggislg + ggisls) + ggislb); + (*(here->BSIM4BPgpPtr) -= ggislg); + (*(here->BSIM4BPspPtr) -= ggisls); + (*(here->BSIM4BPbpPtr) -= ggislb); if (here->BSIM4rbodyMod) { (*(here->BSIM4DPdbPtr +1) += xcdbdb); diff --git a/src/spicelib/devices/bsim4/b4ask.c b/src/spicelib/devices/bsim4/b4ask.c index 475c73c67..449861231 100644 --- a/src/spicelib/devices/bsim4/b4ask.c +++ b/src/spicelib/devices/bsim4/b4ask.c @@ -1,12 +1,13 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4ask.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4ask.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. * - * Modified by Weidong Liu, 10/11/2000. + * Modified by Xuemei Xi, 10/05/2001. **********/ #include "ngspice.h" @@ -17,6 +18,7 @@ #include "devdefs.h" #include "bsim4def.h" #include "sperror.h" +#include "suffix.h" int BSIM4ask(ckt,inst,which,value,select) @@ -164,6 +166,30 @@ BSIM4instance *here = (BSIM4instance*)inst; case BSIM4_CBD: value->rValue = here->BSIM4cbd; return(OK); + case BSIM4_CSUB: + value->rValue = here->BSIM4csub; + return(OK); + case BSIM4_IGIDL: + value->rValue = here->BSIM4Igidl; + return(OK); + case BSIM4_IGISL: + value->rValue = here->BSIM4Igisl; + return(OK); + case BSIM4_IGS: + value->rValue = here->BSIM4Igs; + return(OK); + case BSIM4_IGD: + value->rValue = here->BSIM4Igd; + return(OK); + case BSIM4_IGB: + value->rValue = here->BSIM4Igb; + return(OK); + case BSIM4_IGCS: + value->rValue = here->BSIM4Igcs; + return(OK); + case BSIM4_IGCD: + value->rValue = here->BSIM4Igcd; + return(OK); case BSIM4_GM: value->rValue = here->BSIM4gm; return(OK); @@ -181,7 +207,7 @@ BSIM4instance *here = (BSIM4instance*)inst; return(OK); case BSIM4_QB: value->rValue = *(ckt->CKTstate0 + here->BSIM4qb); - return(OK); + return(OK); case BSIM4_CQB: value->rValue = *(ckt->CKTstate0 + here->BSIM4cqb); return(OK); @@ -193,29 +219,32 @@ BSIM4instance *here = (BSIM4instance*)inst; return(OK); case BSIM4_QD: value->rValue = *(ckt->CKTstate0 + here->BSIM4qd); - return(OK); + return(OK); case BSIM4_CQD: value->rValue = *(ckt->CKTstate0 + here->BSIM4cqd); return(OK); - case BSIM4_CGG: + case BSIM4_QS: + value->rValue = *(ckt->CKTstate0 + here->BSIM4qs); + return(OK); + case BSIM4_CGGB: value->rValue = here->BSIM4cggb; return(OK); - case BSIM4_CGD: + case BSIM4_CGDB: value->rValue = here->BSIM4cgdb; return(OK); - case BSIM4_CGS: + case BSIM4_CGSB: value->rValue = here->BSIM4cgsb; return(OK); - case BSIM4_CDG: + case BSIM4_CDGB: value->rValue = here->BSIM4cdgb; return(OK); - case BSIM4_CDD: + case BSIM4_CDDB: value->rValue = here->BSIM4cddb; return(OK); - case BSIM4_CDS: + case BSIM4_CDSB: value->rValue = here->BSIM4cdsb; return(OK); - case BSIM4_CBG: + case BSIM4_CBGB: value->rValue = here->BSIM4cbgb; return(OK); case BSIM4_CBDB: @@ -224,6 +253,27 @@ BSIM4instance *here = (BSIM4instance*)inst; case BSIM4_CBSB: value->rValue = here->BSIM4cbsb; return(OK); + case BSIM4_CSGB: + value->rValue = here->BSIM4csgb; + return(OK); + case BSIM4_CSDB: + value->rValue = here->BSIM4csdb; + return(OK); + case BSIM4_CSSB: + value->rValue = here->BSIM4cssb; + return(OK); + case BSIM4_CGBB: + value->rValue = here->BSIM4cgbb; + return(OK); + case BSIM4_CDBB: + value->rValue = here->BSIM4cdbb; + return(OK); + case BSIM4_CSBB: + value->rValue = here->BSIM4csbb; + return(OK); + case BSIM4_CBBB: + value->rValue = here->BSIM4cbbb; + return(OK); case BSIM4_CAPBD: value->rValue = here->BSIM4capbd; return(OK); diff --git a/src/spicelib/devices/bsim4/b4check.c b/src/spicelib/devices/bsim4/b4check.c index 5b03e6cbe..820c4091b 100644 --- a/src/spicelib/devices/bsim4/b4check.c +++ b/src/spicelib/devices/bsim4/b4check.c @@ -1,12 +1,13 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4check.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4check.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. **********/ #include "ngspice.h" @@ -18,12 +19,12 @@ #include "const.h" #include "sperror.h" #include "devdefs.h" - +#include "suffix.h" int BSIM4checkModel(model, here, ckt) -BSIM4model *model; -BSIM4instance *here; +register BSIM4model *model; +register BSIM4instance *here; CKTcircuit *ckt; { struct bsim4SizeDependParam *pParam; @@ -33,22 +34,22 @@ FILE *fplog; if ((fplog = fopen("bsim4.out", "w")) != NULL) { pParam = here->pParam; fprintf(fplog, "BSIM4: Berkeley Short Channel IGFET Model-4\n"); - fprintf(fplog, "Developed by Dr. Weidong Liu, Xiaodong Jin, Kanyu M. Cao and Prof. Chenming Hu in 2000.\n"); + fprintf(fplog, "Developed by Weidong Liu, Xuemei Xi , Xiaodong Jin, Kanyu M. Cao and Prof. Chenming Hu in 2001.\n"); fprintf(fplog, "\n"); fprintf(fplog, "++++++++++ BSIM4 PARAMETER CHECKING BELOW ++++++++++\n"); - if (strcmp(model->BSIM4version, "4.1.0") != 0) - { fprintf(fplog, "Warning: This model is BSIM4.1.0; you specified a wrong version number.\n"); - printf("Warning: This model is BSIM4.1.0; you specified a wrong version number.\n"); + if (strcmp(model->BSIM4version, "4.2.1") != 0) + { fprintf(fplog, "Warning: This model is BSIM4.2.1; you specified a wrong version number.\n"); + printf("Warning: This model is BSIM4.2.1; you specified a wrong version number.\n"); } fprintf(fplog, "Model = %s\n", model->BSIM4modName); if ((here->BSIM4rgateMod == 2) || (here->BSIM4rgateMod == 3)) { if ((here->BSIM4trnqsMod == 1) || (here->BSIM4acnqsMod == 1)) - { fprintf(fplog, "Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); - printf("Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); - } + { fprintf(fplog, "Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); + printf("Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); + } } @@ -210,11 +211,10 @@ FILE *fplog; printf("Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4nf); Fatal_Flag = 1; } - - if (here->BSIM4l <= model->BSIM4xgl) - { fprintf(fplog, "Fatal: The parameter xgl must be smaller than Ldrawn.\n"); - printf("Fatal: The parameter xgl must be smaller than Ldrawn.\n"); + if ((here->BSIM4l + model->BSIM4xl) <= model->BSIM4xgl) + { fprintf(fplog, "Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n"); + printf("Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n"); Fatal_Flag = 1; } if (model->BSIM4ngcon < 1.0) @@ -273,64 +273,65 @@ FILE *fplog; pParam->BSIM4moin); printf("Warning: Moin = %g is too large.\n", pParam->BSIM4moin); } - - if (pParam->BSIM4acde < 0.4) - { fprintf(fplog, "Warning: Acde = %g is too small.\n", - pParam->BSIM4acde); - printf("Warning: Acde = %g is too small.\n", pParam->BSIM4acde); - } - if (pParam->BSIM4acde > 1.6) - { fprintf(fplog, "Warning: Acde = %g is too large.\n", - pParam->BSIM4acde); - printf("Warning: Acde = %g is too large.\n", pParam->BSIM4acde); - } + if(model->BSIM4capMod ==2) { + if (pParam->BSIM4acde < 0.4) + { fprintf(fplog, "Warning: Acde = %g is too small.\n", + pParam->BSIM4acde); + printf("Warning: Acde = %g is too small.\n", pParam->BSIM4acde); + } + if (pParam->BSIM4acde > 1.6) + { fprintf(fplog, "Warning: Acde = %g is too large.\n", + pParam->BSIM4acde); + printf("Warning: Acde = %g is too large.\n", pParam->BSIM4acde); + } + } if (model->BSIM4paramChk ==1) { /* Check L and W parameters */ - if (pParam->BSIM4leff <= 5.0e-8) - { fprintf(fplog, "Warning: Leff = %g may be too small.\n", - pParam->BSIM4leff); - printf("Warning: Leff = %g may be too small.\n", + if (pParam->BSIM4leff <= 1.0e-9) + { fprintf(fplog, "Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", + pParam->BSIM4leff); + printf("Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", pParam->BSIM4leff); } - if (pParam->BSIM4leffCV <= 5.0e-8) - { fprintf(fplog, "Warning: Leff for CV = %g may be too small.\n", + if (pParam->BSIM4leffCV <= 1.0e-9) + { fprintf(fplog, "Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", + pParam->BSIM4leffCV); + printf("Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", pParam->BSIM4leffCV); - printf("Warning: Leff for CV = %g may be too small.\n", - pParam->BSIM4leffCV); } - if (pParam->BSIM4weff <= 1.0e-7) - { fprintf(fplog, "Warning: Weff = %g may be too small.\n", + if (pParam->BSIM4weff <= 1.0e-9) + { fprintf(fplog, "Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", pParam->BSIM4weff); - printf("Warning: Weff = %g may be too small.\n", + printf("Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", pParam->BSIM4weff); } - if (pParam->BSIM4weffCV <= 1.0e-7) - { fprintf(fplog, "Warning: Weff for CV = %g may be too small.\n", + if (pParam->BSIM4weffCV <= 1.0e-9) + { fprintf(fplog, "Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", + pParam->BSIM4weffCV); + printf("Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", pParam->BSIM4weffCV); - printf("Warning: Weff for CV = %g may be too small.\n", - pParam->BSIM4weffCV); } /* Check threshold voltage parameters */ - if (model->BSIM4toxe < 1.0e-9) - { fprintf(fplog, "Warning: Toxe = %g is less than 10A.\n", + if (model->BSIM4toxe < 1.0e-10) + { fprintf(fplog, "Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", model->BSIM4toxe); - printf("Warning: Toxe = %g is less than 10A.\n", model->BSIM4toxe); + printf("Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", model->BSIM4toxe); } - if (model->BSIM4toxp < 1.0e-9) - { fprintf(fplog, "Warning: Toxp = %g is less than 10A.\n", + if (model->BSIM4toxp < 1.0e-10) + { fprintf(fplog, "Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", model->BSIM4toxp); - printf("Warning: Toxp = %g is less than 10A.\n", model->BSIM4toxp); + printf("Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", model->BSIM4toxp); } - if (model->BSIM4toxm < 1.0e-9) - { fprintf(fplog, "Warning: Toxm = %g is less than 10A.\n", + if (model->BSIM4toxm < 1.0e-10) + { fprintf(fplog, "Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", model->BSIM4toxm); - printf("Warning: Toxm = %g is less than 10A.\n", model->BSIM4toxm); + printf("Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", model->BSIM4toxm); } if (pParam->BSIM4ndep <= 1.0e12) diff --git a/src/spicelib/devices/bsim4/b4cvtest.c b/src/spicelib/devices/bsim4/b4cvtest.c index cdc75043f..861b6b32a 100644 --- a/src/spicelib/devices/bsim4/b4cvtest.c +++ b/src/spicelib/devices/bsim4/b4cvtest.c @@ -1,10 +1,13 @@ -/**** BSIM4.0.0, Released by Weidong Liu 3/24/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4cvtest.c of BSIM4.0.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4cvtest.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. + * + * Modified by Xuemei Xi, 10/05/2001. **********/ #include "ngspice.h" @@ -16,15 +19,16 @@ #include "const.h" #include "devdefs.h" #include "sperror.h" +#include "suffix.h" int BSIM4convTest(inModel,ckt) GENmodel *inModel; -CKTcircuit *ckt; +register CKTcircuit *ckt; { -BSIM4model *model = (BSIM4model*)inModel; -BSIM4instance *here; +register BSIM4model *model = (BSIM4model*)inModel; +register BSIM4instance *here; double delvbd, delvbs, delvds, delvgd, delvgs; double delvdbd, delvsbs; double delvbd_jct, delvbs_jct; @@ -39,9 +43,7 @@ double tol0, tol1, tol2, tol3, tol4, tol5, tol6; for (; model != NULL; model = model->BSIM4nextModel) { for (here = model->BSIM4instances; here != NULL ; here=here->BSIM4nextInstance) - { - if (here->BSIM4owner != ARCHme) continue; - vds = model->BSIM4type + { vds = model->BSIM4type * (*(ckt->CKTrhsOld + here->BSIM4dNodePrime) - *(ckt->CKTrhsOld + here->BSIM4sNodePrime)); vgs = model->BSIM4type @@ -108,10 +110,11 @@ double tol0, tol1, tol2, tol3, tol4, tol5, tol6; * delvds + here->BSIM4gIgbb * delvbs; } else - { Idtot = here->BSIM4cd + here->BSIM4cbd; - cdhat = Idtot + here->BSIM4gbd * delvbd_jct + here->BSIM4gmbs - * delvbd + here->BSIM4gm * delvgd - - here->BSIM4gds * delvds; + { Idtot = here->BSIM4cd + here->BSIM4cbd - here->BSIM4Igisl; + cdhat = Idtot + here->BSIM4gbd * delvbd_jct + here->BSIM4gmbs + * delvbd + here->BSIM4gm * delvgd + - here->BSIM4gds * delvds - here->BSIM4ggislg * vgd + - here->BSIM4ggislb * vbd + here->BSIM4ggisls * vds; Igstot = here->BSIM4Igs + here->BSIM4Igcd; cgshat = Igstot + here->BSIM4gIgsg * delvgs + here->BSIM4gIgcdg * delvgd @@ -167,18 +170,20 @@ double tol0, tol1, tol2, tol3, tol4, tol5, tol6; } Ibtot = here->BSIM4cbs + here->BSIM4cbd - - here->BSIM4Igidl - here->BSIM4csub; + - here->BSIM4Igidl - here->BSIM4Igisl - here->BSIM4csub; if (here->BSIM4mode >= 0) { cbhat = Ibtot + here->BSIM4gbd * delvbd_jct + here->BSIM4gbs * delvbs_jct - (here->BSIM4gbbs + here->BSIM4ggidlb) * delvbs - (here->BSIM4gbgs + here->BSIM4ggidlg) * delvgs - - (here->BSIM4gbds + here->BSIM4ggidld) * delvds; + - (here->BSIM4gbds + here->BSIM4ggidld) * delvds + - here->BSIM4ggislg * delvgd - here->BSIM4ggislb* delvbd + here->BSIM4ggisls * delvds ; } else { cbhat = Ibtot + here->BSIM4gbs * delvbs_jct + here->BSIM4gbd * delvbd_jct - (here->BSIM4gbbs + here->BSIM4ggidlb) * delvbd - (here->BSIM4gbgs + here->BSIM4ggidlg) * delvgd - + (here->BSIM4gbds + here->BSIM4ggidld) * delvds; + + (here->BSIM4gbds + here->BSIM4ggidld) * delvds + - here->BSIM4ggislg * delvgs - here->BSIM4ggislb * delvbs + here->BSIM4ggisls * delvds; } tol6 = ckt->CKTreltol * MAX(fabs(cbhat), fabs(Ibtot)) + ckt->CKTabstol; diff --git a/src/spicelib/devices/bsim4/b4del.c b/src/spicelib/devices/bsim4/b4del.c index 84ba88f43..ecae506d0 100644 --- a/src/spicelib/devices/bsim4/b4del.c +++ b/src/spicelib/devices/bsim4/b4del.c @@ -1,12 +1,11 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/1/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4del.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4del.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. **********/ #include "ngspice.h" @@ -14,6 +13,7 @@ #include "bsim4def.h" #include "sperror.h" #include "gendefs.h" +#include "suffix.h" int diff --git a/src/spicelib/devices/bsim4/b4dest.c b/src/spicelib/devices/bsim4/b4dest.c index ce0c4e06a..7dbc1d5d4 100644 --- a/src/spicelib/devices/bsim4/b4dest.c +++ b/src/spicelib/devices/bsim4/b4dest.c @@ -1,17 +1,17 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4dest.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4dest.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. **********/ #include "ngspice.h" #include #include "bsim4def.h" +#include "suffix.h" void BSIM4destroy(inModel) diff --git a/src/spicelib/devices/bsim4/b4geo.c b/src/spicelib/devices/bsim4/b4geo.c index b98dd7c93..616d478db 100644 --- a/src/spicelib/devices/bsim4/b4geo.c +++ b/src/spicelib/devices/bsim4/b4geo.c @@ -1,12 +1,11 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4geo.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4geo.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. **********/ #include "ngspice.h" @@ -261,7 +260,8 @@ double nuIntD = 0.0, nuEndD = 0.0, nuIntS = 0.0, nuEndS = 0.0; *Rtot = Rint; else *Rtot = Rint * Rend / (Rint + Rend); - +if(*Rtot==0.0) + printf("Warning: Zero resistance returned from RdseffGeo\n"); return 0; } diff --git a/src/spicelib/devices/bsim4/b4getic.c b/src/spicelib/devices/bsim4/b4getic.c index 590c4df73..6deff2424 100644 --- a/src/spicelib/devices/bsim4/b4getic.c +++ b/src/spicelib/devices/bsim4/b4getic.c @@ -1,12 +1,11 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4getic.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4getic.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. **********/ #include "ngspice.h" @@ -14,7 +13,7 @@ #include "cktdefs.h" #include "bsim4def.h" #include "sperror.h" - +#include "suffix.h" int @@ -27,8 +26,7 @@ BSIM4instance *here; for (; model ; model = model->BSIM4nextModel) { for (here = model->BSIM4instances; here; here = here->BSIM4nextInstance) - { if (here->BSIM4owner != ARCHme) continue; - if (!here->BSIM4icVDSGiven) + { if (!here->BSIM4icVDSGiven) { here->BSIM4icVDS = *(ckt->CKTrhs + here->BSIM4dNode) - *(ckt->CKTrhs + here->BSIM4sNode); } diff --git a/src/spicelib/devices/bsim4/b4ld.c b/src/spicelib/devices/bsim4/b4ld.c index 05d244ae0..37564b454 100644 --- a/src/spicelib/devices/bsim4/b4ld.c +++ b/src/spicelib/devices/bsim4/b4ld.c @@ -1,13 +1,14 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4ld.c of BSIM4.1.0. - * Author: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4ld.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. - ******/ + + * Modified by Xuemei Xi, 10/05/2001. + **********/ #include "ngspice.h" #include @@ -18,7 +19,7 @@ #include "const.h" #include "sperror.h" #include "devdefs.h" - +#include "suffix.h" #define MAX_EXP 5.834617425e14 #define MIN_EXP 1.713908431e-15 @@ -30,14 +31,15 @@ #define DELTA_3 0.02 #define DELTA_4 0.02 +int BSIM4polyDepletion(double phi, double ngate,double coxe, double Vgs, double *Vgs_eff, double *dVgs_eff_dVg); int BSIM4load(inModel,ckt) GENmodel *inModel; -CKTcircuit *ckt; +register CKTcircuit *ckt; { -BSIM4model *model = (BSIM4model*)inModel; -BSIM4instance *here; +register BSIM4model *model = (BSIM4model*)inModel; +register BSIM4instance *here; double ceqgstot, dgstot_dvd, dgstot_dvg, dgstot_dvs, dgstot_dvb; double ceqgdtot, dgdtot_dvd, dgdtot_dvg, dgdtot_dvs, dgdtot_dvb; @@ -94,7 +96,7 @@ double Igstot, cgshat, Igdtot, cgdhat, Igbtot, cgbhat; double Vgs_eff, Vfb, dVbs_dVb, Vth_NarrowW; double Phis, dPhis_dVb, sqrtPhis, dsqrtPhis_dVb, Vth, dVth_dVb, dVth_dVd; double Vgst, dVgst_dVg, dVgst_dVb, dVgs_eff_dVg, Nvtms, Nvtmd; -double Vgdt, Vgsaddvth, Vgsaddvth2, Vgsaddvth1o3,Vtm; +double Vgdt, Vgsaddvth, Vgsaddvth2, Vgsaddvth1o3, Vtm; double n, dn_dVb, dn_dVd, voffcv, noff, dnoff_dVd, dnoff_dVb; double ExpArg, ExpArg1, V0, CoxWLcen, QovCox, LINK; double DeltaPhi, dDeltaPhi_dVg; @@ -164,6 +166,10 @@ double Cgg, Cgd, Cgs, Cgb, Cdg, Cdd, Cds, Cdb, Qg, Qd; double Csg, Csd, Css, Csb, Cbg, Cbd, Cbs, Cbb, Qs, Qb; double Cgg1, Cgb1, Cgd1, Cbg1, Cbb1, Cbd1, Csg1, Csd1, Csb1, Qac0, Qsub0; double dQac0_dVg, dQac0_dVb, dQsub0_dVg, dQsub0_dVd, dQsub0_dVb; +double ggidld, ggidlg, ggidlb,ggisld, ggislg, ggislb, ggisls; +double Igisl, Ggisld, Ggislg, Ggislb, Ggisls; + + struct bsim4SizeDependParam *pParam; int ByPass, ChargeComputationNeeded, error, Check, Check1, Check2; @@ -178,9 +184,7 @@ ChargeComputationNeeded = for (; model != NULL; model = model->BSIM4nextModel) { for (here = model->BSIM4instances; here != NULL; here = here->BSIM4nextInstance) - { - if (here->BSIM4owner != ARCHme) continue; - Check = Check1 = Check2 = 1; + { Check = Check1 = Check2 = 1; ByPass = 0; pParam = here->pParam; @@ -375,11 +379,12 @@ for (; model != NULL; model = model->BSIM4nextModel) + (here->BSIM4gm + here->BSIM4gbgs + here->BSIM4ggidlg) * delvgs + (here->BSIM4gds + here->BSIM4gbds + here->BSIM4ggidld) * delvds; Ibtot = here->BSIM4cbs + here->BSIM4cbd - - here->BSIM4Igidl - here->BSIM4csub; + - here->BSIM4Igidl - here->BSIM4Igisl - here->BSIM4csub; cbhat = Ibtot + here->BSIM4gbd * delvbd_jct + here->BSIM4gbs * delvbs_jct - (here->BSIM4gbbs + here->BSIM4ggidlb) * delvbs - (here->BSIM4gbgs + here->BSIM4ggidlg) * delvgs - - (here->BSIM4gbds + here->BSIM4ggidld) * delvds; + - (here->BSIM4gbds + here->BSIM4ggidld) * delvds + - here->BSIM4ggislg * delvgd - here->BSIM4ggislb* delvbd + here->BSIM4ggisls * delvds ; Igstot = here->BSIM4Igs + here->BSIM4Igcs; cgshat = Igstot + (here->BSIM4gIgsg + here->BSIM4gIgcsg) * delvgs @@ -394,16 +399,18 @@ for (; model != NULL; model = model->BSIM4nextModel) * delvds + here->BSIM4gIgbb * delvbs; } else - { Idtot = here->BSIM4cd + here->BSIM4cbd; + { Idtot = here->BSIM4cd + here->BSIM4cbd - here->BSIM4Igisl; cdhat = Idtot + here->BSIM4gbd * delvbd_jct + here->BSIM4gmbs * delvbd + here->BSIM4gm * delvgd - - here->BSIM4gds * delvds; + - here->BSIM4gds * delvds - here->BSIM4ggislg * vgd + - here->BSIM4ggislb * vbd + here->BSIM4ggisls * vds; Ibtot = here->BSIM4cbs + here->BSIM4cbd - - here->BSIM4Igidl - here->BSIM4csub; + - here->BSIM4Igidl - here->BSIM4Igisl - here->BSIM4csub; cbhat = Ibtot + here->BSIM4gbs * delvbs_jct + here->BSIM4gbd * delvbd_jct - (here->BSIM4gbbs + here->BSIM4ggidlb) * delvbd - (here->BSIM4gbgs + here->BSIM4ggidlg) * delvgd - + (here->BSIM4gbds + here->BSIM4ggidld) * delvds; + + (here->BSIM4gbds + here->BSIM4ggidld) * delvds + - here->BSIM4ggislg * delvgs - here->BSIM4ggislb * delvbs + here->BSIM4ggisls * delvds; Igstot = here->BSIM4Igs + here->BSIM4Igcd; cgshat = Igstot + here->BSIM4gIgsg * delvgs + here->BSIM4gIgcdg * delvgd @@ -428,6 +435,7 @@ for (; model != NULL; model = model->BSIM4nextModel) + here->BSIM4gdtotd * delvds + here->BSIM4gdtotg * delvgs + here->BSIM4gdtotb * delvbs; + #ifndef NOBYPASS /* Following should be one IF statement, but some C compilers * can't handle that all at once, so we split it into several @@ -521,6 +529,7 @@ for (; model != NULL; model = model->BSIM4nextModel) goto line850; } #endif /*NOBYPASS*/ + von = here->BSIM4von; if (*(ckt->CKTstate0 + here->BSIM4vds) >= 0.0) { vgs = DEVfetlim(vgs, *(ckt->CKTstate0 + here->BSIM4vgs), von); @@ -918,7 +927,7 @@ for (; model != NULL; model = model->BSIM4nextModel) T3 = T2 * T2; T4 = T3 + 2.0 * T1 * MIN_EXP; T5 = T1 / T4; - dT1_dVb = -T0 * T1 * dlt1_dVb / lt1; + dT1_dVb = -T0 * T1 * dltw_dVb / ltw; /* bugfix -JX */ dT5_dVb = dT1_dVb * (T4 - 2.0 * T1 * (T2 + MIN_EXP)) / T4 / T4; } else @@ -1015,24 +1024,24 @@ for (; model != NULL; model = model->BSIM4nextModel) /* Poly Gate Si Depletion Effect */ T0 = pParam->BSIM4vfb + pParam->BSIM4phi; - if ((pParam->BSIM4ngate > 1.0e18) - && (pParam->BSIM4ngate < 1.0e25) && (Vgs > T0)) - { T1 = 1.0e6 * Charge_q * EPSSI * pParam->BSIM4ngate - / (model->BSIM4coxe * model->BSIM4coxe); - T8 = Vgs - T0; - T4 = sqrt(1.0 + 2.0 * T8 / T1); - T2 = 2.0 * T8 / (T4 + 1.0); - T3 = 0.5 * T2 * T2 / T1; /* T3 = Vpoly */ - T7 = 1.12 - T3 - 0.05; - T6 = sqrt(T7 * T7 + 0.224); - T5 = 1.12 - 0.5 * (T7 + T6); - Vgs_eff = Vgs - T5; - dVgs_eff_dVg = 1.0 - (0.5 - 0.5 / T4) * (1.0 + T7 / T6); - } - else - { Vgs_eff = Vgs; - dVgs_eff_dVg = 1.0; - } + + BSIM4polyDepletion(T0, pParam->BSIM4ngate, model->BSIM4coxe, vgs, &vgs_eff, &dvgs_eff_dvg); + + BSIM4polyDepletion(T0, pParam->BSIM4ngate, model->BSIM4coxe, vgd, &vgd_eff, &dvgd_eff_dvg); + + if(here->BSIM4mode>0) { + Vgs_eff = vgs_eff; + dVgs_eff_dVg = dvgs_eff_dvg; + } else { + Vgs_eff = vgd_eff; + dVgs_eff_dVg = dvgd_eff_dvg; + } + here->BSIM4vgs_eff = vgs_eff; + here->BSIM4vgd_eff = vgd_eff; + here->BSIM4dvgs_eff_dvg = dvgs_eff_dvg; + here->BSIM4dvgd_eff_dvg = dvgd_eff_dvg; + + Vgst = Vgs_eff - Vth; /* Calculate Vgsteff */ @@ -1852,14 +1861,17 @@ for (; model != NULL; model = model->BSIM4nextModel) } /* Calculate GIDL current */ + vgs_eff = here->BSIM4vgs_eff; + dvgs_eff_dvg = here->BSIM4dvgs_eff_dvg; T0 = 3.0 * model->BSIM4toxe; - T1 = (Vds - Vgs_eff - pParam->BSIM4egidl) / T0; - if ((pParam->BSIM4agidl <= 0.0) || (pParam->BSIM4bgidl <= 0.0) || (T1 < 0.0) - || (pParam->BSIM4cgidl <= 0.0) || (Vdb < 0.0)) + + T1 = (vds - vgs_eff - pParam->BSIM4egidl ) / T0; + if ((pParam->BSIM4agidl <= 0.0) || (pParam->BSIM4bgidl <= 0.0) + || (T1 <= 0.0) || (pParam->BSIM4cgidl <= 0.0) || (vbd > 0.0)) Igidl = Ggidld = Ggidlg = Ggidlb = 0.0; - else - { dT1_dVd = 1.0 / T0; - dT1_dVg = -dVgs_eff_dVg * dT1_dVd; + else { + dT1_dVd = 1.0 / T0; + dT1_dVg = -dvgs_eff_dvg * dT1_dVd; T2 = pParam->BSIM4bgidl / T1; if (T2 < 100.0) { Igidl = pParam->BSIM4agidl * pParam->BSIM4weffCJ * T1 * exp(-T2); @@ -1867,28 +1879,69 @@ for (; model != NULL; model = model->BSIM4nextModel) Ggidld = T3 * dT1_dVd; Ggidlg = T3 * dT1_dVg; } - else + else { Igidl = pParam->BSIM4agidl * pParam->BSIM4weffCJ * 3.720075976e-44; Ggidld = Igidl * dT1_dVd; Ggidlg = Igidl * dT1_dVg; Igidl *= T1; } - - T4 = Vdb * Vdb; - T5 = Vdb * T4; + + T4 = vbd * vbd; + T5 = -vbd * T4; T6 = pParam->BSIM4cgidl + T5; - T7 = T5 / T6; - T8 = 3.0 * pParam->BSIM4cgidl * T4 / T6 / T6; - Ggidld = Ggidld * T7 + Igidl * T8; - Ggidlg = Ggidlg * T7; - Ggidlb = -Igidl * T8; - Igidl *= T7; + T7 = T5 / T6; + T8 = 3.0 * pParam->BSIM4cgidl * T4 / T6 / T6; + Ggidld = Ggidld * T7 + Igidl * T8; + Ggidlg = Ggidlg * T7; + Ggidlb = -Igidl * T8; + Igidl *= T7; } here->BSIM4Igidl = Igidl; - here->BSIM4ggidld = Ggidld; + here->BSIM4ggidld = Ggidld; here->BSIM4ggidlg = Ggidlg; here->BSIM4ggidlb = Ggidlb; + /* Calculate GISL current: bugfix recommended by TI -JX */ + vgd_eff = here->BSIM4vgd_eff; + dvgd_eff_dvg = here->BSIM4dvgd_eff_dvg; + + T1 = (-vds - vgd_eff - pParam->BSIM4egidl ) / T0; + + if ((pParam->BSIM4agidl <= 0.0) || (pParam->BSIM4bgidl <= 0.0) + || (T1 <= 0.0) || (pParam->BSIM4cgidl <= 0.0) || (vbs > 0.0)) + Igisl = Ggisls = Ggislg = Ggislb = 0.0; + else { + dT1_dVd = 1.0 / T0; + dT1_dVg = -dvgd_eff_dvg * dT1_dVd; + T2 = pParam->BSIM4bgidl / T1; + if (T2 < 100.0) + { Igisl = pParam->BSIM4agidl * pParam->BSIM4weffCJ * T1 * exp(-T2); + T3 = Igisl * (1.0 + T2) / T1; + Ggisls = T3 * dT1_dVd; + Ggislg = T3 * dT1_dVg; + } + else + { Igisl = pParam->BSIM4agidl * pParam->BSIM4weffCJ * 3.720075976e-44; + Ggisls = Igisl * dT1_dVd; + Ggislg = Igisl * dT1_dVg; + Igisl *= T1; + } + + T4 = vbs * vbs; + T5 = -vbs * T4; + T6 = pParam->BSIM4cgidl + T5; + T7 = T5 / T6; + T8 = 3.0 * pParam->BSIM4cgidl * T4 / T6 / T6; + Ggisls = Ggisls * T7 + Igisl * T8; + Ggislg = Ggislg * T7; + Ggislb = -Igisl * T8; + Igisl *= T7; + } + here->BSIM4Igisl = Igisl; + here->BSIM4ggisls = Ggisls; + here->BSIM4ggislg = Ggislg; + here->BSIM4ggislb = Ggislb; + /* Calculate gate tunneling current */ if ((model->BSIM4igcMod != 0) || (model->BSIM4igbMod != 0)) @@ -1993,75 +2046,74 @@ for (; model != NULL; model = model->BSIM4nextModel) dIgc_dVd = T11 * (T2 * dT6_dVd + T6 * dT2_dVd); dIgc_dVb = T11 * (T2 * dT6_dVb + T6 * dT2_dVb); - if (model->BSIM4pigcdGiven) - { Pigcd = pParam->BSIM4pigcd; - dPigcd_dVg = dPigcd_dVd = dPigcd_dVb = 0.0; - } - else - { T11 = pParam->BSIM4Bechvb * model->BSIM4toxe; - T12 = Vgsteff + 1.0e-20; - T13 = T11 / T12 / T12; - T14 = -T13 / T12; - Pigcd = T13 * (1.0 - 0.5 * Vdseff / T12); - dPigcd_dVg = T14 * (2.0 + 0.5 * (dVdseff_dVg - * Vgsteff - 3.0 * Vdseff) / T12); - dPigcd_dVd = 0.5 * T14 * dVdseff_dVd - + dPigcd_dVg * dVgsteff_dVd; - dPigcd_dVb = 0.5 * T14 * dVdseff_dVb - + dPigcd_dVg * dVgsteff_dVb; - dPigcd_dVg *= dVgsteff_dVg; - } - - T7 = -Pigcd * Vds; - dT7_dVg = -Vds * dPigcd_dVg; - dT7_dVd = -Pigcd - Vds * dPigcd_dVd; - dT7_dVb = -Vds * dPigcd_dVb; - T8 = T7 * T7 + 2.0e-4; - dT8_dVg = 2.0 * T7; - dT8_dVd = dT8_dVg * dT7_dVd; - dT8_dVb = dT8_dVg * dT7_dVb; - dT8_dVg *= dT7_dVg; - - if (T7 > EXP_THRESHOLD) - { T9 = MAX_EXP; - dT9_dVg = dT9_dVd = dT9_dVb = 0.0; - } - else if (T7 < -EXP_THRESHOLD) - { T9 = MIN_EXP; - dT9_dVg = dT9_dVd = dT9_dVb = 0.0; - } - else - { T9 = exp(T7); - dT9_dVg = T9 * dT7_dVg; - dT9_dVd = T9 * dT7_dVd; - dT9_dVb = T9 * dT7_dVb; - } - - T0 = T8 * T8; - T1 = T9 - 1.0 + 1.0e-4; - T10 = (T1 - T7) / T8; - dT10_dVg = (dT9_dVg - dT7_dVg - T10 * dT8_dVg) / T8; - dT10_dVd = (dT9_dVd - dT7_dVd - T10 * dT8_dVd) / T8; - dT10_dVb = (dT9_dVb - dT7_dVb - T10 * dT8_dVb) / T8; - - Igcs = Igc * T10; - dIgcs_dVg = dIgc_dVg * T10 + Igc * dT10_dVg; - dIgcs_dVd = dIgc_dVd * T10 + Igc * dT10_dVd; - dIgcs_dVb = dIgc_dVb * T10 + Igc * dT10_dVb; - - T1 = T9 - 1.0 - 1.0e-4; - T10 = (T7 * T9 - T1) / T8; - dT10_dVg = (dT7_dVg * T9 + (T7 - 1.0) * dT9_dVg - - T10 * dT8_dVg) / T8; - dT10_dVd = (dT7_dVd * T9 + (T7 - 1.0) * dT9_dVd - - T10 * dT8_dVd) / T8; - dT10_dVb = (dT7_dVb * T9 + (T7 - 1.0) * dT9_dVb - - T10 * dT8_dVb) / T8; - Igcd = Igc * T10; - dIgcd_dVg = dIgc_dVg * T10 + Igc * dT10_dVg; - dIgcd_dVd = dIgc_dVd * T10 + Igc * dT10_dVd; - dIgcd_dVb = dIgc_dVb * T10 + Igc * dT10_dVb; - + if (model->BSIM4pigcdGiven) + { Pigcd = pParam->BSIM4pigcd; + dPigcd_dVg = dPigcd_dVd = dPigcd_dVb = 0.0; + } + else + { T11 = pParam->BSIM4Bechvb * model->BSIM4toxe; + T12 = Vgsteff + 1.0e-20; + T13 = T11 / T12 / T12; + T14 = -T13 / T12; + Pigcd = T13 * (1.0 - 0.5 * Vdseff / T12); + dPigcd_dVg = T14 * (2.0 + 0.5 * (dVdseff_dVg + * Vgsteff - 3.0 * Vdseff) / T12); + dPigcd_dVd = 0.5 * T14 * dVdseff_dVd + + dPigcd_dVg * dVgsteff_dVd; + dPigcd_dVb = 0.5 * T14 * dVdseff_dVb + + dPigcd_dVg * dVgsteff_dVb; + dPigcd_dVg *= dVgsteff_dVg; + } + + T7 = -Pigcd * Vds; + dT7_dVg = -Vds * dPigcd_dVg; + dT7_dVd = -Pigcd - Vds * dPigcd_dVd; + dT7_dVb = -Vds * dPigcd_dVb; + T8 = T7 * T7 + 2.0e-4; + dT8_dVg = 2.0 * T7; + dT8_dVd = dT8_dVg * dT7_dVd; + dT8_dVb = dT8_dVg * dT7_dVb; + dT8_dVg *= dT7_dVg; + + if (T7 > EXP_THRESHOLD) + { T9 = MAX_EXP; + dT9_dVg = dT9_dVd = dT9_dVb = 0.0; + } + else if (T7 < -EXP_THRESHOLD) + { T9 = MIN_EXP; + dT9_dVg = dT9_dVd = dT9_dVb = 0.0; + } + else + { T9 = exp(T7); + dT9_dVg = T9 * dT7_dVg; + dT9_dVd = T9 * dT7_dVd; + dT9_dVb = T9 * dT7_dVb; + } + + T0 = T8 * T8; + T1 = T9 - 1.0 + 1.0e-4; + T10 = (T1 - T7) / T8; + dT10_dVg = (dT9_dVg - dT7_dVg - T10 * dT8_dVg) / T8; + dT10_dVd = (dT9_dVd - dT7_dVd - T10 * dT8_dVd) / T8; + dT10_dVb = (dT9_dVb - dT7_dVb - T10 * dT8_dVb) / T8; + + Igcs = Igc * T10; + dIgcs_dVg = dIgc_dVg * T10 + Igc * dT10_dVg; + dIgcs_dVd = dIgc_dVd * T10 + Igc * dT10_dVd; + dIgcs_dVb = dIgc_dVb * T10 + Igc * dT10_dVb; + + T1 = T9 - 1.0 - 1.0e-4; + T10 = (T7 * T9 - T1) / T8; + dT10_dVg = (dT7_dVg * T9 + (T7 - 1.0) * dT9_dVg + - T10 * dT8_dVg) / T8; + dT10_dVd = (dT7_dVd * T9 + (T7 - 1.0) * dT9_dVd + - T10 * dT8_dVd) / T8; + dT10_dVb = (dT7_dVb * T9 + (T7 - 1.0) * dT9_dVb + - T10 * dT8_dVb) / T8; + Igcd = Igc * T10; + dIgcd_dVg = dIgc_dVg * T10 + Igc * dT10_dVg; + dIgcd_dVd = dIgc_dVd * T10 + Igc * dT10_dVd; + dIgcd_dVb = dIgc_dVb * T10 + Igc * dT10_dVb; here->BSIM4Igcs = Igcs; here->BSIM4gIgcsg = dIgcs_dVg; @@ -2072,7 +2124,6 @@ for (; model != NULL; model = model->BSIM4nextModel) here->BSIM4gIgcdd = dIgcd_dVd; here->BSIM4gIgcdb = dIgcd_dVb * dVbseff_dVb; - T0 = vgs - pParam->BSIM4vfbsd; vgs_eff = sqrt(T0 * T0 + 1.0e-4); dvgs_eff_dvg = T0 / vgs_eff; @@ -2280,6 +2331,11 @@ for (; model != NULL; model = model->BSIM4nextModel) here->BSIM4ggidld *= here->BSIM4nf; here->BSIM4ggidlg *= here->BSIM4nf; here->BSIM4ggidlb *= here->BSIM4nf; + + here->BSIM4Igisl *= here->BSIM4nf; + here->BSIM4ggisls *= here->BSIM4nf; + here->BSIM4ggislg *= here->BSIM4nf; + here->BSIM4ggislb *= here->BSIM4nf; here->BSIM4Igcs *= here->BSIM4nf; here->BSIM4gIgcsg *= here->BSIM4nf; @@ -2305,6 +2361,8 @@ for (; model != NULL; model = model->BSIM4nextModel) here->BSIM4ggidls = -(here->BSIM4ggidld + here->BSIM4ggidlg + here->BSIM4ggidlb); + here->BSIM4ggisld = -(here->BSIM4ggisls + here->BSIM4ggislg + + here->BSIM4ggislb); here->BSIM4gIgbs = -(here->BSIM4gIgbg + here->BSIM4gIgbd + here->BSIM4gIgbb); here->BSIM4gIgcss = -(here->BSIM4gIgcsg + here->BSIM4gIgcsd @@ -2314,40 +2372,42 @@ for (; model != NULL; model = model->BSIM4nextModel) here->BSIM4cd = cdrain; - if (model->BSIM4tnoiMod == 0) - { Abulk = Abulk0 * pParam->BSIM4abulkCVfactor; - Vdsat = Vgsteff / Abulk; - T0 = Vdsat - Vds - DELTA_4; - T1 = sqrt(T0 * T0 + 4.0 * DELTA_4 * Vdsat); - if (T0 >= 0.0) - Vdseff = Vdsat - 0.5 * (T0 + T1); - else - { T3 = (DELTA_4 + DELTA_4) / (T1 - T0); - T4 = 1.0 - T3; - T5 = Vdsat * T3 / (T1 - T0); - Vdseff = Vdsat * T4; - } - if (Vds == 0.0) - Vdseff = 0.0; - - T0 = Abulk * Vdseff; - T1 = 12.0 * (Vgsteff - 0.5 * T0 + 1.0e-20); - T2 = Vdseff / T1; - T3 = T0 * T2; - here->BSIM4qinv = Coxeff * pParam->BSIM4weffCV * here->BSIM4nf - * pParam->BSIM4leffCV - * (Vgsteff - 0.5 * T0 + Abulk * T3); - } + if (model->BSIM4tnoiMod == 0) + { Abulk = Abulk0 * pParam->BSIM4abulkCVfactor; + Vdsat = Vgsteff / Abulk; + T0 = Vdsat - Vds - DELTA_4; + T1 = sqrt(T0 * T0 + 4.0 * DELTA_4 * Vdsat); + if (T0 >= 0.0) + Vdseff = Vdsat - 0.5 * (T0 + T1); + else + { T3 = (DELTA_4 + DELTA_4) / (T1 - T0); + T4 = 1.0 - T3; + T5 = Vdsat * T3 / (T1 - T0); + Vdseff = Vdsat * T4; + } + if (Vds == 0.0) + Vdseff = 0.0; + + T0 = Abulk * Vdseff; + T1 = 12.0 * (Vgsteff - 0.5 * T0 + 1.0e-20); + T2 = Vdseff / T1; + T3 = T0 * T2; + here->BSIM4qinv = Coxeff * pParam->BSIM4weffCV * here->BSIM4nf + * pParam->BSIM4leffCV + * (Vgsteff - 0.5 * T0 + Abulk * T3); + } /* * BSIM4 C-V begins */ - if ((model->BSIM4xpart < 0) || (!ChargeComputationNeeded)) + if ((model->BSIM4xpart < 0) || (!ChargeComputationNeeded)) { qgate = qdrn = qsrc = qbulk = 0.0; here->BSIM4cggb = here->BSIM4cgsb = here->BSIM4cgdb = 0.0; here->BSIM4cdgb = here->BSIM4cdsb = here->BSIM4cddb = 0.0; here->BSIM4cbgb = here->BSIM4cbsb = here->BSIM4cbdb = 0.0; + here->BSIM4csgb = here->BSIM4cssb = here->BSIM4csdb = 0.0; + here->BSIM4cgbb = here->BSIM4csbb = here->BSIM4cdbb = here->BSIM4cbbb = 0.0; here->BSIM4cqdb = here->BSIM4cqsb = here->BSIM4cqgb = here->BSIM4cqbb = 0.0; here->BSIM4gtau = 0.0; @@ -2585,7 +2645,7 @@ for (; model != NULL; model = model->BSIM4nextModel) here->BSIM4cbgb = -(here->BSIM4cggb + here->BSIM4cdgb + T12); here->BSIM4cbdb = -(here->BSIM4cgdb - + here->BSIM4cddb + T11); + + here->BSIM4cddb + T10); /* bug fix */ here->BSIM4cbsb = -(here->BSIM4cgsb + here->BSIM4cdsb + tmp); } @@ -3146,9 +3206,17 @@ for (; model != NULL; model = model->BSIM4nextModel) } /* End of CTM */ } + here->BSIM4csgb = - here->BSIM4cggb - here->BSIM4cdgb - here->BSIM4cbgb; + here->BSIM4csdb = - here->BSIM4cgdb - here->BSIM4cddb - here->BSIM4cbdb; + here->BSIM4cssb = - here->BSIM4cgsb - here->BSIM4cdsb - here->BSIM4cbsb; + here->BSIM4cgbb = - here->BSIM4cgdb - here->BSIM4cggb - here->BSIM4cgsb; + here->BSIM4cdbb = - here->BSIM4cddb - here->BSIM4cdgb - here->BSIM4cdsb; + here->BSIM4cbbb = - here->BSIM4cbgb - here->BSIM4cbdb - here->BSIM4cbsb; + here->BSIM4csbb = - here->BSIM4cgbb - here->BSIM4cdbb - here->BSIM4cbbb; here->BSIM4qgate = qgate; here->BSIM4qbulk = qbulk; here->BSIM4qdrn = qdrn; + here->BSIM4qsrc = -(qgate + qbulk + qdrn); /* NQS begins */ if ((here->BSIM4trnqsMod) || (here->BSIM4acnqsMod)) @@ -3183,13 +3251,13 @@ finished: /* Calculate junction C-V */ if (ChargeComputationNeeded) - { czbd = model->BSIM4DunitAreaJctCap * here->BSIM4Adeff; - czbs = model->BSIM4SunitAreaJctCap * here->BSIM4Aseff; - czbdsw = model->BSIM4DunitLengthSidewallJctCap * here->BSIM4Pdeff; - czbdswg = model->BSIM4DunitLengthGateSidewallJctCap + { czbd = model->BSIM4DunitAreaTempJctCap * here->BSIM4Adeff; /* bug fix */ + czbs = model->BSIM4SunitAreaTempJctCap * here->BSIM4Aseff; + czbdsw = model->BSIM4DunitLengthSidewallTempJctCap * here->BSIM4Pdeff; + czbdswg = model->BSIM4DunitLengthGateSidewallTempJctCap * pParam->BSIM4weffCJ * here->BSIM4nf; - czbssw = model->BSIM4SunitLengthSidewallJctCap * here->BSIM4Pseff; - czbsswg = model->BSIM4SunitLengthGateSidewallJctCap + czbssw = model->BSIM4SunitLengthSidewallTempJctCap * here->BSIM4Pseff; + czbsswg = model->BSIM4SunitLengthGateSidewallTempJctCap * pParam->BSIM4weffCJ * here->BSIM4nf; MJS = model->BSIM4SbulkJctBotGradingCoeff; @@ -3308,6 +3376,46 @@ finished: if ((here->BSIM4off == 0) || (!(ckt->CKTmode & MODEINITFIX))) { if (Check == 1) { ckt->CKTnoncon++; +#ifndef NEWCONV + } + else + { if (here->BSIM4mode >= 0) + { Idtot = here->BSIM4cd + here->BSIM4csub + + here->BSIM4Igidl - here->BSIM4cbd; + } + else + { Idtot = here->BSIM4cd + here->BSIM4cbd; + } + tol0 = ckt->CKTreltol * MAX(fabs(cdhat), fabs(Idtot)) + + ckt->CKTabstol; + tol1 = ckt->CKTreltol * MAX(fabs(cseshat), fabs(Isestot)) + + ckt->CKTabstol; + tol2 = ckt->CKTreltol * MAX(fabs(cdedhat), fabs(Idedtot)) + + ckt->CKTabstol; + tol3 = ckt->CKTreltol * MAX(fabs(cgshat), fabs(Igstot)) + + ckt->CKTabstol; + tol4 = ckt->CKTreltol * MAX(fabs(cgdhat), fabs(Igdtot)) + + ckt->CKTabstol; + tol5 = ckt->CKTreltol * MAX(fabs(cgbhat), fabs(Igbtot)) + + ckt->CKTabstol; + if ((fabs(cdhat - Idtot) >= tol0) || (fabs(cseshat - Isestot) >= tol1) + || (fabs(cdedhat - Idedtot) >= tol2)) + { ckt->CKTnoncon++; + } + else if ((fabs(cgshat - Igstot) >= tol3) || (fabs(cgdhat - Igdtot) >= tol4) + || (fabs(cgbhat - Igbtot) >= tol5)) + { ckt->CKTnoncon++; + } + else + { Ibtot = here->BSIM4cbs + here->BSIM4cbd + - here->BSIM4Igidl - here->BSIM4Igisl - here->BSIM4csub; + tol6 = ckt->CKTreltol * MAX(fabs(cbhat), fabs(Ibtot)) + + ckt->CKTabstol; + if (fabs(cbhat - Ibtot) > tol6) + { ckt->CKTnoncon++; + } + } +#endif /* NEWCONV */ } } *(ckt->CKTstate0 + here->BSIM4vds) = vds; @@ -3327,24 +3435,12 @@ finished: if (!ChargeComputationNeeded) goto line850; - if (model->BSIM4capMod == 0) - { if (vgd < 0.0) - { cgdo = pParam->BSIM4cgdo; + if (model->BSIM4capMod == 0) /* code merge -JX */ + { + cgdo = pParam->BSIM4cgdo; qgdo = pParam->BSIM4cgdo * vgd; - } - else - { cgdo = pParam->BSIM4cgdo; - qgdo = pParam->BSIM4cgdo * vgd; - } - - if (vgs < 0.0) - { cgso = pParam->BSIM4cgso; + cgso = pParam->BSIM4cgso; qgso = pParam->BSIM4cgso * vgs; - } - else - { cgso = pParam->BSIM4cgso; - qgso = pParam->BSIM4cgso * vgs; - } } else /* For both capMod == 1 and 2 */ { T0 = vgd + DELTA_1; @@ -3781,6 +3877,8 @@ line755: *(ckt->CKTstate0 + here->BSIM4qg) = qgate; *(ckt->CKTstate0 + here->BSIM4qd) = qdrn - *(ckt->CKTstate0 + here->BSIM4qbd); + *(ckt->CKTstate0 + here->BSIM4qs) = qsrc + - *(ckt->CKTstate0 + here->BSIM4qbs); if (here->BSIM4rgateMod == 3) *(ckt->CKTstate0 + here->BSIM4qgmid) = qgmid; @@ -3953,16 +4051,16 @@ line900: - (here->BSIM4gbds + here->BSIM4ggidld) * vds - (here->BSIM4gbgs + here->BSIM4ggidlg) * vgs - (here->BSIM4gbbs + here->BSIM4ggidlb) * vbs); - ceqbs = 0.0; + ceqbs = model->BSIM4type * (here->BSIM4Igisl + here->BSIM4ggisls * vds + - here->BSIM4ggislg * vgd - here->BSIM4ggislb * vbd); - gbbdp = -(here->BSIM4gbds + here->BSIM4ggidld); - gbbsp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs - - here->BSIM4ggidls; - - gbdpg = here->BSIM4gbgs + here->BSIM4ggidlg; - gbdpdp = here->BSIM4gbds + here->BSIM4ggidld; - gbdpb = here->BSIM4gbbs + here->BSIM4ggidlb; - gbdpsp = -(gbdpg + gbdpdp + gbdpb) + here->BSIM4ggidls; + gbbdp = -(here->BSIM4gbds); + gbbsp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs; + + gbdpg = here->BSIM4gbgs; + gbdpdp = here->BSIM4gbds; + gbdpb = here->BSIM4gbbs; + gbdpsp = -(gbdpg + gbdpdp + gbdpb); gbspg = 0.0; gbspdp = 0.0; @@ -4040,25 +4138,25 @@ line900: ceqdrn = -model->BSIM4type * (cdrain + here->BSIM4gds * vds + Gm * vgd + Gmbs * vbd); - ceqbs = model->BSIM4type * (here->BSIM4csub + here->BSIM4Igidl - + (here->BSIM4gbds + here->BSIM4ggidld) * vds - - (here->BSIM4gbgs + here->BSIM4ggidlg) * vgd - - (here->BSIM4gbbs + here->BSIM4ggidlb) * vbd); - ceqbd = 0.0; + ceqbs = model->BSIM4type * (here->BSIM4csub + here->BSIM4Igisl + + (here->BSIM4gbds + here->BSIM4ggisls) * vds + - (here->BSIM4gbgs + here->BSIM4ggislg) * vgd + - (here->BSIM4gbbs + here->BSIM4ggislb) * vbd); + ceqbd = model->BSIM4type * (here->BSIM4Igidl - here->BSIM4ggidld * vds + - here->BSIM4ggidlg * vgs - here->BSIM4ggidlb * vbs); - gbbsp = -(here->BSIM4gbds + here->BSIM4ggidld); - gbbdp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs - - here->BSIM4ggidls; + gbbsp = -(here->BSIM4gbds); + gbbdp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs; gbdpg = 0.0; gbdpsp = 0.0; gbdpb = 0.0; gbdpdp = 0.0; - gbspg = here->BSIM4gbgs + here->BSIM4ggidlg; - gbspsp = here->BSIM4gbds + here->BSIM4ggidld; - gbspb = here->BSIM4gbbs + here->BSIM4ggidlb; - gbspdp = -(gbspg + gbspsp + gbspb) + here->BSIM4ggidls; + gbspg = here->BSIM4gbgs; + gbspsp = here->BSIM4gbds; + gbspb = here->BSIM4gbbs; + gbspdp = -(gbspg + gbspsp + gbspb); if (model->BSIM4igcMod) { gIstotg = here->BSIM4gIgsg + here->BSIM4gIgcdg; @@ -4319,10 +4417,37 @@ line900: (*(here->BSIM4SsPtr) += gspr + gstot); (*(here->BSIM4BPdpPtr) += gcbdb - gjbd + gbbdp - gIbtotd); - (*(here->BSIM4BPgpPtr) += gcbgb - here->BSIM4gbgs - here->BSIM4ggidlg - gIbtotg); + (*(here->BSIM4BPgpPtr) += gcbgb - here->BSIM4gbgs - gIbtotg); (*(here->BSIM4BPspPtr) += gcbsb - gjbs + gbbsp - gIbtots); (*(here->BSIM4BPbpPtr) += gjbd + gjbs + gcbbb - here->BSIM4gbbs - - here->BSIM4ggidlb - gIbtotb); + - gIbtotb); + + ggidld = here->BSIM4ggidld; + ggidlg = here->BSIM4ggidlg; + ggidlb = here->BSIM4ggidlb; + ggislg = here->BSIM4ggislg; + ggisls = here->BSIM4ggisls; + ggislb = here->BSIM4ggislb; + + /* stamp gidl */ + (*(here->BSIM4DPdpPtr) += ggidld); + (*(here->BSIM4DPgpPtr) += ggidlg); + (*(here->BSIM4DPspPtr) -= (ggidlg + ggidld + ggidlb)); + (*(here->BSIM4DPbpPtr) += ggidlb); + (*(here->BSIM4BPdpPtr) -= ggidld); + (*(here->BSIM4BPgpPtr) -= ggidlg); + (*(here->BSIM4BPspPtr) += (ggidlg + ggidld + ggidlb)); + (*(here->BSIM4BPbpPtr) -= ggidlb); + /* stamp gisl */ + (*(here->BSIM4SPdpPtr) -= (ggisls + ggislg + ggislb)); + (*(here->BSIM4SPgpPtr) += ggislg); + (*(here->BSIM4SPspPtr) += ggisls); + (*(here->BSIM4SPbpPtr) += ggislb); + (*(here->BSIM4BPdpPtr) += (ggislg + ggisls + ggislb)); + (*(here->BSIM4BPgpPtr) -= ggislg); + (*(here->BSIM4BPspPtr) -= ggisls); + (*(here->BSIM4BPbpPtr) -= ggislb); + if (here->BSIM4rbodyMod) { (*(here->BSIM4DPdbPtr) += gcdbdb - here->BSIM4gbd); @@ -4373,3 +4498,35 @@ line1000: ; return(OK); } + +/* function to compute poly depletion effect */ +int BSIM4polyDepletion( + double phi, + double ngate, + double coxe, + double Vgs, + double *Vgs_eff, + double *dVgs_eff_dVg) +{ + double T1, T2, T3, T4, T5, T6, T7, T8; + + /* Poly Gate Si Depletion Effect */ + if ((ngate > 1.0e18) && + (ngate < 1.0e25) && (Vgs > phi)) { + T1 = 1.0e6 * CHARGE * EPSSI * ngate / (coxe * coxe); + T8 = Vgs - phi; + T4 = sqrt(1.0 + 2.0 * T8 / T1); + T2 = 2.0 * T8 / (T4 + 1.0); + T3 = 0.5 * T2 * T2 / T1; /* T3 = Vpoly */ + T7 = 1.12 - T3 - 0.05; + T6 = sqrt(T7 * T7 + 0.224); + T5 = 1.12 - 0.5 * (T7 + T6); + *Vgs_eff = Vgs - T5; + *dVgs_eff_dVg = 1.0 - (0.5 - 0.5 / T4) * (1.0 + T7 / T6); + } + else { + *Vgs_eff = Vgs; + *dVgs_eff_dVg = 1.0; + } + return(0); +} diff --git a/src/spicelib/devices/bsim4/b4mask.c b/src/spicelib/devices/bsim4/b4mask.c index f681a2f1b..6dd16ddc8 100644 --- a/src/spicelib/devices/bsim4/b4mask.c +++ b/src/spicelib/devices/bsim4/b4mask.c @@ -1,14 +1,14 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4mask.c of BSIM4.1.0. - * Authors: Weidong Liu, Xiaodong Jin, Kanyu M. Cao, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4mask.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. **********/ + #include "ngspice.h" #include #include "ifsim.h" @@ -16,7 +16,7 @@ #include "devdefs.h" #include "bsim4def.h" #include "sperror.h" - +#include "suffix.h" int BSIM4mAsk(ckt,inst,which,value) @@ -519,6 +519,12 @@ IFvalue *value; case BSIM4_MOD_DLC: value->rValue = model->BSIM4dlc; return(OK); + case BSIM4_MOD_XW: + value->rValue = model->BSIM4xw; + return(OK); + case BSIM4_MOD_XL: + value->rValue = model->BSIM4xl; + return(OK); case BSIM4_MOD_DLCIG: value->rValue = model->BSIM4dlcig; return(OK); diff --git a/src/spicelib/devices/bsim4/b4mdel.c b/src/spicelib/devices/bsim4/b4mdel.c index df5cbee96..d133c0e81 100644 --- a/src/spicelib/devices/bsim4/b4mdel.c +++ b/src/spicelib/devices/bsim4/b4mdel.c @@ -1,18 +1,18 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4mdel.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4mdel.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. **********/ #include "ngspice.h" #include #include "bsim4def.h" #include "sperror.h" +#include "suffix.h" int BSIM4mDelete(inModel,modname,kill) diff --git a/src/spicelib/devices/bsim4/b4mpar.c b/src/spicelib/devices/bsim4/b4mpar.c index 8fe69d3f5..679e20843 100644 --- a/src/spicelib/devices/bsim4/b4mpar.c +++ b/src/spicelib/devices/bsim4/b4mpar.c @@ -1,12 +1,13 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4mpar.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4mpar.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. * - * Modified by Weidong Liu, 10/11/2000. + * Modified by Xuemei Xi 04/06/2001 **********/ #include "ngspice.h" @@ -14,6 +15,7 @@ #include "bsim4def.h" #include "ifsim.h" #include "sperror.h" +#include "suffix.h" #include "const.h" int @@ -685,6 +687,14 @@ GENmodel *inMod; mod->BSIM4dlc = value->rValue; mod->BSIM4dlcGiven = TRUE; break; + case BSIM4_MOD_XW : + mod->BSIM4xw = value->rValue; + mod->BSIM4xwGiven = TRUE; + break; + case BSIM4_MOD_XL : + mod->BSIM4xl = value->rValue; + mod->BSIM4xlGiven = TRUE; + break; case BSIM4_MOD_DLCIG : mod->BSIM4dlcig = value->rValue; mod->BSIM4dlcigGiven = TRUE; diff --git a/src/spicelib/devices/bsim4/b4noi.c b/src/spicelib/devices/bsim4/b4noi.c index 5e1fcfab6..f5663d2e6 100644 --- a/src/spicelib/devices/bsim4/b4noi.c +++ b/src/spicelib/devices/bsim4/b4noi.c @@ -1,12 +1,13 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4noi.c of BSIM4.1.0. - * Authors: Weidong Liu, Xiaodong Jin, Kanyu M. Cao, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4noi.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. + + * Modified by Xuemei Xi, 10/05/2001. **********/ #include "ngspice.h" @@ -16,6 +17,7 @@ #include "cktdefs.h" #include "iferrmsg.h" #include "noisedef.h" +#include "suffix.h" #include "const.h" @@ -41,9 +43,12 @@ double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, Ssi; pParam = here->pParam; cd = fabs(here->BSIM4cd); esat = 2.0 * pParam->BSIM4vsattemp / here->BSIM4ueff; - T0 = ((((Vds - here->BSIM4Vdseff) / pParam->BSIM4litl) - + model->BSIM4em) / esat); - DelClm = pParam->BSIM4litl * log (MAX(T0, N_MINLOG)); + if(model->BSIM4em<=0.0) DelClm = 0.0; /* flicker noise modified -JX */ + else { + T0 = ((((Vds - here->BSIM4Vdseff) / pParam->BSIM4litl) + + model->BSIM4em) / esat); + DelClm = pParam->BSIM4litl * log (MAX(T0, N_MINLOG)); + } EffFreq = pow(freq, model->BSIM4ef); T1 = CHARGE * CHARGE * CONSTboltz * cd * temp * here->BSIM4ueff; T2 = 1.0e10 * EffFreq * here->BSIM4Abulk * model->BSIM4coxe @@ -73,11 +78,11 @@ BSIM4noise (mode, operation, inModel, ckt, data, OnDens) int mode, operation; GENmodel *inModel; CKTcircuit *ckt; -Ndata *data; +register Ndata *data; double *OnDens; { -BSIM4model *model = (BSIM4model *)inModel; -BSIM4instance *here; +register BSIM4model *model = (BSIM4model *)inModel; +register BSIM4instance *here; struct bsim4SizeDependParam *pParam; char name[N_MXVLNTH]; double tempOnoise; @@ -86,7 +91,7 @@ double noizDens[BSIM4NSRCS]; double lnNdens[BSIM4NSRCS]; double N0, Nl; -double T0, T1, T2, T5, T10, T11; +double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13; double Vds, n, ExpArg, Ssi, Swi; double tmp, gdpr, gspr, npart_theta, npart_beta, igsquare; diff --git a/src/spicelib/devices/bsim4/b4par.c b/src/spicelib/devices/bsim4/b4par.c index 8dd8b03c7..6fde48085 100644 --- a/src/spicelib/devices/bsim4/b4par.c +++ b/src/spicelib/devices/bsim4/b4par.c @@ -1,12 +1,11 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4par.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4par.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. **********/ #include "ngspice.h" @@ -14,7 +13,7 @@ #include "ifsim.h" #include "bsim4def.h" #include "sperror.h" - +#include "suffix.h" int BSIM4param(param,value,inst,select) diff --git a/src/spicelib/devices/bsim4/b4pzld.c b/src/spicelib/devices/bsim4/b4pzld.c index 6037cf29e..d75087cd7 100644 --- a/src/spicelib/devices/bsim4/b4pzld.c +++ b/src/spicelib/devices/bsim4/b4pzld.c @@ -1,12 +1,13 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4pzld.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4pzld.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. + + * Modified by Xuemei Xi, 10/05/2001. **********/ #include "ngspice.h" @@ -15,16 +16,16 @@ #include "complex.h" #include "sperror.h" #include "bsim4def.h" - +#include "suffix.h" int BSIM4pzLoad(inModel,ckt,s) GENmodel *inModel; -CKTcircuit *ckt; -SPcomplex *s; +register CKTcircuit *ckt; +register SPcomplex *s; { -BSIM4model *model = (BSIM4model*)inModel; -BSIM4instance *here; +register BSIM4model *model = (BSIM4model*)inModel; +register BSIM4instance *here; double gjbd, gjbs, geltd, gcrg, gcrgg, gcrgd, gcrgs, gcrgb; double xcggb, xcgdb, xcgsb, xcgbb, xcbgb, xcbdb, xcbsb, xcbbb; @@ -47,12 +48,13 @@ double dsxpart_dVd, dsxpart_dVg, dsxpart_dVb, dsxpart_dVs; double T0, T1, CoxWL, qcheq, Cdg, Cdd, Cds, Cdb, Csg, Csd, Css, Csb; double ScalingFactor = 1.0e-9; struct bsim4SizeDependParam *pParam; +double ggidld, ggidlg, ggidlb,ggisld, ggislg, ggislb, ggisls; + for (; model != NULL; model = model->BSIM4nextModel) { for (here = model->BSIM4instances; here!= NULL; here = here->BSIM4nextInstance) - { if (here->BSIM4owner != ARCHme) continue; - pParam = here->pParam; + { pParam = here->pParam; capbd = here->BSIM4capbd; capbs = here->BSIM4capbs; cgso = here->BSIM4cgso; @@ -65,13 +67,12 @@ struct bsim4SizeDependParam *pParam; FwdSum = Gm + Gmbs; RevSum = 0.0; - gbbdp = -(here->BSIM4gbds + here->BSIM4ggidld); - gbbsp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs - - here->BSIM4ggidls; - gbdpg = here->BSIM4gbgs + here->BSIM4ggidlg; - gbdpdp = here->BSIM4gbds + here->BSIM4ggidld; - gbdpb = here->BSIM4gbbs + here->BSIM4ggidlb; - gbdpsp = -(gbdpg + gbdpdp + gbdpb) + here->BSIM4ggidls; + gbbdp = -(here->BSIM4gbds); + gbbsp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs; + gbdpg = here->BSIM4gbgs; + gbdpdp = here->BSIM4gbds; + gbdpb = here->BSIM4gbbs; + gbdpsp = -(gbdpg + gbdpdp + gbdpb); gbspdp = 0.0; gbspg = 0.0; @@ -264,19 +265,18 @@ struct bsim4SizeDependParam *pParam; FwdSum = 0.0; RevSum = -(Gm + Gmbs); - gbbsp = -(here->BSIM4gbds + here->BSIM4ggidld); - gbbdp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs - - here->BSIM4ggidls; + gbbsp = -(here->BSIM4gbds); + gbbdp = here->BSIM4gbds + here->BSIM4gbgs + here->BSIM4gbbs; gbdpg = 0.0; gbdpsp = 0.0; gbdpb = 0.0; gbdpdp = 0.0; - gbspg = here->BSIM4gbgs + here->BSIM4ggidlg; - gbspsp = here->BSIM4gbds + here->BSIM4ggidld; - gbspb = here->BSIM4gbbs + here->BSIM4ggidlb; - gbspdp = -(gbspg + gbspsp + gbspb) + here->BSIM4ggidls; + gbspg = here->BSIM4gbgs; + gbspsp = here->BSIM4gbds; + gbspb = here->BSIM4gbbs; + gbspdp = -(gbspg + gbspsp + gbspb); if (model->BSIM4igcMod) { gIstotg = here->BSIM4gIgsg + here->BSIM4gIgcdg; @@ -652,14 +652,39 @@ struct bsim4SizeDependParam *pParam; *(here->BSIM4BPdpPtr) -= gjbd - gbbdp + gIbtotd; *(here->BSIM4BPgpPtr ) += xcbgb * s->real; *(here->BSIM4BPgpPtr +1) += xcbgb * s->imag; - *(here->BSIM4BPgpPtr) -= here->BSIM4gbgs + here->BSIM4ggidlg + gIbtotg; + *(here->BSIM4BPgpPtr) -= here->BSIM4gbgs + gIbtotg; *(here->BSIM4BPspPtr ) += xcbsb * s->real; *(here->BSIM4BPspPtr +1) += xcbsb * s->imag; *(here->BSIM4BPspPtr) -= gjbs - gbbsp + gIbtots; *(here->BSIM4BPbpPtr ) += xcbbb * s->real; *(here->BSIM4BPbpPtr +1) += xcbbb * s->imag; *(here->BSIM4BPbpPtr) += gjbd + gjbs - here->BSIM4gbbs - - gIbtotb - here->BSIM4ggidlb; + - gIbtotb; + ggidld = here->BSIM4ggidld; + ggidlg = here->BSIM4ggidlg; + ggidlb = here->BSIM4ggidlb; + ggislg = here->BSIM4ggislg; + ggisls = here->BSIM4ggisls; + ggislb = here->BSIM4ggislb; + + /* stamp gidl */ + (*(here->BSIM4DPdpPtr) += ggidld); + (*(here->BSIM4DPgpPtr) += ggidlg); + (*(here->BSIM4DPspPtr) -= (ggidlg + ggidld) + ggidlb); + (*(here->BSIM4DPbpPtr) += ggidlb); + (*(here->BSIM4BPdpPtr) -= ggidld); + (*(here->BSIM4BPgpPtr) -= ggidlg); + (*(here->BSIM4BPspPtr) += (ggidlg + ggidld) + ggidlb); + (*(here->BSIM4BPbpPtr) -= ggidlb); + /* stamp gisl */ + (*(here->BSIM4SPdpPtr) -= (ggisls + ggislg) + ggislb); + (*(here->BSIM4SPgpPtr) += ggislg); + (*(here->BSIM4SPspPtr) += ggisls); + (*(here->BSIM4SPbpPtr) += ggislb); + (*(here->BSIM4BPdpPtr) += (ggislg + ggisls) + ggislb); + (*(here->BSIM4BPgpPtr) -= ggislg); + (*(here->BSIM4BPspPtr) -= ggisls); + (*(here->BSIM4BPbpPtr) -= ggislb); if (here->BSIM4rbodyMod) { (*(here->BSIM4DPdbPtr ) += xcdbdb * s->real); diff --git a/src/spicelib/devices/bsim4/b4set.c b/src/spicelib/devices/bsim4/b4set.c index 95b2a3818..ffe5bbf6f 100644 --- a/src/spicelib/devices/bsim4/b4set.c +++ b/src/spicelib/devices/bsim4/b4set.c @@ -1,23 +1,26 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4set.c of BSIM4.1.0. - * Authors: Weidong Liu, Xiaodong Jin, Kanyu M. Cao, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4set.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. **********/ #include "ngspice.h" #include #include +#include "jobdefs.h" +#include "ftedefs.h" #include "smpdefs.h" #include "cktdefs.h" #include "bsim4def.h" #include "const.h" #include "sperror.h" - +#include "suffix.h" #define MAX_EXP 5.834617425e14 #define MIN_EXP 1.713908431e-15 @@ -29,17 +32,27 @@ int BSIM4setup(matrix,inModel,ckt,states) -SMPmatrix *matrix; -GENmodel *inModel; -CKTcircuit *ckt; +register SMPmatrix *matrix; +register GENmodel *inModel; +register CKTcircuit *ckt; int *states; { -BSIM4model *model = (BSIM4model*)inModel; -BSIM4instance *here; +register BSIM4model *model = (BSIM4model*)inModel; +register BSIM4instance *here; int error; CKTnode *tmp; - double tmp1, tmp2; +int noiseAnalGiven = 0, createNode; /* Criteria for new node creation */ +double Rtot, DMCGeff, DMCIeff, DMDGeff; +JOB *job; + + /* Search for a noise analysis request */ + for (job = ((TSKtask *)(ft_curckt->ci_curTask))->jobs;job;job = job->JOBnextJob) { + if(strcmp(job->JOBname,"Noise Analysis")==0) { + noiseAnalGiven = 1; + break; + } + } /* loop through all the BSIM4 device models */ for( ; model != NULL; model = model->BSIM4nextModel ) @@ -147,7 +160,7 @@ double tmp1, tmp2; } if (!model->BSIM4versionGiven) - model->BSIM4version = "4.1.0"; + model->BSIM4version = "4.2.1"; if (!model->BSIM4toxrefGiven) model->BSIM4toxref = 30.0e-10; if (!model->BSIM4toxeGiven) @@ -1216,6 +1229,10 @@ double tmp1, tmp2; model->BSIM4dwc = model->BSIM4Wint; if (!model->BSIM4dlcGiven) model->BSIM4dlc = model->BSIM4Lint; + if (!model->BSIM4xlGiven) + model->BSIM4xl = 0.0; + if (!model->BSIM4xwGiven) + model->BSIM4xw = 0.0; if (!model->BSIM4dlcigGiven) model->BSIM4dlcig = model->BSIM4Lint; if (!model->BSIM4dwjGiven) @@ -1308,6 +1325,9 @@ double tmp1, tmp2; model->BSIM4af = 1.0; if (!model->BSIM4kfGiven) model->BSIM4kf = 0.0; + DMCGeff = model->BSIM4dmcg - model->BSIM4dmcgt; + DMCIeff = model->BSIM4dmci; + DMDGeff = model->BSIM4dmdg - model->BSIM4dmcgt; /* * End processing models and begin to loop @@ -1316,13 +1336,10 @@ double tmp1, tmp2; for (here = model->BSIM4instances; here != NULL ; here=here->BSIM4nextInstance) - { - if (here->BSIM4owner == ARCHme) { - /* allocate a chunk of the state vector */ + { /* allocate a chunk of the state vector */ here->BSIM4states = *states; *states += BSIM4numStates; - } - /* perform the parameter defaulting */ + /* perform the parameter defaulting */ if (!here->BSIM4lGiven) here->BSIM4l = 5.0e-6; if (!here->BSIM4wGiven) @@ -1403,8 +1420,29 @@ double tmp1, tmp2; } /* process drain series resistance */ - if (((here->BSIM4rgeoMod != 0) || (model->BSIM4rdsMod != 0) - || (model->BSIM4tnoiMod != 0)) && (here->BSIM4dNodePrime == 0)) + createNode = 0; + if ( (model->BSIM4rdsMod != 0) + || (model->BSIM4tnoiMod != 0 && noiseAnalGiven)) + { + createNode = 1; + } else if (model->BSIM4sheetResistance > 0) + { + if (here->BSIM4drainSquaresGiven + && here->BSIM4drainSquares > 0) + { + createNode = 1; + } else if (!here->BSIM4drainSquaresGiven + && (here->BSIM4rgeoMod != 0)) + { + BSIM4RdseffGeo(here->BSIM4nf, here->BSIM4geoMod, + here->BSIM4rgeoMod, here->BSIM4min, + here->BSIM4w, model->BSIM4sheetResistance, + DMCGeff, DMCIeff, DMDGeff, 0, &Rtot); + if(Rtot > 0) + createNode = 1; + } + } + if ( createNode != 0 && (here->BSIM4dNodePrime == 0)) { error = CKTmkVolt(ckt,&tmp,here->BSIM4name,"drain"); if(error) return(error); here->BSIM4dNodePrime = tmp->number; @@ -1412,16 +1450,37 @@ double tmp1, tmp2; else { here->BSIM4dNodePrime = here->BSIM4dNode; } + /* process source series resistance */ - if (((here->BSIM4rgeoMod != 0) || (model->BSIM4rdsMod != 0) - || (model->BSIM4tnoiMod != 0)) && (here->BSIM4sNodePrime == 0)) + createNode = 0; + if ( (model->BSIM4rdsMod != 0) + || (model->BSIM4tnoiMod != 0 && noiseAnalGiven)) + { + createNode = 1; + } else if (model->BSIM4sheetResistance > 0) + { + if (here->BSIM4sourceSquaresGiven + && here->BSIM4sourceSquares > 0) + { + createNode = 1; + } else if (!here->BSIM4sourceSquaresGiven + && (here->BSIM4rgeoMod != 0)) + { + BSIM4RdseffGeo(here->BSIM4nf, here->BSIM4geoMod, + here->BSIM4rgeoMod, here->BSIM4min, + here->BSIM4w, model->BSIM4sheetResistance, + DMCGeff, DMCIeff, DMDGeff, 1, &Rtot); + if(Rtot > 0) + createNode = 1; + } + } + if ( createNode != 0 && here->BSIM4sNodePrime == 0) { error = CKTmkVolt(ckt,&tmp,here->BSIM4name,"source"); if(error) return(error); here->BSIM4sNodePrime = tmp->number; } else here->BSIM4sNodePrime = here->BSIM4sNode; - if ((here->BSIM4rgateMod > 0) && (here->BSIM4gNodePrime == 0)) { error = CKTmkVolt(ckt,&tmp,here->BSIM4name,"gate"); @@ -1589,6 +1648,7 @@ BSIM4unsetup(inModel,ckt) GENmodel *inModel; CKTcircuit *ckt; { +#ifndef HAS_BATCHSIM BSIM4model *model; BSIM4instance *here; @@ -1612,5 +1672,6 @@ BSIM4unsetup(inModel,ckt) } } } +#endif return OK; } diff --git a/src/spicelib/devices/bsim4/b4temp.c b/src/spicelib/devices/bsim4/b4temp.c index b94bf3dfd..06237253f 100644 --- a/src/spicelib/devices/bsim4/b4temp.c +++ b/src/spicelib/devices/bsim4/b4temp.c @@ -1,12 +1,13 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4temp.c of BSIM4.1.0. - * Authors: Weidong Liu, Xiaodong Jin, Kanyu M. Cao, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4temp.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. + * Modified by Xuemei Xi, 04/06/2001. + * Modified by Xuemei Xi, 10/05/2001. **********/ #include "ngspice.h" @@ -17,6 +18,7 @@ #include "bsim4def.h" #include "const.h" #include "sperror.h" +#include "suffix.h" #define Kb 1.3806226e-23 #define KboQ 8.617087e-5 @@ -49,11 +51,11 @@ BSIM4temp(inModel,ckt) GENmodel *inModel; CKTcircuit *ckt; { -BSIM4model *model = (BSIM4model*) inModel; -BSIM4instance *here; +register BSIM4model *model = (BSIM4model*) inModel; +register BSIM4instance *here; struct bsim4SizeDependParam *pSizeDependParamKnot, *pLastKnot, *pParam; double tmp, tmp1, tmp2, tmp3, Eg, Eg0, ni; -double T0, T1, T2, T3, T4, T5, T8, T9, Ldrn, Wdrn; +double T0, T1, T2, T3, T4, T5, T8, T9, Lnew, Wnew; double delTemp, Temp, TRatio, Inv_L, Inv_W, Inv_LW, Dw, Dl, Vtm0, Tnom; double dumPs, dumPd, dumAs, dumAd, PowWeffWr; double DMCGeff, DMCIeff, DMDGeff; @@ -186,46 +188,46 @@ int Size_Not_Found; delTemp = ckt->CKTtemp - model->BSIM4tnom; T0 = model->BSIM4tcj * delTemp; if (T0 >= -1.0) - { model->BSIM4SunitAreaJctCap *= 1.0 + T0; - model->BSIM4DunitAreaJctCap *= 1.0 + T0; + { model->BSIM4SunitAreaTempJctCap = model->BSIM4SunitAreaJctCap *(1.0 + T0); /*bug_fix -JX */ + model->BSIM4DunitAreaTempJctCap = model->BSIM4DunitAreaJctCap *(1.0 + T0); } else { if (model->BSIM4SunitAreaJctCap > 0.0) - { model->BSIM4SunitAreaJctCap = 0.0; + { model->BSIM4SunitAreaTempJctCap = 0.0; fprintf(stderr, "Temperature effect has caused cjs to be negative. Cjs is clamped to zero.\n"); } if (model->BSIM4DunitAreaJctCap > 0.0) - { model->BSIM4DunitAreaJctCap = 0.0; + { model->BSIM4DunitAreaTempJctCap = 0.0; fprintf(stderr, "Temperature effect has caused cjd to be negative. Cjd is clamped to zero.\n"); } } T0 = model->BSIM4tcjsw * delTemp; if (T0 >= -1.0) - { model->BSIM4SunitLengthSidewallJctCap *= 1.0 + T0; - model->BSIM4DunitLengthSidewallJctCap *= 1.0 + T0; + { model->BSIM4SunitLengthSidewallTempJctCap = model->BSIM4SunitLengthSidewallJctCap *(1.0 + T0); + model->BSIM4DunitLengthSidewallTempJctCap = model->BSIM4DunitLengthSidewallJctCap *(1.0 + T0); } else { if (model->BSIM4SunitLengthSidewallJctCap > 0.0) - { model->BSIM4SunitLengthSidewallJctCap = 0.0; + { model->BSIM4SunitLengthSidewallTempJctCap = 0.0; fprintf(stderr, "Temperature effect has caused cjsws to be negative. Cjsws is clamped to zero.\n"); } if (model->BSIM4DunitLengthSidewallJctCap > 0.0) - { model->BSIM4DunitLengthSidewallJctCap = 0.0; + { model->BSIM4DunitLengthSidewallTempJctCap = 0.0; fprintf(stderr, "Temperature effect has caused cjswd to be negative. Cjswd is clamped to zero.\n"); } } T0 = model->BSIM4tcjswg * delTemp; if (T0 >= -1.0) - { model->BSIM4SunitLengthGateSidewallJctCap *= 1.0 + T0; - model->BSIM4DunitLengthGateSidewallJctCap *= 1.0 + T0; + { model->BSIM4SunitLengthGateSidewallTempJctCap = model->BSIM4SunitLengthGateSidewallJctCap *(1.0 + T0); + model->BSIM4DunitLengthGateSidewallTempJctCap = model->BSIM4DunitLengthGateSidewallJctCap *(1.0 + T0); } else { if (model->BSIM4SunitLengthGateSidewallJctCap > 0.0) - { model->BSIM4SunitLengthGateSidewallJctCap = 0.0; + { model->BSIM4SunitLengthGateSidewallTempJctCap = 0.0; fprintf(stderr, "Temperature effect has caused cjswgs to be negative. Cjswgs is clamped to zero.\n"); } if (model->BSIM4DunitLengthGateSidewallJctCap > 0.0) - { model->BSIM4DunitLengthGateSidewallJctCap = 0.0; + { model->BSIM4DunitLengthGateSidewallTempJctCap = 0.0; fprintf(stderr, "Temperature effect has caused cjswgd to be negative. Cjswgd is clamped to zero.\n"); } } @@ -319,8 +321,7 @@ int Size_Not_Found; /* loop through all the instances of the model */ for (here = model->BSIM4instances; here != NULL; here = here->BSIM4nextInstance) - { if (here->BSIM4owner != ARCHme) continue; - pSizeDependParamKnot = model->pSizeDependParamKnot; + { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; while ((pSizeDependParamKnot != NULL) && Size_Not_Found) { if ((here->BSIM4l == pSizeDependParamKnot->Length) @@ -328,6 +329,7 @@ int Size_Not_Found; && (here->BSIM4nf == pSizeDependParamKnot->NFinger)) { Size_Not_Found = 0; here->pParam = pSizeDependParamKnot; + pParam = here->pParam; /*bug-fix */ } else { pLastKnot = pSizeDependParamKnot; @@ -336,7 +338,7 @@ int Size_Not_Found; } if (Size_Not_Found) - { pParam = (struct bsim4SizeDependParam *)tmalloc( + { pParam = (struct bsim4SizeDependParam *)malloc( sizeof(struct bsim4SizeDependParam)); if (pLastKnot == NULL) model->pSizeDependParamKnot = pParam; @@ -348,11 +350,11 @@ int Size_Not_Found; pParam->Length = here->BSIM4l; pParam->Width = here->BSIM4w; pParam->NFinger = here->BSIM4nf; - Ldrn = here->BSIM4l; - Wdrn = here->BSIM4w / here->BSIM4nf; + Lnew = here->BSIM4l + model->BSIM4xl ; + Wnew = here->BSIM4w / here->BSIM4nf + model->BSIM4xw; - T0 = pow(Ldrn, model->BSIM4Lln); - T1 = pow(Wdrn, model->BSIM4Lwn); + T0 = pow(Lnew, model->BSIM4Lln); + T1 = pow(Wnew, model->BSIM4Lwn); tmp1 = model->BSIM4Ll / T0 + model->BSIM4Lw / T1 + model->BSIM4Lwl / (T0 * T1); pParam->BSIM4dl = model->BSIM4Lint + tmp1; @@ -361,17 +363,17 @@ int Size_Not_Found; pParam->BSIM4dlc = model->BSIM4dlc + tmp2; pParam->BSIM4dlcig = model->BSIM4dlcig + tmp2; - T2 = pow(Ldrn, model->BSIM4Wln); - T3 = pow(Wdrn, model->BSIM4Wwn); + T2 = pow(Lnew, model->BSIM4Wln); + T3 = pow(Wnew, model->BSIM4Wwn); tmp1 = model->BSIM4Wl / T2 + model->BSIM4Ww / T3 + model->BSIM4Wwl / (T2 * T3); pParam->BSIM4dw = model->BSIM4Wint + tmp1; tmp2 = model->BSIM4Wlc / T2 + model->BSIM4Wwc / T3 - + model->BSIM4Wwlc / (T2 * T3); + + model->BSIM4Wwlc / (T2 * T3); pParam->BSIM4dwc = model->BSIM4dwc + tmp2; pParam->BSIM4dwj = model->BSIM4dwj + tmp2; - pParam->BSIM4leff = here->BSIM4l - 2.0 * pParam->BSIM4dl; + pParam->BSIM4leff = Lnew - 2.0 * pParam->BSIM4dl; if (pParam->BSIM4leff <= 0.0) { IFuid namarray[2]; namarray[0] = model->BSIM4modName; @@ -382,8 +384,7 @@ int Size_Not_Found; return(E_BADPARM); } - pParam->BSIM4weff = here->BSIM4w / here->BSIM4nf - - 2.0 * pParam->BSIM4dw; + pParam->BSIM4weff = Wnew - 2.0 * pParam->BSIM4dw; if (pParam->BSIM4weff <= 0.0) { IFuid namarray[2]; namarray[0] = model->BSIM4modName; @@ -394,7 +395,7 @@ int Size_Not_Found; return(E_BADPARM); } - pParam->BSIM4leffCV = here->BSIM4l - 2.0 * pParam->BSIM4dlc; + pParam->BSIM4leffCV = Lnew - 2.0 * pParam->BSIM4dlc; if (pParam->BSIM4leffCV <= 0.0) { IFuid namarray[2]; namarray[0] = model->BSIM4modName; @@ -405,8 +406,7 @@ int Size_Not_Found; return(E_BADPARM); } - pParam->BSIM4weffCV = here->BSIM4w / here->BSIM4nf - - 2.0 * pParam->BSIM4dwc; + pParam->BSIM4weffCV = Wnew - 2.0 * pParam->BSIM4dwc; if (pParam->BSIM4weffCV <= 0.0) { IFuid namarray[2]; namarray[0] = model->BSIM4modName; @@ -417,8 +417,7 @@ int Size_Not_Found; return(E_BADPARM); } - pParam->BSIM4weffCJ = here->BSIM4w / here->BSIM4nf - - 2.0 * pParam->BSIM4dwj; + pParam->BSIM4weffCJ = Wnew - 2.0 * pParam->BSIM4dwj; if (pParam->BSIM4weffCJ <= 0.0) { IFuid namarray[2]; namarray[0] = model->BSIM4modName; @@ -1250,7 +1249,7 @@ int Size_Not_Found; here->BSIM4grgeltd = model->BSIM4rshg * (model->BSIM4xgw + pParam->BSIM4weffCJ / 3.0 / model->BSIM4ngcon) / (model->BSIM4ngcon * here->BSIM4nf * - (here->BSIM4l - model->BSIM4xgl)); + (Lnew - model->BSIM4xgl)); if (here->BSIM4grgeltd > 0.0) here->BSIM4grgeltd = 1.0 / here->BSIM4grgeltd; else @@ -1302,47 +1301,69 @@ int Size_Not_Found; &dumPs, &dumPd, &dumAs, &(here->BSIM4Adeff)); /* Processing S/D resistance and conductance below */ - if (here->BSIM4rgeoMod == 0) - here->BSIM4sourceConductance = 0.0; - else if (here->BSIM4sourceSquaresGiven) - here->BSIM4sourceConductance = model->BSIM4sheetResistance + if(here->BSIM4sNodePrime != here->BSIM4sNode) + { + here->BSIM4sourceConductance = 0.0; + if(here->BSIM4sourceSquaresGiven) + { + here->BSIM4sourceConductance = model->BSIM4sheetResistance * here->BSIM4sourceSquares; - else - BSIM4RdseffGeo(here->BSIM4nf, here->BSIM4geoMod, here->BSIM4rgeoMod, here->BSIM4min, - pParam->BSIM4weffCJ, model->BSIM4sheetResistance, - DMCGeff, DMCIeff, DMDGeff, 1, &(here->BSIM4sourceConductance)); + } else if (here->BSIM4rgeoMod > 0) + { + BSIM4RdseffGeo(here->BSIM4nf, here->BSIM4geoMod, + here->BSIM4rgeoMod, here->BSIM4min, + pParam->BSIM4weffCJ, model->BSIM4sheetResistance, + DMCGeff, DMCIeff, DMDGeff, 1, &(here->BSIM4sourceConductance)); + } else + { + here->BSIM4sourceConductance = 0.0; + } - if (here->BSIM4rgeoMod == 0) - here->BSIM4drainConductance = 0.0; - else if (here->BSIM4drainSquaresGiven) - here->BSIM4drainConductance = model->BSIM4sheetResistance - * here->BSIM4drainSquares; - else - BSIM4RdseffGeo(here->BSIM4nf, here->BSIM4geoMod, here->BSIM4rgeoMod, here->BSIM4min, - pParam->BSIM4weffCJ, model->BSIM4sheetResistance, - DMCGeff, DMCIeff, DMDGeff, 0, &(here->BSIM4drainConductance)); - - if (here->BSIM4drainConductance > 0.0) - here->BSIM4drainConductance = 1.0 / here->BSIM4drainConductance; - else - here->BSIM4drainConductance = 0.0; - - if (here->BSIM4sourceConductance > 0.0) - here->BSIM4sourceConductance = 1.0 / here->BSIM4sourceConductance; - else + if (here->BSIM4sourceConductance > 0.0) + here->BSIM4sourceConductance = 1.0 + / here->BSIM4sourceConductance; + else + { + here->BSIM4sourceConductance = 1.0e3; /* mho */ + printf ("Warning: Source conductance reset to 1.0e3 mho.\n"); + } + } else + { here->BSIM4sourceConductance = 0.0; + } + if(here->BSIM4dNodePrime != here->BSIM4dNode) + { + here->BSIM4drainConductance = 0.0; + if(here->BSIM4drainSquaresGiven) + { + here->BSIM4drainConductance = model->BSIM4sheetResistance + * here->BSIM4drainSquares; + } else if (here->BSIM4rgeoMod > 0) + { + BSIM4RdseffGeo(here->BSIM4nf, here->BSIM4geoMod, + here->BSIM4rgeoMod, here->BSIM4min, + pParam->BSIM4weffCJ, model->BSIM4sheetResistance, + DMCGeff, DMCIeff, DMDGeff, 0, &(here->BSIM4drainConductance)); + } else + { + here->BSIM4drainConductance = 0.0; + } - if (((here->BSIM4rgeoMod != 0) || (model->BSIM4rdsMod != 0) - || (model->BSIM4tnoiMod != 0)) && (here->BSIM4sourceConductance == 0.0)) - { here->BSIM4sourceConductance = 1.0e3; /* mho */ - printf("Warning: Source conductance reset to 1.0e3 mho.\n"); - } - if (((here->BSIM4rgeoMod != 0) || (model->BSIM4rdsMod != 0) - || (model->BSIM4tnoiMod != 0)) && (here->BSIM4drainConductance == 0.0)) - { here->BSIM4drainConductance = 1.0e3; /* mho */ - printf("Warning: Drain conductance reset to 1.0e3 mho.\n"); - } /* End of Rsd processing */ + if (here->BSIM4drainConductance > 0.0) + here->BSIM4drainConductance = 1.0 + / here->BSIM4drainConductance; + else + { + here->BSIM4drainConductance = 1.0e3; /* mho */ + printf ("Warning: Drain conductance reset to 1.0e3 mho.\n"); + } + } else + { + here->BSIM4drainConductance = 0.0; + } + + /* End of Rsd processing */ Nvtms = model->BSIM4vtm * model->BSIM4SjctEmissionCoeff; @@ -1467,7 +1488,7 @@ int Size_Not_Found; { IFuid namarray[2]; namarray[0] = model->BSIM4modName; namarray[1] = here->BSIM4name; - (*(SPfrontEnd->IFerror)) (ERR_FATAL, "Fatal error(s) detected during BSIM4.1.0 parameter checking for %s in model %s", namarray); + (*(SPfrontEnd->IFerror)) (ERR_FATAL, "Fatal error(s) detected during BSIM4.2.1 parameter checking for %s in model %s", namarray); return(E_BADPARM); } } /* End instance */ diff --git a/src/spicelib/devices/bsim4/b4trunc.c b/src/spicelib/devices/bsim4/b4trunc.c index c8930cd5c..8d1cb3b53 100644 --- a/src/spicelib/devices/bsim4/b4trunc.c +++ b/src/spicelib/devices/bsim4/b4trunc.c @@ -1,12 +1,11 @@ -/**** BSIM4.1.0, Released by Weidong Liu 10/11/2000 ****/ +/**** BSIM4.2.1, Released by Xuemei Xi 10/05/2001 ****/ /********** - * Copyright 2000 Regents of the University of California. All rights reserved. - * File: b4trunc.c of BSIM4.1.0. - * Authors: Weidong Liu, Kanyu M. Cao, Xiaodong Jin, Chenming Hu. + * Copyright 2001 Regents of the University of California. All rights reserved. + * File: b4trunc.c of BSIM4.2.1. + * Author: 2000 Weidong Liu + * Authors: Xuemei Xi, Kanyu M. Cao, Hui Wan, Mansun Chan, Chenming Hu. * Project Director: Prof. Chenming Hu. - * - * Modified by Weidong Liu, 10/11/2000. **********/ #include "ngspice.h" @@ -15,16 +14,17 @@ #include "cktdefs.h" #include "bsim4def.h" #include "sperror.h" +#include "suffix.h" int BSIM4trunc(inModel,ckt,timeStep) GENmodel *inModel; -CKTcircuit *ckt; +register CKTcircuit *ckt; double *timeStep; { -BSIM4model *model = (BSIM4model*)inModel; -BSIM4instance *here; +register BSIM4model *model = (BSIM4model*)inModel; +register BSIM4instance *here; #ifdef STEPDEBUG double debugtemp; @@ -34,7 +34,6 @@ BSIM4instance *here; { for (here = model->BSIM4instances; here != NULL; here = here->BSIM4nextInstance) { - if (here->BSIM4owner != ARCHme) continue; #ifdef STEPDEBUG debugtemp = *timeStep; #endif /* STEPDEBUG */ diff --git a/src/spicelib/devices/bsim4/bsim4def.h b/src/spicelib/devices/bsim4/bsim4def.h index 0450ad2cf..cd4d6cb1b 100644 --- a/src/spicelib/devices/bsim4/bsim4def.h +++ b/src/spicelib/devices/bsim4/bsim4def.h @@ -1,6 +1,7 @@ /********** -Copyright 2000 Regents of the University of California. All rights reserved. +Copyright 2001 Regents of the University of California. All rights reserved. Author: 2000 Weidong Liu. +Modified by Xuemei Xi October 2001 File: bsim4def.h **********/ @@ -18,7 +19,6 @@ typedef struct sBSIM4instance struct sBSIM4model *BSIM4modPtr; struct sBSIM4instance *BSIM4nextInstance; IFuid BSIM4name; - int BSIM4owner; /* Number of owner process */ int BSIM4states; /* index into state table for this device */ int BSIM4dNode; int BSIM4gNodeExt; @@ -100,6 +100,10 @@ typedef struct sBSIM4instance /* OP point */ double BSIM4Vgsteff; + double BSIM4vgs_eff; + double BSIM4vgd_eff; + double BSIM4dvgs_eff_dvg; + double BSIM4dvgd_eff_dvg; double BSIM4Vdseff; double BSIM4nstar; double BSIM4Abulk; @@ -111,6 +115,7 @@ typedef struct sBSIM4instance double BSIM4cbd; double BSIM4csub; double BSIM4Igidl; + double BSIM4Igisl; double BSIM4gm; double BSIM4gds; double BSIM4gmbs; @@ -124,6 +129,10 @@ typedef struct sBSIM4instance double BSIM4ggidlg; double BSIM4ggidls; double BSIM4ggidlb; + double BSIM4ggisld; + double BSIM4ggislg; + double BSIM4ggisls; + double BSIM4ggislb; double BSIM4Igcs; double BSIM4gIgcsg; @@ -178,6 +187,13 @@ typedef struct sBSIM4instance double BSIM4cdgb; double BSIM4cddb; double BSIM4cdsb; + double BSIM4csgb; + double BSIM4csdb; + double BSIM4cssb; + double BSIM4cgbb; + double BSIM4cdbb; + double BSIM4csbb; + double BSIM4cbbb; double BSIM4capbd; double BSIM4capbs; @@ -189,6 +205,7 @@ typedef struct sBSIM4instance double BSIM4qgate; double BSIM4qbulk; double BSIM4qdrn; + double BSIM4qsrc; double BSIM4qchqs; double BSIM4taunet; @@ -308,6 +325,7 @@ typedef struct sBSIM4instance double *BSIM4GPqPtr; double *BSIM4SPqPtr; + #define BSIM4vbd BSIM4states+ 0 #define BSIM4vbs BSIM4states+ 1 #define BSIM4vgs BSIM4states+ 2 @@ -339,8 +357,9 @@ typedef struct sBSIM4instance #define BSIM4qcdump BSIM4states+ 25 #define BSIM4cqcdump BSIM4states+ 26 #define BSIM4qdef BSIM4states+ 27 +#define BSIM4qs BSIM4states+ 28 -#define BSIM4numStates 28 +#define BSIM4numStates 29 /* indices to the array of BSIM4 NOISE SOURCES */ @@ -741,6 +760,8 @@ typedef struct sBSIM4model double BSIM4cle; double BSIM4dwc; double BSIM4dlc; + double BSIM4xw; + double BSIM4xl; double BSIM4dlcig; double BSIM4dwj; double BSIM4noff; @@ -1220,6 +1241,12 @@ typedef struct sBSIM4model double BSIM4DjctTempSatCurDensity; double BSIM4DjctSidewallTempSatCurDensity; double BSIM4DjctGateSidewallTempSatCurDensity; + double BSIM4SunitAreaTempJctCap; + double BSIM4DunitAreaTempJctCap; + double BSIM4SunitLengthSidewallTempJctCap; + double BSIM4DunitLengthSidewallTempJctCap; + double BSIM4SunitLengthGateSidewallTempJctCap; + double BSIM4DunitLengthGateSidewallTempJctCap; double BSIM4oxideTrapDensityA; double BSIM4oxideTrapDensityB; @@ -1398,6 +1425,8 @@ typedef struct sBSIM4model unsigned BSIM4cleGiven :1; unsigned BSIM4dwcGiven :1; unsigned BSIM4dlcGiven :1; + unsigned BSIM4xwGiven :1; + unsigned BSIM4xlGiven :1; unsigned BSIM4dlcigGiven :1; unsigned BSIM4dwjGiven :1; unsigned BSIM4noffGiven :1; @@ -2511,37 +2540,39 @@ typedef struct sBSIM4model #define BSIM4_MOD_WMAX 864 #define BSIM4_MOD_DWC 865 #define BSIM4_MOD_DLC 866 -#define BSIM4_MOD_EM 867 -#define BSIM4_MOD_EF 868 -#define BSIM4_MOD_AF 869 -#define BSIM4_MOD_KF 870 -#define BSIM4_MOD_NJS 871 -#define BSIM4_MOD_XTIS 872 -#define BSIM4_MOD_PBSWGS 873 -#define BSIM4_MOD_MJSWGS 874 -#define BSIM4_MOD_CJSWGS 875 -#define BSIM4_MOD_JSWS 876 -#define BSIM4_MOD_LLC 877 -#define BSIM4_MOD_LWC 878 -#define BSIM4_MOD_LWLC 879 -#define BSIM4_MOD_WLC 880 -#define BSIM4_MOD_WWC 881 -#define BSIM4_MOD_WWLC 882 -#define BSIM4_MOD_DWJ 883 -#define BSIM4_MOD_JSD 884 -#define BSIM4_MOD_PBD 885 -#define BSIM4_MOD_MJD 886 -#define BSIM4_MOD_PBSWD 887 -#define BSIM4_MOD_MJSWD 888 -#define BSIM4_MOD_CJD 889 -#define BSIM4_MOD_CJSWD 890 -#define BSIM4_MOD_NJD 891 -#define BSIM4_MOD_XTID 892 -#define BSIM4_MOD_PBSWGD 893 -#define BSIM4_MOD_MJSWGD 894 -#define BSIM4_MOD_CJSWGD 895 -#define BSIM4_MOD_JSWD 896 -#define BSIM4_MOD_DLCIG 897 +#define BSIM4_MOD_XL 867 +#define BSIM4_MOD_XW 868 +#define BSIM4_MOD_EM 869 +#define BSIM4_MOD_EF 870 +#define BSIM4_MOD_AF 871 +#define BSIM4_MOD_KF 872 +#define BSIM4_MOD_NJS 873 +#define BSIM4_MOD_XTIS 874 +#define BSIM4_MOD_PBSWGS 875 +#define BSIM4_MOD_MJSWGS 876 +#define BSIM4_MOD_CJSWGS 877 +#define BSIM4_MOD_JSWS 878 +#define BSIM4_MOD_LLC 879 +#define BSIM4_MOD_LWC 880 +#define BSIM4_MOD_LWLC 881 +#define BSIM4_MOD_WLC 882 +#define BSIM4_MOD_WWC 883 +#define BSIM4_MOD_WWLC 884 +#define BSIM4_MOD_DWJ 885 +#define BSIM4_MOD_JSD 886 +#define BSIM4_MOD_PBD 887 +#define BSIM4_MOD_MJD 888 +#define BSIM4_MOD_PBSWD 889 +#define BSIM4_MOD_MJSWD 890 +#define BSIM4_MOD_CJD 891 +#define BSIM4_MOD_CJSWD 892 +#define BSIM4_MOD_NJD 893 +#define BSIM4_MOD_XTID 894 +#define BSIM4_MOD_PBSWGD 895 +#define BSIM4_MOD_MJSWGD 896 +#define BSIM4_MOD_CJSWGD 897 +#define BSIM4_MOD_JSWD 898 +#define BSIM4_MOD_DLCIG 899 /* device questions */ #define BSIM4_DNODE 945 @@ -2574,17 +2605,17 @@ typedef struct sBSIM4model #define BSIM4_CQG 972 #define BSIM4_QD 973 #define BSIM4_CQD 974 -#define BSIM4_CGG 975 -#define BSIM4_CGD 976 -#define BSIM4_CGS 977 -#define BSIM4_CBG 978 +#define BSIM4_CGGB 975 +#define BSIM4_CGDB 976 +#define BSIM4_CGSB 977 +#define BSIM4_CBGB 978 #define BSIM4_CAPBD 979 #define BSIM4_CQBD 980 #define BSIM4_CAPBS 981 #define BSIM4_CQBS 982 -#define BSIM4_CDG 983 -#define BSIM4_CDD 984 -#define BSIM4_CDS 985 +#define BSIM4_CDGB 983 +#define BSIM4_CDDB 984 +#define BSIM4_CDSB 985 #define BSIM4_VON 986 #define BSIM4_VDSAT 987 #define BSIM4_QBS 988 @@ -2593,7 +2624,26 @@ typedef struct sBSIM4model #define BSIM4_DRAINCONDUCT 991 #define BSIM4_CBDB 992 #define BSIM4_CBSB 993 +#define BSIM4_CSUB 994 +#define BSIM4_QINV 995 +#define BSIM4_IGIDL 996 +#define BSIM4_CSGB 997 +#define BSIM4_CSDB 998 +#define BSIM4_CSSB 999 +#define BSIM4_CGBB 1000 +#define BSIM4_CDBB 1001 +#define BSIM4_CSBB 1002 +#define BSIM4_CBBB 1003 +#define BSIM4_QS 1004 +#define BSIM4_IGISL 1005 +#define BSIM4_IGS 1006 +#define BSIM4_IGD 1007 +#define BSIM4_IGB 1008 +#define BSIM4_IGCS 1009 +#define BSIM4_IGCD 1010 + +# #include "bsim4ext.h" #ifdef __STDC__ diff --git a/src/spicelib/devices/bsim4/bsim4ext.h b/src/spicelib/devices/bsim4/bsim4ext.h index 4cc7979c2..4e4977201 100644 --- a/src/spicelib/devices/bsim4/bsim4ext.h +++ b/src/spicelib/devices/bsim4/bsim4ext.h @@ -1,6 +1,7 @@ /********** -Copyright 2000 Regents of the University of California. All rights reserved. -Author: 2000 Weidong Liu. +Copyright 2001 Regents of the University of California. All rights reserved. +Author: 2000 Weidong Liu +Author: 2001 Xuemei Xi File: bsim4ext.h **********/ diff --git a/src/spicelib/devices/bsim4/bsim4itf.h b/src/spicelib/devices/bsim4/bsim4itf.h index 9b010ec42..911050479 100644 --- a/src/spicelib/devices/bsim4/bsim4itf.h +++ b/src/spicelib/devices/bsim4/bsim4itf.h @@ -1,11 +1,89 @@ /********** -Copyright 2000 Regents of the University of California. All rights reserved. +Copyright 2001 Regents of the University of California. All rights reserved. Author: 2000 Weidong Liu. +Author: 2001 Xuemei Xi File: bsim4itf.h **********/ +#ifdef DEV_bsim4 + #ifndef DEV_BSIM4 #define DEV_BSIM4 -SPICEdev *get_bsim4_info(void); +#include "bsim4ext.h" + +extern IFparm BSIM4pTable[ ]; +extern IFparm BSIM4mPTable[ ]; +extern char *BSIM4names[ ]; +extern int BSIM4pTSize; +extern int BSIM4mPTSize; +extern int BSIM4nSize; +extern int BSIM4iSize; +extern int BSIM4mSize; + +SPICEdev B4info = { + { "BSIM4", + "Berkeley Short Channel IGFET Model-4", + + &BSIM4nSize, + &BSIM4nSize, + BSIM4names, + + &BSIM4pTSize, + BSIM4pTable, + + &BSIM4mPTSize, + BSIM4mPTable, + DEV_DEFAULT + }, + BSIM4param, + BSIM4mParam, + BSIM4load, + BSIM4setup, + BSIM4unsetup, + BSIM4setup, + BSIM4temp, + BSIM4trunc, + NULL, + BSIM4acLoad, + NULL, + BSIM4destroy, +#ifdef DELETES + BSIM4mDelete, + BSIM4delete, +#else /* DELETES */ + NULL, + NULL, +#endif /* DELETES */ + BSIM4getic, + BSIM4ask, + BSIM4mAsk, +#ifdef AN_pz + BSIM4pzLoad, +#else /* AN_pz */ + NULL, +#endif /* AN_pz */ +#ifdef NEWCONV + BSIM4convTest, +#else /* NEWCONV */ + NULL, +#endif /* NEWCONV */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + +#ifdef AN_noise + BSIM4noise, +#else /* AN_noise */ + NULL, +#endif /* AN_noise */ + + &BSIM4iSize, + &BSIM4mSize +}; #endif +#endif