⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 b3v0temp.c

📁 ngspice又一个电子CAD仿真软件代码.功能更全
💻 C
📖 第 1 页 / 共 2 页
字号:
/***********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1995 Min-Chie Jeng and Mansun Chan.File: b3v0temp.c**********//* Lmin, Lmax, Wmin, Wmax */#include "ngspice.h"#include "smpdefs.h"#include "cktdefs.h"#include "bsim3v0def.h"#include "const.h"#include "sperror.h"#include "suffix.h"#define Kb 1.3806226e-23#define KboQ 8.617087e-5  /* Kb / q  where q = 1.60219e-19 */#define EPSOX 3.453133e-11#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/* ARGSUSED */intBSIM3v0temp(GENmodel *inModel, CKTcircuit *ckt){register BSIM3v0model *model = (BSIM3v0model*) inModel;register BSIM3v0instance *here;struct bsim3v0SizeDependParam *pSizeDependParamKnot, *pLastKnot, *pParam = NULL;double tmp1, tmp2, Eg, ni, T0, T1, T2, T3, Ldrn, Wdrn;double Temp, TRatio, Inv_L, Inv_W, Inv_LW, Vtm0, Tnom;int Size_Not_Found;    /*  loop through all the BSIM3v0 device models */    for (; model != NULL; model = model->BSIM3v0nextModel)    {    Temp = ckt->CKTtemp;         if (model->BSIM3v0bulkJctPotential < 0.1)  	     model->BSIM3v0bulkJctPotential = 0.1;         if (model->BSIM3v0sidewallJctPotential < 0.1)             model->BSIM3v0sidewallJctPotential = 0.1;         model->pSizeDependParamKnot = NULL;	 pLastKnot = NULL;	 Tnom = model->BSIM3v0tnom;	 TRatio = Temp / Tnom;         	 /* loop through all the instances of the model */         for (here = model->BSIM3v0instances; here != NULL;              here=here->BSIM3v0nextInstance)  	 {    	              if (here->BSIM3v0owner != ARCHme)                     continue;	 	      pSizeDependParamKnot = model->pSizeDependParamKnot;	      Size_Not_Found = 1;	      while ((pSizeDependParamKnot != NULL) && Size_Not_Found)	      {   if ((here->BSIM3v0l == pSizeDependParamKnot->Length)		      && (here->BSIM3v0w == pSizeDependParamKnot->Width))                  {   Size_Not_Found = 0;		      here->pParam = pSizeDependParamKnot;		  }		  else		  {   pLastKnot = pSizeDependParamKnot;		      pSizeDependParamKnot = pSizeDependParamKnot->pNext;		  }              }	      if (Size_Not_Found)	      {   pParam = (struct bsim3v0SizeDependParam *)tmalloc(	                    sizeof(struct bsim3v0SizeDependParam));                  if (pLastKnot == NULL)		      model->pSizeDependParamKnot = pParam;                  else		      pLastKnot->pNext = pParam;                  pParam->pNext = NULL;                  here->pParam = pParam;		     Ldrn = here->BSIM3v0l;		     Wdrn = here->BSIM3v0w;		                    T0 = pow(Ldrn, model->BSIM3v0Lln);                  T1 = pow(Wdrn, model->BSIM3v0Lwn);                  tmp1 = model->BSIM3v0Ll / T0 + model->BSIM3v0Lw / T1                       + model->BSIM3v0Lwl / (T0 * T1);                  pParam->BSIM3v0dl = model->BSIM3v0Lint + tmp1;                  pParam->BSIM3v0dlc = model->BSIM3v0dlc + tmp1;                  T2 = pow(Ldrn, model->BSIM3v0Wln);                  T3 = pow(Wdrn, model->BSIM3v0Wwn);                  tmp2 = model->BSIM3v0Wl / T2 + model->BSIM3v0Ww / T3                       + model->BSIM3v0Wwl / (T2 * T3);                  pParam->BSIM3v0dw = model->BSIM3v0Wint + tmp2;                  pParam->BSIM3v0dwc = model->BSIM3v0dwc + tmp2;                  pParam->BSIM3v0leff = here->BSIM3v0l - 2.0 * pParam->BSIM3v0dl;                  if (pParam->BSIM3v0leff <= 0.0)	          {   IFuid namarray[2];                      namarray[0] = model->BSIM3v0modName;                      namarray[1] = here->BSIM3v0name;                      (*(SPfrontEnd->IFerror))(ERR_FATAL,                      "BSIM3v0: mosfet %s, model %s: Effective channel length <= 0",                       namarray);                      return(E_BADPARM);                  }                  pParam->BSIM3v0weff = here->BSIM3v0w - 2.0 * pParam->BSIM3v0dw;                  if (pParam->BSIM3v0weff <= 0.0)	          {   IFuid namarray[2];                      namarray[0] = model->BSIM3v0modName;                      namarray[1] = here->BSIM3v0name;                      (*(SPfrontEnd->IFerror))(ERR_FATAL,                      "BSIM3v0: mosfet %s, model %s: Effective channel width <= 0",                       namarray);                      return(E_BADPARM);                  }                  pParam->BSIM3v0leffCV = here->BSIM3v0l - 2.0 * pParam->BSIM3v0dlc;                  if (pParam->BSIM3v0leffCV <= 0.0)	          {   IFuid namarray[2];                      namarray[0] = model->BSIM3v0modName;                      namarray[1] = here->BSIM3v0name;                      (*(SPfrontEnd->IFerror))(ERR_FATAL,                      "BSIM3v0: mosfet %s, model %s: Effective channel length for C-V <= 0",                       namarray);                      return(E_BADPARM);                  }                  pParam->BSIM3v0weffCV = here->BSIM3v0w - 2.0 * pParam->BSIM3v0dwc;                  if (pParam->BSIM3v0weffCV <= 0.0)	          {   IFuid namarray[2];                      namarray[0] = model->BSIM3v0modName;                      namarray[1] = here->BSIM3v0name;                      (*(SPfrontEnd->IFerror))(ERR_FATAL,                      "BSIM3v0: mosfet %s, model %s: Effective channel width for C-V <= 0",                       namarray);                      return(E_BADPARM);                  }	          model->BSIM3v0vcrit = CONSTvt0 * log(CONSTvt0				    / (CONSTroot2 * 1.0e-14));                  model->BSIM3v0factor1 = sqrt(EPSSI / EPSOX * model->BSIM3v0tox);		  if (model->BSIM3v0binUnit == 1)		  {   Inv_L = 1.0e-6 / pParam->BSIM3v0leff;		      Inv_W = 1.0e-6 / pParam->BSIM3v0weff;		      Inv_LW = 1.0e-12 / (pParam->BSIM3v0leff			     * pParam->BSIM3v0weff);		  }		  else		  {   Inv_L = 1.0 / pParam->BSIM3v0leff;		      Inv_W = 1.0 / pParam->BSIM3v0weff;		      Inv_LW = 1.0 / (pParam->BSIM3v0leff			     * pParam->BSIM3v0weff);		  }		  pParam->BSIM3v0cdsc = model->BSIM3v0cdsc				    + model->BSIM3v0lcdsc * Inv_L				    + model->BSIM3v0wcdsc * Inv_W				    + model->BSIM3v0pcdsc * Inv_LW;		  pParam->BSIM3v0cdscb = model->BSIM3v0cdscb				     + model->BSIM3v0lcdscb * Inv_L				     + model->BSIM3v0wcdscb * Inv_W				     + model->BSIM3v0pcdscb * Inv_LW; 				         		  pParam->BSIM3v0cdscd = model->BSIM3v0cdscd				     + model->BSIM3v0lcdscd * Inv_L				     + model->BSIM3v0wcdscd * Inv_W				     + model->BSIM3v0pcdscd * Inv_LW; 				     		  pParam->BSIM3v0cit = model->BSIM3v0cit				   + model->BSIM3v0lcit * Inv_L				   + model->BSIM3v0wcit * Inv_W				   + model->BSIM3v0pcit * Inv_LW;		  pParam->BSIM3v0nfactor = model->BSIM3v0nfactor				       + model->BSIM3v0lnfactor * Inv_L				       + model->BSIM3v0wnfactor * Inv_W				       + model->BSIM3v0pnfactor * Inv_LW;		  pParam->BSIM3v0xj = model->BSIM3v0xj				  + model->BSIM3v0lxj * Inv_L				  + model->BSIM3v0wxj * Inv_W				  + model->BSIM3v0pxj * Inv_LW;		  pParam->BSIM3v0vsat = model->BSIM3v0vsat				    + model->BSIM3v0lvsat * Inv_L				    + model->BSIM3v0wvsat * Inv_W				    + model->BSIM3v0pvsat * Inv_LW;		  pParam->BSIM3v0at = model->BSIM3v0at				  + model->BSIM3v0lat * Inv_L				  + model->BSIM3v0wat * Inv_W				  + model->BSIM3v0pat * Inv_LW;		  pParam->BSIM3v0a0 = model->BSIM3v0a0				  + model->BSIM3v0la0 * Inv_L				  + model->BSIM3v0wa0 * Inv_W				  + model->BSIM3v0pa0 * Inv_LW; 				  		  pParam->BSIM3v0ags = model->BSIM3v0ags				  + model->BSIM3v0lags * Inv_L				  + model->BSIM3v0wags * Inv_W				  + model->BSIM3v0pags * Inv_LW;				  		  pParam->BSIM3v0a1 = model->BSIM3v0a1				  + model->BSIM3v0la1 * Inv_L				  + model->BSIM3v0wa1 * Inv_W				  + model->BSIM3v0pa1 * Inv_LW;		  pParam->BSIM3v0a2 = model->BSIM3v0a2				  + model->BSIM3v0la2 * Inv_L				  + model->BSIM3v0wa2 * Inv_W				  + model->BSIM3v0pa2 * Inv_LW;		  pParam->BSIM3v0keta = model->BSIM3v0keta				    + model->BSIM3v0lketa * Inv_L				    + model->BSIM3v0wketa * Inv_W				    + model->BSIM3v0pketa * Inv_LW;		  pParam->BSIM3v0nsub = model->BSIM3v0nsub				    + model->BSIM3v0lnsub * Inv_L				    + model->BSIM3v0wnsub * Inv_W				    + model->BSIM3v0pnsub * Inv_LW;		  pParam->BSIM3v0npeak = model->BSIM3v0npeak				     + model->BSIM3v0lnpeak * Inv_L				     + model->BSIM3v0wnpeak * Inv_W				     + model->BSIM3v0pnpeak * Inv_LW;		  pParam->BSIM3v0ngate = model->BSIM3v0ngate				     + model->BSIM3v0lngate * Inv_L				     + model->BSIM3v0wngate * Inv_W				     + model->BSIM3v0pngate * Inv_LW;		  pParam->BSIM3v0gamma1 = model->BSIM3v0gamma1				      + model->BSIM3v0lgamma1 * Inv_L				      + model->BSIM3v0wgamma1 * Inv_W				      + model->BSIM3v0pgamma1 * Inv_LW;		  pParam->BSIM3v0gamma2 = model->BSIM3v0gamma2				      + model->BSIM3v0lgamma2 * Inv_L				      + model->BSIM3v0wgamma2 * Inv_W				      + model->BSIM3v0pgamma2 * Inv_LW;		  pParam->BSIM3v0vbx = model->BSIM3v0vbx				   + model->BSIM3v0lvbx * Inv_L				   + model->BSIM3v0wvbx * Inv_W				   + model->BSIM3v0pvbx * Inv_LW;		  pParam->BSIM3v0vbm = model->BSIM3v0vbm				   + model->BSIM3v0lvbm * Inv_L				   + model->BSIM3v0wvbm * Inv_W				   + model->BSIM3v0pvbm * Inv_LW;		  pParam->BSIM3v0xt = model->BSIM3v0xt				   + model->BSIM3v0lxt * Inv_L				   + model->BSIM3v0wxt * Inv_W				   + model->BSIM3v0pxt * Inv_LW;		  pParam->BSIM3v0k1 = model->BSIM3v0k1				  + model->BSIM3v0lk1 * Inv_L				  + model->BSIM3v0wk1 * Inv_W				  + model->BSIM3v0pk1 * Inv_LW;		  pParam->BSIM3v0kt1 = model->BSIM3v0kt1				   + model->BSIM3v0lkt1 * Inv_L				   + model->BSIM3v0wkt1 * Inv_W				   + model->BSIM3v0pkt1 * Inv_LW;		  pParam->BSIM3v0kt1l = model->BSIM3v0kt1l				    + model->BSIM3v0lkt1l * Inv_L				    + model->BSIM3v0wkt1l * Inv_W				    + model->BSIM3v0pkt1l * Inv_LW;		  pParam->BSIM3v0k2 = model->BSIM3v0k2				  + model->BSIM3v0lk2 * Inv_L				  + model->BSIM3v0wk2 * Inv_W				  + model->BSIM3v0pk2 * Inv_LW;		  pParam->BSIM3v0kt2 = model->BSIM3v0kt2				   + model->BSIM3v0lkt2 * Inv_L				   + model->BSIM3v0wkt2 * Inv_W				   + model->BSIM3v0pkt2 * Inv_LW;		  pParam->BSIM3v0k3 = model->BSIM3v0k3				  + model->BSIM3v0lk3 * Inv_L				  + model->BSIM3v0wk3 * Inv_W				  + model->BSIM3v0pk3 * Inv_LW;		  pParam->BSIM3v0k3b = model->BSIM3v0k3b				   + model->BSIM3v0lk3b * Inv_L				   + model->BSIM3v0wk3b * Inv_W				   + model->BSIM3v0pk3b * Inv_LW;		  pParam->BSIM3v0w0 = model->BSIM3v0w0				  + model->BSIM3v0lw0 * Inv_L				  + model->BSIM3v0ww0 * Inv_W				  + model->BSIM3v0pw0 * Inv_LW;		  pParam->BSIM3v0nlx = model->BSIM3v0nlx				   + model->BSIM3v0lnlx * Inv_L				   + model->BSIM3v0wnlx * Inv_W				   + model->BSIM3v0pnlx * Inv_LW;		  pParam->BSIM3v0dvt0 = model->BSIM3v0dvt0				    + model->BSIM3v0ldvt0 * Inv_L				    + model->BSIM3v0wdvt0 * Inv_W				    + model->BSIM3v0pdvt0 * Inv_LW;		  pParam->BSIM3v0dvt1 = model->BSIM3v0dvt1				    + model->BSIM3v0ldvt1 * Inv_L				    + model->BSIM3v0wdvt1 * Inv_W				    + model->BSIM3v0pdvt1 * Inv_LW;		  pParam->BSIM3v0dvt2 = model->BSIM3v0dvt2				    + model->BSIM3v0ldvt2 * Inv_L				    + model->BSIM3v0wdvt2 * Inv_W				    + model->BSIM3v0pdvt2 * Inv_LW;		  pParam->BSIM3v0dvt0w = model->BSIM3v0dvt0w				    + model->BSIM3v0ldvt0w * Inv_L				    + model->BSIM3v0wdvt0w * Inv_W				    + model->BSIM3v0pdvt0w * Inv_LW;		  pParam->BSIM3v0dvt1w = model->BSIM3v0dvt1w				    + model->BSIM3v0ldvt1w * Inv_L				    + model->BSIM3v0wdvt1w * Inv_W				    + model->BSIM3v0pdvt1w * Inv_LW;		  pParam->BSIM3v0dvt2w = model->BSIM3v0dvt2w				    + model->BSIM3v0ldvt2w * Inv_L				    + model->BSIM3v0wdvt2w * Inv_W				    + model->BSIM3v0pdvt2w * Inv_LW;		  pParam->BSIM3v0drout = model->BSIM3v0drout				     + model->BSIM3v0ldrout * Inv_L				     + model->BSIM3v0wdrout * Inv_W				     + model->BSIM3v0pdrout * Inv_LW;		  pParam->BSIM3v0dsub = model->BSIM3v0dsub				    + model->BSIM3v0ldsub * Inv_L				    + model->BSIM3v0wdsub * Inv_W				    + model->BSIM3v0pdsub * Inv_LW;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -