b3check.c
来自「ngspice又一个电子CAD仿真软件代码.功能更全」· C语言 代码 · 共 450 行 · 第 1/2 页
C
450 行
/**** BSIM3v3.2.4, Released by Xuemei Xi 12/14/2001 ****//********** * Copyright 2001 Regents of the University of California. All rights reserved. * File: b3check.c of BSIM3v3.2.4 * Author: 1995 Min-Chie Jeng * Author: 1997-1999 Weidong Liu. * Author: 2001 Xuemei Xi * Modified by Xuemei Xi, 10/05, 12/14, 2001. * Modified by Paolo Nenzi 2002 and Dietmar Warning 2003 **********/#include "ngspice.h"#include "cktdefs.h"#include "bsim3def.h"#include "trandefs.h"#include "const.h"#include "sperror.h"#include "devdefs.h"#include "suffix.h"intBSIM3checkModel (BSIM3model *model, BSIM3instance *here, CKTcircuit *ckt){struct bsim3SizeDependParam *pParam;int Fatal_Flag = 0;FILE *fplog; if ((fplog = fopen("b3v3check.log", "w")) != NULL) { pParam = here->pParam; fprintf (fplog, "BSIM3v3.2 Model (Supports: v3.2 and v3.2.{2,3,4}).\n"); fprintf (fplog, "Parameter Checking.\n"); fprintf (fplog, "Model = %s\n", model->BSIM3modName); fprintf (fplog, "W = %g, L = %g, M = %g\n", here->BSIM3w, here->BSIM3l, here->BSIM3m); if ((strcmp (model->BSIM3version, "3.2.4")) && (strcmp (model->BSIM3version, "3.2.3")) && (strcmp (model->BSIM3version, "3.2.2")) && (strcmp (model->BSIM3version, "3.2"))) { fprintf (fplog, "Warning: This model supports BSIM3v3.2 and BSIM3v3.2.{2,3,4}\n"); fprintf (fplog, "You specified a wrong version number.\n"); printf ("Warning: This model supports BSIM3v3.2 and BSIM3v3.2.{2,3,4}\n"); printf ("You specified a wrong version number.\n"); } if (pParam->BSIM3nlx < -pParam->BSIM3leff) { fprintf(fplog, "Fatal: Nlx = %g is less than -Leff.\n", pParam->BSIM3nlx); printf("Fatal: Nlx = %g is less than -Leff.\n", pParam->BSIM3nlx); Fatal_Flag = 1; } if (model->BSIM3tox <= 0.0) { fprintf(fplog, "Fatal: Tox = %g is not positive.\n", model->BSIM3tox); printf("Fatal: Tox = %g is not positive.\n", model->BSIM3tox); Fatal_Flag = 1; } if (model->BSIM3toxm <= 0.0) { fprintf(fplog, "Fatal: Toxm = %g is not positive.\n", model->BSIM3toxm); printf("Fatal: Toxm = %g is not positive.\n", model->BSIM3toxm); Fatal_Flag = 1; } if (pParam->BSIM3npeak <= 0.0) { fprintf(fplog, "Fatal: Nch = %g is not positive.\n", pParam->BSIM3npeak); printf("Fatal: Nch = %g is not positive.\n", pParam->BSIM3npeak); Fatal_Flag = 1; } if (pParam->BSIM3nsub <= 0.0) { fprintf(fplog, "Fatal: Nsub = %g is not positive.\n", pParam->BSIM3nsub); printf("Fatal: Nsub = %g is not positive.\n", pParam->BSIM3nsub); Fatal_Flag = 1; } if (pParam->BSIM3ngate < 0.0) { fprintf(fplog, "Fatal: Ngate = %g is not positive.\n", pParam->BSIM3ngate); printf("Fatal: Ngate = %g Ngate is not positive.\n", pParam->BSIM3ngate); Fatal_Flag = 1; } if (pParam->BSIM3ngate > 1.e25) { fprintf(fplog, "Fatal: Ngate = %g is too high.\n", pParam->BSIM3ngate); printf("Fatal: Ngate = %g Ngate is too high\n", pParam->BSIM3ngate); Fatal_Flag = 1; } if (pParam->BSIM3xj <= 0.0) { fprintf(fplog, "Fatal: Xj = %g is not positive.\n", pParam->BSIM3xj); printf("Fatal: Xj = %g is not positive.\n", pParam->BSIM3xj); Fatal_Flag = 1; } if (pParam->BSIM3dvt1 < 0.0) { fprintf(fplog, "Fatal: Dvt1 = %g is negative.\n", pParam->BSIM3dvt1); printf("Fatal: Dvt1 = %g is negative.\n", pParam->BSIM3dvt1); Fatal_Flag = 1; } if (pParam->BSIM3dvt1w < 0.0) { fprintf(fplog, "Fatal: Dvt1w = %g is negative.\n", pParam->BSIM3dvt1w); printf("Fatal: Dvt1w = %g is negative.\n", pParam->BSIM3dvt1w); Fatal_Flag = 1; } if (pParam->BSIM3w0 == -pParam->BSIM3weff) { fprintf(fplog, "Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n"); printf("Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n"); Fatal_Flag = 1; } if (pParam->BSIM3dsub < 0.0) { fprintf(fplog, "Fatal: Dsub = %g is negative.\n", pParam->BSIM3dsub); printf("Fatal: Dsub = %g is negative.\n", pParam->BSIM3dsub); Fatal_Flag = 1; } if (pParam->BSIM3b1 == -pParam->BSIM3weff) { fprintf(fplog, "Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n"); printf("Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n"); Fatal_Flag = 1; } if (pParam->BSIM3u0temp <= 0.0) { fprintf(fplog, "Fatal: u0 at current temperature = %g is not positive.\n", pParam->BSIM3u0temp); printf("Fatal: u0 at current temperature = %g is not positive.\n", pParam->BSIM3u0temp); Fatal_Flag = 1; } /* Check delta parameter */ if (pParam->BSIM3delta < 0.0) { fprintf(fplog, "Fatal: Delta = %g is less than zero.\n", pParam->BSIM3delta); printf("Fatal: Delta = %g is less than zero.\n", pParam->BSIM3delta); Fatal_Flag = 1; } if (pParam->BSIM3vsattemp <= 0.0) { fprintf(fplog, "Fatal: Vsat at current temperature = %g is not positive.\n", pParam->BSIM3vsattemp); printf("Fatal: Vsat at current temperature = %g is not positive.\n", pParam->BSIM3vsattemp); Fatal_Flag = 1; }/* Check Rout parameters */ if (pParam->BSIM3pclm <= 0.0) { fprintf(fplog, "Fatal: Pclm = %g is not positive.\n", pParam->BSIM3pclm); printf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM3pclm); Fatal_Flag = 1; } if (pParam->BSIM3drout < 0.0) { fprintf(fplog, "Fatal: Drout = %g is negative.\n", pParam->BSIM3drout); printf("Fatal: Drout = %g is negative.\n", pParam->BSIM3drout); Fatal_Flag = 1; } if (pParam->BSIM3pscbe2 <= 0.0) { fprintf(fplog, "Warning: Pscbe2 = %g is not positive.\n", pParam->BSIM3pscbe2); printf("Warning: Pscbe2 = %g is not positive.\n", pParam->BSIM3pscbe2); } /* acm model */ if (model->BSIM3acmMod == 0) { if (model->BSIM3unitLengthSidewallJctCap > 0.0 || model->BSIM3unitLengthGateSidewallJctCap > 0.0) { if (here->BSIM3drainPerimeter < pParam->BSIM3weff) { fprintf(fplog, "Warning: Pd = %g is less than W.\n", here->BSIM3drainPerimeter); printf("Warning: Pd = %g is less than W.\n", here->BSIM3drainPerimeter); } if (here->BSIM3sourcePerimeter < pParam->BSIM3weff) { fprintf(fplog, "Warning: Ps = %g is less than W.\n", here->BSIM3sourcePerimeter); printf("Warning: Ps = %g is less than W.\n", here->BSIM3sourcePerimeter); } } } if (pParam->BSIM3noff < 0.1) { fprintf(fplog, "Warning: Noff = %g is too small.\n", pParam->BSIM3noff); printf("Warning: Noff = %g is too small.\n", pParam->BSIM3noff); } if (pParam->BSIM3noff > 4.0) { fprintf(fplog, "Warning: Noff = %g is too large.\n", pParam->BSIM3noff); printf("Warning: Noff = %g is too large.\n", pParam->BSIM3noff); } if (pParam->BSIM3voffcv < -0.5) { fprintf(fplog, "Warning: Voffcv = %g is too small.\n", pParam->BSIM3voffcv); printf("Warning: Voffcv = %g is too small.\n", pParam->BSIM3voffcv); } if (pParam->BSIM3voffcv > 0.5) { fprintf(fplog, "Warning: Voffcv = %g is too large.\n", pParam->BSIM3voffcv); printf("Warning: Voffcv = %g is too large.\n", pParam->BSIM3voffcv); } if (model->BSIM3ijth < 0.0) { fprintf(fplog, "Fatal: Ijth = %g cannot be negative.\n", model->BSIM3ijth); printf("Fatal: Ijth = %g cannot be negative.\n", model->BSIM3ijth); Fatal_Flag = 1;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?