More effective check for BSIM3 model parameter

This commit is contained in:
dwarning 2020-12-26 10:16:56 +01:00 committed by Holger Vogt
parent 49890fe302
commit fdf7a6a868
2 changed files with 604 additions and 726 deletions

View File

@ -3,11 +3,12 @@
/********** /**********
* Copyright 2004 Regents of the University of California. All rights reserved. * Copyright 2004 Regents of the University of California. All rights reserved.
* File: b3check.c of BSIM3v3.3.0 * File: b3check.c of BSIM3v3.3.0
* Author: 1995 Min-Chie Jeng * Author: 1995 Min-Chie Jeng
* Author: 1997-1999 Weidong Liu. * Author: 1997-1999 Weidong Liu.
* Author: 2001 Xuemei Xi. * Author: 2001 Xuemei Xi.
* Modified by Xuemei Xi, 10/05, 12/14, 2001. * Modified by Xuemei Xi, 10/05, 12/14, 2001.
* Modified by Xuemei Xi, 07/29/2005. * Modified by Xuemei Xi, 07/29/2005.
* Modified by Dietmar Warning, 12/21/2020.
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -18,438 +19,378 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/devdefs.h" #include "ngspice/devdefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
#include "ngspice/wordlist.h"
#include "ngspice/cpextern.h"
/* Check for correctness of the BSIM3.3 parameters:
If parameter excursions are found, put the warning or error message into a wordlist.
Only then open a file b3v33check.log and print the data into the file. */
int int
BSIM3checkModel( BSIM3checkModel (BSIM3model *model, BSIM3instance *here, CKTcircuit *ckt)
BSIM3model *model,
BSIM3instance *here,
CKTcircuit *ckt)
{ {
struct bsim3SizeDependParam *pParam; struct bsim3SizeDependParam *pParam;
int Fatal_Flag = 0; int Fatal_Flag = 0;
FILE *fplog; FILE *fplog;
wordlist* wl, *wlstart;
NG_IGNORE(ckt); NG_IGNORE(ckt);
if ((fplog = fopen("b3v33check.log", "w")) != NULL) pParam = here->pParam;
{ pParam = here->pParam;
fprintf(fplog, "BSIM3v3.3.0 Parameter Checking.\n");
if ((strncmp(model->BSIM3version, "3.3.0", 5)) && (strncmp(model->BSIM3version, "3.30", 4)) && (strncmp(model->BSIM3version, "3.3", 3)))
{ fprintf(fplog, "Warning: This model is BSIM3v3.3.0; you specified a wrong version number.\n");
printf("Warning: This model is BSIM3v3.3.0; you specified a wrong version number.\n");
}
fprintf(fplog, "Model = %s\n", model->BSIM3modName);
if (pParam->BSIM3nlx < -pParam->BSIM3leff) if (cp_getvar("ng_nomodcheck", CP_BOOL, NULL, 0))
{ fprintf(fplog, "Fatal: Nlx = %g is less than -Leff.\n", return(0);
pParam->BSIM3nlx);
printf("Fatal: Nlx = %g is less than -Leff.\n",
pParam->BSIM3nlx);
Fatal_Flag = 1;
}
if (model->BSIM3tox <= 0.0) wl = wlstart = TMALLOC(wordlist, 1);
{ fprintf(fplog, "Fatal: Tox = %g is not positive.\n", wl->wl_prev = NULL;
model->BSIM3tox); wl->wl_next = NULL;
printf("Fatal: Tox = %g is not positive.\n", model->BSIM3tox); wl->wl_word = tprintf("\nChecking parameters for BSIM 3.3 model %s\n", model->BSIM3modName);
Fatal_Flag = 1;
}
if (model->BSIM3toxm <= 0.0) if ((strncmp(model->BSIM3version, "3.3.0", 5)) && (strncmp(model->BSIM3version, "3.30", 4)) && (strncmp(model->BSIM3version, "3.3", 3)))
{ fprintf(fplog, "Fatal: Toxm = %g is not positive.\n", {
model->BSIM3toxm); printf("Warning: This model is BSIM3v3.3.0; you specified a wrong version number.\n");
printf("Fatal: Toxm = %g is not positive.\n", model->BSIM3toxm); wl_append_word(&wl, &wl, tprintf("Warning: This model is BSIM3v3.3.0; you specified a wrong version number.\n"));
Fatal_Flag = 1; }
}
if (model->BSIM3lintnoi > pParam->BSIM3leff/2) if (pParam->BSIM3nlx < -pParam->BSIM3leff)
{ fprintf(fplog, "Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Nlx = %g is less than -Leff.\n",
model->BSIM3lintnoi); pParam->BSIM3nlx));
printf("Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", Fatal_Flag = 1;
model->BSIM3lintnoi); }
Fatal_Flag = 1;
}
if (pParam->BSIM3npeak <= 0.0) if (model->BSIM3tox <= 0.0)
{ fprintf(fplog, "Fatal: Nch = %g is not positive.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Tox = %g is not positive.\n",
pParam->BSIM3npeak); model->BSIM3tox));
printf("Fatal: Nch = %g is not positive.\n", Fatal_Flag = 1;
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) if (model->BSIM3toxm <= 0.0)
{ fprintf(fplog, "Fatal: Dvt1 = %g is negative.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Toxm = %g is not positive.\n",
pParam->BSIM3dvt1); model->BSIM3toxm));
printf("Fatal: Dvt1 = %g is negative.\n", pParam->BSIM3dvt1); Fatal_Flag = 1;
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) if (model->BSIM3lintnoi > pParam->BSIM3leff/2)
{ fprintf(fplog, "Fatal: Dsub = %g is negative.\n", pParam->BSIM3dsub); { wl_append_word(&wl, &wl, tprintf("Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n",
printf("Fatal: Dsub = %g is negative.\n", pParam->BSIM3dsub); model->BSIM3lintnoi));
Fatal_Flag = 1; 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) if (pParam->BSIM3npeak <= 0.0)
{ fprintf(fplog, "Fatal: Vsat at current temperature = %g is not positive.\n", pParam->BSIM3vsattemp); { wl_append_word(&wl, &wl, tprintf("Fatal: Nch = %g is not positive.\n",
printf("Fatal: Vsat at current temperature = %g is not positive.\n", pParam->BSIM3npeak));
pParam->BSIM3vsattemp); Fatal_Flag = 1;
Fatal_Flag = 1; }
} if (pParam->BSIM3nsub <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Nsub = %g is not positive.\n",
pParam->BSIM3nsub));
Fatal_Flag = 1;
}
if (pParam->BSIM3ngate < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Ngate = %g is not positive.\n",
pParam->BSIM3ngate));
Fatal_Flag = 1;
}
if (pParam->BSIM3ngate > 1.e25)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Ngate = %g is too high.\n",
pParam->BSIM3ngate));
Fatal_Flag = 1;
}
if (pParam->BSIM3xj <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Xj = %g is not positive.\n",
pParam->BSIM3xj));
Fatal_Flag = 1;
}
if (pParam->BSIM3dvt1 < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Dvt1 = %g is negative.\n",
pParam->BSIM3dvt1));
Fatal_Flag = 1;
}
if (pParam->BSIM3dvt1w < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Dvt1w = %g is negative.\n",
pParam->BSIM3dvt1w));
Fatal_Flag = 1;
}
if (pParam->BSIM3w0 == -pParam->BSIM3weff)
{ wl_append_word(&wl, &wl, tprintf("Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n"));
Fatal_Flag = 1;
}
if (pParam->BSIM3dsub < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Dsub = %g is negative.\n", pParam->BSIM3dsub));
Fatal_Flag = 1;
}
if (pParam->BSIM3b1 == -pParam->BSIM3weff)
{ wl_append_word(&wl, &wl, tprintf("Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n"));
Fatal_Flag = 1;
}
if (pParam->BSIM3u0temp <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: u0 at current temperature = %g is not positive.\n", pParam->BSIM3u0temp));
Fatal_Flag = 1;
}
/* Check delta parameter */
if (pParam->BSIM3delta < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Delta = %g is less than zero.\n",
pParam->BSIM3delta));
Fatal_Flag = 1;
}
if (pParam->BSIM3vsattemp <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Vsat at current temperature = %g is not positive.\n", pParam->BSIM3vsattemp));
Fatal_Flag = 1;
}
/* Check Rout parameters */ /* Check Rout parameters */
if (pParam->BSIM3pclm <= 0.0) if (pParam->BSIM3pclm <= 0.0)
{ fprintf(fplog, "Fatal: Pclm = %g is not positive.\n", pParam->BSIM3pclm); { wl_append_word(&wl, &wl, tprintf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM3pclm));
printf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM3pclm); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (pParam->BSIM3drout < 0.0) if (pParam->BSIM3drout < 0.0)
{ fprintf(fplog, "Fatal: Drout = %g is negative.\n", pParam->BSIM3drout); { wl_append_word(&wl, &wl, tprintf("Fatal: Drout = %g is negative.\n", pParam->BSIM3drout));
printf("Fatal: Drout = %g is negative.\n", pParam->BSIM3drout); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (pParam->BSIM3pscbe2 <= 0.0) if (pParam->BSIM3pscbe2 <= 0.0)
{ fprintf(fplog, "Warning: Pscbe2 = %g is not positive.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Pscbe2 = %g is not positive.\n",
pParam->BSIM3pscbe2); pParam->BSIM3pscbe2));
printf("Warning: Pscbe2 = %g is not positive.\n", pParam->BSIM3pscbe2); }
}
/* ACM model */ /* ACM model */
if (model->BSIM3acmMod == 0) { if (model->BSIM3acmMod == 0) {
if (model->BSIM3unitLengthSidewallJctCap > 0.0 || if (model->BSIM3unitLengthSidewallJctCap > 0.0 ||
model->BSIM3unitLengthGateSidewallJctCap > 0.0) model->BSIM3unitLengthGateSidewallJctCap > 0.0)
{ {
if (here->BSIM3drainPerimeter < pParam->BSIM3weff) if (here->BSIM3drainPerimeter < pParam->BSIM3weff)
{ fprintf(fplog, "Warning: Pd = %g is less than W.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Pd = %g is less than W.\n",
here->BSIM3drainPerimeter); here->BSIM3drainPerimeter));
printf("Warning: Pd = %g is less than W.\n", }
here->BSIM3drainPerimeter); if (here->BSIM3sourcePerimeter < pParam->BSIM3weff)
} { wl_append_word(&wl, &wl, tprintf("Warning: Ps = %g is less than W.\n",
if (here->BSIM3sourcePerimeter < pParam->BSIM3weff) here->BSIM3sourcePerimeter));
{ fprintf(fplog, "Warning: Ps = %g is less than W.\n",
here->BSIM3sourcePerimeter);
printf("Warning: Ps = %g is less than W.\n",
here->BSIM3sourcePerimeter);
}
} }
} }
}
if ((model->BSIM3calcacm > 0) && (model->BSIM3acmMod != 12)) if ((model->BSIM3calcacm > 0) && (model->BSIM3acmMod != 12))
{ fprintf(fplog, "Warning: CALCACM = %d is wrong. Set back to 0.\n", { wl_append_word(&wl, &wl, tprintf("Warning: CALCACM = %d is wrong. Set back to 0.\n",
model->BSIM3calcacm); model->BSIM3calcacm));
printf("Warning: CALCACM = %d is wrong. Set back to 0.\n", model->BSIM3calcacm); model->BSIM3calcacm = 0;
model->BSIM3calcacm = 0; }
}
if (pParam->BSIM3noff < 0.1) if (pParam->BSIM3noff < 0.1)
{ fprintf(fplog, "Warning: Noff = %g is too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Noff = %g is too small.\n",
pParam->BSIM3noff); pParam->BSIM3noff));
printf("Warning: Noff = %g is too small.\n", pParam->BSIM3noff); }
} if (pParam->BSIM3noff > 4.0)
if (pParam->BSIM3noff > 4.0) { wl_append_word(&wl, &wl, tprintf("Warning: Noff = %g is too large.\n",
{ fprintf(fplog, "Warning: Noff = %g is too large.\n", pParam->BSIM3noff));
pParam->BSIM3noff); }
printf("Warning: Noff = %g is too large.\n", pParam->BSIM3noff);
}
if (pParam->BSIM3voffcv < -0.5) if (pParam->BSIM3voffcv < -0.5)
{ fprintf(fplog, "Warning: Voffcv = %g is too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Voffcv = %g is too small.\n",
pParam->BSIM3voffcv); pParam->BSIM3voffcv));
printf("Warning: Voffcv = %g is too small.\n", pParam->BSIM3voffcv); }
} if (pParam->BSIM3voffcv > 0.5)
if (pParam->BSIM3voffcv > 0.5) { wl_append_word(&wl, &wl, tprintf("Warning: Voffcv = %g is too large.\n",
{ fprintf(fplog, "Warning: Voffcv = %g is too large.\n", pParam->BSIM3voffcv));
pParam->BSIM3voffcv); }
printf("Warning: Voffcv = %g is too large.\n", pParam->BSIM3voffcv);
}
if (model->BSIM3ijth < 0.0) if (model->BSIM3ijth < 0.0)
{ fprintf(fplog, "Fatal: Ijth = %g cannot be negative.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Ijth = %g cannot be negative.\n",
model->BSIM3ijth); model->BSIM3ijth));
printf("Fatal: Ijth = %g cannot be negative.\n", model->BSIM3ijth); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
/* Check capacitance parameters */ /* Check capacitance parameters */
if (pParam->BSIM3clc < 0.0) if (pParam->BSIM3clc < 0.0)
{ fprintf(fplog, "Fatal: Clc = %g is negative.\n", pParam->BSIM3clc); { wl_append_word(&wl, &wl, tprintf("Fatal: Clc = %g is negative.\n", pParam->BSIM3clc));
printf("Fatal: Clc = %g is negative.\n", pParam->BSIM3clc); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (pParam->BSIM3moin < 5.0) if (pParam->BSIM3moin < 5.0)
{ fprintf(fplog, "Warning: Moin = %g is too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Moin = %g is too small.\n",
pParam->BSIM3moin); pParam->BSIM3moin));
printf("Warning: Moin = %g is too small.\n", pParam->BSIM3moin); }
} if (pParam->BSIM3moin > 25.0)
if (pParam->BSIM3moin > 25.0) { wl_append_word(&wl, &wl, tprintf("Warning: Moin = %g is too large.\n",
{ fprintf(fplog, "Warning: Moin = %g is too large.\n", pParam->BSIM3moin));
pParam->BSIM3moin); }
printf("Warning: Moin = %g is too large.\n", pParam->BSIM3moin);
}
if(model->BSIM3capMod ==3) { if(model->BSIM3capMod ==3) {
if (pParam->BSIM3acde < 0.4) if (pParam->BSIM3acde < 0.4)
{ fprintf(fplog, "Warning: Acde = %g is too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Acde = %g is too small.\n",
pParam->BSIM3acde); pParam->BSIM3acde));
printf("Warning: Acde = %g is too small.\n", pParam->BSIM3acde);
}
if (pParam->BSIM3acde > 1.6)
{ fprintf(fplog, "Warning: Acde = %g is too large.\n",
pParam->BSIM3acde);
printf("Warning: Acde = %g is too large.\n", pParam->BSIM3acde);
}
} }
if (pParam->BSIM3acde > 1.6)
{ wl_append_word(&wl, &wl, tprintf("Warning: Acde = %g is too large.\n",
pParam->BSIM3acde));
}
}
if (model->BSIM3paramChk ==1) if (model->BSIM3paramChk ==1)
{ {
/* Check L and W parameters */ /* Check L and W parameters */
if (pParam->BSIM3leff <= 5.0e-8) if (pParam->BSIM3leff <= 5.0e-8)
{ fprintf(fplog, "Warning: Leff = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Leff = %g may be too small.\n",
pParam->BSIM3leff); pParam->BSIM3leff));
printf("Warning: Leff = %g may be too small.\n", }
pParam->BSIM3leff);
}
if (pParam->BSIM3leffCV <= 5.0e-8) if (pParam->BSIM3leffCV <= 5.0e-8)
{ fprintf(fplog, "Warning: Leff for CV = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Leff for CV = %g may be too small.\n",
pParam->BSIM3leffCV); pParam->BSIM3leffCV));
printf("Warning: Leff for CV = %g may be too small.\n", }
pParam->BSIM3leffCV);
}
if (pParam->BSIM3weff <= 1.0e-7) if (pParam->BSIM3weff <= 1.0e-7)
{ fprintf(fplog, "Warning: Weff = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Weff = %g may be too small.\n",
pParam->BSIM3weff); pParam->BSIM3weff));
printf("Warning: Weff = %g may be too small.\n", }
pParam->BSIM3weff);
}
if (pParam->BSIM3weffCV <= 1.0e-7) if (pParam->BSIM3weffCV <= 1.0e-7)
{ fprintf(fplog, "Warning: Weff for CV = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Weff for CV = %g may be too small.\n",
pParam->BSIM3weffCV); pParam->BSIM3weffCV));
printf("Warning: Weff for CV = %g may be too small.\n", }
pParam->BSIM3weffCV);
} /* Check threshold voltage parameters */
/* Check threshold voltage parameters */
if (pParam->BSIM3nlx < 0.0) if (pParam->BSIM3nlx < 0.0)
{ fprintf(fplog, "Warning: Nlx = %g is negative.\n", pParam->BSIM3nlx); { wl_append_word(&wl, &wl, tprintf("Warning: Nlx = %g is negative.\n", pParam->BSIM3nlx));
printf("Warning: Nlx = %g is negative.\n", pParam->BSIM3nlx);
} }
if (model->BSIM3tox < 1.0e-9) if (model->BSIM3tox < 1.0e-9)
{ fprintf(fplog, "Warning: Tox = %g is less than 10A.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Tox = %g is less than 10A.\n",
model->BSIM3tox); model->BSIM3tox));
printf("Warning: Tox = %g is less than 10A.\n", model->BSIM3tox);
} }
if (pParam->BSIM3npeak <= 1.0e15) if (pParam->BSIM3npeak <= 1.0e15)
{ fprintf(fplog, "Warning: Nch = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Nch = %g may be too small.\n",
pParam->BSIM3npeak); pParam->BSIM3npeak));
printf("Warning: Nch = %g may be too small.\n",
pParam->BSIM3npeak);
} }
else if (pParam->BSIM3npeak >= 1.0e21) else if (pParam->BSIM3npeak >= 1.0e21)
{ fprintf(fplog, "Warning: Nch = %g may be too large.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Nch = %g may be too large.\n",
pParam->BSIM3npeak); pParam->BSIM3npeak));
printf("Warning: Nch = %g may be too large.\n",
pParam->BSIM3npeak);
} }
if (pParam->BSIM3nsub <= 1.0e14) if (pParam->BSIM3nsub <= 1.0e14)
{ fprintf(fplog, "Warning: Nsub = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Nsub = %g may be too small.\n",
pParam->BSIM3nsub); pParam->BSIM3nsub));
printf("Warning: Nsub = %g may be too small.\n",
pParam->BSIM3nsub);
} }
else if (pParam->BSIM3nsub >= 1.0e21) else if (pParam->BSIM3nsub >= 1.0e21)
{ fprintf(fplog, "Warning: Nsub = %g may be too large.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Nsub = %g may be too large.\n",
pParam->BSIM3nsub); pParam->BSIM3nsub));
printf("Warning: Nsub = %g may be too large.\n",
pParam->BSIM3nsub);
} }
if ((pParam->BSIM3ngate > 0.0) && if ((pParam->BSIM3ngate > 0.0) &&
(pParam->BSIM3ngate <= 1.e18)) (pParam->BSIM3ngate <= 1.e18))
{ fprintf(fplog, "Warning: Ngate = %g is less than 1.E18cm^-3.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Ngate = %g is less than 1.E18cm^-3.\n",
pParam->BSIM3ngate); pParam->BSIM3ngate));
printf("Warning: Ngate = %g is less than 1.E18cm^-3.\n",
pParam->BSIM3ngate);
}
if (pParam->BSIM3dvt0 < 0.0)
{ fprintf(fplog, "Warning: Dvt0 = %g is negative.\n",
pParam->BSIM3dvt0);
printf("Warning: Dvt0 = %g is negative.\n", pParam->BSIM3dvt0);
}
if (fabs(1.0e-6 / (pParam->BSIM3w0 + pParam->BSIM3weff)) > 10.0)
{ fprintf(fplog, "Warning: (W0 + Weff) may be too small.\n");
printf("Warning: (W0 + Weff) may be too small.\n");
} }
/* Check subthreshold parameters */ if (pParam->BSIM3dvt0 < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: Dvt0 = %g is negative.\n",
pParam->BSIM3dvt0));
}
if (fabs(1.0e-6 / (pParam->BSIM3w0 + pParam->BSIM3weff)) > 10.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: (W0 + Weff) may be too small.\n"));
}
/* Check subthreshold parameters */
if (pParam->BSIM3nfactor < 0.0) if (pParam->BSIM3nfactor < 0.0)
{ fprintf(fplog, "Warning: Nfactor = %g is negative.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Nfactor = %g is negative.\n",
pParam->BSIM3nfactor); pParam->BSIM3nfactor));
printf("Warning: Nfactor = %g is negative.\n", pParam->BSIM3nfactor);
} }
if (pParam->BSIM3cdsc < 0.0) if (pParam->BSIM3cdsc < 0.0)
{ fprintf(fplog, "Warning: Cdsc = %g is negative.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Cdsc = %g is negative.\n",
pParam->BSIM3cdsc); pParam->BSIM3cdsc));
printf("Warning: Cdsc = %g is negative.\n", pParam->BSIM3cdsc);
} }
if (pParam->BSIM3cdscd < 0.0) if (pParam->BSIM3cdscd < 0.0)
{ fprintf(fplog, "Warning: Cdscd = %g is negative.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Cdscd = %g is negative.\n",
pParam->BSIM3cdscd); pParam->BSIM3cdscd));
printf("Warning: Cdscd = %g is negative.\n", pParam->BSIM3cdscd);
} }
/* Check DIBL parameters */ /* Check DIBL parameters */
if (pParam->BSIM3eta0 < 0.0) if (pParam->BSIM3eta0 < 0.0)
{ fprintf(fplog, "Warning: Eta0 = %g is negative.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Eta0 = %g is negative.\n",
pParam->BSIM3eta0); pParam->BSIM3eta0));
printf("Warning: Eta0 = %g is negative.\n", pParam->BSIM3eta0);
} }
/* Check Abulk parameters */
if (fabs(1.0e-6 / (pParam->BSIM3b1 + pParam->BSIM3weff)) > 10.0)
{ fprintf(fplog, "Warning: (B1 + Weff) may be too small.\n");
printf("Warning: (B1 + Weff) may be too small.\n");
}
/* Check Saturation parameters */ /* Check Abulk parameters */
if (pParam->BSIM3a2 < 0.01) if (fabs(1.0e-6 / (pParam->BSIM3b1 + pParam->BSIM3weff)) > 10.0)
{ fprintf(fplog, "Warning: A2 = %g is too small. Set to 0.01.\n", pParam->BSIM3a2); { wl_append_word(&wl, &wl, tprintf("Warning: (B1 + Weff) may be too small.\n"));
printf("Warning: A2 = %g is too small. Set to 0.01.\n", }
pParam->BSIM3a2);
/* Check Saturation parameters */
if (pParam->BSIM3a2 < 0.01)
{ wl_append_word(&wl, &wl, tprintf("Warning: A2 = %g is too small. Set to 0.01.\n", pParam->BSIM3a2));
pParam->BSIM3a2 = 0.01; pParam->BSIM3a2 = 0.01;
} }
else if (pParam->BSIM3a2 > 1.0) else if (pParam->BSIM3a2 > 1.0)
{ fprintf(fplog, "Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n", { wl_append_word(&wl, &wl, tprintf("Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n",
pParam->BSIM3a2); pParam->BSIM3a2));
printf("Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n",
pParam->BSIM3a2);
pParam->BSIM3a2 = 1.0; pParam->BSIM3a2 = 1.0;
pParam->BSIM3a1 = 0.0; pParam->BSIM3a1 = 0.0;
} }
if (pParam->BSIM3rdsw < 0.0) if (pParam->BSIM3rdsw < 0.0)
{ fprintf(fplog, "Warning: Rdsw = %g is negative. Set to zero.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Rdsw = %g is negative. Set to zero.\n",
pParam->BSIM3rdsw); pParam->BSIM3rdsw));
printf("Warning: Rdsw = %g is negative. Set to zero.\n",
pParam->BSIM3rdsw);
pParam->BSIM3rdsw = 0.0; pParam->BSIM3rdsw = 0.0;
pParam->BSIM3rds0 = 0.0; pParam->BSIM3rds0 = 0.0;
} }
if (pParam->BSIM3rds0 < 0.0) else if ((pParam->BSIM3rds0 > 0.0) && (pParam->BSIM3rds0 < 0.001))
{ fprintf(fplog, "Warning: Rds at current temperature = %g is negative. Set to zero.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Rds at current temperature = %g is less than 0.001 ohm. Set to zero.\n",
pParam->BSIM3rds0); pParam->BSIM3rds0));
printf("Warning: Rds at current temperature = %g is negative. Set to zero.\n",
pParam->BSIM3rds0);
pParam->BSIM3rds0 = 0.0; pParam->BSIM3rds0 = 0.0;
} }
if (pParam->BSIM3vsattemp < 1.0e3)
if (pParam->BSIM3vsattemp < 1.0e3) { wl_append_word(&wl, &wl, tprintf("Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM3vsattemp));
{ fprintf(fplog, "Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM3vsattemp);
printf("Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM3vsattemp);
} }
if (pParam->BSIM3pdibl1 < 0.0) if (pParam->BSIM3pdibl1 < 0.0)
{ fprintf(fplog, "Warning: Pdibl1 = %g is negative.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Pdibl1 = %g is negative.\n",
pParam->BSIM3pdibl1); pParam->BSIM3pdibl1));
printf("Warning: Pdibl1 = %g is negative.\n", pParam->BSIM3pdibl1);
} }
if (pParam->BSIM3pdibl2 < 0.0) if (pParam->BSIM3pdibl2 < 0.0)
{ fprintf(fplog, "Warning: Pdibl2 = %g is negative.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Pdibl2 = %g is negative.\n",
pParam->BSIM3pdibl2); pParam->BSIM3pdibl2));
printf("Warning: Pdibl2 = %g is negative.\n", pParam->BSIM3pdibl2);
} }
/* Check overlap capacitance parameters */ /* Check overlap capacitance parameters */
if (model->BSIM3cgdo < 0.0) if (model->BSIM3cgdo < 0.0)
{ fprintf(fplog, "Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM3cgdo); { wl_append_word(&wl, &wl, tprintf("Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM3cgdo));
printf("Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM3cgdo);
model->BSIM3cgdo = 0.0; model->BSIM3cgdo = 0.0;
} }
if (model->BSIM3cgso < 0.0) if (model->BSIM3cgso < 0.0)
{ fprintf(fplog, "Warning: cgso = %g is negative. Set to zero.\n", model->BSIM3cgso); { wl_append_word(&wl, &wl, tprintf("Warning: cgso = %g is negative. Set to zero.\n", model->BSIM3cgso));
printf("Warning: cgso = %g is negative. Set to zero.\n", model->BSIM3cgso);
model->BSIM3cgso = 0.0; model->BSIM3cgso = 0.0;
} }
if (model->BSIM3cgbo < 0.0) if (model->BSIM3cgbo < 0.0)
{ fprintf(fplog, "Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM3cgbo); { wl_append_word(&wl, &wl, tprintf("Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM3cgbo));
printf("Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM3cgbo);
model->BSIM3cgbo = 0.0; model->BSIM3cgbo = 0.0;
} }
}/* loop for the parameter check for warning messages */
fclose(fplog);
} }
else
{ fprintf(stderr, "Warning: Can't open log file. Parameter checking skipped.\n"); if (wlstart->wl_next) {
if ((fplog = fopen("b3v33check.log", "w")) != NULL) {
while (wlstart) {
fprintf(fplog, "%s", wlstart->wl_word);
fprintf(stderr, "%s", wlstart->wl_word);
wlstart = wlstart->wl_next;
}
fclose(fplog);
}
else {
while (wlstart) {
fprintf(stderr, "%s", wlstart->wl_word);
wlstart = wlstart->wl_next;
}
}
} }
wl_free(wlstart);
return(Fatal_Flag); return(Fatal_Flag);
} }

View File

@ -8,6 +8,7 @@
* Author: 2001 Xuemei Xi * Author: 2001 Xuemei Xi
* Modified by Xuemei Xi, 10/05, 12/14, 2001. * Modified by Xuemei Xi, 10/05, 12/14, 2001.
* Modified by Paolo Nenzi 2002 and Dietmar Warning 2003 * Modified by Paolo Nenzi 2002 and Dietmar Warning 2003
* Modified by Dietmar Warning, 12/21/2020.
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -18,441 +19,377 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/devdefs.h" #include "ngspice/devdefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
#include "ngspice/wordlist.h"
#include "ngspice/cpextern.h"
/* Check for correctness of the BSIM3.2 parameters:
If parameter excursions are found, put the warning or error message into a wordlist.
Only then open a file b3v32check.log and print the data into the file. */
int int
BSIM3v32checkModel (BSIM3v32model *model, BSIM3v32instance *here, CKTcircuit *ckt) BSIM3v32checkModel (BSIM3v32model *model, BSIM3v32instance *here, CKTcircuit *ckt)
{ {
struct bsim3v32SizeDependParam *pParam; struct bsim3v32SizeDependParam *pParam;
int Fatal_Flag = 0; int Fatal_Flag = 0;
FILE *fplog; FILE *fplog;
wordlist* wl, *wlstart;
NG_IGNORE(ckt); NG_IGNORE(ckt);
if ((fplog = fopen("b3v32check.log", "w")) != NULL) pParam = here->pParam;
{ pParam = here->pParam;
fprintf (fplog, if (cp_getvar("ng_nomodcheck", CP_BOOL, NULL, 0))
"BSIM3 Model (Supports: v3.2, v3.2.2, v3.2.3, v3.2.4)\n"); return(0);
fprintf (fplog, "Parameter Checking.\n");
fprintf (fplog, "Model = %s\n", model->BSIM3v32modName);
fprintf (fplog, "W = %g, L = %g, M = %g\n", here->BSIM3v32w,
here->BSIM3v32l, here->BSIM3v32m);
if ((strcmp(model->BSIM3v32version, "3.2.4")) && (strncmp(model->BSIM3v32version, "3.24", 4)) wl = wlstart = TMALLOC(wordlist, 1);
&& (strcmp(model->BSIM3v32version, "3.2.3")) && (strncmp(model->BSIM3v32version, "3.23", 4)) wl->wl_prev = NULL;
&& (strcmp(model->BSIM3v32version, "3.2.2")) && (strncmp(model->BSIM3v32version, "3.22", 4)) wl->wl_next = NULL;
&& (strncmp(model->BSIM3v32version, "3.2", 3)) && (strncmp(model->BSIM3v32version, "3.20", 4))) wl->wl_word = tprintf("\nChecking parameters for BSIM 3.2 model %s\n", model->BSIM3v32modName);
{
fprintf (fplog,
"Warning: This model supports BSIM3v3.2, BSIM3v3.2.2, BSIM3v3.2.3, BSIM3v3.2.4\n");
fprintf (fplog,
"You specified a wrong version number. Working now with BSIM3v3.2.4.\n");
printf ("Warning: This model supports BSIM3v3.2, BSIM3v3.2.2, BSIM3v3.2.3, BSIM3v3.2.4\n");
printf ("You specified a wrong version number. Working now with BSIM3v3.2.4.\n");
}
if (pParam->BSIM3v32nlx < -pParam->BSIM3v32leff) if ((strcmp(model->BSIM3v32version, "3.2.4")) && (strncmp(model->BSIM3v32version, "3.24", 4))
{ fprintf(fplog, "Fatal: Nlx = %g is less than -Leff.\n", && (strcmp(model->BSIM3v32version, "3.2.3")) && (strncmp(model->BSIM3v32version, "3.23", 4))
pParam->BSIM3v32nlx); && (strcmp(model->BSIM3v32version, "3.2.2")) && (strncmp(model->BSIM3v32version, "3.22", 4))
printf("Fatal: Nlx = %g is less than -Leff.\n", && (strncmp(model->BSIM3v32version, "3.2", 3)) && (strncmp(model->BSIM3v32version, "3.20", 4)))
pParam->BSIM3v32nlx); {
Fatal_Flag = 1; printf("Warning: This model supports BSIM3v3.2, BSIM3v3.2.2, BSIM3v3.2.3, BSIM3v3.2.4\n");
} printf("You specified a wrong version number. Working now with BSIM3v3.2.4.\n");
wl_append_word(&wl, &wl, tprintf("Warning: This model supports BSIM3v3.2, BSIM3v3.2.2, BSIM3v3.2.3, BSIM3v3.2.4\n"));
wl_append_word(&wl, &wl, tprintf("You specified a wrong version number. Working now with BSIM3v3.2.4.\n"));
}
if (model->BSIM3v32tox <= 0.0) if (pParam->BSIM3v32nlx < -pParam->BSIM3v32leff)
{ fprintf(fplog, "Fatal: Tox = %g is not positive.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Nlx = %g is less than -Leff.\n",
model->BSIM3v32tox); pParam->BSIM3v32nlx));
printf("Fatal: Tox = %g is not positive.\n", model->BSIM3v32tox); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (model->BSIM3v32toxm <= 0.0) if (model->BSIM3v32tox <= 0.0)
{ fprintf(fplog, "Fatal: Toxm = %g is not positive.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Tox = %g is not positive.\n",
model->BSIM3v32toxm); model->BSIM3v32tox));
printf("Fatal: Toxm = %g is not positive.\n", model->BSIM3v32toxm); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (pParam->BSIM3v32npeak <= 0.0) if (model->BSIM3v32toxm <= 0.0)
{ fprintf(fplog, "Fatal: Nch = %g is not positive.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Toxm = %g is not positive.\n",
pParam->BSIM3v32npeak); model->BSIM3v32toxm));
printf("Fatal: Nch = %g is not positive.\n", Fatal_Flag = 1;
pParam->BSIM3v32npeak); }
Fatal_Flag = 1;
}
if (pParam->BSIM3v32nsub <= 0.0)
{ fprintf(fplog, "Fatal: Nsub = %g is not positive.\n",
pParam->BSIM3v32nsub);
printf("Fatal: Nsub = %g is not positive.\n",
pParam->BSIM3v32nsub);
Fatal_Flag = 1;
}
if (pParam->BSIM3v32ngate < 0.0)
{ fprintf(fplog, "Fatal: Ngate = %g is not positive.\n",
pParam->BSIM3v32ngate);
printf("Fatal: Ngate = %g Ngate is not positive.\n",
pParam->BSIM3v32ngate);
Fatal_Flag = 1;
}
if (pParam->BSIM3v32ngate > 1.e25)
{ fprintf(fplog, "Fatal: Ngate = %g is too high.\n",
pParam->BSIM3v32ngate);
printf("Fatal: Ngate = %g Ngate is too high\n",
pParam->BSIM3v32ngate);
Fatal_Flag = 1;
}
if (pParam->BSIM3v32xj <= 0.0)
{ fprintf(fplog, "Fatal: Xj = %g is not positive.\n",
pParam->BSIM3v32xj);
printf("Fatal: Xj = %g is not positive.\n", pParam->BSIM3v32xj);
Fatal_Flag = 1;
}
if (pParam->BSIM3v32dvt1 < 0.0) if (pParam->BSIM3v32npeak <= 0.0)
{ fprintf(fplog, "Fatal: Dvt1 = %g is negative.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Nch = %g is not positive.\n",
pParam->BSIM3v32dvt1); pParam->BSIM3v32npeak));
printf("Fatal: Dvt1 = %g is negative.\n", pParam->BSIM3v32dvt1); Fatal_Flag = 1;
Fatal_Flag = 1; }
} if (pParam->BSIM3v32nsub <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Nsub = %g is not positive.\n",
pParam->BSIM3v32nsub));
Fatal_Flag = 1;
}
if (pParam->BSIM3v32ngate < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Ngate = %g is not positive.\n",
pParam->BSIM3v32ngate));
Fatal_Flag = 1;
}
if (pParam->BSIM3v32ngate > 1.e25)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Ngate = %g is too high.\n",
pParam->BSIM3v32ngate));
Fatal_Flag = 1;
}
if (pParam->BSIM3v32xj <= 0.0)
{ wl_append_word(&wl, &wl, tprintf("Fatal: Xj = %g is not positive.\n",
pParam->BSIM3v32xj));
Fatal_Flag = 1;
}
if (pParam->BSIM3v32dvt1w < 0.0) if (pParam->BSIM3v32dvt1 < 0.0)
{ fprintf(fplog, "Fatal: Dvt1w = %g is negative.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Dvt1 = %g is negative.\n",
pParam->BSIM3v32dvt1w); pParam->BSIM3v32dvt1));
printf("Fatal: Dvt1w = %g is negative.\n", pParam->BSIM3v32dvt1w); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (pParam->BSIM3v32w0 == -pParam->BSIM3v32weff) if (pParam->BSIM3v32dvt1w < 0.0)
{ fprintf(fplog, "Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n"); { wl_append_word(&wl, &wl, tprintf("Fatal: Dvt1w = %g is negative.\n",
printf("Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n"); pParam->BSIM3v32dvt1w));
Fatal_Flag = 1; Fatal_Flag = 1;
} }
if (pParam->BSIM3v32dsub < 0.0) if (pParam->BSIM3v32w0 == -pParam->BSIM3v32weff)
{ fprintf(fplog, "Fatal: Dsub = %g is negative.\n", pParam->BSIM3v32dsub); { wl_append_word(&wl, &wl, tprintf("Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n"));
printf("Fatal: Dsub = %g is negative.\n", pParam->BSIM3v32dsub); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (pParam->BSIM3v32b1 == -pParam->BSIM3v32weff) if (pParam->BSIM3v32dsub < 0.0)
{ fprintf(fplog, "Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n"); { wl_append_word(&wl, &wl, tprintf("Fatal: Dsub = %g is negative.\n", pParam->BSIM3v32dsub));
printf("Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n"); Fatal_Flag = 1;
Fatal_Flag = 1; }
} if (pParam->BSIM3v32b1 == -pParam->BSIM3v32weff)
if (pParam->BSIM3v32u0temp <= 0.0) { wl_append_word(&wl, &wl, tprintf("Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n"));
{ fprintf(fplog, "Fatal: u0 at current temperature = %g is not positive.\n", pParam->BSIM3v32u0temp); Fatal_Flag = 1;
printf("Fatal: u0 at current temperature = %g is not positive.\n", }
pParam->BSIM3v32u0temp); if (pParam->BSIM3v32u0temp <= 0.0)
Fatal_Flag = 1; { wl_append_word(&wl, &wl, tprintf("Fatal: u0 at current temperature = %g is not positive.\n", pParam->BSIM3v32u0temp));
} Fatal_Flag = 1;
}
/* Check delta parameter */ /* Check delta parameter */
if (pParam->BSIM3v32delta < 0.0) if (pParam->BSIM3v32delta < 0.0)
{ fprintf(fplog, "Fatal: Delta = %g is less than zero.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Delta = %g is less than zero.\n",
pParam->BSIM3v32delta); pParam->BSIM3v32delta));
printf("Fatal: Delta = %g is less than zero.\n", pParam->BSIM3v32delta); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (pParam->BSIM3v32vsattemp <= 0.0) if (pParam->BSIM3v32vsattemp <= 0.0)
{ fprintf(fplog, "Fatal: Vsat at current temperature = %g is not positive.\n", pParam->BSIM3v32vsattemp); { wl_append_word(&wl, &wl, tprintf("Fatal: Vsat at current temperature = %g is not positive.\n", pParam->BSIM3v32vsattemp));
printf("Fatal: Vsat at current temperature = %g is not positive.\n", Fatal_Flag = 1;
pParam->BSIM3v32vsattemp); }
Fatal_Flag = 1;
}
/* Check Rout parameters */ /* Check Rout parameters */
if (pParam->BSIM3v32pclm <= 0.0) if (pParam->BSIM3v32pclm <= 0.0)
{ fprintf(fplog, "Fatal: Pclm = %g is not positive.\n", pParam->BSIM3v32pclm); { wl_append_word(&wl, &wl, tprintf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM3v32pclm));
printf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM3v32pclm); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (pParam->BSIM3v32drout < 0.0) if (pParam->BSIM3v32drout < 0.0)
{ fprintf(fplog, "Fatal: Drout = %g is negative.\n", pParam->BSIM3v32drout); { wl_append_word(&wl, &wl, tprintf("Fatal: Drout = %g is negative.\n", pParam->BSIM3v32drout));
printf("Fatal: Drout = %g is negative.\n", pParam->BSIM3v32drout); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
if (pParam->BSIM3v32pscbe2 <= 0.0) if (pParam->BSIM3v32pscbe2 <= 0.0)
{ fprintf(fplog, "Warning: Pscbe2 = %g is not positive.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Pscbe2 = %g is not positive.\n",
pParam->BSIM3v32pscbe2); pParam->BSIM3v32pscbe2));
printf("Warning: Pscbe2 = %g is not positive.\n", pParam->BSIM3v32pscbe2); }
}
/* ACM model */ /* ACM model */
if (model->BSIM3v32acmMod == 0) { if (model->BSIM3v32acmMod == 0) {
if (model->BSIM3v32unitLengthSidewallJctCap > 0.0 || if (model->BSIM3v32unitLengthSidewallJctCap > 0.0 ||
model->BSIM3v32unitLengthGateSidewallJctCap > 0.0) model->BSIM3v32unitLengthGateSidewallJctCap > 0.0)
{ {
if (here->BSIM3v32drainPerimeter < pParam->BSIM3v32weff) if (here->BSIM3v32drainPerimeter < pParam->BSIM3v32weff)
{ fprintf(fplog, "Warning: Pd = %g is less than W.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Pd = %g is less than W.\n",
here->BSIM3v32drainPerimeter); here->BSIM3v32drainPerimeter));
printf("Warning: Pd = %g is less than W.\n", }
here->BSIM3v32drainPerimeter); if (here->BSIM3v32sourcePerimeter < pParam->BSIM3v32weff)
} { wl_append_word(&wl, &wl, tprintf("Warning: Ps = %g is less than W.\n",
if (here->BSIM3v32sourcePerimeter < pParam->BSIM3v32weff) here->BSIM3v32sourcePerimeter));
{ fprintf(fplog, "Warning: Ps = %g is less than W.\n",
here->BSIM3v32sourcePerimeter);
printf("Warning: Ps = %g is less than W.\n",
here->BSIM3v32sourcePerimeter);
}
} }
} }
}
if ((model->BSIM3v32calcacm > 0) && (model->BSIM3v32acmMod != 12)) if ((model->BSIM3v32calcacm > 0) && (model->BSIM3v32acmMod != 12))
{ fprintf(fplog, "Warning: CALCACM = %d is wrong. Set back to 0.\n", { wl_append_word(&wl, &wl, tprintf("Warning: CALCACM = %d is wrong. Set back to 0.\n",
model->BSIM3v32calcacm); model->BSIM3v32calcacm));
printf("Warning: CALCACM = %d is wrong. Set back to 0.\n", model->BSIM3v32calcacm); model->BSIM3v32calcacm = 0;
model->BSIM3v32calcacm = 0; }
}
if (pParam->BSIM3v32noff < 0.1) if (pParam->BSIM3v32noff < 0.1)
{ fprintf(fplog, "Warning: Noff = %g is too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Noff = %g is too small.\n",
pParam->BSIM3v32noff); pParam->BSIM3v32noff));
printf("Warning: Noff = %g is too small.\n", pParam->BSIM3v32noff); }
} if (pParam->BSIM3v32noff > 4.0)
if (pParam->BSIM3v32noff > 4.0) { wl_append_word(&wl, &wl, tprintf("Warning: Noff = %g is too large.\n",
{ fprintf(fplog, "Warning: Noff = %g is too large.\n", pParam->BSIM3v32noff));
pParam->BSIM3v32noff); }
printf("Warning: Noff = %g is too large.\n", pParam->BSIM3v32noff);
}
if (pParam->BSIM3v32voffcv < -0.5) if (pParam->BSIM3v32voffcv < -0.5)
{ fprintf(fplog, "Warning: Voffcv = %g is too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Voffcv = %g is too small.\n",
pParam->BSIM3v32voffcv); pParam->BSIM3v32voffcv));
printf("Warning: Voffcv = %g is too small.\n", pParam->BSIM3v32voffcv); }
} if (pParam->BSIM3v32voffcv > 0.5)
if (pParam->BSIM3v32voffcv > 0.5) { wl_append_word(&wl, &wl, tprintf("Warning: Voffcv = %g is too large.\n",
{ fprintf(fplog, "Warning: Voffcv = %g is too large.\n", pParam->BSIM3v32voffcv));
pParam->BSIM3v32voffcv); }
printf("Warning: Voffcv = %g is too large.\n", pParam->BSIM3v32voffcv);
}
if (model->BSIM3v32ijth < 0.0) if (model->BSIM3v32ijth < 0.0)
{ fprintf(fplog, "Fatal: Ijth = %g cannot be negative.\n", { wl_append_word(&wl, &wl, tprintf("Fatal: Ijth = %g cannot be negative.\n",
model->BSIM3v32ijth); model->BSIM3v32ijth));
printf("Fatal: Ijth = %g cannot be negative.\n", model->BSIM3v32ijth); Fatal_Flag = 1;
Fatal_Flag = 1; }
}
/* Check capacitance parameters */ /* Check capacitance parameters */
if (pParam->BSIM3v32clc < 0.0) if (pParam->BSIM3v32clc < 0.0)
{ fprintf(fplog, "Fatal: Clc = %g is negative.\n", pParam->BSIM3v32clc); { wl_append_word(&wl, &wl, tprintf("Fatal: Clc = %g is negative.\n", pParam->BSIM3v32clc));
printf("Fatal: Clc = %g is negative.\n", pParam->BSIM3v32clc); Fatal_Flag = 1;
Fatal_Flag = 1; }
if (pParam->BSIM3v32moin < 5.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: Moin = %g is too small.\n",
pParam->BSIM3v32moin));
}
if (pParam->BSIM3v32moin > 25.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: Moin = %g is too large.\n",
pParam->BSIM3v32moin));
}
if(model->BSIM3v32capMod ==3) {
if (pParam->BSIM3v32acde < 0.4)
{ wl_append_word(&wl, &wl, tprintf("Warning: Acde = %g is too small.\n",
pParam->BSIM3v32acde));
}
if (pParam->BSIM3v32acde > 1.6)
{ wl_append_word(&wl, &wl, tprintf("Warning: Acde = %g is too large.\n",
pParam->BSIM3v32acde));
}
}
if (model->BSIM3v32paramChk ==1)
{
/* Check L and W parameters */
if (pParam->BSIM3v32leff <= 5.0e-8)
{ wl_append_word(&wl, &wl, tprintf("Warning: Leff = %g may be too small.\n",
pParam->BSIM3v32leff));
} }
if (pParam->BSIM3v32moin < 5.0) if (pParam->BSIM3v32leffCV <= 5.0e-8)
{ fprintf(fplog, "Warning: Moin = %g is too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Leff for CV = %g may be too small.\n",
pParam->BSIM3v32moin); pParam->BSIM3v32leffCV));
printf("Warning: Moin = %g is too small.\n", pParam->BSIM3v32moin);
}
if (pParam->BSIM3v32moin > 25.0)
{ fprintf(fplog, "Warning: Moin = %g is too large.\n",
pParam->BSIM3v32moin);
printf("Warning: Moin = %g is too large.\n", pParam->BSIM3v32moin);
} }
if(model->BSIM3v32capMod ==3) { if (pParam->BSIM3v32weff <= 1.0e-7)
if (pParam->BSIM3v32acde < 0.4) { wl_append_word(&wl, &wl, tprintf("Warning: Weff = %g may be too small.\n",
{ fprintf(fplog, "Warning: Acde = %g is too small.\n", pParam->BSIM3v32weff));
pParam->BSIM3v32acde);
printf("Warning: Acde = %g is too small.\n", pParam->BSIM3v32acde);
}
if (pParam->BSIM3v32acde > 1.6)
{ fprintf(fplog, "Warning: Acde = %g is too large.\n",
pParam->BSIM3v32acde);
printf("Warning: Acde = %g is too large.\n", pParam->BSIM3v32acde);
}
} }
if (model->BSIM3v32paramChk ==1) if (pParam->BSIM3v32weffCV <= 1.0e-7)
{ { wl_append_word(&wl, &wl, tprintf("Warning: Weff for CV = %g may be too small.\n",
/* Check L and W parameters */ pParam->BSIM3v32weffCV));
if (pParam->BSIM3v32leff <= 5.0e-8) }
{ fprintf(fplog, "Warning: Leff = %g may be too small.\n",
pParam->BSIM3v32leff);
printf("Warning: Leff = %g may be too small.\n",
pParam->BSIM3v32leff);
}
if (pParam->BSIM3v32leffCV <= 5.0e-8) /* Check threshold voltage parameters */
{ fprintf(fplog, "Warning: Leff for CV = %g may be too small.\n", if (pParam->BSIM3v32nlx < 0.0)
pParam->BSIM3v32leffCV); { wl_append_word(&wl, &wl, tprintf("Warning: Nlx = %g is negative.\n", pParam->BSIM3v32nlx));
printf("Warning: Leff for CV = %g may be too small.\n", }
pParam->BSIM3v32leffCV); if (model->BSIM3v32tox < 1.0e-9)
} { wl_append_word(&wl, &wl, tprintf("Warning: Tox = %g is less than 10A.\n",
model->BSIM3v32tox));
}
if (pParam->BSIM3v32weff <= 1.0e-7) if (pParam->BSIM3v32npeak <= 1.0e15)
{ fprintf(fplog, "Warning: Weff = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Nch = %g may be too small.\n",
pParam->BSIM3v32weff); pParam->BSIM3v32npeak));
printf("Warning: Weff = %g may be too small.\n", }
pParam->BSIM3v32weff); else if (pParam->BSIM3v32npeak >= 1.0e21)
} { wl_append_word(&wl, &wl, tprintf("Warning: Nch = %g may be too large.\n",
pParam->BSIM3v32npeak));
}
if (pParam->BSIM3v32weffCV <= 1.0e-7) if (pParam->BSIM3v32nsub <= 1.0e14)
{ fprintf(fplog, "Warning: Weff for CV = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Nsub = %g may be too small.\n",
pParam->BSIM3v32weffCV); pParam->BSIM3v32nsub));
printf("Warning: Weff for CV = %g may be too small.\n", }
pParam->BSIM3v32weffCV); else if (pParam->BSIM3v32nsub >= 1.0e21)
} { wl_append_word(&wl, &wl, tprintf("Warning: Nsub = %g may be too large.\n",
pParam->BSIM3v32nsub));
}
/* Check threshold voltage parameters */ if ((pParam->BSIM3v32ngate > 0.0) &&
if (pParam->BSIM3v32nlx < 0.0) (pParam->BSIM3v32ngate <= 1.e18))
{ fprintf(fplog, "Warning: Nlx = %g is negative.\n", pParam->BSIM3v32nlx); { wl_append_word(&wl, &wl, tprintf("Warning: Ngate = %g is less than 1.E18cm^-3.\n",
printf("Warning: Nlx = %g is negative.\n", pParam->BSIM3v32nlx); pParam->BSIM3v32ngate));
} }
if (model->BSIM3v32tox < 1.0e-9)
{ fprintf(fplog, "Warning: Tox = %g is less than 10A.\n",
model->BSIM3v32tox);
printf("Warning: Tox = %g is less than 10A.\n", model->BSIM3v32tox);
}
if (pParam->BSIM3v32npeak <= 1.0e15) if (pParam->BSIM3v32dvt0 < 0.0)
{ fprintf(fplog, "Warning: Nch = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Dvt0 = %g is negative.\n",
pParam->BSIM3v32npeak); pParam->BSIM3v32dvt0));
printf("Warning: Nch = %g may be too small.\n", }
pParam->BSIM3v32npeak);
}
else if (pParam->BSIM3v32npeak >= 1.0e21)
{ fprintf(fplog, "Warning: Nch = %g may be too large.\n",
pParam->BSIM3v32npeak);
printf("Warning: Nch = %g may be too large.\n",
pParam->BSIM3v32npeak);
}
if (pParam->BSIM3v32nsub <= 1.0e14) if (fabs(1.0e-6 / (pParam->BSIM3v32w0 + pParam->BSIM3v32weff)) > 10.0)
{ fprintf(fplog, "Warning: Nsub = %g may be too small.\n", { wl_append_word(&wl, &wl, tprintf("Warning: (W0 + Weff) may be too small.\n"));
pParam->BSIM3v32nsub); }
printf("Warning: Nsub = %g may be too small.\n",
pParam->BSIM3v32nsub);
}
else if (pParam->BSIM3v32nsub >= 1.0e21)
{ fprintf(fplog, "Warning: Nsub = %g may be too large.\n",
pParam->BSIM3v32nsub);
printf("Warning: Nsub = %g may be too large.\n",
pParam->BSIM3v32nsub);
}
if ((pParam->BSIM3v32ngate > 0.0) && /* Check subthreshold parameters */
(pParam->BSIM3v32ngate <= 1.e18)) if (pParam->BSIM3v32nfactor < 0.0)
{ fprintf(fplog, "Warning: Ngate = %g is less than 1.E18cm^-3.\n", { wl_append_word(&wl, &wl, tprintf("Warning: Nfactor = %g is negative.\n",
pParam->BSIM3v32ngate); pParam->BSIM3v32nfactor));
printf("Warning: Ngate = %g is less than 1.E18cm^-3.\n", }
pParam->BSIM3v32ngate); if (pParam->BSIM3v32cdsc < 0.0)
} { wl_append_word(&wl, &wl, tprintf("Warning: Cdsc = %g is negative.\n",
pParam->BSIM3v32cdsc));
}
if (pParam->BSIM3v32cdscd < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: Cdscd = %g is negative.\n",
pParam->BSIM3v32cdscd));
}
/* Check DIBL parameters */
if (pParam->BSIM3v32eta0 < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: Eta0 = %g is negative.\n",
pParam->BSIM3v32eta0));
}
if (pParam->BSIM3v32dvt0 < 0.0) /* Check Abulk parameters */
{ fprintf(fplog, "Warning: Dvt0 = %g is negative.\n", if (fabs(1.0e-6 / (pParam->BSIM3v32b1 + pParam->BSIM3v32weff)) > 10.0)
pParam->BSIM3v32dvt0); { wl_append_word(&wl, &wl, tprintf("Warning: (B1 + Weff) may be too small.\n"));
printf("Warning: Dvt0 = %g is negative.\n", pParam->BSIM3v32dvt0); }
}
if (fabs(1.0e-6 / (pParam->BSIM3v32w0 + pParam->BSIM3v32weff)) > 10.0) /* Check Saturation parameters */
{ fprintf(fplog, "Warning: (W0 + Weff) may be too small.\n"); if (pParam->BSIM3v32a2 < 0.01)
printf("Warning: (W0 + Weff) may be too small.\n"); { wl_append_word(&wl, &wl, tprintf("Warning: A2 = %g is too small. Set to 0.01.\n", pParam->BSIM3v32a2));
} pParam->BSIM3v32a2 = 0.01;
}
else if (pParam->BSIM3v32a2 > 1.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n",
pParam->BSIM3v32a2));
pParam->BSIM3v32a2 = 1.0;
pParam->BSIM3v32a1 = 0.0;
/* Check subthreshold parameters */ }
if (pParam->BSIM3v32nfactor < 0.0)
{ fprintf(fplog, "Warning: Nfactor = %g is negative.\n",
pParam->BSIM3v32nfactor);
printf("Warning: Nfactor = %g is negative.\n", pParam->BSIM3v32nfactor);
}
if (pParam->BSIM3v32cdsc < 0.0)
{ fprintf(fplog, "Warning: Cdsc = %g is negative.\n",
pParam->BSIM3v32cdsc);
printf("Warning: Cdsc = %g is negative.\n", pParam->BSIM3v32cdsc);
}
if (pParam->BSIM3v32cdscd < 0.0)
{ fprintf(fplog, "Warning: Cdscd = %g is negative.\n",
pParam->BSIM3v32cdscd);
printf("Warning: Cdscd = %g is negative.\n", pParam->BSIM3v32cdscd);
}
/* Check DIBL parameters */
if (pParam->BSIM3v32eta0 < 0.0)
{ fprintf(fplog, "Warning: Eta0 = %g is negative.\n",
pParam->BSIM3v32eta0);
printf("Warning: Eta0 = %g is negative.\n", pParam->BSIM3v32eta0);
}
/* Check Abulk parameters */ if (pParam->BSIM3v32rdsw < 0.0)
if (fabs(1.0e-6 / (pParam->BSIM3v32b1 + pParam->BSIM3v32weff)) > 10.0) { wl_append_word(&wl, &wl, tprintf("Warning: Rdsw = %g is negative. Set to zero.\n",
{ fprintf(fplog, "Warning: (B1 + Weff) may be too small.\n"); pParam->BSIM3v32rdsw));
printf("Warning: (B1 + Weff) may be too small.\n"); pParam->BSIM3v32rdsw = 0.0;
} pParam->BSIM3v32rds0 = 0.0;
}
else if ((pParam->BSIM3v32rds0 > 0.0) && (pParam->BSIM3v32rds0 < 0.001))
{ wl_append_word(&wl, &wl, tprintf("Warning: Rds at current temperature = %g is less than 0.001 ohm. Set to zero.\n",
pParam->BSIM3v32rds0));
pParam->BSIM3v32rds0 = 0.0;
}
if (pParam->BSIM3v32vsattemp < 1.0e3)
{ wl_append_word(&wl, &wl, tprintf("Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM3v32vsattemp));
}
if (pParam->BSIM3v32pdibl1 < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: Pdibl1 = %g is negative.\n",
pParam->BSIM3v32pdibl1));
}
if (pParam->BSIM3v32pdibl2 < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: Pdibl2 = %g is negative.\n",
pParam->BSIM3v32pdibl2));
}
/* Check overlap capacitance parameters */
if (model->BSIM3v32cgdo < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM3v32cgdo));
model->BSIM3v32cgdo = 0.0;
}
if (model->BSIM3v32cgso < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: cgso = %g is negative. Set to zero.\n", model->BSIM3v32cgso));
model->BSIM3v32cgso = 0.0;
}
if (model->BSIM3v32cgbo < 0.0)
{ wl_append_word(&wl, &wl, tprintf("Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM3v32cgbo));
model->BSIM3v32cgbo = 0.0;
}
/* Check Saturation parameters */ }
if (pParam->BSIM3v32a2 < 0.01)
{ fprintf(fplog, "Warning: A2 = %g is too small. Set to 0.01.\n", pParam->BSIM3v32a2);
printf("Warning: A2 = %g is too small. Set to 0.01.\n",
pParam->BSIM3v32a2);
pParam->BSIM3v32a2 = 0.01;
}
else if (pParam->BSIM3v32a2 > 1.0)
{ fprintf(fplog, "Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n",
pParam->BSIM3v32a2);
printf("Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n",
pParam->BSIM3v32a2);
pParam->BSIM3v32a2 = 1.0;
pParam->BSIM3v32a1 = 0.0;
} if (wlstart->wl_next) {
if ((fplog = fopen("b3v32check.log", "w")) != NULL) {
while (wlstart) {
fprintf(fplog, "%s", wlstart->wl_word);
fprintf(stderr, "%s", wlstart->wl_word);
wlstart = wlstart->wl_next;
}
fclose(fplog);
}
else {
while (wlstart) {
fprintf(stderr, "%s", wlstart->wl_word);
wlstart = wlstart->wl_next;
}
}
}
if (pParam->BSIM3v32rdsw < 0.0) wl_free(wlstart);
{ fprintf(fplog, "Warning: Rdsw = %g is negative. Set to zero.\n",
pParam->BSIM3v32rdsw);
printf("Warning: Rdsw = %g is negative. Set to zero.\n",
pParam->BSIM3v32rdsw);
pParam->BSIM3v32rdsw = 0.0;
pParam->BSIM3v32rds0 = 0.0;
}
else if ((pParam->BSIM3v32rds0 > 0.0) && (pParam->BSIM3v32rds0 < 0.001))
{ fprintf(fplog, "Warning: Rds at current temperature = %g is less than 0.001 ohm. Set to zero.\n",
pParam->BSIM3v32rds0);
printf("Warning: Rds at current temperature = %g is less than 0.001 ohm. Set to zero.\n",
pParam->BSIM3v32rds0);
pParam->BSIM3v32rds0 = 0.0;
}
if (pParam->BSIM3v32vsattemp < 1.0e3)
{ fprintf(fplog, "Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM3v32vsattemp);
printf("Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM3v32vsattemp);
}
if (pParam->BSIM3v32pdibl1 < 0.0) return(Fatal_Flag);
{ fprintf(fplog, "Warning: Pdibl1 = %g is negative.\n",
pParam->BSIM3v32pdibl1);
printf("Warning: Pdibl1 = %g is negative.\n", pParam->BSIM3v32pdibl1);
}
if (pParam->BSIM3v32pdibl2 < 0.0)
{ fprintf(fplog, "Warning: Pdibl2 = %g is negative.\n",
pParam->BSIM3v32pdibl2);
printf("Warning: Pdibl2 = %g is negative.\n", pParam->BSIM3v32pdibl2);
}
/* Check overlap capacitance parameters */
if (model->BSIM3v32cgdo < 0.0)
{ fprintf(fplog, "Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM3v32cgdo);
printf("Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM3v32cgdo);
model->BSIM3v32cgdo = 0.0;
}
if (model->BSIM3v32cgso < 0.0)
{ fprintf(fplog, "Warning: cgso = %g is negative. Set to zero.\n", model->BSIM3v32cgso);
printf("Warning: cgso = %g is negative. Set to zero.\n", model->BSIM3v32cgso);
model->BSIM3v32cgso = 0.0;
}
if (model->BSIM3v32cgbo < 0.0)
{ fprintf(fplog, "Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM3v32cgbo);
printf("Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM3v32cgbo);
model->BSIM3v32cgbo = 0.0;
}
}/* loop for the parameter check for warning messages */
fclose(fplog);
}
else
{ fprintf(stderr, "Warning: Can't open log file. Parameter checking skipped.\n");
}
return(Fatal_Flag);
} }