📄 b4temp.c
字号:
/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****//********** * Copyright 2004 Regents of the University of California. All rights reserved. * File: b4temp.c of BSIM4.4.0. * Author: 2000 Weidong Liu * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. * Project Director: Prof. Chenming Hu. * Modified by Xuemei Xi, 04/06/2001. * Modified by Xuemei Xi, 10/05/2001. * Modified by Xuemei Xi, 11/15/2002. * Modified by Xuemei Xi, 05/09/2003. * Modified by Xuemei Xi, 03/04/2004. **********/#include "ngspice.h"#include "smpdefs.h"#include "cktdefs.h"#include "bsim4def.h"#include "const.h"#include "sperror.h"#include "suffix.h"#define Kb 1.3806226e-23#define KboQ 8.617087e-5 #define EPS0 8.85418e-12#define EPSSI 1.03594e-10#define PI 3.141592654#define MAX_EXP 5.834617425e14#define MIN_EXP 1.713908431e-15#define EXP_THRESHOLD 34.0#define Charge_q 1.60219e-19#define DELTA 1.0E-9#define DEXP(A,B) { \ if (A > EXP_THRESHOLD) { \ B = MAX_EXP*(1.0+(A)-EXP_THRESHOLD); \ } else if (A < -EXP_THRESHOLD) { \ B = MIN_EXP; \ } else { \ B = exp(A); \ } \ }intBSIM4PAeffGeo(double, int, int, double, double, double, double, double *, double *, double *, double *);intBSIM4RdseffGeo(double, int, int, int, double, double, double, double, double, int, double *);intBSIM4DioIjthVjmEval(Nvtm, Ijth, Isb, XExpBV, Vjm)double Nvtm, Ijth, Isb, XExpBV;double *Vjm;{double Tb, Tc, EVjmovNv; Tc = XExpBV; Tb = 1.0 + Ijth / Isb - Tc; EVjmovNv = 0.5 * (Tb + sqrt(Tb * Tb + 4.0 * Tc)); *Vjm = Nvtm * log(EVjmovNv);return 0;}intBSIM4temp(inModel,ckt)GENmodel *inModel;CKTcircuit *ckt;{BSIM4model *model = (BSIM4model*) inModel;BSIM4instance *here;struct bsim4SizeDependParam *pSizeDependParamKnot, *pLastKnot, *pParam=NULL;double tmp, tmp1, tmp2, tmp3, Eg, Eg0, ni;double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Lnew=0.0, Wnew;double delTemp, Temp, TRatio, Inv_L, Inv_W, Inv_LW, Vtm0, Tnom;double dumPs, dumPd, dumAs, dumAd, PowWeffWr;double DMCGeff, DMCIeff, DMDGeff;double Nvtms, Nvtmd, SourceSatCurrent, DrainSatCurrent;double T10;double Inv_saref, Inv_sbref, Inv_sa, Inv_sb, rho, Ldrn, dvth0_lod;double W_tmp, Inv_ODeff, OD_offset, dk2_lod, deta0_lod;int Size_Not_Found, i; /* loop through all the BSIM4 device models */ for (; model != NULL; model = model->BSIM4nextModel) { Temp = ckt->CKTtemp; if (model->BSIM4SbulkJctPotential < 0.1) { model->BSIM4SbulkJctPotential = 0.1; fprintf(stderr, "Given pbs is less than 0.1. Pbs is set to 0.1.\n"); } if (model->BSIM4SsidewallJctPotential < 0.1) { model->BSIM4SsidewallJctPotential = 0.1; fprintf(stderr, "Given pbsws is less than 0.1. Pbsws is set to 0.1.\n"); } if (model->BSIM4SGatesidewallJctPotential < 0.1) { model->BSIM4SGatesidewallJctPotential = 0.1; fprintf(stderr, "Given pbswgs is less than 0.1. Pbswgs is set to 0.1.\n"); } if (model->BSIM4DbulkJctPotential < 0.1) { model->BSIM4DbulkJctPotential = 0.1; fprintf(stderr, "Given pbd is less than 0.1. Pbd is set to 0.1.\n"); } if (model->BSIM4DsidewallJctPotential < 0.1) { model->BSIM4DsidewallJctPotential = 0.1; fprintf(stderr, "Given pbswd is less than 0.1. Pbswd is set to 0.1.\n"); } if (model->BSIM4DGatesidewallJctPotential < 0.1) { model->BSIM4DGatesidewallJctPotential = 0.1; fprintf(stderr, "Given pbswgd is less than 0.1. Pbswgd is set to 0.1.\n"); } if ((model->BSIM4toxeGiven) && (model->BSIM4toxpGiven) && (model->BSIM4dtoxGiven) && (model->BSIM4toxe != (model->BSIM4toxp + model->BSIM4dtox))) printf("Warning: toxe, toxp and dtox all given and toxe != toxp + dtox; dtox ignored.\n"); else if ((model->BSIM4toxeGiven) && (!model->BSIM4toxpGiven)) model->BSIM4toxp = model->BSIM4toxe - model->BSIM4dtox; else if ((!model->BSIM4toxeGiven) && (model->BSIM4toxpGiven)) model->BSIM4toxe = model->BSIM4toxp + model->BSIM4dtox; model->BSIM4coxe = model->BSIM4epsrox * EPS0 / model->BSIM4toxe; model->BSIM4coxp = model->BSIM4epsrox * EPS0 / model->BSIM4toxp; if (!model->BSIM4cgdoGiven) { if (model->BSIM4dlcGiven && (model->BSIM4dlc > 0.0)) model->BSIM4cgdo = model->BSIM4dlc * model->BSIM4coxe - model->BSIM4cgdl ; else model->BSIM4cgdo = 0.6 * model->BSIM4xj * model->BSIM4coxe; } if (!model->BSIM4cgsoGiven) { if (model->BSIM4dlcGiven && (model->BSIM4dlc > 0.0)) model->BSIM4cgso = model->BSIM4dlc * model->BSIM4coxe - model->BSIM4cgsl ; else model->BSIM4cgso = 0.6 * model->BSIM4xj * model->BSIM4coxe; } if (!model->BSIM4cgboGiven) model->BSIM4cgbo = 2.0 * model->BSIM4dwc * model->BSIM4coxe; model->pSizeDependParamKnot = NULL; pLastKnot = NULL; Tnom = model->BSIM4tnom; TRatio = Temp / Tnom; model->BSIM4vcrit = CONSTvt0 * log(CONSTvt0 / (CONSTroot2 * 1.0e-14)); model->BSIM4factor1 = sqrt(EPSSI / (model->BSIM4epsrox * EPS0) * model->BSIM4toxe); Vtm0 = model->BSIM4vtm0 = KboQ * Tnom; Eg0 = 1.16 - 7.02e-4 * Tnom * Tnom / (Tnom + 1108.0); ni = 1.45e10 * (Tnom / 300.15) * sqrt(Tnom / 300.15) * exp(21.5565981 - Eg0 / (2.0 * Vtm0)); model->BSIM4vtm = KboQ * Temp; Eg = 1.16 - 7.02e-4 * Temp * Temp / (Temp + 1108.0); if (Temp != Tnom) { T0 = Eg0 / Vtm0 - Eg / model->BSIM4vtm; T1 = log(Temp / Tnom); T2 = T0 + model->BSIM4SjctTempExponent * T1; T3 = exp(T2 / model->BSIM4SjctEmissionCoeff); model->BSIM4SjctTempSatCurDensity = model->BSIM4SjctSatCurDensity * T3; model->BSIM4SjctSidewallTempSatCurDensity = model->BSIM4SjctSidewallSatCurDensity * T3; model->BSIM4SjctGateSidewallTempSatCurDensity = model->BSIM4SjctGateSidewallSatCurDensity * T3; T2 = T0 + model->BSIM4DjctTempExponent * T1; T3 = exp(T2 / model->BSIM4DjctEmissionCoeff); model->BSIM4DjctTempSatCurDensity = model->BSIM4DjctSatCurDensity * T3; model->BSIM4DjctSidewallTempSatCurDensity = model->BSIM4DjctSidewallSatCurDensity * T3; model->BSIM4DjctGateSidewallTempSatCurDensity = model->BSIM4DjctGateSidewallSatCurDensity * T3; } else { model->BSIM4SjctTempSatCurDensity = model->BSIM4SjctSatCurDensity; model->BSIM4SjctSidewallTempSatCurDensity = model->BSIM4SjctSidewallSatCurDensity; model->BSIM4SjctGateSidewallTempSatCurDensity = model->BSIM4SjctGateSidewallSatCurDensity; model->BSIM4DjctTempSatCurDensity = model->BSIM4DjctSatCurDensity; model->BSIM4DjctSidewallTempSatCurDensity = model->BSIM4DjctSidewallSatCurDensity; model->BSIM4DjctGateSidewallTempSatCurDensity = model->BSIM4DjctGateSidewallSatCurDensity; } if (model->BSIM4SjctTempSatCurDensity < 0.0) model->BSIM4SjctTempSatCurDensity = 0.0; if (model->BSIM4SjctSidewallTempSatCurDensity < 0.0) model->BSIM4SjctSidewallTempSatCurDensity = 0.0; if (model->BSIM4SjctGateSidewallTempSatCurDensity < 0.0) model->BSIM4SjctGateSidewallTempSatCurDensity = 0.0; if (model->BSIM4DjctTempSatCurDensity < 0.0) model->BSIM4DjctTempSatCurDensity = 0.0; if (model->BSIM4DjctSidewallTempSatCurDensity < 0.0) model->BSIM4DjctSidewallTempSatCurDensity = 0.0; if (model->BSIM4DjctGateSidewallTempSatCurDensity < 0.0) model->BSIM4DjctGateSidewallTempSatCurDensity = 0.0; /* Temperature dependence of D/B and S/B diode capacitance begins */ delTemp = ckt->CKTtemp - model->BSIM4tnom; T0 = model->BSIM4tcj * delTemp; if (T0 >= -1.0) { model->BSIM4SunitAreaTempJctCap = model->BSIM4SunitAreaJctCap *(1.0 + T0); /*bug_fix -JX */ model->BSIM4DunitAreaTempJctCap = model->BSIM4DunitAreaJctCap *(1.0 + T0); } else { if (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->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->BSIM4SunitLengthSidewallTempJctCap = model->BSIM4SunitLengthSidewallJctCap *(1.0 + T0); model->BSIM4DunitLengthSidewallTempJctCap = model->BSIM4DunitLengthSidewallJctCap *(1.0 + T0); } else { if (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->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->BSIM4SunitLengthGateSidewallTempJctCap = model->BSIM4SunitLengthGateSidewallJctCap *(1.0 + T0); model->BSIM4DunitLengthGateSidewallTempJctCap = model->BSIM4DunitLengthGateSidewallJctCap *(1.0 + T0); } else { if (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->BSIM4DunitLengthGateSidewallTempJctCap = 0.0; fprintf(stderr, "Temperature effect has caused cjswgd to be negative. Cjswgd is clamped to zero.\n"); } } model->BSIM4PhiBS = model->BSIM4SbulkJctPotential - model->BSIM4tpb * delTemp; if (model->BSIM4PhiBS < 0.01) { model->BSIM4PhiBS = 0.01; fprintf(stderr, "Temperature effect has caused pbs to be less than 0.01. Pbs is clamped to 0.01.\n"); } model->BSIM4PhiBD = model->BSIM4DbulkJctPotential - model->BSIM4tpb * delTemp; if (model->BSIM4PhiBD < 0.01) { model->BSIM4PhiBD = 0.01; fprintf(stderr, "Temperature effect has caused pbd to be less than 0.01. Pbd is clamped to 0.01.\n"); } model->BSIM4PhiBSWS = model->BSIM4SsidewallJctPotential - model->BSIM4tpbsw * delTemp; if (model->BSIM4PhiBSWS <= 0.01) { model->BSIM4PhiBSWS = 0.01; fprintf(stderr, "Temperature effect has caused pbsws to be less than 0.01. Pbsws is clamped to 0.01.\n"); } model->BSIM4PhiBSWD = model->BSIM4DsidewallJctPotential - model->BSIM4tpbsw * delTemp; if (model->BSIM4PhiBSWD <= 0.01) { model->BSIM4PhiBSWD = 0.01; fprintf(stderr, "Temperature effect has caused pbswd to be less than 0.01. Pbswd is clamped to 0.01.\n"); } model->BSIM4PhiBSWGS = model->BSIM4SGatesidewallJctPotential - model->BSIM4tpbswg * delTemp; if (model->BSIM4PhiBSWGS <= 0.01) { model->BSIM4PhiBSWGS = 0.01; fprintf(stderr, "Temperature effect has caused pbswgs to be less than 0.01. Pbswgs is clamped to 0.01.\n"); } model->BSIM4PhiBSWGD = model->BSIM4DGatesidewallJctPotential - model->BSIM4tpbswg * delTemp;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -