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

📄 b4set.c

📁 ngspice又一个电子CAD仿真软件代码.功能更全
💻 C
📖 第 1 页 / 共 5 页
字号:
/**** BSIM4.4.0  Released by Xuemei (Jane) Xi 03/04/2004 ****//********** * Copyright 2004 Regents of the University of California. All rights reserved. * File: b4set.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 "jobdefs.h"  /* Needed because the model searches for noise Analysis */   #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#define EXP_THRESHOLD 34.0#define EPS0 8.85418e-12#define EPSSI 1.03594e-10#define PI 3.141592654#define Charge_q 1.60219e-19intBSIM4PAeffGeo(double, int, int, double, double, double, double, double *, double *, double *, double *);intBSIM4RdseffGeo(double, int, int, int, double, double, double, double, double, int, double *);intBSIM4setup(matrix,inModel,ckt,states)SMPmatrix *matrix;GENmodel *inModel;CKTcircuit *ckt;int *states;{BSIM4model *model = (BSIM4model*)inModel;BSIM4instance *here;int error;CKTnode *tmp;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 )    {   /* process defaults of model parameters */        if (!model->BSIM4typeGiven)            model->BSIM4type = NMOS;             if (!model->BSIM4mobModGiven)             model->BSIM4mobMod = 0;	else if ((model->BSIM4mobMod != 0) && (model->BSIM4mobMod != 1)	         && (model->BSIM4mobMod != 2))	{   model->BSIM4mobMod = 0;            printf("Warning: mobMod has been set to its default value: 0.\n");	}        if (!model->BSIM4binUnitGiven)             model->BSIM4binUnit = 1;        if (!model->BSIM4paramChkGiven)             model->BSIM4paramChk = 1;        if (!model->BSIM4dioModGiven)            model->BSIM4dioMod = 1;        else if ((model->BSIM4dioMod != 0) && (model->BSIM4dioMod != 1)            && (model->BSIM4dioMod != 2))        {   model->BSIM4dioMod = 1;            printf("Warning: dioMod has been set to its default value: 1.\n");        }        if (!model->BSIM4capModGiven)             model->BSIM4capMod = 2;        else if ((model->BSIM4capMod != 0) && (model->BSIM4capMod != 1)            && (model->BSIM4capMod != 2))        {   model->BSIM4capMod = 2;            printf("Warning: capMod has been set to its default value: 2.\n");        }        if (!model->BSIM4rdsModGiven)            model->BSIM4rdsMod = 0;	else if ((model->BSIM4rdsMod != 0) && (model->BSIM4rdsMod != 1))        {   model->BSIM4rdsMod = 0;	    printf("Warning: rdsMod has been set to its default value: 0.\n");	}        if (!model->BSIM4rbodyModGiven)            model->BSIM4rbodyMod = 0;        else if ((model->BSIM4rbodyMod != 0) && (model->BSIM4rbodyMod != 1))        {   model->BSIM4rbodyMod = 0;            printf("Warning: rbodyMod has been set to its default value: 0.\n");        }        if (!model->BSIM4rgateModGiven)            model->BSIM4rgateMod = 0;        else if ((model->BSIM4rgateMod != 0) && (model->BSIM4rgateMod != 1)            && (model->BSIM4rgateMod != 2) && (model->BSIM4rgateMod != 3))        {   model->BSIM4rgateMod = 0;            printf("Warning: rgateMod has been set to its default value: 0.\n");        }        if (!model->BSIM4perModGiven)            model->BSIM4perMod = 1;        else if ((model->BSIM4perMod != 0) && (model->BSIM4perMod != 1))        {   model->BSIM4perMod = 1;            printf("Warning: perMod has been set to its default value: 1.\n");        }        if (!model->BSIM4geoModGiven)            model->BSIM4geoMod = 0;        if (!model->BSIM4fnoiModGiven)             model->BSIM4fnoiMod = 1;        else if ((model->BSIM4fnoiMod != 0) && (model->BSIM4fnoiMod != 1))        {   model->BSIM4fnoiMod = 1;            printf("Warning: fnoiMod has been set to its default value: 1.\n");        }        if (!model->BSIM4tnoiModGiven)            model->BSIM4tnoiMod = 0; /* WDLiu: tnoiMod=1 needs to set internal S/D nodes */        else if ((model->BSIM4tnoiMod != 0) && (model->BSIM4tnoiMod != 1))        {   model->BSIM4tnoiMod = 0;            printf("Warning: tnoiMod has been set to its default value: 0.\n");        }        if (!model->BSIM4trnqsModGiven)            model->BSIM4trnqsMod = 0;         else if ((model->BSIM4trnqsMod != 0) && (model->BSIM4trnqsMod != 1))        {   model->BSIM4trnqsMod = 0;            printf("Warning: trnqsMod has been set to its default value: 0.\n");        }        if (!model->BSIM4acnqsModGiven)            model->BSIM4acnqsMod = 0;        else if ((model->BSIM4acnqsMod != 0) && (model->BSIM4acnqsMod != 1))        {   model->BSIM4acnqsMod = 0;            printf("Warning: acnqsMod has been set to its default value: 0.\n");        }        if (!model->BSIM4igcModGiven)            model->BSIM4igcMod = 0;        else if ((model->BSIM4igcMod != 0) && (model->BSIM4igcMod != 1))        {   model->BSIM4igcMod = 0;            printf("Warning: igcMod has been set to its default value: 0.\n");        }        if (!model->BSIM4igbModGiven)            model->BSIM4igbMod = 0;        else if ((model->BSIM4igbMod != 0) && (model->BSIM4igbMod != 1))        {   model->BSIM4igbMod = 0;            printf("Warning: igbMod has been set to its default value: 0.\n");        }        if (!model->BSIM4tempModGiven)            model->BSIM4tempMod = 0;        else if ((model->BSIM4tempMod != 0) && (model->BSIM4tempMod != 1))        {   model->BSIM4tempMod = 0;            printf("Warning: tempMod has been set to its default value: 0.\n");        }        if (!model->BSIM4versionGiven)             model->BSIM4version = "4.4.0";        if (!model->BSIM4toxrefGiven)            model->BSIM4toxref = 30.0e-10;        if (!model->BSIM4toxeGiven)            model->BSIM4toxe = 30.0e-10;        if (!model->BSIM4toxpGiven)            model->BSIM4toxp = model->BSIM4toxe;        if (!model->BSIM4toxmGiven)            model->BSIM4toxm = model->BSIM4toxe;        if (!model->BSIM4dtoxGiven)            model->BSIM4dtox = 0.0;        if (!model->BSIM4epsroxGiven)            model->BSIM4epsrox = 3.9;        if (!model->BSIM4cdscGiven)	    model->BSIM4cdsc = 2.4e-4;   /* unit Q/V/m^2  */        if (!model->BSIM4cdscbGiven)	    model->BSIM4cdscb = 0.0;   /* unit Q/V/m^2  */    	    if (!model->BSIM4cdscdGiven)	    model->BSIM4cdscd = 0.0;   /* unit Q/V/m^2  */        if (!model->BSIM4citGiven)	    model->BSIM4cit = 0.0;   /* unit Q/V/m^2  */        if (!model->BSIM4nfactorGiven)	    model->BSIM4nfactor = 1.0;        if (!model->BSIM4xjGiven)            model->BSIM4xj = .15e-6;        if (!model->BSIM4vsatGiven)            model->BSIM4vsat = 8.0e4;    /* unit m/s */         if (!model->BSIM4atGiven)            model->BSIM4at = 3.3e4;    /* unit m/s */         if (!model->BSIM4a0Given)            model->BSIM4a0 = 1.0;          if (!model->BSIM4agsGiven)            model->BSIM4ags = 0.0;        if (!model->BSIM4a1Given)            model->BSIM4a1 = 0.0;        if (!model->BSIM4a2Given)            model->BSIM4a2 = 1.0;        if (!model->BSIM4ketaGiven)            model->BSIM4keta = -0.047;    /* unit  / V */        if (!model->BSIM4nsubGiven)            model->BSIM4nsub = 6.0e16;   /* unit 1/cm3 */        if (!model->BSIM4ndepGiven)            model->BSIM4ndep = 1.7e17;   /* unit 1/cm3 */        if (!model->BSIM4nsdGiven)            model->BSIM4nsd = 1.0e20;   /* unit 1/cm3 */        if (!model->BSIM4phinGiven)            model->BSIM4phin = 0.0; /* unit V */        if (!model->BSIM4ngateGiven)            model->BSIM4ngate = 0;   /* unit 1/cm3 */        if (!model->BSIM4vbmGiven)	    model->BSIM4vbm = -3.0;        if (!model->BSIM4xtGiven)	    model->BSIM4xt = 1.55e-7;        if (!model->BSIM4kt1Given)            model->BSIM4kt1 = -0.11;      /* unit V */        if (!model->BSIM4kt1lGiven)            model->BSIM4kt1l = 0.0;      /* unit V*m */        if (!model->BSIM4kt2Given)            model->BSIM4kt2 = 0.022;      /* No unit */        if (!model->BSIM4k3Given)            model->BSIM4k3 = 80.0;              if (!model->BSIM4k3bGiven)            model->BSIM4k3b = 0.0;              if (!model->BSIM4w0Given)            model->BSIM4w0 = 2.5e-6;            if (!model->BSIM4lpe0Given)            model->BSIM4lpe0 = 1.74e-7;             if (!model->BSIM4lpebGiven)            model->BSIM4lpeb = 0.0;        if (!model->BSIM4dvtp0Given)            model->BSIM4dvtp0 = 0.0;        if (!model->BSIM4dvtp1Given)            model->BSIM4dvtp1 = 0.0;        if (!model->BSIM4dvt0Given)            model->BSIM4dvt0 = 2.2;            if (!model->BSIM4dvt1Given)            model->BSIM4dvt1 = 0.53;              if (!model->BSIM4dvt2Given)            model->BSIM4dvt2 = -0.032;   /* unit 1 / V */             if (!model->BSIM4dvt0wGiven)            model->BSIM4dvt0w = 0.0;            if (!model->BSIM4dvt1wGiven)            model->BSIM4dvt1w = 5.3e6;            if (!model->BSIM4dvt2wGiven)            model->BSIM4dvt2w = -0.032;           if (!model->BSIM4droutGiven)            model->BSIM4drout = 0.56;             if (!model->BSIM4dsubGiven)            model->BSIM4dsub = model->BSIM4drout;             if (!model->BSIM4vth0Given)            model->BSIM4vth0 = (model->BSIM4type == NMOS) ? 0.7 : -0.7;        if (!model->BSIM4euGiven)            model->BSIM4eu = (model->BSIM4type == NMOS) ? 1.67 : 1.0;;        if (!model->BSIM4uaGiven)            model->BSIM4ua = (model->BSIM4mobMod == 2) ? 1.0e-15 : 1.0e-9; /* unit m/V */        if (!model->BSIM4ua1Given)            model->BSIM4ua1 = 1.0e-9;      /* unit m/V */        if (!model->BSIM4ubGiven)            model->BSIM4ub = 1.0e-19;     /* unit (m/V)**2 */        if (!model->BSIM4ub1Given)            model->BSIM4ub1 = -1.0e-18;     /* unit (m/V)**2 */        if (!model->BSIM4ucGiven)            model->BSIM4uc = (model->BSIM4mobMod == 1) ? -0.0465 : -0.0465e-9;           if (!model->BSIM4uc1Given)            model->BSIM4uc1 = (model->BSIM4mobMod == 1) ? -0.056 : -0.056e-9;           if (!model->BSIM4u0Given)            model->BSIM4u0 = (model->BSIM4type == NMOS) ? 0.067 : 0.025;        if (!model->BSIM4uteGiven)	    model->BSIM4ute = -1.5;            if (!model->BSIM4voffGiven)	    model->BSIM4voff = -0.08;        if (!model->BSIM4vofflGiven)            model->BSIM4voffl = 0.0;        if (!model->BSIM4minvGiven)            model->BSIM4minv = 0.0;        if (!model->BSIM4fproutGiven)            model->BSIM4fprout = 0.0;        if (!model->BSIM4pditsGiven)            model->BSIM4pdits = 0.0;        if (!model->BSIM4pditsdGiven)            model->BSIM4pditsd = 0.0;        if (!model->BSIM4pditslGiven)            model->BSIM4pditsl = 0.0;        if (!model->BSIM4deltaGiven)             model->BSIM4delta = 0.01;        if (!model->BSIM4rdswminGiven)            model->BSIM4rdswmin = 0.0;        if (!model->BSIM4rdwminGiven)            model->BSIM4rdwmin = 0.0;        if (!model->BSIM4rswminGiven)            model->BSIM4rswmin = 0.0;        if (!model->BSIM4rdswGiven)	    model->BSIM4rdsw = 200.0; /* in ohm*um */             if (!model->BSIM4rdwGiven)            model->BSIM4rdw = 100.0;        if (!model->BSIM4rswGiven)            model->BSIM4rsw = 100.0;        if (!model->BSIM4prwgGiven)            model->BSIM4prwg = 1.0; /* in 1/V */        if (!model->BSIM4prwbGiven)            model->BSIM4prwb = 0.0;              if (!model->BSIM4prtGiven)        if (!model->BSIM4prtGiven)            model->BSIM4prt = 0.0;              if (!model->BSIM4eta0Given)            model->BSIM4eta0 = 0.08;      /* no unit  */         if (!model->BSIM4etabGiven)            model->BSIM4etab = -0.07;      /* unit  1/V */         if (!model->BSIM4pclmGiven)            model->BSIM4pclm = 1.3;      /* no unit  */         if (!model->BSIM4pdibl1Given)            model->BSIM4pdibl1 = 0.39;    /* no unit  */        if (!model->BSIM4pdibl2Given)            model->BSIM4pdibl2 = 0.0086;    /* no unit  */         if (!model->BSIM4pdiblbGiven)            model->BSIM4pdiblb = 0.0;    /* 1/V  */         if (!model->BSIM4pscbe1Given)            model->BSIM4pscbe1 = 4.24e8;             if (!model->BSIM4pscbe2Given)

⌨️ 快捷键说明

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