📄 b4pzld.c
字号:
/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****//********** * Copyright 2004 Regents of the University of California. All rights reserved. * File: b4pzld.c of BSIM4.4.0. * Author: 2000 Weidong Liu * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. * Project Director: Prof. Chenming Hu. * Modified by Xuemei Xi, 10/05/2001. **********/#include "ngspice.h"#include "cktdefs.h"#include "complex.h"#include "sperror.h"#include "bsim4def.h"#include "suffix.h"intBSIM4pzLoad(inModel,ckt,s)GENmodel *inModel;CKTcircuit *ckt;SPcomplex *s;{BSIM4model *model = (BSIM4model*)inModel;BSIM4instance *here;double gjbd, gjbs, geltd, gcrg, gcrgg, gcrgd, gcrgs, gcrgb;double xcggb, xcgdb, xcgsb, xcgbb, xcbgb, xcbdb, xcbsb, xcbbb;double xcdgb, xcddb, xcdsb, xcdbb, xcsgb, xcsdb, xcssb, xcsbb;double gds, capbd, capbs, FwdSum, RevSum, Gm, Gmbs;double gstot, gstotd, gstotg, gstots, gstotb, gspr;double gdtot, gdtotd, gdtotg, gdtots, gdtotb, gdpr;double gIstotg, gIstotd, gIstots, gIstotb;double gIdtotg, gIdtotd, gIdtots, gIdtotb;double gIbtotg, gIbtotd, gIbtots, gIbtotb;double gIgtotg, gIgtotd, gIgtots, gIgtotb;double cgso, cgdo, cgbo;double xcdbdb=0.0, xcsbsb=0.0, xcgmgmb=0.0, xcgmdb=0.0, xcgmsb=0.0, xcdgmb=0.0, xcsgmb=0.0;double xcgmbb=0.0, xcbgmb=0.0;double dxpart, sxpart, xgtg, xgtd, xgts, xgtb, xcqgb=0.0, xcqdb=0.0, xcqsb=0.0, xcqbb=0.0;double gbspsp, gbbdp, gbbsp, gbspg, gbspb;double gbspdp, gbdpdp, gbdpg, gbdpb, gbdpsp;double ddxpart_dVd, ddxpart_dVg, ddxpart_dVb, ddxpart_dVs;double dsxpart_dVd, dsxpart_dVg, dsxpart_dVb, dsxpart_dVs;double T0=0.0, T1, CoxWL, qcheq, Cdg, Cdd, Cds, Csg, Csd, Css;double ScalingFactor = 1.0e-9;struct bsim4SizeDependParam *pParam;double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls;double m; for (; model != NULL; model = model->BSIM4nextModel) { for (here = model->BSIM4instances; here!= NULL; here = here->BSIM4nextInstance) { if (here->BSIM4owner != ARCHme) continue; pParam = here->pParam; capbd = here->BSIM4capbd; capbs = here->BSIM4capbs; cgso = here->BSIM4cgso; cgdo = here->BSIM4cgdo; cgbo = pParam->BSIM4cgbo; if (here->BSIM4mode >= 0) { Gm = here->BSIM4gm; Gmbs = here->BSIM4gmbs; FwdSum = Gm + Gmbs; RevSum = 0.0; 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; gbspb = 0.0; gbspsp = 0.0; if (model->BSIM4igcMod) { gIstotg = here->BSIM4gIgsg + here->BSIM4gIgcsg; gIstotd = here->BSIM4gIgcsd; gIstots = here->BSIM4gIgss + here->BSIM4gIgcss; gIstotb = here->BSIM4gIgcsb; gIdtotg = here->BSIM4gIgdg + here->BSIM4gIgcdg; gIdtotd = here->BSIM4gIgdd + here->BSIM4gIgcdd; gIdtots = here->BSIM4gIgcds; gIdtotb = here->BSIM4gIgcdb; } else { gIstotg = gIstotd = gIstots = gIstotb = 0.0; gIdtotg = gIdtotd = gIdtots = gIdtotb = 0.0; } if (model->BSIM4igbMod) { gIbtotg = here->BSIM4gIgbg; gIbtotd = here->BSIM4gIgbd; gIbtots = here->BSIM4gIgbs; gIbtotb = here->BSIM4gIgbb; } else gIbtotg = gIbtotd = gIbtots = gIbtotb = 0.0; if ((model->BSIM4igcMod != 0) || (model->BSIM4igbMod != 0)) { gIgtotg = gIstotg + gIdtotg + gIbtotg; gIgtotd = gIstotd + gIdtotd + gIbtotd ; gIgtots = gIstots + gIdtots + gIbtots; gIgtotb = gIstotb + gIdtotb + gIbtotb; } else gIgtotg = gIgtotd = gIgtots = gIgtotb = 0.0; if (here->BSIM4rgateMod == 2) T0 = *(ckt->CKTstates[0] + here->BSIM4vges) - *(ckt->CKTstates[0] + here->BSIM4vgs); else if (here->BSIM4rgateMod == 3) T0 = *(ckt->CKTstates[0] + here->BSIM4vgms) - *(ckt->CKTstates[0] + here->BSIM4vgs); if (here->BSIM4rgateMod > 1) { gcrgd = here->BSIM4gcrgd * T0; gcrgg = here->BSIM4gcrgg * T0; gcrgs = here->BSIM4gcrgs * T0; gcrgb = here->BSIM4gcrgb * T0; gcrgg -= here->BSIM4gcrg; gcrg = here->BSIM4gcrg; } else gcrg = gcrgd = gcrgg = gcrgs = gcrgb = 0.0; if (here->BSIM4acnqsMod == 0) { if (here->BSIM4rgateMod == 3) { xcgmgmb = cgdo + cgso + pParam->BSIM4cgbo; xcgmdb = -cgdo; xcgmsb = -cgso; xcgmbb = -pParam->BSIM4cgbo; xcdgmb = xcgmdb; xcsgmb = xcgmsb; xcbgmb = xcgmbb; xcggb = here->BSIM4cggb; xcgdb = here->BSIM4cgdb; xcgsb = here->BSIM4cgsb; xcgbb = -(xcggb + xcgdb + xcgsb); xcdgb = here->BSIM4cdgb; xcsgb = -(here->BSIM4cggb + here->BSIM4cbgb + here->BSIM4cdgb); xcbgb = here->BSIM4cbgb; } else { xcggb = here->BSIM4cggb + cgdo + cgso + pParam->BSIM4cgbo; xcgdb = here->BSIM4cgdb - cgdo; xcgsb = here->BSIM4cgsb - cgso; xcgbb = -(xcggb + xcgdb + xcgsb); xcdgb = here->BSIM4cdgb - cgdo; xcsgb = -(here->BSIM4cggb + here->BSIM4cbgb + here->BSIM4cdgb + cgso); xcbgb = here->BSIM4cbgb - pParam->BSIM4cgbo; xcdgmb = xcsgmb = xcbgmb = 0.0; } xcddb = here->BSIM4cddb + here->BSIM4capbd + cgdo; xcdsb = here->BSIM4cdsb; xcsdb = -(here->BSIM4cgdb + here->BSIM4cbdb + here->BSIM4cddb); xcssb = here->BSIM4capbs + cgso - (here->BSIM4cgsb + here->BSIM4cbsb + here->BSIM4cdsb); if (!here->BSIM4rbodyMod) { xcdbb = -(xcdgb + xcddb + xcdsb + xcdgmb); xcsbb = -(xcsgb + xcsdb + xcssb + xcsgmb); xcbdb = here->BSIM4cbdb - here->BSIM4capbd; xcbsb = here->BSIM4cbsb - here->BSIM4capbs; xcdbdb = 0.0; } else { xcdbb = -(here->BSIM4cddb + here->BSIM4cdgb + here->BSIM4cdsb); xcsbb = -(xcsgb + xcsdb + xcssb + xcsgmb) + here->BSIM4capbs; xcbdb = here->BSIM4cbdb; xcbsb = here->BSIM4cbsb; xcdbdb = -here->BSIM4capbd; xcsbsb = -here->BSIM4capbs; } xcbbb = -(xcbdb + xcbgb + xcbsb + xcbgmb); xgtg = xgtd = xgts = xgtb = 0.0; sxpart = 0.6; dxpart = 0.4; ddxpart_dVd = ddxpart_dVg = ddxpart_dVb = ddxpart_dVs = 0.0; dsxpart_dVd = dsxpart_dVg = dsxpart_dVb = dsxpart_dVs = 0.0; } else { xcggb = xcgdb = xcgsb = xcgbb = 0.0; xcbgb = xcbdb = xcbsb = xcbbb = 0.0; xcdgb = xcddb = xcdsb = xcdbb = 0.0; xcsgb = xcsdb = xcssb = xcsbb = 0.0; xgtg = here->BSIM4gtg; xgtd = here->BSIM4gtd; xgts = here->BSIM4gts; xgtb = here->BSIM4gtb; xcqgb = here->BSIM4cqgb; xcqdb = here->BSIM4cqdb; xcqsb = here->BSIM4cqsb; xcqbb = here->BSIM4cqbb; CoxWL = model->BSIM4coxe * here->pParam->BSIM4weffCV * here->BSIM4nf * here->pParam->BSIM4leffCV; qcheq = -(here->BSIM4qgate + here->BSIM4qbulk); if (fabs(qcheq) <= 1.0e-5 * CoxWL) { if (model->BSIM4xpart < 0.5) { dxpart = 0.4; } else if (model->BSIM4xpart > 0.5) { dxpart = 0.0; } else { dxpart = 0.5; } ddxpart_dVd = ddxpart_dVg = ddxpart_dVb = ddxpart_dVs = 0.0; } else { dxpart = here->BSIM4qdrn / qcheq; Cdd = here->BSIM4cddb; Csd = -(here->BSIM4cgdb + here->BSIM4cddb + here->BSIM4cbdb); ddxpart_dVd = (Cdd - dxpart * (Cdd + Csd)) / qcheq; Cdg = here->BSIM4cdgb; Csg = -(here->BSIM4cggb + here->BSIM4cdgb + here->BSIM4cbgb); ddxpart_dVg = (Cdg - dxpart * (Cdg + Csg)) / qcheq; Cds = here->BSIM4cdsb; Css = -(here->BSIM4cgsb + here->BSIM4cdsb + here->BSIM4cbsb); ddxpart_dVs = (Cds - dxpart * (Cds + Css)) / qcheq; ddxpart_dVb = -(ddxpart_dVd + ddxpart_dVg + ddxpart_dVs);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -