From b1daabbe95f1ef8e28e2f4977a30b1a35227a4a9 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 27 Dec 2020 16:06:00 +0100 Subject: [PATCH] update the model checking --- src/spicelib/devices/bsim4/b4check.c | 1541 ++++++++++------------ src/spicelib/devices/bsim4/b4temp.c | 3 +- src/spicelib/devices/bsim4v7/b4v7check.c | 1410 ++++++++++---------- src/spicelib/devices/bsim4v7/b4v7temp.c | 3 +- 4 files changed, 1411 insertions(+), 1546 deletions(-) diff --git a/src/spicelib/devices/bsim4/b4check.c b/src/spicelib/devices/bsim4/b4check.c index 230951ce5..6ae37084a 100644 --- a/src/spicelib/devices/bsim4/b4check.c +++ b/src/spicelib/devices/bsim4/b4check.c @@ -56,7 +56,9 @@ * ____Chenming Hu__________________________ * * ____Professor in Graduate School ________ * * * - ****************************************************************************** */ + ****************************************************************************** + * Modified by Holger Vogt, 12/27/2020 + ******************************************************************************/ #include "ngspice/ngspice.h" #include "ngspice/cktdefs.h" @@ -66,950 +68,869 @@ #include "ngspice/sperror.h" #include "ngspice/devdefs.h" #include "ngspice/suffix.h" +#include "ngspice/wordlist.h" +#include "ngspice/cpextern.h" + + +/* Check for correctness of the BSIM4.8 parameters: + If parameter excursions are found, put the warning or error message into a wordlist. + Only then open a file bsim4.out and print the data into the file. */ int BSIM4checkModel( BSIM4model *model, BSIM4instance *here, CKTcircuit *ckt) { -struct bsim4SizeDependParam *pParam; -int Fatal_Flag = 0; -FILE *fplog; - - if ((fplog = fopen("bsim4.out", "w")) != NULL) - { pParam = here->pParam; - fprintf(fplog, "BSIM4: Berkeley Short Channel IGFET Model-4\n"); - fprintf(fplog, "Developed by Xuemei (Jane) Xi, Mohan Dunga, Prof. Ali Niknejad and Prof. Chenming Hu in 2003.\n"); - fprintf(fplog, "\n"); - fprintf(fplog, "++++++++++ BSIM4 PARAMETER CHECKING BELOW ++++++++++\n"); - - if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) && (strncmp(model->BSIM4version, "4.8", 3))) - { fprintf(fplog, "Warning: This model is BSIM4.8.1; you specified a deviating version number.\n"); - printf("Warning: This model is BSIM4.8.1; you specified a deviating version number.\n"); - } - fprintf(fplog, "Model = %s\n", model->BSIM4modName); - - - if ((here->BSIM4rgateMod == 2) || (here->BSIM4rgateMod == 3)) - { if ((here->BSIM4trnqsMod == 1) || (here->BSIM4acnqsMod == 1)) - { fprintf(fplog, "Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); - printf("Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); - } - } + struct bsim4SizeDependParam *pParam; + int Fatal_Flag = 0; + FILE *fplog; + wordlist* wl, *wlstart; - if (model->BSIM4toxe <= 0.0) - { fprintf(fplog, "Fatal: Toxe = %g is not positive.\n", - model->BSIM4toxe); - printf("Fatal: Toxe = %g is not positive.\n", model->BSIM4toxe); - Fatal_Flag = 1; - } - if (here->BSIM4toxp <= 0.0) - { fprintf(fplog, "Fatal: Toxp = %g is not positive.\n", - here->BSIM4toxp); - printf("Fatal: Toxp = %g is not positive.\n", here->BSIM4toxp); - Fatal_Flag = 1; - } - if (model->BSIM4eot <= 0.0) - { fprintf(fplog, "Fatal: EOT = %g is not positive.\n", - model->BSIM4eot); - printf("Fatal: EOT = %g is not positive.\n", model->BSIM4eot); - Fatal_Flag = 1; - } - if (model->BSIM4epsrgate < 0.0) - { fprintf(fplog, "Fatal: Epsrgate = %g is not positive.\n", - model->BSIM4epsrgate); - printf("Fatal: Epsrgate = %g is not positive.\n", model->BSIM4epsrgate); - Fatal_Flag = 1; - } - if (model->BSIM4epsrsub < 0.0) - { fprintf(fplog, "Fatal: Epsrsub = %g is not positive.\n", - model->BSIM4epsrsub); - printf("Fatal: Epsrsub = %g is not positive.\n", model->BSIM4epsrsub); - Fatal_Flag = 1; - } - if (model->BSIM4easub < 0.0) - { fprintf(fplog, "Fatal: Easub = %g is not positive.\n", - model->BSIM4easub); - printf("Fatal: Easub = %g is not positive.\n", model->BSIM4easub); - Fatal_Flag = 1; - } - if (model->BSIM4ni0sub <= 0.0) - { fprintf(fplog, "Fatal: Ni0sub = %g is not positive.\n", - model->BSIM4ni0sub); - printf("Fatal: Easub = %g is not positive.\n", model->BSIM4ni0sub); - Fatal_Flag = 1; - } + pParam = here->pParam; - if (model->BSIM4toxm <= 0.0) - { fprintf(fplog, "Fatal: Toxm = %g is not positive.\n", - model->BSIM4toxm); - printf("Fatal: Toxm = %g is not positive.\n", model->BSIM4toxm); - Fatal_Flag = 1; - } + if (cp_getvar("ng_nomodcheck", CP_BOOL, NULL, 0)) + return(0); - if (model->BSIM4toxref <= 0.0) - { fprintf(fplog, "Fatal: Toxref = %g is not positive.\n", - model->BSIM4toxref); - printf("Fatal: Toxref = %g is not positive.\n", model->BSIM4toxref); - Fatal_Flag = 1; - } + wl = wlstart = TMALLOC(wordlist, 1); + wl->wl_prev = NULL; + wl->wl_next = NULL; + wl->wl_word = tprintf("\nChecking parameters for BSIM 4.7 model %s\n", model->BSIM4modName); - if (pParam->BSIM4lpe0 < -pParam->BSIM4leff) - { fprintf(fplog, "Fatal: Lpe0 = %g is less than -Leff.\n", - pParam->BSIM4lpe0); - printf("Fatal: Lpe0 = %g is less than -Leff.\n", - pParam->BSIM4lpe0); - Fatal_Flag = 1; - } - if (model->BSIM4lintnoi > pParam->BSIM4leff/2) - { fprintf(fplog, "Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", - model->BSIM4lintnoi); - printf("Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", - model->BSIM4lintnoi); - Fatal_Flag = 1; - } - if (pParam->BSIM4lpeb < -pParam->BSIM4leff) - { fprintf(fplog, "Fatal: Lpeb = %g is less than -Leff.\n", - pParam->BSIM4lpeb); - printf("Fatal: Lpeb = %g is less than -Leff.\n", - pParam->BSIM4lpeb); - Fatal_Flag = 1; - } - if (pParam->BSIM4ndep <= 0.0) - { fprintf(fplog, "Fatal: Ndep = %g is not positive.\n", - pParam->BSIM4ndep); - printf("Fatal: Ndep = %g is not positive.\n", - pParam->BSIM4ndep); - Fatal_Flag = 1; - } - if (pParam->BSIM4phi <= 0.0) - { fprintf(fplog, "Fatal: Phi = %g is not positive. Please check Phin and Ndep\n", - pParam->BSIM4phi); - fprintf(fplog, " Phin = %g Ndep = %g \n", - pParam->BSIM4phin, pParam->BSIM4ndep); - printf("Fatal: Phi = %g is not positive. Please check Phin and Ndep\n", - pParam->BSIM4phi); - printf(" Phin = %g Ndep = %g \n", - pParam->BSIM4phin, pParam->BSIM4ndep); - Fatal_Flag = 1; - } - if (pParam->BSIM4nsub <= 0.0) - { fprintf(fplog, "Fatal: Nsub = %g is not positive.\n", - pParam->BSIM4nsub); - printf("Fatal: Nsub = %g is not positive.\n", - pParam->BSIM4nsub); - Fatal_Flag = 1; - } - if (pParam->BSIM4ngate < 0.0) - { fprintf(fplog, "Fatal: Ngate = %g is not positive.\n", - pParam->BSIM4ngate); - printf("Fatal: Ngate = %g Ngate is not positive.\n", - pParam->BSIM4ngate); - Fatal_Flag = 1; - } - if (pParam->BSIM4ngate > 1.e25) - { fprintf(fplog, "Fatal: Ngate = %g is too high.\n", - pParam->BSIM4ngate); - printf("Fatal: Ngate = %g Ngate is too high\n", - pParam->BSIM4ngate); - Fatal_Flag = 1; - } - if (pParam->BSIM4xj <= 0.0) - { fprintf(fplog, "Fatal: Xj = %g is not positive.\n", - pParam->BSIM4xj); - printf("Fatal: Xj = %g is not positive.\n", pParam->BSIM4xj); - Fatal_Flag = 1; + if ((here->BSIM4rgateMod == 2) || (here->BSIM4rgateMod == 3)) + { if ((here->BSIM4trnqsMod == 1) || (here->BSIM4acnqsMod == 1)) { + wl_append_word(&wl, &wl, tprintf("Warning: You've selected both Rg and charge deficit NQS; select one only.\n")); } + } - if (pParam->BSIM4dvt1 < 0.0) - { fprintf(fplog, "Fatal: Dvt1 = %g is negative.\n", - pParam->BSIM4dvt1); - printf("Fatal: Dvt1 = %g is negative.\n", pParam->BSIM4dvt1); - Fatal_Flag = 1; - } - - if (pParam->BSIM4dvt1w < 0.0) - { fprintf(fplog, "Fatal: Dvt1w = %g is negative.\n", - pParam->BSIM4dvt1w); - printf("Fatal: Dvt1w = %g is negative.\n", pParam->BSIM4dvt1w); - Fatal_Flag = 1; - } - - if (pParam->BSIM4w0 == -pParam->BSIM4weff) - { 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 (model->BSIM4toxe <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Toxe = %g is not positive.\n", + model->BSIM4toxe)); + Fatal_Flag = 1; + } - if (pParam->BSIM4dsub < 0.0) - { fprintf(fplog, "Fatal: Dsub = %g is negative.\n", pParam->BSIM4dsub); - printf("Fatal: Dsub = %g is negative.\n", pParam->BSIM4dsub); - Fatal_Flag = 1; - } - if (pParam->BSIM4b1 == -pParam->BSIM4weff) - { 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 (here->BSIM4u0temp <= 0.0) - { fprintf(fplog, "Fatal: u0 at current temperature = %g is not positive.\n", here->BSIM4u0temp); - printf("Fatal: u0 at current temperature = %g is not positive.\n", - here->BSIM4u0temp); - Fatal_Flag = 1; - } - - if (pParam->BSIM4delta < 0.0) - { fprintf(fplog, "Fatal: Delta = %g is less than zero.\n", - pParam->BSIM4delta); - printf("Fatal: Delta = %g is less than zero.\n", pParam->BSIM4delta); - Fatal_Flag = 1; - } + if (model->BSIM4toxp <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Toxp = %g is not positive.\n", model->BSIM4toxp)); + Fatal_Flag = 1; + } - if (here->BSIM4vsattemp <= 0.0) - { fprintf(fplog, "Fatal: Vsat at current temperature = %g is not positive.\n", here->BSIM4vsattemp); - printf("Fatal: Vsat at current temperature = %g is not positive.\n", - here->BSIM4vsattemp); - Fatal_Flag = 1; - } + if (model->BSIM4eot <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: EOT = %g is not positive.\n", model->BSIM4eot)); + Fatal_Flag = 1; + } + if (model->BSIM4epsrgate < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Epsrgate = %g is not positive.\n", model->BSIM4epsrgate)); + Fatal_Flag = 1; + } + if (model->BSIM4epsrsub < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Epsrsub = %g is not positive.\n", model->BSIM4epsrsub)); + Fatal_Flag = 1; + } + if (model->BSIM4easub < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Easub = %g is not positive.\n", model->BSIM4easub)); + Fatal_Flag = 1; + } + if (model->BSIM4ni0sub <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Easub = %g is not positive.\n", model->BSIM4ni0sub)); + Fatal_Flag = 1; + } - if (pParam->BSIM4pclm <= 0.0) - { fprintf(fplog, "Fatal: Pclm = %g is not positive.\n", pParam->BSIM4pclm); - printf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM4pclm); - Fatal_Flag = 1; - } + if (model->BSIM4toxm <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Toxm = %g is not positive.\n", model->BSIM4toxm)); + Fatal_Flag = 1; + } + if (model->BSIM4toxref <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Toxref = %g is not positive.\n", model->BSIM4toxref)); + Fatal_Flag = 1; + } - if (pParam->BSIM4drout < 0.0) - { fprintf(fplog, "Fatal: Drout = %g is negative.\n", pParam->BSIM4drout); - printf("Fatal: Drout = %g is negative.\n", pParam->BSIM4drout); - Fatal_Flag = 1; - } + if (pParam->BSIM4lpe0 < -pParam->BSIM4leff) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Lpe0 = %g is less than -Leff.\n", + pParam->BSIM4lpe0)); + Fatal_Flag = 1; + } + if (model->BSIM4lintnoi > pParam->BSIM4leff / 2) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", + model->BSIM4lintnoi)); + Fatal_Flag = 1; + } + if (pParam->BSIM4lpeb < -pParam->BSIM4leff) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Lpeb = %g is less than -Leff.\n", + pParam->BSIM4lpeb)); + Fatal_Flag = 1; + } + if (pParam->BSIM4ndep <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Ndep = %g is not positive.\n", + pParam->BSIM4ndep)); + Fatal_Flag = 1; + } + if (pParam->BSIM4phi <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Phi = %g is not positive. Please check Phin and Ndep\n", + pParam->BSIM4phi)); + wl_append_word(&wl, &wl, tprintf(" Phin = %g Ndep = %g \n", + pParam->BSIM4phin, pParam->BSIM4ndep)); + Fatal_Flag = 1; + } + if (pParam->BSIM4nsub <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Nsub = %g is not positive.\n", + pParam->BSIM4nsub)); + Fatal_Flag = 1; + } + if (pParam->BSIM4ngate < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Ngate = %g Ngate is not positive.\n", + pParam->BSIM4ngate)); + Fatal_Flag = 1; + } + if (pParam->BSIM4ngate > 1.e25) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Ngate = %g Ngate is too high\n", + pParam->BSIM4ngate)); + Fatal_Flag = 1; + } + if (pParam->BSIM4xj <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Xj = %g is not positive.\n", pParam->BSIM4xj)); + Fatal_Flag = 1; + } - if (here->BSIM4m < 1.0) - { fprintf(fplog, "Fatal: Number of multiplier = %g is smaller than one.\n", here->BSIM4m); - printf("Fatal: Number of multiplier = %g is smaller than one.\n", here->BSIM4m); - Fatal_Flag = 1; - } + if (pParam->BSIM4dvt1 < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Dvt1 = %g is negative.\n", pParam->BSIM4dvt1)); + Fatal_Flag = 1; + } - if (here->BSIM4nf < 1.0) - { fprintf(fplog, "Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4nf); - printf("Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4nf); - Fatal_Flag = 1; - } + if (pParam->BSIM4dvt1w < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Dvt1w = %g is negative.\n", pParam->BSIM4dvt1w)); + Fatal_Flag = 1; + } - if((here->BSIM4sa > 0.0) && (here->BSIM4sb > 0.0) && - ((here->BSIM4nf == 1.0) || ((here->BSIM4nf > 1.0) && (here->BSIM4sd > 0.0))) ) - { if (model->BSIM4saref <= 0.0) - { fprintf(fplog, "Fatal: SAref = %g is not positive.\n",model->BSIM4saref); - printf("Fatal: SAref = %g is not positive.\n",model->BSIM4saref); - Fatal_Flag = 1; - } - if (model->BSIM4sbref <= 0.0) - { fprintf(fplog, "Fatal: SBref = %g is not positive.\n",model->BSIM4sbref); - printf("Fatal: SBref = %g is not positive.\n",model->BSIM4sbref); - Fatal_Flag = 1; - } - } + if (pParam->BSIM4w0 == -pParam->BSIM4weff) + { + wl_append_word(&wl, &wl, tprintf("Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n")); + Fatal_Flag = 1; + } - if ((here->BSIM4l + model->BSIM4xl) <= model->BSIM4xgl) - { fprintf(fplog, "Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n"); - printf("Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n"); - Fatal_Flag = 1; - } - if (here->BSIM4ngcon < 1.0) - { fprintf(fplog, "Fatal: The parameter ngcon cannot be smaller than one.\n"); - printf("Fatal: The parameter ngcon cannot be smaller than one.\n"); - Fatal_Flag = 1; - } - if ((here->BSIM4ngcon != 1.0) && (here->BSIM4ngcon != 2.0)) - { here->BSIM4ngcon = 1.0; - fprintf(fplog, "Warning: Ngcon must be equal to one or two; reset to 1.0.\n"); - printf("Warning: Ngcon must be equal to one or two; reset to 1.0.\n"); - } + if (pParam->BSIM4dsub < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Dsub = %g is negative.\n", pParam->BSIM4dsub)); + Fatal_Flag = 1; + } + if (pParam->BSIM4b1 == -pParam->BSIM4weff) + { + wl_append_word(&wl, &wl, tprintf("Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n")); + Fatal_Flag = 1; + } + if (here->BSIM4u0temp <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: u0 at current temperature = %g is not positive.\n", + here->BSIM4u0temp)); + Fatal_Flag = 1; + } - if (model->BSIM4gbmin < 1.0e-20) - { fprintf(fplog, "Warning: Gbmin = %g is too small.\n", - model->BSIM4gbmin); - printf("Warning: Gbmin = %g is too small.\n", model->BSIM4gbmin); - } + if (pParam->BSIM4delta < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Delta = %g is less than zero.\n", pParam->BSIM4delta)); + Fatal_Flag = 1; + } - /* Check saturation parameters */ - if (pParam->BSIM4fprout < 0.0) - { fprintf(fplog, "Fatal: fprout = %g is negative.\n", - pParam->BSIM4fprout); - printf("Fatal: fprout = %g is negative.\n", pParam->BSIM4fprout); - Fatal_Flag = 1; - } - if (pParam->BSIM4pdits < 0.0) - { fprintf(fplog, "Fatal: pdits = %g is negative.\n", - pParam->BSIM4pdits); - printf("Fatal: pdits = %g is negative.\n", pParam->BSIM4pdits); + if (here->BSIM4vsattemp <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vsat at current temperature = %g is not positive.\n", + here->BSIM4vsattemp)); + Fatal_Flag = 1; + } + + if (pParam->BSIM4pclm <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM4pclm)); + Fatal_Flag = 1; + } + + if (pParam->BSIM4drout < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Drout = %g is negative.\n", pParam->BSIM4drout)); + Fatal_Flag = 1; + } + + if (here->BSIM4m <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: multiplier = %g is not positive.\n", here->BSIM4m)); + Fatal_Flag = 1; + } + if (here->BSIM4nf < 1.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4nf)); + Fatal_Flag = 1; + } + + if ((here->BSIM4sa > 0.0) && (here->BSIM4sb > 0.0) && + ((here->BSIM4nf == 1.0) || ((here->BSIM4nf > 1.0) && (here->BSIM4sd > 0.0)))) + { + if (model->BSIM4saref <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: SAref = %g is not positive.\n", model->BSIM4saref)); Fatal_Flag = 1; } - if (model->BSIM4pditsl < 0.0) - { fprintf(fplog, "Fatal: pditsl = %g is negative.\n", - model->BSIM4pditsl); - printf("Fatal: pditsl = %g is negative.\n", model->BSIM4pditsl); + if (model->BSIM4sbref <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: SBref = %g is not positive.\n", model->BSIM4sbref)); Fatal_Flag = 1; } + } + + if ((here->BSIM4l + model->BSIM4xl) <= model->BSIM4xgl) + { + wl_append_word(&wl, &wl, tprintf("Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n")); + Fatal_Flag = 1; + } + if (here->BSIM4ngcon < 1.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: The parameter ngcon cannot be smaller than one.\n")); + Fatal_Flag = 1; + } + if ((here->BSIM4ngcon != 1.0) && (here->BSIM4ngcon != 2.0)) + { + here->BSIM4ngcon = 1.0; + wl_append_word(&wl, &wl, tprintf("Warning: Ngcon must be equal to one or two; reset to 1.0.\n")); + } + + if (model->BSIM4gbmin < 1.0e-20) + { + wl_append_word(&wl, &wl, tprintf("Warning: Gbmin = %g is too small.\n", model->BSIM4gbmin)); + } - /* Check gate current parameters */ - if (model->BSIM4igbMod) { + /* Check saturation parameters */ + if (pParam->BSIM4fprout < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: fprout = %g is negative.\n", pParam->BSIM4fprout)); + Fatal_Flag = 1; + } + if (pParam->BSIM4pdits < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: pdits = %g is negative.\n", pParam->BSIM4pdits)); + Fatal_Flag = 1; + } + if (model->BSIM4pditsl < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: pditsl = %g is negative.\n", model->BSIM4pditsl)); + Fatal_Flag = 1; + } + + /* Check gate current parameters */ + if (model->BSIM4igbMod) { if (pParam->BSIM4nigbinv <= 0.0) - { fprintf(fplog, "Fatal: nigbinv = %g is non-positive.\n", - pParam->BSIM4nigbinv); - printf("Fatal: nigbinv = %g is non-positive.\n", pParam->BSIM4nigbinv); + { + wl_append_word(&wl, &wl, tprintf("Fatal: nigbinv = %g is non-positive.\n", pParam->BSIM4nigbinv)); Fatal_Flag = 1; } if (pParam->BSIM4nigbacc <= 0.0) - { fprintf(fplog, "Fatal: nigbacc = %g is non-positive.\n", - pParam->BSIM4nigbacc); - printf("Fatal: nigbacc = %g is non-positive.\n", pParam->BSIM4nigbacc); + { + wl_append_word(&wl, &wl, tprintf("Fatal: nigbacc = %g is non-positive.\n", pParam->BSIM4nigbacc)); Fatal_Flag = 1; } - } - if (model->BSIM4igcMod) { + } + if (model->BSIM4igcMod) { if (pParam->BSIM4nigc <= 0.0) - { fprintf(fplog, "Fatal: nigc = %g is non-positive.\n", - pParam->BSIM4nigc); - printf("Fatal: nigc = %g is non-positive.\n", pParam->BSIM4nigc); + { + wl_append_word(&wl, &wl, tprintf("Fatal: nigc = %g is non-positive.\n", pParam->BSIM4nigc)); Fatal_Flag = 1; } if (pParam->BSIM4poxedge <= 0.0) - { fprintf(fplog, "Fatal: poxedge = %g is non-positive.\n", - pParam->BSIM4poxedge); - printf("Fatal: poxedge = %g is non-positive.\n", pParam->BSIM4poxedge); + { + wl_append_word(&wl, &wl, tprintf("Fatal: poxedge = %g is non-positive.\n", pParam->BSIM4poxedge)); Fatal_Flag = 1; } if (pParam->BSIM4pigcd <= 0.0) - { fprintf(fplog, "Fatal: pigcd = %g is non-positive.\n", - pParam->BSIM4pigcd); - printf("Fatal: pigcd = %g is non-positive.\n", pParam->BSIM4pigcd); + { + wl_append_word(&wl, &wl, tprintf("Fatal: pigcd = %g is non-positive.\n", pParam->BSIM4pigcd)); Fatal_Flag = 1; } - } + } - /* Check capacitance parameters */ - if (pParam->BSIM4clc < 0.0) - { fprintf(fplog, "Fatal: Clc = %g is negative.\n", pParam->BSIM4clc); - printf("Fatal: Clc = %g is negative.\n", pParam->BSIM4clc); - Fatal_Flag = 1; - } - - /* Check overlap capacitance parameters */ - if (pParam->BSIM4ckappas < 0.02) - { fprintf(fplog, "Warning: ckappas = %g is too small. Set to 0.02\n", - pParam->BSIM4ckappas); - printf("Warning: ckappas = %g is too small.\n", pParam->BSIM4ckappas); - pParam->BSIM4ckappas = 0.02; - } - if (pParam->BSIM4ckappad < 0.02) - { fprintf(fplog, "Warning: ckappad = %g is too small. Set to 0.02\n", - pParam->BSIM4ckappad); - printf("Warning: ckappad = %g is too small.\n", pParam->BSIM4ckappad); - pParam->BSIM4ckappad = 0.02; - } - - if (model->BSIM4vtss < 0.0) - { fprintf(fplog, "Fatal: Vtss = %g is negative.\n", - model->BSIM4vtss); - printf("Fatal: Vtss = %g is negative.\n", - model->BSIM4vtss); - Fatal_Flag = 1; - } - if (model->BSIM4vtsd < 0.0) - { fprintf(fplog, "Fatal: Vtsd = %g is negative.\n", - model->BSIM4vtsd); - printf("Fatal: Vtsd = %g is negative.\n", - model->BSIM4vtsd); - Fatal_Flag = 1; - } - if (model->BSIM4vtssws < 0.0) - { fprintf(fplog, "Fatal: Vtssws = %g is negative.\n", - model->BSIM4vtssws); - printf("Fatal: Vtssws = %g is negative.\n", - model->BSIM4vtssws); - Fatal_Flag = 1; - } - if (model->BSIM4vtsswd < 0.0) - { fprintf(fplog, "Fatal: Vtsswd = %g is negative.\n", - model->BSIM4vtsswd); - printf("Fatal: Vtsswd = %g is negative.\n", - model->BSIM4vtsswd); - Fatal_Flag = 1; - } - if (model->BSIM4vtsswgs < 0.0) - { fprintf(fplog, "Fatal: Vtsswgs = %g is negative.\n", - model->BSIM4vtsswgs); - printf("Fatal: Vtsswgs = %g is negative.\n", - model->BSIM4vtsswgs); - Fatal_Flag = 1; - } - if (model->BSIM4vtsswgd < 0.0) - { fprintf(fplog, "Fatal: Vtsswgd = %g is negative.\n", - model->BSIM4vtsswgd); - printf("Fatal: Vtsswgd = %g is negative.\n", - model->BSIM4vtsswgd); - Fatal_Flag = 1; - } + /* Check capacitance parameters */ + if (pParam->BSIM4clc < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Clc = %g is negative.\n", pParam->BSIM4clc)); + Fatal_Flag = 1; + } + /* Check overlap capacitance parameters */ + if (pParam->BSIM4ckappas < 0.02) + { + wl_append_word(&wl, &wl, tprintf("Warning: ckappas = %g is too small.\n", pParam->BSIM4ckappas)); + pParam->BSIM4ckappas = 0.02; + } + if (pParam->BSIM4ckappad < 0.02) + { + wl_append_word(&wl, &wl, tprintf("Warning: ckappad = %g is too small.\n", pParam->BSIM4ckappad)); + pParam->BSIM4ckappad = 0.02; + } - if (model->BSIM4paramChk ==1) - { -/* Check L and W parameters */ + if (model->BSIM4vtss < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtss = %g is negative.\n", + model->BSIM4vtss)); + Fatal_Flag = 1; + } + if (model->BSIM4vtsd < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtsd = %g is negative.\n", + model->BSIM4vtsd)); + Fatal_Flag = 1; + } + if (model->BSIM4vtssws < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtssws = %g is negative.\n", + model->BSIM4vtssws)); + Fatal_Flag = 1; + } + if (model->BSIM4vtsswd < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtsswd = %g is negative.\n", + model->BSIM4vtsswd)); + Fatal_Flag = 1; + } + if (model->BSIM4vtsswgs < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtsswgs = %g is negative.\n", + model->BSIM4vtsswgs)); + Fatal_Flag = 1; + } + if (model->BSIM4vtsswgd < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtsswgd = %g is negative.\n", + model->BSIM4vtsswgd)); + Fatal_Flag = 1; + } + + + if (model->BSIM4paramChk == 1) + { + /* Check L and W parameters */ if (pParam->BSIM4leff <= 1.0e-9) - { fprintf(fplog, "Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", - pParam->BSIM4leff); - printf("Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", - pParam->BSIM4leff); - } - + { + wl_append_word(&wl, &wl, tprintf("Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", + pParam->BSIM4leff)); + } + if (pParam->BSIM4leffCV <= 1.0e-9) - { fprintf(fplog, "Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", - pParam->BSIM4leffCV); - printf("Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", - pParam->BSIM4leffCV); - } - + { + wl_append_word(&wl, &wl, tprintf("Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", + pParam->BSIM4leffCV)); + } + if (pParam->BSIM4weff <= 1.0e-9) - { fprintf(fplog, "Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", - pParam->BSIM4weff); - printf("Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", - pParam->BSIM4weff); - } - + { + wl_append_word(&wl, &wl, tprintf("Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", + pParam->BSIM4weff)); + } + if (pParam->BSIM4weffCV <= 1.0e-9) - { fprintf(fplog, "Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", - pParam->BSIM4weffCV); - printf("Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", - pParam->BSIM4weffCV); - } - + { + wl_append_word(&wl, &wl, tprintf("Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", + pParam->BSIM4weffCV)); + } + /* Check threshold voltage parameters */ if (model->BSIM4toxe < 1.0e-10) - { fprintf(fplog, "Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", - model->BSIM4toxe); - printf("Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", model->BSIM4toxe); + { + wl_append_word(&wl, &wl, tprintf("Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", model->BSIM4toxe)); } - if (here->BSIM4toxp < 1.0e-10) - { fprintf(fplog, "Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", - here->BSIM4toxp); - printf("Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", here->BSIM4toxp); + if (model->BSIM4toxp < 1.0e-10) + { + wl_append_word(&wl, &wl, tprintf("Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", model->BSIM4toxp)); } if (model->BSIM4toxm < 1.0e-10) - { fprintf(fplog, "Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", - model->BSIM4toxm); - printf("Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", model->BSIM4toxm); + { + wl_append_word(&wl, &wl, tprintf("Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", model->BSIM4toxm)); } if (pParam->BSIM4ndep <= 1.0e12) - { fprintf(fplog, "Warning: Ndep = %g may be too small.\n", - pParam->BSIM4ndep); - printf("Warning: Ndep = %g may be too small.\n", - pParam->BSIM4ndep); + { + wl_append_word(&wl, &wl, tprintf("Warning: Ndep = %g may be too small.\n", + pParam->BSIM4ndep)); } else if (pParam->BSIM4ndep >= 1.0e21) - { fprintf(fplog, "Warning: Ndep = %g may be too large.\n", - pParam->BSIM4ndep); - printf("Warning: Ndep = %g may be too large.\n", - pParam->BSIM4ndep); + { + wl_append_word(&wl, &wl, tprintf("Warning: Ndep = %g may be too large.\n", + pParam->BSIM4ndep)); } - if (pParam->BSIM4nsub <= 1.0e14) - { fprintf(fplog, "Warning: Nsub = %g may be too small.\n", - pParam->BSIM4nsub); - printf("Warning: Nsub = %g may be too small.\n", - pParam->BSIM4nsub); + if (pParam->BSIM4nsub <= 1.0e14) + { + wl_append_word(&wl, &wl, tprintf("Warning: Nsub = %g may be too small.\n", + pParam->BSIM4nsub)); } else if (pParam->BSIM4nsub >= 1.0e21) - { fprintf(fplog, "Warning: Nsub = %g may be too large.\n", - pParam->BSIM4nsub); - printf("Warning: Nsub = %g may be too large.\n", - pParam->BSIM4nsub); + { + wl_append_word(&wl, &wl, tprintf("Warning: Nsub = %g may be too large.\n", + pParam->BSIM4nsub)); } if ((pParam->BSIM4ngate > 0.0) && (pParam->BSIM4ngate <= 1.e18)) - { fprintf(fplog, "Warning: Ngate = %g is less than 1.E18cm^-3.\n", - pParam->BSIM4ngate); - printf("Warning: Ngate = %g is less than 1.E18cm^-3.\n", - pParam->BSIM4ngate); + { + wl_append_word(&wl, &wl, tprintf("Warning: Ngate = %g is less than 1.E18cm^-3.\n", + pParam->BSIM4ngate)); } - + if (pParam->BSIM4dvt0 < 0.0) - { fprintf(fplog, "Warning: Dvt0 = %g is negative.\n", - pParam->BSIM4dvt0); - printf("Warning: Dvt0 = %g is negative.\n", pParam->BSIM4dvt0); + { + wl_append_word(&wl, &wl, tprintf("Warning: Dvt0 = %g is negative.\n", pParam->BSIM4dvt0)); } - + if (fabs(1.0e-8 / (pParam->BSIM4w0 + pParam->BSIM4weff)) > 10.0) - { fprintf(fplog, "Warning: (W0 + Weff) may be too small.\n"); - printf("Warning: (W0 + Weff) may be too small.\n"); + { + wl_append_word(&wl, &wl, tprintf("Warning: (W0 + Weff) may be too small.\n")); } -/* Check subthreshold parameters */ + /* Check subthreshold parameters */ if (pParam->BSIM4nfactor < 0.0) - { fprintf(fplog, "Warning: Nfactor = %g is negative.\n", - pParam->BSIM4nfactor); - printf("Warning: Nfactor = %g is negative.\n", pParam->BSIM4nfactor); + { + wl_append_word(&wl, &wl, tprintf("Warning: Nfactor = %g is negative.\n", pParam->BSIM4nfactor)); } if (pParam->BSIM4cdsc < 0.0) - { fprintf(fplog, "Warning: Cdsc = %g is negative.\n", - pParam->BSIM4cdsc); - printf("Warning: Cdsc = %g is negative.\n", pParam->BSIM4cdsc); + { + wl_append_word(&wl, &wl, tprintf("Warning: Cdsc = %g is negative.\n", pParam->BSIM4cdsc)); } if (pParam->BSIM4cdscd < 0.0) - { fprintf(fplog, "Warning: Cdscd = %g is negative.\n", - pParam->BSIM4cdscd); - printf("Warning: Cdscd = %g is negative.\n", pParam->BSIM4cdscd); + { + wl_append_word(&wl, &wl, tprintf("Warning: Cdscd = %g is negative.\n", pParam->BSIM4cdscd)); } -/* Check DIBL parameters */ + /* Check DIBL parameters */ if (here->BSIM4eta0 < 0.0) - { fprintf(fplog, "Warning: Eta0 = %g is negative.\n", - here->BSIM4eta0); - printf("Warning: Eta0 = %g is negative.\n", here->BSIM4eta0); - } - -/* Check Abulk parameters */ - if (fabs(1.0e-8 / (pParam->BSIM4b1 + pParam->BSIM4weff)) > 10.0) - { fprintf(fplog, "Warning: (B1 + Weff) may be too small.\n"); - printf("Warning: (B1 + Weff) may be too small.\n"); - } - - -/* Check Saturation parameters */ - if (pParam->BSIM4a2 < 0.01) - { fprintf(fplog, "Warning: A2 = %g is too small. Set to 0.01.\n", pParam->BSIM4a2); - printf("Warning: A2 = %g is too small. Set to 0.01.\n", - pParam->BSIM4a2); + { + wl_append_word(&wl, &wl, tprintf("Warning: Eta0 = %g is negative.\n", here->BSIM4eta0)); + } + + /* Check Abulk parameters */ + if (fabs(1.0e-8 / (pParam->BSIM4b1 + pParam->BSIM4weff)) > 10.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: (B1 + Weff) may be too small.\n")); + } + + + /* Check Saturation parameters */ + if (pParam->BSIM4a2 < 0.01) + { + wl_append_word(&wl, &wl, tprintf("Warning: A2 = %g is too small. Set to 0.01.\n", + pParam->BSIM4a2)); pParam->BSIM4a2 = 0.01; } else if (pParam->BSIM4a2 > 1.0) - { fprintf(fplog, "Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n", - pParam->BSIM4a2); - printf("Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n", - pParam->BSIM4a2); + { + 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->BSIM4a2)); pParam->BSIM4a2 = 1.0; pParam->BSIM4a1 = 0.0; } if (pParam->BSIM4prwg < 0.0) - { fprintf(fplog, "Warning: Prwg = %g is negative. Set to zero.\n", - pParam->BSIM4prwg); - printf("Warning: Prwg = %g is negative. Set to zero.\n", - pParam->BSIM4prwg); + { + wl_append_word(&wl, &wl, tprintf("Warning: Prwg = %g is negative. Set to zero.\n", + pParam->BSIM4prwg)); pParam->BSIM4prwg = 0.0; } if (pParam->BSIM4rdsw < 0.0) - { fprintf(fplog, "Warning: Rdsw = %g is negative. Set to zero.\n", - pParam->BSIM4rdsw); - printf("Warning: Rdsw = %g is negative. Set to zero.\n", - pParam->BSIM4rdsw); + { + wl_append_word(&wl, &wl, tprintf("Warning: Rdsw = %g is negative. Set to zero.\n", + pParam->BSIM4rdsw)); pParam->BSIM4rdsw = 0.0; pParam->BSIM4rds0 = 0.0; } if (pParam->BSIM4rds0 < 0.0) - { fprintf(fplog, "Warning: Rds at current temperature = %g is negative. Set to zero.\n", - pParam->BSIM4rds0); - printf("Warning: Rds at current temperature = %g is negative. Set to zero.\n", - pParam->BSIM4rds0); + { + wl_append_word(&wl, &wl, tprintf("Warning: Rds at current temperature = %g is negative. Set to zero.\n", + pParam->BSIM4rds0)); pParam->BSIM4rds0 = 0.0; } if (pParam->BSIM4rdswmin < 0.0) - { fprintf(fplog, "Warning: Rdswmin at current temperature = %g is negative. Set to zero.\n", - pParam->BSIM4rdswmin); - printf("Warning: Rdswmin at current temperature = %g is negative. Set to zero.\n", - pParam->BSIM4rdswmin); + { + wl_append_word(&wl, &wl, tprintf("Warning: Rdswmin at current temperature = %g is negative. Set to zero.\n", + pParam->BSIM4rdswmin)); pParam->BSIM4rdswmin = 0.0; } if (pParam->BSIM4pscbe2 <= 0.0) - { fprintf(fplog, "Warning: Pscbe2 = %g is not positive.\n", - pParam->BSIM4pscbe2); - printf("Warning: Pscbe2 = %g is not positive.\n", pParam->BSIM4pscbe2); + { + wl_append_word(&wl, &wl, tprintf("Warning: Pscbe2 = %g is not positive.\n", pParam->BSIM4pscbe2)); } if (pParam->BSIM4vsattemp < 1.0e3) - { fprintf(fplog, "Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM4vsattemp); - printf("Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM4vsattemp); + { + wl_append_word(&wl, &wl, tprintf("Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM4vsattemp)); } - if((model->BSIM4lambdaGiven) && (pParam->BSIM4lambda > 0.0) ) - { - if (pParam->BSIM4lambda > 1.0e-9) - { fprintf(fplog, "Warning: Lambda = %g may be too large.\n", pParam->BSIM4lambda); - printf("Warning: Lambda = %g may be too large.\n", pParam->BSIM4lambda); + if ((model->BSIM4lambdaGiven) && (pParam->BSIM4lambda > 0.0)) + { + if (pParam->BSIM4lambda > 1.0e-9) + { + wl_append_word(&wl, &wl, tprintf("Warning: Lambda = %g may be too large.\n", pParam->BSIM4lambda)); + } } - } - if((model->BSIM4vtlGiven) && (pParam->BSIM4vtl > 0.0) ) - { - if (pParam->BSIM4vtl < 6.0e4) - { fprintf(fplog, "Warning: Thermal velocity vtl = %g may be too small.\n", pParam->BSIM4vtl); - printf("Warning: Thermal velocity vtl = %g may be too small.\n", pParam->BSIM4vtl); - } + if ((model->BSIM4vtlGiven) && (pParam->BSIM4vtl > 0.0)) + { + if (pParam->BSIM4vtl < 6.0e4) + { + wl_append_word(&wl, &wl, tprintf("Warning: Thermal velocity vtl = %g may be too small.\n", pParam->BSIM4vtl)); + } - if (pParam->BSIM4xn < 3.0) - { fprintf(fplog, "Warning: back scattering coeff xn = %g is too small.\n", pParam->BSIM4xn); - printf("Warning: back scattering coeff xn = %g is too small. Reset to 3.0 \n", pParam->BSIM4xn); - pParam->BSIM4xn = 3.0; - } + if (pParam->BSIM4xn < 3.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: back scattering coeff xn = %g is too small. Reset to 3.0 \n", pParam->BSIM4xn)); + pParam->BSIM4xn = 3.0; + } - if (model->BSIM4lc < 0.0) - { fprintf(fplog, "Warning: back scattering coeff lc = %g is too small.\n", model->BSIM4lc); - printf("Warning: back scattering coeff lc = %g is too small. Reset to 0.0\n", model->BSIM4lc); - pParam->BSIM4lc = 0.0; + if (model->BSIM4lc < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: back scattering coeff lc = %g is too small. Reset to 0.0\n", model->BSIM4lc)); + pParam->BSIM4lc = 0.0; + } } - } if (pParam->BSIM4pdibl1 < 0.0) - { fprintf(fplog, "Warning: Pdibl1 = %g is negative.\n", - pParam->BSIM4pdibl1); - printf("Warning: Pdibl1 = %g is negative.\n", pParam->BSIM4pdibl1); - } - if (pParam->BSIM4pdibl2 < 0.0) - { fprintf(fplog, "Warning: Pdibl2 = %g is negative.\n", - pParam->BSIM4pdibl2); - printf("Warning: Pdibl2 = %g is negative.\n", pParam->BSIM4pdibl2); - } - -/* Check stress effect parameters */ - if((here->BSIM4sa > 0.0) && (here->BSIM4sb > 0.0) && - ((here->BSIM4nf == 1.0) || ((here->BSIM4nf > 1.0) && (here->BSIM4sd > 0.0))) ) - { if (model->BSIM4lodk2 <= 0.0) - { fprintf(fplog, "Warning: LODK2 = %g is not positive.\n",model->BSIM4lodk2); - printf("Warning: LODK2 = %g is not positive.\n",model->BSIM4lodk2); - } - if (model->BSIM4lodeta0 <= 0.0) - { fprintf(fplog, "Warning: LODETA0 = %g is not positive.\n",model->BSIM4lodeta0); - printf("Warning: LODETA0 = %g is not positive.\n",model->BSIM4lodeta0); - } - } - -/* Check gate resistance parameters */ - if (here->BSIM4rgateMod == 1) - { if (model->BSIM4rshg <= 0.0) - printf("Warning: rshg should be positive for rgateMod = 1.\n"); - } - else if (here->BSIM4rgateMod == 2) - { if (model->BSIM4rshg <= 0.0) - printf("Warning: rshg <= 0.0 for rgateMod = 2.\n"); - else if (pParam->BSIM4xrcrg1 <= 0.0) - printf("Warning: xrcrg1 <= 0.0 for rgateMod = 2.\n"); - } - if (here->BSIM4rgateMod == 3) - { if (model->BSIM4rshg <= 0.0) - printf("Warning: rshg should be positive for rgateMod = 3.\n"); - else if (pParam->BSIM4xrcrg1 <= 0.0) - printf("Warning: xrcrg1 should be positive for rgateMod = 3.\n"); - } - - /* Check body resistance parameters */ - if (model->BSIM4rbps0 <= 0.0) - { fprintf(fplog, "Fatal: RBPS0 = %g is not positive.\n", - model->BSIM4rbps0 ); - printf("Fatal: RBPS0 = %g is not positive.\n", model->BSIM4rbps0); - Fatal_Flag = 1; - } - if (model->BSIM4rbpd0 <= 0.0) - { fprintf(fplog, "Fatal: RBPD0 = %g is not positive.\n", - model->BSIM4rbpd0 ); - printf("Fatal: RBPD0 = %g is not positive.\n", model->BSIM4rbpd0); - Fatal_Flag = 1; - } - if (model->BSIM4rbpbx0 <= 0.0) - { fprintf(fplog, "Fatal: RBPBX0 = %g is not positive.\n", - model->BSIM4rbpbx0); - printf("Fatal: RBPBX0 = %g is not positive.\n", model->BSIM4rbpbx0); - Fatal_Flag = 1; - } - if (model->BSIM4rbpby0 <= 0.0) - { fprintf(fplog, "Fatal: RBPBY0 = %g is not positive.\n", - model->BSIM4rbpby0); - printf("Fatal: RBPBY0 = %g is not positive.\n", model->BSIM4rbpby0); - Fatal_Flag = 1; + { + wl_append_word(&wl, &wl, tprintf("Warning: Pdibl1 = %g is negative.\n", pParam->BSIM4pdibl1)); } - if (model->BSIM4rbdbx0 <= 0.0) - { fprintf(fplog, "Fatal: RBDBX0 = %g is not positive.\n", - model->BSIM4rbdbx0); - printf("Fatal: RBDBX0 = %g is not positive.\n", model->BSIM4rbdbx0); - Fatal_Flag = 1; + } + + if (pParam->BSIM4pdibl2 < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Pdibl2 = %g is negative.\n", pParam->BSIM4pdibl2)); + } + + /* Check stress effect parameters */ + if ((here->BSIM4sa > 0.0) && (here->BSIM4sb > 0.0) && + ((here->BSIM4nf == 1.0) || ((here->BSIM4nf > 1.0) && (here->BSIM4sd > 0.0)))) + { + if (model->BSIM4lodk2 <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: LODK2 = %g is not positive.\n", model->BSIM4lodk2)); } - if (model->BSIM4rbdby0 <= 0.0) - { fprintf(fplog, "Fatal: RBDBY0 = %g is not positive.\n", - model->BSIM4rbdby0); - printf("Fatal: RBDBY0 = %g is not positive.\n", model->BSIM4rbdby0); - Fatal_Flag = 1; + if (model->BSIM4lodeta0 <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: LODETA0 = %g is not positive.\n", model->BSIM4lodeta0)); } - if (model->BSIM4rbsbx0 <= 0.0) - { fprintf(fplog, "Fatal: RBSBX0 = %g is not positive.\n", - model->BSIM4rbsbx0); - printf("Fatal: RBSBX0 = %g is not positive.\n", model->BSIM4rbsbx0); - Fatal_Flag = 1; + } + +/* Check gate resistance parameters */ + if (here->BSIM4rgateMod == 1) + { if (model->BSIM4rshg <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: rshg should be positive for rgateMod = 1.\n")); + } + else if (here->BSIM4rgateMod == 2) + { if (model->BSIM4rshg <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: rshg <= 0.0 for rgateMod = 2.\n")); + else if (pParam->BSIM4xrcrg1 <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: xrcrg1 <= 0.0 for rgateMod = 2.\n")); + } + if (here->BSIM4rgateMod == 3) + { if (model->BSIM4rshg <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: rshg should be positive for rgateMod = 3.\n")); + else if (pParam->BSIM4xrcrg1 <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: xrcrg1 should be positive for rgateMod = 3.\n")); + } + + /* Check body resistance parameters */ + if (model->BSIM4rbps0 <= 0.0) + { wl_append_word(&wl, &wl, tprintf("Fatal: RBPS0 = %g is not positive.\n", model->BSIM4rbps0)); + Fatal_Flag = 1; + } + if (model->BSIM4rbpd0 <= 0.0) + { wl_append_word(&wl, &wl, tprintf("Fatal: RBPD0 = %g is not positive.\n", model->BSIM4rbpd0)); + Fatal_Flag = 1; + } + if (model->BSIM4rbpbx0 <= 0.0) + { wl_append_word(&wl, &wl, tprintf("Fatal: RBPBX0 = %g is not positive.\n", model->BSIM4rbpbx0)); + Fatal_Flag = 1; + } + if (model->BSIM4rbpby0 <= 0.0) + { wl_append_word(&wl, &wl, tprintf("Fatal: RBPBY0 = %g is not positive.\n", model->BSIM4rbpby0)); + Fatal_Flag = 1; + } + if (model->BSIM4rbdbx0 <= 0.0) + { wl_append_word(&wl, &wl, tprintf("Fatal: RBDBX0 = %g is not positive.\n", model->BSIM4rbdbx0)); + Fatal_Flag = 1; + } + if (model->BSIM4rbdby0 <= 0.0) + { wl_append_word(&wl, &wl, tprintf("Fatal: RBDBY0 = %g is not positive.\n", model->BSIM4rbdby0)); + Fatal_Flag = 1; + } + if (model->BSIM4rbsbx0 <= 0.0) + { wl_append_word(&wl, &wl, tprintf("Fatal: RBSBX0 = %g is not positive.\n", model->BSIM4rbsbx0)); + Fatal_Flag = 1; + } + if (model->BSIM4rbsby0 <= 0.0) + { wl_append_word(&wl, &wl, tprintf("Fatal: RBSBY0 = %g is not positive.\n", model->BSIM4rbsby0)); + Fatal_Flag = 1; + } + + /* Check capacitance parameters */ + if (pParam->BSIM4noff < 0.1) + { + wl_append_word(&wl, &wl, tprintf("Warning: Noff = %g is too small.\n", pParam->BSIM4noff)); + } + + if (pParam->BSIM4voffcv < -0.5) + { + wl_append_word(&wl, &wl, tprintf("Warning: Voffcv = %g is too small.\n", pParam->BSIM4voffcv)); + } + + if (pParam->BSIM4moin < 5.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Moin = %g is too small.\n", pParam->BSIM4moin)); + } + if (pParam->BSIM4moin > 25.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Moin = %g is too large.\n", pParam->BSIM4moin)); + } + if (model->BSIM4capMod == 2) { + if (pParam->BSIM4acde < 0.1) + { + wl_append_word(&wl, &wl, tprintf("Warning: Acde = %g is too small.\n", pParam->BSIM4acde)); } - if (model->BSIM4rbsby0 <= 0.0) - { fprintf(fplog, "Fatal: RBSBY0 = %g is not positive.\n", - model->BSIM4rbsby0); - printf("Fatal: RBSBY0 = %g is not positive.\n", model->BSIM4rbsby0); - Fatal_Flag = 1; + if (pParam->BSIM4acde > 1.6) + { + wl_append_word(&wl, &wl, tprintf("Warning: Acde = %g is too large.\n", pParam->BSIM4acde)); } + } -/* Check capacitance parameters */ - if (pParam->BSIM4noff < 0.1) - { fprintf(fplog, "Warning: Noff = %g is too small.\n", - pParam->BSIM4noff); - printf("Warning: Noff = %g is too small.\n", pParam->BSIM4noff); - } - - if (pParam->BSIM4voffcv < -0.5) - { fprintf(fplog, "Warning: Voffcv = %g is too small.\n", - pParam->BSIM4voffcv); - printf("Warning: Voffcv = %g is too small.\n", pParam->BSIM4voffcv); - } - if (pParam->BSIM4moin < 5.0) - { fprintf(fplog, "Warning: Moin = %g is too small.\n", - pParam->BSIM4moin); - printf("Warning: Moin = %g is too small.\n", pParam->BSIM4moin); - } - if (pParam->BSIM4moin > 25.0) - { fprintf(fplog, "Warning: Moin = %g is too large.\n", - pParam->BSIM4moin); - printf("Warning: Moin = %g is too large.\n", pParam->BSIM4moin); - } - if(model->BSIM4capMod ==2) { - if (pParam->BSIM4acde < 0.1) - { fprintf(fplog, "Warning: Acde = %g is too small.\n", - pParam->BSIM4acde); - printf("Warning: Acde = %g is too small.\n", pParam->BSIM4acde); - } - if (pParam->BSIM4acde > 1.6) - { fprintf(fplog, "Warning: Acde = %g is too large.\n", - pParam->BSIM4acde); - printf("Warning: Acde = %g is too large.\n", pParam->BSIM4acde); - } - } - -/* Check overlap capacitance parameters */ - if (model->BSIM4cgdo < 0.0) - { fprintf(fplog, "Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM4cgdo); - printf("Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM4cgdo); - model->BSIM4cgdo = 0.0; - } - if (model->BSIM4cgso < 0.0) - { fprintf(fplog, "Warning: cgso = %g is negative. Set to zero.\n", model->BSIM4cgso); - printf("Warning: cgso = %g is negative. Set to zero.\n", model->BSIM4cgso); - model->BSIM4cgso = 0.0; - } - if (model->BSIM4cgbo < 0.0) - { fprintf(fplog, "Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM4cgbo); - printf("Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM4cgbo); - model->BSIM4cgbo = 0.0; - } - if (model->BSIM4tnoiMod == 1){ - printf("Warning: TNOIMOD=1 is not supported and may be removed from future version.\n"); - } + /* Check overlap capacitance parameters */ + if (model->BSIM4cgdo < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM4cgdo)); + model->BSIM4cgdo = 0.0; + } + if (model->BSIM4cgso < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: cgso = %g is negative. Set to zero.\n", model->BSIM4cgso)); + model->BSIM4cgso = 0.0; + } + if (model->BSIM4cgbo < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM4cgbo)); + model->BSIM4cgbo = 0.0; + } + if (model->BSIM4tnoiMod == 1){ + wl_append_word(&wl, &wl, tprintf("Warning: TNOIMOD=1 is not supported and may be removed from future version.\n")); + } - if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4))) { + if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4))) { /* v4.7 */ - if (model->BSIM4tnoiMod == 1 || model->BSIM4tnoiMod == 2) { - if (model->BSIM4tnoia < 0.0) { - fprintf(fplog, "Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4tnoia); - printf("Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4tnoia); - model->BSIM4tnoia = 0.0; - } - if (model->BSIM4tnoib < 0.0) { - fprintf(fplog, "Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4tnoib); - printf("Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4tnoib); - model->BSIM4tnoib = 0.0; - } - if (model->BSIM4rnoia < 0.0) { - fprintf(fplog, "Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4rnoia); - printf("Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4rnoia); - model->BSIM4rnoia = 0.0; - } - if (model->BSIM4rnoib < 0.0) { - fprintf(fplog, "Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4rnoib); - printf("Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4rnoib); - model->BSIM4rnoib = 0.0; - } + if (model->BSIM4tnoiMod == 1 || model->BSIM4tnoiMod == 2) { + if (model->BSIM4tnoia < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4tnoia)); + model->BSIM4tnoia = 0.0; + } + if (model->BSIM4tnoib < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4tnoib)); + model->BSIM4tnoib = 0.0; } - /* v4.7 */ - if (model->BSIM4tnoiMod == 2) { - if (model->BSIM4tnoic < 0.0) { - fprintf(fplog, "Warning: tnoic = %g is negative. Set to zero.\n", model->BSIM4tnoic); - printf("Warning: tnoic = %g is negative. Set to zero.\n", model->BSIM4tnoic); - model->BSIM4tnoic = 0.0; - } - if (model->BSIM4rnoic < 0.0) { - fprintf(fplog, "Warning: rnoic = %g is negative. Set to zero.\n", model->BSIM4rnoic); - printf("Warning: rnoic = %g is negative. Set to zero.\n", model->BSIM4rnoic); - model->BSIM4rnoic = 0.0; - } + if (model->BSIM4rnoia < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4rnoia)); + model->BSIM4rnoia = 0.0; + } + if (model->BSIM4rnoib < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4rnoib)); + model->BSIM4rnoib = 0.0; } } - else - { - if (model->BSIM4tnoiMod == 1){ - if (model->BSIM4tnoia < 0.0) { - fprintf(fplog, "Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4tnoia); - printf("Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4tnoia); - model->BSIM4tnoia = 0.0; - } - if (model->BSIM4tnoib < 0.0) { - fprintf(fplog, "Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4tnoib); - printf("Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4tnoib); - model->BSIM4tnoib = 0.0; - } - if (model->BSIM4rnoia < 0.0) { - fprintf(fplog, "Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4rnoia); - printf("Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4rnoia); - model->BSIM4rnoia = 0.0; - } - if (model->BSIM4rnoib < 0.0) { - fprintf(fplog, "Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4rnoib); - printf("Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4rnoib); - model->BSIM4rnoib = 0.0; - } + + /* v4.7 */ + if (model->BSIM4tnoiMod == 2) { + if (model->BSIM4tnoic < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: tnoic = %g is negative. Set to zero.\n", model->BSIM4tnoic)); + model->BSIM4tnoic = 0.0; + } + if (model->BSIM4rnoic < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: rnoic = %g is negative. Set to zero.\n", model->BSIM4rnoic)); + model->BSIM4rnoic = 0.0; } } + } + else + { + if (model->BSIM4tnoiMod == 1){ + if (model->BSIM4tnoia < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4tnoia)); + model->BSIM4tnoia = 0.0; + } + if (model->BSIM4tnoib < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4tnoib)); + model->BSIM4tnoib = 0.0; + } + if (model->BSIM4rnoia < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4rnoia)); + model->BSIM4rnoia = 0.0; + } + if (model->BSIM4rnoib < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4rnoib)); + model->BSIM4rnoib = 0.0; + } + } + } - /* Limits of Njs and Njd modified in BSIM4.7 */ - if (model->BSIM4SjctEmissionCoeff < 0.1) { - fprintf(fplog, "Warning: Njs = %g is less than 0.1. Setting Njs to 0.1.\n", model->BSIM4SjctEmissionCoeff); - printf("Warning: Njs = %g is less than 0.1. Setting Njs to 0.1.\n", model->BSIM4SjctEmissionCoeff); + /* Limits of Njs and Njd modified in BSIM4.7 */ + if (model->BSIM4SjctEmissionCoeff < 0.1) { + wl_append_word(&wl, &wl, tprintf("Warning: Njs = %g is less than 0.1. Setting Njs to 0.1.\n", model->BSIM4SjctEmissionCoeff)); model->BSIM4SjctEmissionCoeff = 0.1; - } - else if (model->BSIM4SjctEmissionCoeff < 0.7) { - fprintf(fplog, "Warning: Njs = %g is less than 0.7.\n", model->BSIM4SjctEmissionCoeff); - printf("Warning: Njs = %g is less than 0.7.\n", model->BSIM4SjctEmissionCoeff); - } - if (model->BSIM4DjctEmissionCoeff < 0.1) { - fprintf(fplog, "Warning: Njd = %g is less than 0.1. Setting Njd to 0.1.\n", model->BSIM4DjctEmissionCoeff); - printf("Warning: Njd = %g is less than 0.1. Setting Njd to 0.1.\n", model->BSIM4DjctEmissionCoeff); - model->BSIM4DjctEmissionCoeff = 0.1; - } - else if (model->BSIM4DjctEmissionCoeff < 0.7) { - fprintf(fplog, "Warning: Njd = %g is less than 0.7.\n", model->BSIM4DjctEmissionCoeff); - printf("Warning: Njd = %g is less than 0.7.\n", model->BSIM4DjctEmissionCoeff); - } - - if (model->BSIM4njtsstemp < 0.0) - { fprintf(fplog, "Warning: Njts = %g is negative at temperature = %g.\n", - model->BSIM4njtsstemp, ckt->CKTtemp); - printf("Warning: Njts = %g is negative at temperature = %g.\n", - model->BSIM4njtsstemp, ckt->CKTtemp); - } - if (model->BSIM4njtsswstemp < 0.0) - { fprintf(fplog, "Warning: Njtssw = %g is negative at temperature = %g.\n", - model->BSIM4njtsswstemp, ckt->CKTtemp); - printf("Warning: Njtssw = %g is negative at temperature = %g.\n", - model->BSIM4njtsswstemp, ckt->CKTtemp); - } - if (model->BSIM4njtsswgstemp < 0.0) - { fprintf(fplog, "Warning: Njtsswg = %g is negative at temperature = %g.\n", - model->BSIM4njtsswgstemp, ckt->CKTtemp); - printf("Warning: Njtsswg = %g is negative at temperature = %g.\n", - model->BSIM4njtsswgstemp, ckt->CKTtemp); - } - - if (model->BSIM4njtsdGiven && model->BSIM4njtsdtemp < 0.0) - { fprintf(fplog, "Warning: Njtsd = %g is negative at temperature = %g.\n", - model->BSIM4njtsdtemp, ckt->CKTtemp); - printf("Warning: Njtsd = %g is negative at temperature = %g.\n", - model->BSIM4njtsdtemp, ckt->CKTtemp); - } - if (model->BSIM4njtsswdGiven && model->BSIM4njtsswdtemp < 0.0) - { fprintf(fplog, "Warning: Njtsswd = %g is negative at temperature = %g.\n", - model->BSIM4njtsswdtemp, ckt->CKTtemp); - printf("Warning: Njtsswd = %g is negative at temperature = %g.\n", - model->BSIM4njtsswdtemp, ckt->CKTtemp); - } - if (model->BSIM4njtsswgdGiven && model->BSIM4njtsswgdtemp < 0.0) - { fprintf(fplog, "Warning: Njtsswgd = %g is negative at temperature = %g.\n", - model->BSIM4njtsswgdtemp, ckt->CKTtemp); - printf("Warning: Njtsswgd = %g is negative at temperature = %g.\n", - model->BSIM4njtsswgdtemp, ckt->CKTtemp); - } - - if (model->BSIM4ntnoi < 0.0) - { fprintf(fplog, "Warning: ntnoi = %g is negative. Set to zero.\n", model->BSIM4ntnoi); - printf("Warning: ntnoi = %g is negative. Set to zero.\n", model->BSIM4ntnoi); - model->BSIM4ntnoi = 0.0; - } - - /* diode model */ - if (model->BSIM4SbulkJctBotGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJS = %g is too big. Set to 0.99.\n", model->BSIM4SbulkJctBotGradingCoeff); - printf("Warning: MJS = %g is too big. Set to 0.99.\n", model->BSIM4SbulkJctBotGradingCoeff); - model->BSIM4SbulkJctBotGradingCoeff = 0.99; - } - if (model->BSIM4SbulkJctSideGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJSWS = %g is too big. Set to 0.99.\n", model->BSIM4SbulkJctSideGradingCoeff); - printf("Warning: MJSWS = %g is too big. Set to 0.99.\n", model->BSIM4SbulkJctSideGradingCoeff); - model->BSIM4SbulkJctSideGradingCoeff = 0.99; - } - if (model->BSIM4SbulkJctGateSideGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJSWGS = %g is too big. Set to 0.99.\n", model->BSIM4SbulkJctGateSideGradingCoeff); - printf("Warning: MJSWGS = %g is too big. Set to 0.99.\n", model->BSIM4SbulkJctGateSideGradingCoeff); - model->BSIM4SbulkJctGateSideGradingCoeff = 0.99; - } - - if (model->BSIM4DbulkJctBotGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJD = %g is too big. Set to 0.99.\n", model->BSIM4DbulkJctBotGradingCoeff); - printf("Warning: MJD = %g is too big. Set to 0.99.\n", model->BSIM4DbulkJctBotGradingCoeff); - model->BSIM4DbulkJctBotGradingCoeff = 0.99; - } - if (model->BSIM4DbulkJctSideGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJSWD = %g is too big. Set to 0.99.\n", model->BSIM4DbulkJctSideGradingCoeff); - printf("Warning: MJSWD = %g is too big. Set to 0.99.\n", model->BSIM4DbulkJctSideGradingCoeff); - model->BSIM4DbulkJctSideGradingCoeff = 0.99; - } - if (model->BSIM4DbulkJctGateSideGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJSWGD = %g is too big. Set to 0.99.\n", model->BSIM4DbulkJctGateSideGradingCoeff); - printf("Warning: MJSWGD = %g is too big. Set to 0.99.\n", model->BSIM4DbulkJctGateSideGradingCoeff); - model->BSIM4DbulkJctGateSideGradingCoeff = 0.99; - } - if (model->BSIM4wpemod == 1) - { - if (model->BSIM4scref <= 0.0) - { fprintf(fplog, "Warning: SCREF = %g is not positive. Set to 1e-6.\n", model->BSIM4scref); - printf("Warning: SCREF = %g is not positive. Set to 1e-6.\n", model->BSIM4scref); - model->BSIM4scref = 1e-6; - } - /*Move these checks to temp.c for sceff calculation*/ - /* - if (here->BSIM4sca < 0.0) - { fprintf(fplog, "Warning: SCA = %g is negative. Set to 0.0.\n", here->BSIM4sca); - printf("Warning: SCA = %g is negative. Set to 0.0.\n", here->BSIM4sca); - here->BSIM4sca = 0.0; - } - if (here->BSIM4scb < 0.0) - { fprintf(fplog, "Warning: SCB = %g is negative. Set to 0.0.\n", here->BSIM4scb); - printf("Warning: SCB = %g is negative. Set to 0.0.\n", here->BSIM4scb); - here->BSIM4scb = 0.0; - } - if (here->BSIM4scc < 0.0) - { fprintf(fplog, "Warning: SCC = %g is negative. Set to 0.0.\n", here->BSIM4scc); - printf("Warning: SCC = %g is negative. Set to 0.0.\n", here->BSIM4scc); - here->BSIM4scc = 0.0; - } - if (here->BSIM4sc < 0.0) - { fprintf(fplog, "Warning: SC = %g is negative. Set to 0.0.\n", here->BSIM4sc); - printf("Warning: SC = %g is negative. Set to 0.0.\n", here->BSIM4sc); - here->BSIM4sc = 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"); + else if (model->BSIM4SjctEmissionCoeff < 0.7) { + wl_append_word(&wl, &wl, tprintf("Warning: Njs = %g is less than 0.7.\n", model->BSIM4SjctEmissionCoeff)); + } + if (model->BSIM4DjctEmissionCoeff < 0.1) + { + wl_append_word(&wl, &wl, tprintf("Warning: Njd = %g is less than 0.1. Setting Njd to 0.1.\n", model->BSIM4DjctEmissionCoeff)); + model->BSIM4DjctEmissionCoeff = 0.1; + } + else if (model->BSIM4DjctEmissionCoeff < 0.7) { + wl_append_word(&wl, &wl, tprintf("Warning: Njd = %g is less than 0.7.\n", model->BSIM4DjctEmissionCoeff)); + } + + if (model->BSIM4njtsstemp < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: Njts = %g is negative at temperature = %g.\n", + model->BSIM4njtsstemp, ckt->CKTtemp)); + } + if (model->BSIM4njtsswstemp < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: Njtssw = %g is negative at temperature = %g.\n", + model->BSIM4njtsswstemp, ckt->CKTtemp)); + } + if (model->BSIM4njtsswgstemp < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: Njtsswg = %g is negative at temperature = %g.\n", + model->BSIM4njtsswgstemp, ckt->CKTtemp)); + } + + if (model->BSIM4njtsdGiven && model->BSIM4njtsdtemp < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Njtsd = %g is negative at temperature = %g.\n", + model->BSIM4njtsdtemp, ckt->CKTtemp)); + } + if (model->BSIM4njtsswdGiven && model->BSIM4njtsswdtemp < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Njtsswd = %g is negative at temperature = %g.\n", + model->BSIM4njtsswdtemp, ckt->CKTtemp)); + } + if (model->BSIM4njtsswgdGiven && model->BSIM4njtsswgdtemp < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Njtsswgd = %g is negative at temperature = %g.\n", + model->BSIM4njtsswgdtemp, ckt->CKTtemp)); + } + + if (model->BSIM4ntnoi < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: ntnoi = %g is negative. Set to zero.\n", model->BSIM4ntnoi)); + model->BSIM4ntnoi = 0.0; + } + + /* diode model */ + if (model->BSIM4SbulkJctBotGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJS = %g is too big. Set to 0.99.\n", model->BSIM4SbulkJctBotGradingCoeff)); + model->BSIM4SbulkJctBotGradingCoeff = 0.99; + } + if (model->BSIM4SbulkJctSideGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJSWS = %g is too big. Set to 0.99.\n", model->BSIM4SbulkJctSideGradingCoeff)); + model->BSIM4SbulkJctSideGradingCoeff = 0.99; + } + if (model->BSIM4SbulkJctGateSideGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJSWGS = %g is too big. Set to 0.99.\n", model->BSIM4SbulkJctGateSideGradingCoeff)); + model->BSIM4SbulkJctGateSideGradingCoeff = 0.99; + } + + if (model->BSIM4DbulkJctBotGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJD = %g is too big. Set to 0.99.\n", model->BSIM4DbulkJctBotGradingCoeff)); + model->BSIM4DbulkJctBotGradingCoeff = 0.99; + } + if (model->BSIM4DbulkJctSideGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJSWD = %g is too big. Set to 0.99.\n", model->BSIM4DbulkJctSideGradingCoeff)); + model->BSIM4DbulkJctSideGradingCoeff = 0.99; + } + if (model->BSIM4DbulkJctGateSideGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJSWGD = %g is too big. Set to 0.99.\n", model->BSIM4DbulkJctGateSideGradingCoeff)); + model->BSIM4DbulkJctGateSideGradingCoeff = 0.99; + } + if (model->BSIM4wpemod == 1) + { + if (model->BSIM4scref <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SCREF = %g is not positive. Set to 1e-6.\n", model->BSIM4scref)); + model->BSIM4scref = 1e-6; + } + if (here->BSIM4sca < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SCA = %g is negative. Set to 0.0.\n", here->BSIM4sca)); + here->BSIM4sca = 0.0; + } + if (here->BSIM4scb < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SCB = %g is negative. Set to 0.0.\n", here->BSIM4scb)); + here->BSIM4scb = 0.0; + } + if (here->BSIM4scc < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SCC = %g is negative. Set to 0.0.\n", here->BSIM4scc)); + here->BSIM4scc = 0.0; + } + if (here->BSIM4sc < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SC = %g is negative. Set to 0.0.\n", here->BSIM4sc)); + here->BSIM4sc = 0.0; + } + } + + if (wlstart->wl_next) { + if ((fplog = fopen("bsim4.out", "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); + + if ((strcmp(model->BSIM4version, "4.8.1")) && (strncmp(model->BSIM4version, "4.81", 4)) && (strncmp(model->BSIM4version, "4.8", 3))) + { + printf("Warning: This model is BSIM4.8.1; you specified a wrong version number '%s'.\n", model->BSIM4version); } return(Fatal_Flag); diff --git a/src/spicelib/devices/bsim4/b4temp.c b/src/spicelib/devices/bsim4/b4temp.c index aa69d7b21..e2afea53c 100644 --- a/src/spicelib/devices/bsim4/b4temp.c +++ b/src/spicelib/devices/bsim4/b4temp.c @@ -2407,7 +2407,8 @@ int Size_Not_Found, i; if (BSIM4checkModel(model, here, ckt)) { - SPfrontEnd->IFerrorf (ERR_FATAL, "Fatal error(s) detected during BSIM4.8.1 parameter checking for %s in model %s", model->BSIM4modName, here->BSIM4name); + SPfrontEnd->IFerrorf(ERR_FATAL, + "detected during BSIM4.8.1 parameter checking for \n model %s of device instance %s\n", model->BSIM4modName, here->BSIM4name); return(E_BADPARM); } } /* End instance */ diff --git a/src/spicelib/devices/bsim4v7/b4v7check.c b/src/spicelib/devices/bsim4v7/b4v7check.c index 5b4d31f29..4b6a28bee 100644 --- a/src/spicelib/devices/bsim4v7/b4v7check.c +++ b/src/spicelib/devices/bsim4v7/b4v7check.c @@ -18,6 +18,7 @@ * Modified by Mohan Dunga, Wenwei Yang, 05/18/2007. * Modified by Wenwei Yang, 07/31/2008 . * Modified by Tanvir Morshed, Darsen Lu 03/27/2011 + * Modified by Holger Vogt, 12/27/2020. **********/ #include "ngspice/ngspice.h" @@ -28,870 +29,811 @@ #include "ngspice/sperror.h" #include "ngspice/devdefs.h" #include "ngspice/suffix.h" +#include "ngspice/wordlist.h" +#include "ngspice/cpextern.h" + + +/* Check for correctness of the BSIM4.7 parameters: + If parameter excursions are found, put the warning or error message into a wordlist. + Only then open a file bsim4v7.out and print the data into the file. */ int BSIM4v7checkModel( BSIM4v7model *model, BSIM4v7instance *here, CKTcircuit *ckt) { -struct bsim4SizeDependParam *pParam; -int Fatal_Flag = 0; -FILE *fplog; - - if ((fplog = fopen("bsim4.out", "w")) != NULL) - { pParam = here->pParam; - fprintf(fplog, "BSIM4v7: Berkeley Short Channel IGFET Model-4\n"); - fprintf(fplog, "Developed by Xuemei (Jane) Xi, Mohan Dunga, Prof. Ali Niknejad and Prof. Chenming Hu in 2003.\n"); - fprintf(fplog, "\n"); - fprintf(fplog, "++++++++++ BSIM4v7 PARAMETER CHECKING BELOW ++++++++++\n"); + struct bsim4SizeDependParam *pParam; + int Fatal_Flag = 0; + FILE *fplog; + wordlist* wl, *wlstart; - if ((strcmp(model->BSIM4v7version, "4.7.0")) && (strncmp(model->BSIM4v7version, "4.70", 4)) && (strncmp(model->BSIM4v7version, "4.7", 3))) - { fprintf(fplog, "Warning: This model is BSIM4.7.0; you specified a wrong version number.\n"); - printf("Warning: This model is BSIM4.7.0; you specified a wrong version number.\n"); - } - fprintf(fplog, "Model = %s\n", model->BSIM4v7modName); + pParam = here->pParam; + if (cp_getvar("ng_nomodcheck", CP_BOOL, NULL, 0)) + return(0); - if ((here->BSIM4v7rgateMod == 2) || (here->BSIM4v7rgateMod == 3)) - { if ((here->BSIM4v7trnqsMod == 1) || (here->BSIM4v7acnqsMod == 1)) - { fprintf(fplog, "Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); - printf("Warning: You've selected both Rg and charge deficit NQS; select one only.\n"); - } - } + wl = wlstart = TMALLOC(wordlist, 1); + wl->wl_prev = NULL; + wl->wl_next = NULL; + wl->wl_word = tprintf("\nChecking parameters for BSIM 4.7 model %s\n", model->BSIM4v7modName); - if (model->BSIM4v7toxe <= 0.0) - { fprintf(fplog, "Fatal: Toxe = %g is not positive.\n", - model->BSIM4v7toxe); - printf("Fatal: Toxe = %g is not positive.\n", model->BSIM4v7toxe); - Fatal_Flag = 1; - } - if (model->BSIM4v7toxp <= 0.0) - { fprintf(fplog, "Fatal: Toxp = %g is not positive.\n", - model->BSIM4v7toxp); - printf("Fatal: Toxp = %g is not positive.\n", model->BSIM4v7toxp); - Fatal_Flag = 1; - } - if (model->BSIM4v7eot <= 0.0) - { fprintf(fplog, "Fatal: EOT = %g is not positive.\n", - model->BSIM4v7eot); - printf("Fatal: EOT = %g is not positive.\n", model->BSIM4v7eot); - Fatal_Flag = 1; - } - if (model->BSIM4v7epsrgate < 0.0) - { fprintf(fplog, "Fatal: Epsrgate = %g is not positive.\n", - model->BSIM4v7epsrgate); - printf("Fatal: Epsrgate = %g is not positive.\n", model->BSIM4v7epsrgate); - Fatal_Flag = 1; - } - if (model->BSIM4v7epsrsub < 0.0) - { fprintf(fplog, "Fatal: Epsrsub = %g is not positive.\n", - model->BSIM4v7epsrsub); - printf("Fatal: Epsrsub = %g is not positive.\n", model->BSIM4v7epsrsub); - Fatal_Flag = 1; - } - if (model->BSIM4v7easub < 0.0) - { fprintf(fplog, "Fatal: Easub = %g is not positive.\n", - model->BSIM4v7easub); - printf("Fatal: Easub = %g is not positive.\n", model->BSIM4v7easub); - Fatal_Flag = 1; - } - if (model->BSIM4v7ni0sub <= 0.0) - { fprintf(fplog, "Fatal: Ni0sub = %g is not positive.\n", - model->BSIM4v7ni0sub); - printf("Fatal: Easub = %g is not positive.\n", model->BSIM4v7ni0sub); - Fatal_Flag = 1; + if ((here->BSIM4v7rgateMod == 2) || (here->BSIM4v7rgateMod == 3)) + { if ((here->BSIM4v7trnqsMod == 1) || (here->BSIM4v7acnqsMod == 1)) { + wl_append_word(&wl, &wl, tprintf("Warning: You've selected both Rg and charge deficit NQS; select one only.\n")); } + } - if (model->BSIM4v7toxm <= 0.0) - { fprintf(fplog, "Fatal: Toxm = %g is not positive.\n", - model->BSIM4v7toxm); - printf("Fatal: Toxm = %g is not positive.\n", model->BSIM4v7toxm); - Fatal_Flag = 1; - } + if (model->BSIM4v7toxe <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Toxe = %g is not positive.\n", + model->BSIM4v7toxe)); + Fatal_Flag = 1; + } - if (model->BSIM4v7toxref <= 0.0) - { fprintf(fplog, "Fatal: Toxref = %g is not positive.\n", - model->BSIM4v7toxref); - printf("Fatal: Toxref = %g is not positive.\n", model->BSIM4v7toxref); - Fatal_Flag = 1; - } + if (model->BSIM4v7toxp <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Toxp = %g is not positive.\n", model->BSIM4v7toxp)); + Fatal_Flag = 1; + } - if (pParam->BSIM4v7lpe0 < -pParam->BSIM4v7leff) - { fprintf(fplog, "Fatal: Lpe0 = %g is less than -Leff.\n", - pParam->BSIM4v7lpe0); - printf("Fatal: Lpe0 = %g is less than -Leff.\n", - pParam->BSIM4v7lpe0); - Fatal_Flag = 1; - } - if (model->BSIM4v7lintnoi > pParam->BSIM4v7leff/2) - { fprintf(fplog, "Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", - model->BSIM4v7lintnoi); - printf("Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", - model->BSIM4v7lintnoi); - Fatal_Flag = 1; - } - if (pParam->BSIM4v7lpeb < -pParam->BSIM4v7leff) - { fprintf(fplog, "Fatal: Lpeb = %g is less than -Leff.\n", - pParam->BSIM4v7lpeb); - printf("Fatal: Lpeb = %g is less than -Leff.\n", - pParam->BSIM4v7lpeb); - Fatal_Flag = 1; - } - if (pParam->BSIM4v7ndep <= 0.0) - { fprintf(fplog, "Fatal: Ndep = %g is not positive.\n", - pParam->BSIM4v7ndep); - printf("Fatal: Ndep = %g is not positive.\n", - pParam->BSIM4v7ndep); - Fatal_Flag = 1; - } - if (pParam->BSIM4v7phi <= 0.0) - { fprintf(fplog, "Fatal: Phi = %g is not positive. Please check Phin and Ndep\n", - pParam->BSIM4v7phi); - fprintf(fplog, " Phin = %g Ndep = %g \n", - pParam->BSIM4v7phin, pParam->BSIM4v7ndep); - printf("Fatal: Phi = %g is not positive. Please check Phin and Ndep\n", - pParam->BSIM4v7phi); - printf(" Phin = %g Ndep = %g \n", - pParam->BSIM4v7phin, pParam->BSIM4v7ndep); - Fatal_Flag = 1; - } - if (pParam->BSIM4v7nsub <= 0.0) - { fprintf(fplog, "Fatal: Nsub = %g is not positive.\n", - pParam->BSIM4v7nsub); - printf("Fatal: Nsub = %g is not positive.\n", - pParam->BSIM4v7nsub); - Fatal_Flag = 1; - } - if (pParam->BSIM4v7ngate < 0.0) - { fprintf(fplog, "Fatal: Ngate = %g is not positive.\n", - pParam->BSIM4v7ngate); - printf("Fatal: Ngate = %g Ngate is not positive.\n", - pParam->BSIM4v7ngate); - Fatal_Flag = 1; - } - if (pParam->BSIM4v7ngate > 1.e25) - { fprintf(fplog, "Fatal: Ngate = %g is too high.\n", - pParam->BSIM4v7ngate); - printf("Fatal: Ngate = %g Ngate is too high\n", - pParam->BSIM4v7ngate); - Fatal_Flag = 1; - } - if (pParam->BSIM4v7xj <= 0.0) - { fprintf(fplog, "Fatal: Xj = %g is not positive.\n", - pParam->BSIM4v7xj); - printf("Fatal: Xj = %g is not positive.\n", pParam->BSIM4v7xj); - Fatal_Flag = 1; - } + if (model->BSIM4v7eot <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: EOT = %g is not positive.\n", model->BSIM4v7eot)); + Fatal_Flag = 1; + } + if (model->BSIM4v7epsrgate < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Epsrgate = %g is not positive.\n", model->BSIM4v7epsrgate)); + Fatal_Flag = 1; + } + if (model->BSIM4v7epsrsub < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Epsrsub = %g is not positive.\n", model->BSIM4v7epsrsub)); + Fatal_Flag = 1; + } + if (model->BSIM4v7easub < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Easub = %g is not positive.\n", model->BSIM4v7easub)); + Fatal_Flag = 1; + } + if (model->BSIM4v7ni0sub <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Easub = %g is not positive.\n", model->BSIM4v7ni0sub)); + Fatal_Flag = 1; + } - if (pParam->BSIM4v7dvt1 < 0.0) - { fprintf(fplog, "Fatal: Dvt1 = %g is negative.\n", - pParam->BSIM4v7dvt1); - printf("Fatal: Dvt1 = %g is negative.\n", pParam->BSIM4v7dvt1); - Fatal_Flag = 1; - } - - if (pParam->BSIM4v7dvt1w < 0.0) - { fprintf(fplog, "Fatal: Dvt1w = %g is negative.\n", - pParam->BSIM4v7dvt1w); - printf("Fatal: Dvt1w = %g is negative.\n", pParam->BSIM4v7dvt1w); - Fatal_Flag = 1; - } - - if (pParam->BSIM4v7w0 == -pParam->BSIM4v7weff) - { 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 (model->BSIM4v7toxm <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Toxm = %g is not positive.\n", model->BSIM4v7toxm)); + Fatal_Flag = 1; + } + if (model->BSIM4v7toxref <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Toxref = %g is not positive.\n", model->BSIM4v7toxref)); + Fatal_Flag = 1; + } - if (pParam->BSIM4v7dsub < 0.0) - { fprintf(fplog, "Fatal: Dsub = %g is negative.\n", pParam->BSIM4v7dsub); - printf("Fatal: Dsub = %g is negative.\n", pParam->BSIM4v7dsub); - Fatal_Flag = 1; - } - if (pParam->BSIM4v7b1 == -pParam->BSIM4v7weff) - { 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 (here->BSIM4v7u0temp <= 0.0) - { fprintf(fplog, "Fatal: u0 at current temperature = %g is not positive.\n", here->BSIM4v7u0temp); - printf("Fatal: u0 at current temperature = %g is not positive.\n", - here->BSIM4v7u0temp); - Fatal_Flag = 1; - } - - if (pParam->BSIM4v7delta < 0.0) - { fprintf(fplog, "Fatal: Delta = %g is less than zero.\n", - pParam->BSIM4v7delta); - printf("Fatal: Delta = %g is less than zero.\n", pParam->BSIM4v7delta); - Fatal_Flag = 1; - } + if (pParam->BSIM4v7lpe0 < -pParam->BSIM4v7leff) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Lpe0 = %g is less than -Leff.\n", + pParam->BSIM4v7lpe0)); + Fatal_Flag = 1; + } + if (model->BSIM4v7lintnoi > pParam->BSIM4v7leff / 2) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Lintnoi = %g is too large - Leff for noise is negative.\n", + model->BSIM4v7lintnoi)); + Fatal_Flag = 1; + } + if (pParam->BSIM4v7lpeb < -pParam->BSIM4v7leff) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Lpeb = %g is less than -Leff.\n", + pParam->BSIM4v7lpeb)); + Fatal_Flag = 1; + } + if (pParam->BSIM4v7ndep <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Ndep = %g is not positive.\n", + pParam->BSIM4v7ndep)); + Fatal_Flag = 1; + } + if (pParam->BSIM4v7phi <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Phi = %g is not positive. Please check Phin and Ndep\n", + pParam->BSIM4v7phi)); + wl_append_word(&wl, &wl, tprintf(" Phin = %g Ndep = %g \n", + pParam->BSIM4v7phin, pParam->BSIM4v7ndep)); + Fatal_Flag = 1; + } + if (pParam->BSIM4v7nsub <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Nsub = %g is not positive.\n", + pParam->BSIM4v7nsub)); + Fatal_Flag = 1; + } + if (pParam->BSIM4v7ngate < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Ngate = %g Ngate is not positive.\n", + pParam->BSIM4v7ngate)); + Fatal_Flag = 1; + } + if (pParam->BSIM4v7ngate > 1.e25) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Ngate = %g Ngate is too high\n", + pParam->BSIM4v7ngate)); + Fatal_Flag = 1; + } + if (pParam->BSIM4v7xj <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Xj = %g is not positive.\n", pParam->BSIM4v7xj)); + Fatal_Flag = 1; + } - if (here->BSIM4v7vsattemp <= 0.0) - { fprintf(fplog, "Fatal: Vsat at current temperature = %g is not positive.\n", here->BSIM4v7vsattemp); - printf("Fatal: Vsat at current temperature = %g is not positive.\n", - here->BSIM4v7vsattemp); - Fatal_Flag = 1; - } + if (pParam->BSIM4v7dvt1 < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Dvt1 = %g is negative.\n", pParam->BSIM4v7dvt1)); + Fatal_Flag = 1; + } - if (pParam->BSIM4v7pclm <= 0.0) - { fprintf(fplog, "Fatal: Pclm = %g is not positive.\n", pParam->BSIM4v7pclm); - printf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM4v7pclm); - Fatal_Flag = 1; - } + if (pParam->BSIM4v7dvt1w < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Dvt1w = %g is negative.\n", pParam->BSIM4v7dvt1w)); + Fatal_Flag = 1; + } - if (pParam->BSIM4v7drout < 0.0) - { fprintf(fplog, "Fatal: Drout = %g is negative.\n", pParam->BSIM4v7drout); - printf("Fatal: Drout = %g is negative.\n", pParam->BSIM4v7drout); - Fatal_Flag = 1; - } + if (pParam->BSIM4v7w0 == -pParam->BSIM4v7weff) + { + wl_append_word(&wl, &wl, tprintf("Fatal: (W0 + Weff) = 0 causing divided-by-zero.\n")); + Fatal_Flag = 1; + } - if (here->BSIM4v7m < 1.0) - { fprintf(fplog, "Fatal: Number of multiplier = %g is smaller than one.\n", here->BSIM4v7m); - printf("Fatal: Number of multiplier = %g is smaller than one.\n", here->BSIM4v7m); - Fatal_Flag = 1; - } + if (pParam->BSIM4v7dsub < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Dsub = %g is negative.\n", pParam->BSIM4v7dsub)); + Fatal_Flag = 1; + } + if (pParam->BSIM4v7b1 == -pParam->BSIM4v7weff) + { + wl_append_word(&wl, &wl, tprintf("Fatal: (B1 + Weff) = 0 causing divided-by-zero.\n")); + Fatal_Flag = 1; + } + if (here->BSIM4v7u0temp <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: u0 at current temperature = %g is not positive.\n", + here->BSIM4v7u0temp)); + Fatal_Flag = 1; + } - if (here->BSIM4v7nf < 1.0) - { fprintf(fplog, "Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4v7nf); - printf("Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4v7nf); - Fatal_Flag = 1; - } + if (pParam->BSIM4v7delta < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Delta = %g is less than zero.\n", pParam->BSIM4v7delta)); + Fatal_Flag = 1; + } - if((here->BSIM4v7sa > 0.0) && (here->BSIM4v7sb > 0.0) && - ((here->BSIM4v7nf == 1.0) || ((here->BSIM4v7nf > 1.0) && (here->BSIM4v7sd > 0.0))) ) - { if (model->BSIM4v7saref <= 0.0) - { fprintf(fplog, "Fatal: SAref = %g is not positive.\n",model->BSIM4v7saref); - printf("Fatal: SAref = %g is not positive.\n",model->BSIM4v7saref); - Fatal_Flag = 1; - } - if (model->BSIM4v7sbref <= 0.0) - { fprintf(fplog, "Fatal: SBref = %g is not positive.\n",model->BSIM4v7sbref); - printf("Fatal: SBref = %g is not positive.\n",model->BSIM4v7sbref); - Fatal_Flag = 1; - } - } + if (here->BSIM4v7vsattemp <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vsat at current temperature = %g is not positive.\n", + here->BSIM4v7vsattemp)); + Fatal_Flag = 1; + } - if ((here->BSIM4v7l + model->BSIM4v7xl) <= model->BSIM4v7xgl) - { fprintf(fplog, "Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n"); - printf("Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n"); - Fatal_Flag = 1; - } - if (here->BSIM4v7ngcon < 1.0) - { fprintf(fplog, "Fatal: The parameter ngcon cannot be smaller than one.\n"); - printf("Fatal: The parameter ngcon cannot be smaller than one.\n"); - Fatal_Flag = 1; - } - if ((here->BSIM4v7ngcon != 1.0) && (here->BSIM4v7ngcon != 2.0)) - { here->BSIM4v7ngcon = 1.0; - fprintf(fplog, "Warning: Ngcon must be equal to one or two; reset to 1.0.\n"); - printf("Warning: Ngcon must be equal to one or two; reset to 1.0.\n"); - } + if (pParam->BSIM4v7pclm <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Pclm = %g is not positive.\n", pParam->BSIM4v7pclm)); + Fatal_Flag = 1; + } - if (model->BSIM4v7gbmin < 1.0e-20) - { fprintf(fplog, "Warning: Gbmin = %g is too small.\n", - model->BSIM4v7gbmin); - printf("Warning: Gbmin = %g is too small.\n", model->BSIM4v7gbmin); - } + if (pParam->BSIM4v7drout < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Drout = %g is negative.\n", pParam->BSIM4v7drout)); + Fatal_Flag = 1; + } - /* Check saturation parameters */ - if (pParam->BSIM4v7fprout < 0.0) - { fprintf(fplog, "Fatal: fprout = %g is negative.\n", - pParam->BSIM4v7fprout); - printf("Fatal: fprout = %g is negative.\n", pParam->BSIM4v7fprout); - Fatal_Flag = 1; - } - if (pParam->BSIM4v7pdits < 0.0) - { fprintf(fplog, "Fatal: pdits = %g is negative.\n", - pParam->BSIM4v7pdits); - printf("Fatal: pdits = %g is negative.\n", pParam->BSIM4v7pdits); + if (here->BSIM4v7m <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: multiplier = %g is not positive.\n", here->BSIM4v7m)); + Fatal_Flag = 1; + } + if (here->BSIM4v7nf < 1.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Number of finger = %g is smaller than one.\n", here->BSIM4v7nf)); + Fatal_Flag = 1; + } + + if ((here->BSIM4v7sa > 0.0) && (here->BSIM4v7sb > 0.0) && + ((here->BSIM4v7nf == 1.0) || ((here->BSIM4v7nf > 1.0) && (here->BSIM4v7sd > 0.0)))) + { + if (model->BSIM4v7saref <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: SAref = %g is not positive.\n", model->BSIM4v7saref)); Fatal_Flag = 1; } - if (model->BSIM4v7pditsl < 0.0) - { fprintf(fplog, "Fatal: pditsl = %g is negative.\n", - model->BSIM4v7pditsl); - printf("Fatal: pditsl = %g is negative.\n", model->BSIM4v7pditsl); + if (model->BSIM4v7sbref <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: SBref = %g is not positive.\n", model->BSIM4v7sbref)); Fatal_Flag = 1; } + } - /* Check gate current parameters */ - if (model->BSIM4v7igbMod) { + if ((here->BSIM4v7l + model->BSIM4v7xl) <= model->BSIM4v7xgl) + { + wl_append_word(&wl, &wl, tprintf("Fatal: The parameter xgl must be smaller than Ldrawn+XL.\n")); + Fatal_Flag = 1; + } + if (here->BSIM4v7ngcon < 1.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: The parameter ngcon cannot be smaller than one.\n")); + Fatal_Flag = 1; + } + if ((here->BSIM4v7ngcon != 1.0) && (here->BSIM4v7ngcon != 2.0)) + { + here->BSIM4v7ngcon = 1.0; + wl_append_word(&wl, &wl, tprintf("Warning: Ngcon must be equal to one or two; reset to 1.0.\n")); + } + + if (model->BSIM4v7gbmin < 1.0e-20) + { + wl_append_word(&wl, &wl, tprintf("Warning: Gbmin = %g is too small.\n", model->BSIM4v7gbmin)); + } + + /* Check saturation parameters */ + if (pParam->BSIM4v7fprout < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: fprout = %g is negative.\n", pParam->BSIM4v7fprout)); + Fatal_Flag = 1; + } + if (pParam->BSIM4v7pdits < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: pdits = %g is negative.\n", pParam->BSIM4v7pdits)); + Fatal_Flag = 1; + } + if (model->BSIM4v7pditsl < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: pditsl = %g is negative.\n", model->BSIM4v7pditsl)); + Fatal_Flag = 1; + } + + /* Check gate current parameters */ + if (model->BSIM4v7igbMod) { if (pParam->BSIM4v7nigbinv <= 0.0) - { fprintf(fplog, "Fatal: nigbinv = %g is non-positive.\n", - pParam->BSIM4v7nigbinv); - printf("Fatal: nigbinv = %g is non-positive.\n", pParam->BSIM4v7nigbinv); + { + wl_append_word(&wl, &wl, tprintf("Fatal: nigbinv = %g is non-positive.\n", pParam->BSIM4v7nigbinv)); Fatal_Flag = 1; } if (pParam->BSIM4v7nigbacc <= 0.0) - { fprintf(fplog, "Fatal: nigbacc = %g is non-positive.\n", - pParam->BSIM4v7nigbacc); - printf("Fatal: nigbacc = %g is non-positive.\n", pParam->BSIM4v7nigbacc); + { + wl_append_word(&wl, &wl, tprintf("Fatal: nigbacc = %g is non-positive.\n", pParam->BSIM4v7nigbacc)); Fatal_Flag = 1; } - } - if (model->BSIM4v7igcMod) { + } + if (model->BSIM4v7igcMod) { if (pParam->BSIM4v7nigc <= 0.0) - { fprintf(fplog, "Fatal: nigc = %g is non-positive.\n", - pParam->BSIM4v7nigc); - printf("Fatal: nigc = %g is non-positive.\n", pParam->BSIM4v7nigc); + { + wl_append_word(&wl, &wl, tprintf("Fatal: nigc = %g is non-positive.\n", pParam->BSIM4v7nigc)); Fatal_Flag = 1; } if (pParam->BSIM4v7poxedge <= 0.0) - { fprintf(fplog, "Fatal: poxedge = %g is non-positive.\n", - pParam->BSIM4v7poxedge); - printf("Fatal: poxedge = %g is non-positive.\n", pParam->BSIM4v7poxedge); + { + wl_append_word(&wl, &wl, tprintf("Fatal: poxedge = %g is non-positive.\n", pParam->BSIM4v7poxedge)); Fatal_Flag = 1; } if (pParam->BSIM4v7pigcd <= 0.0) - { fprintf(fplog, "Fatal: pigcd = %g is non-positive.\n", - pParam->BSIM4v7pigcd); - printf("Fatal: pigcd = %g is non-positive.\n", pParam->BSIM4v7pigcd); + { + wl_append_word(&wl, &wl, tprintf("Fatal: pigcd = %g is non-positive.\n", pParam->BSIM4v7pigcd)); Fatal_Flag = 1; } - } + } - /* Check capacitance parameters */ - if (pParam->BSIM4v7clc < 0.0) - { fprintf(fplog, "Fatal: Clc = %g is negative.\n", pParam->BSIM4v7clc); - printf("Fatal: Clc = %g is negative.\n", pParam->BSIM4v7clc); - Fatal_Flag = 1; - } - - /* Check overlap capacitance parameters */ - if (pParam->BSIM4v7ckappas < 0.02) - { fprintf(fplog, "Warning: ckappas = %g is too small. Set to 0.02\n", - pParam->BSIM4v7ckappas); - printf("Warning: ckappas = %g is too small.\n", pParam->BSIM4v7ckappas); - pParam->BSIM4v7ckappas = 0.02; - } - if (pParam->BSIM4v7ckappad < 0.02) - { fprintf(fplog, "Warning: ckappad = %g is too small. Set to 0.02\n", - pParam->BSIM4v7ckappad); - printf("Warning: ckappad = %g is too small.\n", pParam->BSIM4v7ckappad); - pParam->BSIM4v7ckappad = 0.02; - } - - if (model->BSIM4v7vtss < 0.0) - { fprintf(fplog, "Fatal: Vtss = %g is negative.\n", - model->BSIM4v7vtss); - printf("Fatal: Vtss = %g is negative.\n", - model->BSIM4v7vtss); - Fatal_Flag = 1; - } - if (model->BSIM4v7vtsd < 0.0) - { fprintf(fplog, "Fatal: Vtsd = %g is negative.\n", - model->BSIM4v7vtsd); - printf("Fatal: Vtsd = %g is negative.\n", - model->BSIM4v7vtsd); - Fatal_Flag = 1; - } - if (model->BSIM4v7vtssws < 0.0) - { fprintf(fplog, "Fatal: Vtssws = %g is negative.\n", - model->BSIM4v7vtssws); - printf("Fatal: Vtssws = %g is negative.\n", - model->BSIM4v7vtssws); - Fatal_Flag = 1; - } - if (model->BSIM4v7vtsswd < 0.0) - { fprintf(fplog, "Fatal: Vtsswd = %g is negative.\n", - model->BSIM4v7vtsswd); - printf("Fatal: Vtsswd = %g is negative.\n", - model->BSIM4v7vtsswd); - Fatal_Flag = 1; - } - if (model->BSIM4v7vtsswgs < 0.0) - { fprintf(fplog, "Fatal: Vtsswgs = %g is negative.\n", - model->BSIM4v7vtsswgs); - printf("Fatal: Vtsswgs = %g is negative.\n", - model->BSIM4v7vtsswgs); - Fatal_Flag = 1; - } - if (model->BSIM4v7vtsswgd < 0.0) - { fprintf(fplog, "Fatal: Vtsswgd = %g is negative.\n", - model->BSIM4v7vtsswgd); - printf("Fatal: Vtsswgd = %g is negative.\n", - model->BSIM4v7vtsswgd); - Fatal_Flag = 1; - } + /* Check capacitance parameters */ + if (pParam->BSIM4v7clc < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Clc = %g is negative.\n", pParam->BSIM4v7clc)); + Fatal_Flag = 1; + } + + /* Check overlap capacitance parameters */ + if (pParam->BSIM4v7ckappas < 0.02) + { + wl_append_word(&wl, &wl, tprintf("Warning: ckappas = %g is too small.\n", pParam->BSIM4v7ckappas)); + pParam->BSIM4v7ckappas = 0.02; + } + if (pParam->BSIM4v7ckappad < 0.02) + { + wl_append_word(&wl, &wl, tprintf("Warning: ckappad = %g is too small.\n", pParam->BSIM4v7ckappad)); + pParam->BSIM4v7ckappad = 0.02; + } + + if (model->BSIM4v7vtss < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtss = %g is negative.\n", + model->BSIM4v7vtss)); + Fatal_Flag = 1; + } + if (model->BSIM4v7vtsd < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtsd = %g is negative.\n", + model->BSIM4v7vtsd)); + Fatal_Flag = 1; + } + if (model->BSIM4v7vtssws < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtssws = %g is negative.\n", + model->BSIM4v7vtssws)); + Fatal_Flag = 1; + } + if (model->BSIM4v7vtsswd < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtsswd = %g is negative.\n", + model->BSIM4v7vtsswd)); + Fatal_Flag = 1; + } + if (model->BSIM4v7vtsswgs < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtsswgs = %g is negative.\n", + model->BSIM4v7vtsswgs)); + Fatal_Flag = 1; + } + if (model->BSIM4v7vtsswgd < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Fatal: Vtsswgd = %g is negative.\n", + model->BSIM4v7vtsswgd)); + Fatal_Flag = 1; + } - if (model->BSIM4v7paramChk ==1) - { -/* Check L and W parameters */ + if (model->BSIM4v7paramChk == 1) + { + /* Check L and W parameters */ if (pParam->BSIM4v7leff <= 1.0e-9) - { fprintf(fplog, "Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", - pParam->BSIM4v7leff); - printf("Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", - pParam->BSIM4v7leff); - } - + { + wl_append_word(&wl, &wl, tprintf("Warning: Leff = %g <= 1.0e-9. Recommended Leff >= 1e-8 \n", + pParam->BSIM4v7leff)); + } + if (pParam->BSIM4v7leffCV <= 1.0e-9) - { fprintf(fplog, "Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", - pParam->BSIM4v7leffCV); - printf("Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", - pParam->BSIM4v7leffCV); - } - + { + wl_append_word(&wl, &wl, tprintf("Warning: Leff for CV = %g <= 1.0e-9. Recommended LeffCV >=1e-8 \n", + pParam->BSIM4v7leffCV)); + } + if (pParam->BSIM4v7weff <= 1.0e-9) - { fprintf(fplog, "Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", - pParam->BSIM4v7weff); - printf("Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", - pParam->BSIM4v7weff); - } - + { + wl_append_word(&wl, &wl, tprintf("Warning: Weff = %g <= 1.0e-9. Recommended Weff >=1e-7 \n", + pParam->BSIM4v7weff)); + } + if (pParam->BSIM4v7weffCV <= 1.0e-9) - { fprintf(fplog, "Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", - pParam->BSIM4v7weffCV); - printf("Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", - pParam->BSIM4v7weffCV); - } - + { + wl_append_word(&wl, &wl, tprintf("Warning: Weff for CV = %g <= 1.0e-9. Recommended WeffCV >= 1e-7 \n", + pParam->BSIM4v7weffCV)); + } + /* Check threshold voltage parameters */ if (model->BSIM4v7toxe < 1.0e-10) - { fprintf(fplog, "Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", - model->BSIM4v7toxe); - printf("Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", model->BSIM4v7toxe); + { + wl_append_word(&wl, &wl, tprintf("Warning: Toxe = %g is less than 1A. Recommended Toxe >= 5A\n", model->BSIM4v7toxe)); } if (model->BSIM4v7toxp < 1.0e-10) - { fprintf(fplog, "Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", - model->BSIM4v7toxp); - printf("Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", model->BSIM4v7toxp); + { + wl_append_word(&wl, &wl, tprintf("Warning: Toxp = %g is less than 1A. Recommended Toxp >= 5A\n", model->BSIM4v7toxp)); } if (model->BSIM4v7toxm < 1.0e-10) - { fprintf(fplog, "Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", - model->BSIM4v7toxm); - printf("Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", model->BSIM4v7toxm); + { + wl_append_word(&wl, &wl, tprintf("Warning: Toxm = %g is less than 1A. Recommended Toxm >= 5A\n", model->BSIM4v7toxm)); } if (pParam->BSIM4v7ndep <= 1.0e12) - { fprintf(fplog, "Warning: Ndep = %g may be too small.\n", - pParam->BSIM4v7ndep); - printf("Warning: Ndep = %g may be too small.\n", - pParam->BSIM4v7ndep); + { + wl_append_word(&wl, &wl, tprintf("Warning: Ndep = %g may be too small.\n", + pParam->BSIM4v7ndep)); } else if (pParam->BSIM4v7ndep >= 1.0e21) - { fprintf(fplog, "Warning: Ndep = %g may be too large.\n", - pParam->BSIM4v7ndep); - printf("Warning: Ndep = %g may be too large.\n", - pParam->BSIM4v7ndep); + { + wl_append_word(&wl, &wl, tprintf("Warning: Ndep = %g may be too large.\n", + pParam->BSIM4v7ndep)); } - if (pParam->BSIM4v7nsub <= 1.0e14) - { fprintf(fplog, "Warning: Nsub = %g may be too small.\n", - pParam->BSIM4v7nsub); - printf("Warning: Nsub = %g may be too small.\n", - pParam->BSIM4v7nsub); + if (pParam->BSIM4v7nsub <= 1.0e14) + { + wl_append_word(&wl, &wl, tprintf("Warning: Nsub = %g may be too small.\n", + pParam->BSIM4v7nsub)); } else if (pParam->BSIM4v7nsub >= 1.0e21) - { fprintf(fplog, "Warning: Nsub = %g may be too large.\n", - pParam->BSIM4v7nsub); - printf("Warning: Nsub = %g may be too large.\n", - pParam->BSIM4v7nsub); + { + wl_append_word(&wl, &wl, tprintf("Warning: Nsub = %g may be too large.\n", + pParam->BSIM4v7nsub)); } if ((pParam->BSIM4v7ngate > 0.0) && (pParam->BSIM4v7ngate <= 1.e18)) - { fprintf(fplog, "Warning: Ngate = %g is less than 1.E18cm^-3.\n", - pParam->BSIM4v7ngate); - printf("Warning: Ngate = %g is less than 1.E18cm^-3.\n", - pParam->BSIM4v7ngate); + { + wl_append_word(&wl, &wl, tprintf("Warning: Ngate = %g is less than 1.E18cm^-3.\n", + pParam->BSIM4v7ngate)); } - + if (pParam->BSIM4v7dvt0 < 0.0) - { fprintf(fplog, "Warning: Dvt0 = %g is negative.\n", - pParam->BSIM4v7dvt0); - printf("Warning: Dvt0 = %g is negative.\n", pParam->BSIM4v7dvt0); + { + wl_append_word(&wl, &wl, tprintf("Warning: Dvt0 = %g is negative.\n", pParam->BSIM4v7dvt0)); } - + if (fabs(1.0e-8 / (pParam->BSIM4v7w0 + pParam->BSIM4v7weff)) > 10.0) - { fprintf(fplog, "Warning: (W0 + Weff) may be too small.\n"); - printf("Warning: (W0 + Weff) may be too small.\n"); + { + wl_append_word(&wl, &wl, tprintf("Warning: (W0 + Weff) may be too small.\n")); } -/* Check subthreshold parameters */ + /* Check subthreshold parameters */ if (pParam->BSIM4v7nfactor < 0.0) - { fprintf(fplog, "Warning: Nfactor = %g is negative.\n", - pParam->BSIM4v7nfactor); - printf("Warning: Nfactor = %g is negative.\n", pParam->BSIM4v7nfactor); + { + wl_append_word(&wl, &wl, tprintf("Warning: Nfactor = %g is negative.\n", pParam->BSIM4v7nfactor)); } if (pParam->BSIM4v7cdsc < 0.0) - { fprintf(fplog, "Warning: Cdsc = %g is negative.\n", - pParam->BSIM4v7cdsc); - printf("Warning: Cdsc = %g is negative.\n", pParam->BSIM4v7cdsc); + { + wl_append_word(&wl, &wl, tprintf("Warning: Cdsc = %g is negative.\n", pParam->BSIM4v7cdsc)); } if (pParam->BSIM4v7cdscd < 0.0) - { fprintf(fplog, "Warning: Cdscd = %g is negative.\n", - pParam->BSIM4v7cdscd); - printf("Warning: Cdscd = %g is negative.\n", pParam->BSIM4v7cdscd); + { + wl_append_word(&wl, &wl, tprintf("Warning: Cdscd = %g is negative.\n", pParam->BSIM4v7cdscd)); } -/* Check DIBL parameters */ + /* Check DIBL parameters */ if (here->BSIM4v7eta0 < 0.0) - { fprintf(fplog, "Warning: Eta0 = %g is negative.\n", - here->BSIM4v7eta0); - printf("Warning: Eta0 = %g is negative.\n", here->BSIM4v7eta0); - } - -/* Check Abulk parameters */ - if (fabs(1.0e-8 / (pParam->BSIM4v7b1 + pParam->BSIM4v7weff)) > 10.0) - { fprintf(fplog, "Warning: (B1 + Weff) may be too small.\n"); - printf("Warning: (B1 + Weff) may be too small.\n"); - } - + { + wl_append_word(&wl, &wl, tprintf("Warning: Eta0 = %g is negative.\n", here->BSIM4v7eta0)); + } -/* Check Saturation parameters */ - if (pParam->BSIM4v7a2 < 0.01) - { fprintf(fplog, "Warning: A2 = %g is too small. Set to 0.01.\n", pParam->BSIM4v7a2); - printf("Warning: A2 = %g is too small. Set to 0.01.\n", - pParam->BSIM4v7a2); + /* Check Abulk parameters */ + if (fabs(1.0e-8 / (pParam->BSIM4v7b1 + pParam->BSIM4v7weff)) > 10.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: (B1 + Weff) may be too small.\n")); + } + + + /* Check Saturation parameters */ + if (pParam->BSIM4v7a2 < 0.01) + { + wl_append_word(&wl, &wl, tprintf("Warning: A2 = %g is too small. Set to 0.01.\n", + pParam->BSIM4v7a2)); pParam->BSIM4v7a2 = 0.01; } else if (pParam->BSIM4v7a2 > 1.0) - { fprintf(fplog, "Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n", - pParam->BSIM4v7a2); - printf("Warning: A2 = %g is larger than 1. A2 is set to 1 and A1 is set to 0.\n", - pParam->BSIM4v7a2); + { + 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->BSIM4v7a2)); pParam->BSIM4v7a2 = 1.0; pParam->BSIM4v7a1 = 0.0; } if (pParam->BSIM4v7prwg < 0.0) - { fprintf(fplog, "Warning: Prwg = %g is negative. Set to zero.\n", - pParam->BSIM4v7prwg); - printf("Warning: Prwg = %g is negative. Set to zero.\n", - pParam->BSIM4v7prwg); + { + wl_append_word(&wl, &wl, tprintf("Warning: Prwg = %g is negative. Set to zero.\n", + pParam->BSIM4v7prwg)); pParam->BSIM4v7prwg = 0.0; } if (pParam->BSIM4v7rdsw < 0.0) - { fprintf(fplog, "Warning: Rdsw = %g is negative. Set to zero.\n", - pParam->BSIM4v7rdsw); - printf("Warning: Rdsw = %g is negative. Set to zero.\n", - pParam->BSIM4v7rdsw); + { + wl_append_word(&wl, &wl, tprintf("Warning: Rdsw = %g is negative. Set to zero.\n", + pParam->BSIM4v7rdsw)); pParam->BSIM4v7rdsw = 0.0; pParam->BSIM4v7rds0 = 0.0; } if (pParam->BSIM4v7rds0 < 0.0) - { fprintf(fplog, "Warning: Rds at current temperature = %g is negative. Set to zero.\n", - pParam->BSIM4v7rds0); - printf("Warning: Rds at current temperature = %g is negative. Set to zero.\n", - pParam->BSIM4v7rds0); + { + wl_append_word(&wl, &wl, tprintf("Warning: Rds at current temperature = %g is negative. Set to zero.\n", + pParam->BSIM4v7rds0)); pParam->BSIM4v7rds0 = 0.0; } if (pParam->BSIM4v7rdswmin < 0.0) - { fprintf(fplog, "Warning: Rdswmin at current temperature = %g is negative. Set to zero.\n", - pParam->BSIM4v7rdswmin); - printf("Warning: Rdswmin at current temperature = %g is negative. Set to zero.\n", - pParam->BSIM4v7rdswmin); + { + wl_append_word(&wl, &wl, tprintf("Warning: Rdswmin at current temperature = %g is negative. Set to zero.\n", + pParam->BSIM4v7rdswmin)); pParam->BSIM4v7rdswmin = 0.0; } if (pParam->BSIM4v7pscbe2 <= 0.0) - { fprintf(fplog, "Warning: Pscbe2 = %g is not positive.\n", - pParam->BSIM4v7pscbe2); - printf("Warning: Pscbe2 = %g is not positive.\n", pParam->BSIM4v7pscbe2); + { + wl_append_word(&wl, &wl, tprintf("Warning: Pscbe2 = %g is not positive.\n", pParam->BSIM4v7pscbe2)); } if (pParam->BSIM4v7vsattemp < 1.0e3) - { fprintf(fplog, "Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM4v7vsattemp); - printf("Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM4v7vsattemp); + { + wl_append_word(&wl, &wl, tprintf("Warning: Vsat at current temperature = %g may be too small.\n", pParam->BSIM4v7vsattemp)); } - if((model->BSIM4v7lambdaGiven) && (pParam->BSIM4v7lambda > 0.0) ) - { - if (pParam->BSIM4v7lambda > 1.0e-9) - { fprintf(fplog, "Warning: Lambda = %g may be too large.\n", pParam->BSIM4v7lambda); - printf("Warning: Lambda = %g may be too large.\n", pParam->BSIM4v7lambda); + if ((model->BSIM4v7lambdaGiven) && (pParam->BSIM4v7lambda > 0.0)) + { + if (pParam->BSIM4v7lambda > 1.0e-9) + { + wl_append_word(&wl, &wl, tprintf("Warning: Lambda = %g may be too large.\n", pParam->BSIM4v7lambda)); + } } - } - if((model->BSIM4v7vtlGiven) && (pParam->BSIM4v7vtl > 0.0) ) - { - if (pParam->BSIM4v7vtl < 6.0e4) - { fprintf(fplog, "Warning: Thermal velocity vtl = %g may be too small.\n", pParam->BSIM4v7vtl); - printf("Warning: Thermal velocity vtl = %g may be too small.\n", pParam->BSIM4v7vtl); + if ((model->BSIM4v7vtlGiven) && (pParam->BSIM4v7vtl > 0.0)) + { + if (pParam->BSIM4v7vtl < 6.0e4) + { + wl_append_word(&wl, &wl, tprintf("Warning: Thermal velocity vtl = %g may be too small.\n", pParam->BSIM4v7vtl)); + } + + if (pParam->BSIM4v7xn < 3.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: back scattering coeff xn = %g is too small. Reset to 3.0 \n", pParam->BSIM4v7xn)); + pParam->BSIM4v7xn = 3.0; + } + + if (model->BSIM4v7lc < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: back scattering coeff lc = %g is too small. Reset to 0.0\n", model->BSIM4v7lc)); + pParam->BSIM4v7lc = 0.0; + } } - if (pParam->BSIM4v7xn < 3.0) - { fprintf(fplog, "Warning: back scattering coeff xn = %g is too small.\n", pParam->BSIM4v7xn); - printf("Warning: back scattering coeff xn = %g is too small. Reset to 3.0 \n", pParam->BSIM4v7xn); - pParam->BSIM4v7xn = 3.0; + if (pParam->BSIM4v7pdibl1 < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Pdibl1 = %g is negative.\n", pParam->BSIM4v7pdibl1)); } + } - if (model->BSIM4v7lc < 0.0) - { fprintf(fplog, "Warning: back scattering coeff lc = %g is too small.\n", model->BSIM4v7lc); - printf("Warning: back scattering coeff lc = %g is too small. Reset to 0.0\n", model->BSIM4v7lc); - pParam->BSIM4v7lc = 0.0; + if (pParam->BSIM4v7pdibl2 < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Pdibl2 = %g is negative.\n", pParam->BSIM4v7pdibl2)); + } + + /* Check stress effect parameters */ + if ((here->BSIM4v7sa > 0.0) && (here->BSIM4v7sb > 0.0) && + ((here->BSIM4v7nf == 1.0) || ((here->BSIM4v7nf > 1.0) && (here->BSIM4v7sd > 0.0)))) + { + if (model->BSIM4v7lodk2 <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: LODK2 = %g is not positive.\n", model->BSIM4v7lodk2)); + } + if (model->BSIM4v7lodeta0 <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: LODETA0 = %g is not positive.\n", model->BSIM4v7lodeta0)); } - } + } - if (pParam->BSIM4v7pdibl1 < 0.0) - { fprintf(fplog, "Warning: Pdibl1 = %g is negative.\n", - pParam->BSIM4v7pdibl1); - printf("Warning: Pdibl1 = %g is negative.\n", pParam->BSIM4v7pdibl1); - } - if (pParam->BSIM4v7pdibl2 < 0.0) - { fprintf(fplog, "Warning: Pdibl2 = %g is negative.\n", - pParam->BSIM4v7pdibl2); - printf("Warning: Pdibl2 = %g is negative.\n", pParam->BSIM4v7pdibl2); - } - -/* Check stress effect parameters */ - if((here->BSIM4v7sa > 0.0) && (here->BSIM4v7sb > 0.0) && - ((here->BSIM4v7nf == 1.0) || ((here->BSIM4v7nf > 1.0) && (here->BSIM4v7sd > 0.0))) ) - { if (model->BSIM4v7lodk2 <= 0.0) - { fprintf(fplog, "Warning: LODK2 = %g is not positive.\n",model->BSIM4v7lodk2); - printf("Warning: LODK2 = %g is not positive.\n",model->BSIM4v7lodk2); - } - if (model->BSIM4v7lodeta0 <= 0.0) - { fprintf(fplog, "Warning: LODETA0 = %g is not positive.\n",model->BSIM4v7lodeta0); - printf("Warning: LODETA0 = %g is not positive.\n",model->BSIM4v7lodeta0); - } - } - -/* Check gate resistance parameters */ - if (here->BSIM4v7rgateMod == 1) - { if (model->BSIM4v7rshg <= 0.0) - printf("Warning: rshg should be positive for rgateMod = 1.\n"); - } - else if (here->BSIM4v7rgateMod == 2) - { if (model->BSIM4v7rshg <= 0.0) - printf("Warning: rshg <= 0.0 for rgateMod = 2.\n"); - else if (pParam->BSIM4v7xrcrg1 <= 0.0) - printf("Warning: xrcrg1 <= 0.0 for rgateMod = 2.\n"); - } - if (here->BSIM4v7rgateMod == 3) - { if (model->BSIM4v7rshg <= 0.0) - printf("Warning: rshg should be positive for rgateMod = 3.\n"); - else if (pParam->BSIM4v7xrcrg1 <= 0.0) - printf("Warning: xrcrg1 should be positive for rgateMod = 3.\n"); - } - -/* Check capacitance parameters */ - if (pParam->BSIM4v7noff < 0.1) - { fprintf(fplog, "Warning: Noff = %g is too small.\n", - pParam->BSIM4v7noff); - printf("Warning: Noff = %g is too small.\n", pParam->BSIM4v7noff); - } - - if (pParam->BSIM4v7voffcv < -0.5) - { fprintf(fplog, "Warning: Voffcv = %g is too small.\n", - pParam->BSIM4v7voffcv); - printf("Warning: Voffcv = %g is too small.\n", pParam->BSIM4v7voffcv); - } - if (pParam->BSIM4v7moin < 5.0) - { fprintf(fplog, "Warning: Moin = %g is too small.\n", - pParam->BSIM4v7moin); - printf("Warning: Moin = %g is too small.\n", pParam->BSIM4v7moin); - } - if (pParam->BSIM4v7moin > 25.0) - { fprintf(fplog, "Warning: Moin = %g is too large.\n", - pParam->BSIM4v7moin); - printf("Warning: Moin = %g is too large.\n", pParam->BSIM4v7moin); - } - if(model->BSIM4v7capMod ==2) { - if (pParam->BSIM4v7acde < 0.1) - { fprintf(fplog, "Warning: Acde = %g is too small.\n", - pParam->BSIM4v7acde); - printf("Warning: Acde = %g is too small.\n", pParam->BSIM4v7acde); - } - if (pParam->BSIM4v7acde > 1.6) - { fprintf(fplog, "Warning: Acde = %g is too large.\n", - pParam->BSIM4v7acde); - printf("Warning: Acde = %g is too large.\n", pParam->BSIM4v7acde); - } - } - -/* Check overlap capacitance parameters */ - if (model->BSIM4v7cgdo < 0.0) - { fprintf(fplog, "Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM4v7cgdo); - printf("Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM4v7cgdo); - model->BSIM4v7cgdo = 0.0; - } - if (model->BSIM4v7cgso < 0.0) - { fprintf(fplog, "Warning: cgso = %g is negative. Set to zero.\n", model->BSIM4v7cgso); - printf("Warning: cgso = %g is negative. Set to zero.\n", model->BSIM4v7cgso); - model->BSIM4v7cgso = 0.0; - } - if (model->BSIM4v7cgbo < 0.0) - { fprintf(fplog, "Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM4v7cgbo); - printf("Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM4v7cgbo); - model->BSIM4v7cgbo = 0.0; - } - - /* v4.7 */ - if (model->BSIM4v7tnoiMod == 1 || model->BSIM4v7tnoiMod == 2) { - if (model->BSIM4v7tnoia < 0.0) { - fprintf(fplog, "Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4v7tnoia); - printf("Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4v7tnoia); - model->BSIM4v7tnoia = 0.0; - } - if (model->BSIM4v7tnoib < 0.0) { - fprintf(fplog, "Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4v7tnoib); - printf("Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4v7tnoib); - model->BSIM4v7tnoib = 0.0; - } - if (model->BSIM4v7rnoia < 0.0) { - fprintf(fplog, "Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4v7rnoia); - printf("Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4v7rnoia); - model->BSIM4v7rnoia = 0.0; - } - if (model->BSIM4v7rnoib < 0.0) { - fprintf(fplog, "Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4v7rnoib); - printf("Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4v7rnoib); - model->BSIM4v7rnoib = 0.0; - } + /* Check gate resistance parameters */ + if (here->BSIM4v7rgateMod == 1) + { + if (model->BSIM4v7rshg <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: rshg should be positive for rgateMod = 1.\n")); + } + else if (here->BSIM4v7rgateMod == 2) + { + if (model->BSIM4v7rshg <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: rshg <= 0.0 for rgateMod = 2.\n")); + else if (pParam->BSIM4v7xrcrg1 <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: xrcrg1 <= 0.0 for rgateMod = 2.\n")); + } + if (here->BSIM4v7rgateMod == 3) + { + if (model->BSIM4v7rshg <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: rshg should be positive for rgateMod = 3.\n")); + else if (pParam->BSIM4v7xrcrg1 <= 0.0) + wl_append_word(&wl, &wl, tprintf("Warning: xrcrg1 should be positive for rgateMod = 3.\n")); + } + + /* Check capacitance parameters */ + if (pParam->BSIM4v7noff < 0.1) + { + wl_append_word(&wl, &wl, tprintf("Warning: Noff = %g is too small.\n", pParam->BSIM4v7noff)); + } + + if (pParam->BSIM4v7voffcv < -0.5) + { + wl_append_word(&wl, &wl, tprintf("Warning: Voffcv = %g is too small.\n", pParam->BSIM4v7voffcv)); + } + + if (pParam->BSIM4v7moin < 5.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Moin = %g is too small.\n", pParam->BSIM4v7moin)); + } + if (pParam->BSIM4v7moin > 25.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Moin = %g is too large.\n", pParam->BSIM4v7moin)); + } + if (model->BSIM4v7capMod == 2) { + if (pParam->BSIM4v7acde < 0.1) + { + wl_append_word(&wl, &wl, tprintf("Warning: Acde = %g is too small.\n", pParam->BSIM4v7acde)); + } + if (pParam->BSIM4v7acde > 1.6) + { + wl_append_word(&wl, &wl, tprintf("Warning: Acde = %g is too large.\n", pParam->BSIM4v7acde)); + } + } + + /* Check overlap capacitance parameters */ + if (model->BSIM4v7cgdo < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: cgdo = %g is negative. Set to zero.\n", model->BSIM4v7cgdo)); + model->BSIM4v7cgdo = 0.0; + } + if (model->BSIM4v7cgso < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: cgso = %g is negative. Set to zero.\n", model->BSIM4v7cgso)); + model->BSIM4v7cgso = 0.0; + } + if (model->BSIM4v7cgbo < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: cgbo = %g is negative. Set to zero.\n", model->BSIM4v7cgbo)); + model->BSIM4v7cgbo = 0.0; + } + /* v4.7 */ + if (model->BSIM4v7tnoiMod == 1 || model->BSIM4v7tnoiMod == 2) { + if (model->BSIM4v7tnoia < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: tnoia = %g is negative. Set to zero.\n", model->BSIM4v7tnoia)); + model->BSIM4v7tnoia = 0.0; + } + if (model->BSIM4v7tnoib < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: tnoib = %g is negative. Set to zero.\n", model->BSIM4v7tnoib)); + model->BSIM4v7tnoib = 0.0; + } + + if (model->BSIM4v7rnoia < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: rnoia = %g is negative. Set to zero.\n", model->BSIM4v7rnoia)); + model->BSIM4v7rnoia = 0.0; + } + if (model->BSIM4v7rnoib < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: rnoib = %g is negative. Set to zero.\n", model->BSIM4v7rnoib)); + model->BSIM4v7rnoib = 0.0; } + } - /* v4.7 */ - if (model->BSIM4v7tnoiMod == 2) { - if (model->BSIM4v7tnoic < 0.0) { - fprintf(fplog, "Warning: tnoic = %g is negative. Set to zero.\n", model->BSIM4v7tnoic); - printf("Warning: tnoic = %g is negative. Set to zero.\n", model->BSIM4v7tnoic); - model->BSIM4v7tnoic = 0.0; + /* v4.7 */ + if (model->BSIM4v7tnoiMod == 2) { + if (model->BSIM4v7tnoic < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: tnoic = %g is negative. Set to zero.\n", model->BSIM4v7tnoic)); + model->BSIM4v7tnoic = 0.0; + } + if (model->BSIM4v7rnoic < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: rnoic = %g is negative. Set to zero.\n", model->BSIM4v7rnoic)); + model->BSIM4v7rnoic = 0.0; + } + } + + /* Limits of Njs and Njd modified in BSIM4v7.7 */ + if (model->BSIM4v7SjctEmissionCoeff < 0.1) { + wl_append_word(&wl, &wl, tprintf("Warning: Njs = %g is less than 0.1. Setting Njs to 0.1.\n", model->BSIM4v7SjctEmissionCoeff)); + model->BSIM4v7SjctEmissionCoeff = 0.1; + } + else if (model->BSIM4v7SjctEmissionCoeff < 0.7) { + wl_append_word(&wl, &wl, tprintf("Warning: Njs = %g is less than 0.7.\n", model->BSIM4v7SjctEmissionCoeff)); + } + if (model->BSIM4v7DjctEmissionCoeff < 0.1) + { + wl_append_word(&wl, &wl, tprintf("Warning: Njd = %g is less than 0.1. Setting Njd to 0.1.\n", model->BSIM4v7DjctEmissionCoeff)); + model->BSIM4v7DjctEmissionCoeff = 0.1; + } + else if (model->BSIM4v7DjctEmissionCoeff < 0.7) { + wl_append_word(&wl, &wl, tprintf("Warning: Njd = %g is less than 0.7.\n", model->BSIM4v7DjctEmissionCoeff)); + } + + if (model->BSIM4v7njtsstemp < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: Njts = %g is negative at temperature = %g.\n", + model->BSIM4v7njtsstemp, ckt->CKTtemp)); + } + if (model->BSIM4v7njtsswstemp < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: Njtssw = %g is negative at temperature = %g.\n", + model->BSIM4v7njtsswstemp, ckt->CKTtemp)); + } + if (model->BSIM4v7njtsswgstemp < 0.0) { + wl_append_word(&wl, &wl, tprintf("Warning: Njtsswg = %g is negative at temperature = %g.\n", + model->BSIM4v7njtsswgstemp, ckt->CKTtemp)); + } + + if (model->BSIM4v7njtsdGiven && model->BSIM4v7njtsdtemp < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Njtsd = %g is negative at temperature = %g.\n", + model->BSIM4v7njtsdtemp, ckt->CKTtemp)); + } + if (model->BSIM4v7njtsswdGiven && model->BSIM4v7njtsswdtemp < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Njtsswd = %g is negative at temperature = %g.\n", + model->BSIM4v7njtsswdtemp, ckt->CKTtemp)); + } + if (model->BSIM4v7njtsswgdGiven && model->BSIM4v7njtsswgdtemp < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: Njtsswgd = %g is negative at temperature = %g.\n", + model->BSIM4v7njtsswgdtemp, ckt->CKTtemp)); + } + + if (model->BSIM4v7ntnoi < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: ntnoi = %g is negative. Set to zero.\n", model->BSIM4v7ntnoi)); + model->BSIM4v7ntnoi = 0.0; + } + + /* diode model */ + if (model->BSIM4v7SbulkJctBotGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJS = %g is too big. Set to 0.99.\n", model->BSIM4v7SbulkJctBotGradingCoeff)); + model->BSIM4v7SbulkJctBotGradingCoeff = 0.99; + } + if (model->BSIM4v7SbulkJctSideGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJSWS = %g is too big. Set to 0.99.\n", model->BSIM4v7SbulkJctSideGradingCoeff)); + model->BSIM4v7SbulkJctSideGradingCoeff = 0.99; + } + if (model->BSIM4v7SbulkJctGateSideGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJSWGS = %g is too big. Set to 0.99.\n", model->BSIM4v7SbulkJctGateSideGradingCoeff)); + model->BSIM4v7SbulkJctGateSideGradingCoeff = 0.99; + } + + if (model->BSIM4v7DbulkJctBotGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJD = %g is too big. Set to 0.99.\n", model->BSIM4v7DbulkJctBotGradingCoeff)); + model->BSIM4v7DbulkJctBotGradingCoeff = 0.99; + } + if (model->BSIM4v7DbulkJctSideGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJSWD = %g is too big. Set to 0.99.\n", model->BSIM4v7DbulkJctSideGradingCoeff)); + model->BSIM4v7DbulkJctSideGradingCoeff = 0.99; + } + if (model->BSIM4v7DbulkJctGateSideGradingCoeff >= 0.99) + { + wl_append_word(&wl, &wl, tprintf("Warning: MJSWGD = %g is too big. Set to 0.99.\n", model->BSIM4v7DbulkJctGateSideGradingCoeff)); + model->BSIM4v7DbulkJctGateSideGradingCoeff = 0.99; + } + if (model->BSIM4v7wpemod == 1) + { + if (model->BSIM4v7scref <= 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SCREF = %g is not positive. Set to 1e-6.\n", model->BSIM4v7scref)); + model->BSIM4v7scref = 1e-6; + } + if (here->BSIM4v7sca < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SCA = %g is negative. Set to 0.0.\n", here->BSIM4v7sca)); + here->BSIM4v7sca = 0.0; + } + if (here->BSIM4v7scb < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SCB = %g is negative. Set to 0.0.\n", here->BSIM4v7scb)); + here->BSIM4v7scb = 0.0; + } + if (here->BSIM4v7scc < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SCC = %g is negative. Set to 0.0.\n", here->BSIM4v7scc)); + here->BSIM4v7scc = 0.0; + } + if (here->BSIM4v7sc < 0.0) + { + wl_append_word(&wl, &wl, tprintf("Warning: SC = %g is negative. Set to 0.0.\n", here->BSIM4v7sc)); + here->BSIM4v7sc = 0.0; + } + } + + if (wlstart->wl_next) { + if ((fplog = fopen("bsim4v7.out", "w")) != NULL) { + while (wlstart) { + fprintf(fplog, "%s", wlstart->wl_word); + fprintf(stderr, "%s", wlstart->wl_word); + wlstart = wlstart->wl_next; } - if (model->BSIM4v7rnoic < 0.0) { - fprintf(fplog, "Warning: rnoic = %g is negative. Set to zero.\n", model->BSIM4v7rnoic); - printf("Warning: rnoic = %g is negative. Set to zero.\n", model->BSIM4v7rnoic); - model->BSIM4v7rnoic = 0.0; + fclose(fplog); + } + else { + while (wlstart) { + fprintf(stderr, "%s", wlstart->wl_word); + wlstart = wlstart->wl_next; } } + } - /* Limits of Njs and Njd modified in BSIM4v7.7 */ - if (model->BSIM4v7SjctEmissionCoeff < 0.1) { - fprintf(fplog, "Warning: Njs = %g is less than 0.1. Setting Njs to 0.1.\n", model->BSIM4v7SjctEmissionCoeff); - printf("Warning: Njs = %g is less than 0.1. Setting Njs to 0.1.\n", model->BSIM4v7SjctEmissionCoeff); - model->BSIM4v7SjctEmissionCoeff = 0.1; - } - else if (model->BSIM4v7SjctEmissionCoeff < 0.7) { - fprintf(fplog, "Warning: Njs = %g is less than 0.7.\n", model->BSIM4v7SjctEmissionCoeff); - printf("Warning: Njs = %g is less than 0.7.\n", model->BSIM4v7SjctEmissionCoeff); - } - if (model->BSIM4v7DjctEmissionCoeff < 0.1) { - fprintf(fplog, "Warning: Njd = %g is less than 0.1. Setting Njd to 0.1.\n", model->BSIM4v7DjctEmissionCoeff); - printf("Warning: Njd = %g is less than 0.1. Setting Njd to 0.1.\n", model->BSIM4v7DjctEmissionCoeff); - model->BSIM4v7DjctEmissionCoeff = 0.1; - } - else if (model->BSIM4v7DjctEmissionCoeff < 0.7) { - fprintf(fplog, "Warning: Njd = %g is less than 0.7.\n", model->BSIM4v7DjctEmissionCoeff); - printf("Warning: Njd = %g is less than 0.7.\n", model->BSIM4v7DjctEmissionCoeff); - } - - if (model->BSIM4v7njtsstemp < 0.0) - { fprintf(fplog, "Warning: Njts = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsstemp, ckt->CKTtemp); - printf("Warning: Njts = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsstemp, ckt->CKTtemp); - } - if (model->BSIM4v7njtsswstemp < 0.0) - { fprintf(fplog, "Warning: Njtssw = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsswstemp, ckt->CKTtemp); - printf("Warning: Njtssw = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsswstemp, ckt->CKTtemp); - } - if (model->BSIM4v7njtsswgstemp < 0.0) - { fprintf(fplog, "Warning: Njtsswg = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsswgstemp, ckt->CKTtemp); - printf("Warning: Njtsswg = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsswgstemp, ckt->CKTtemp); - } - - if (model->BSIM4v7njtsdGiven && model->BSIM4v7njtsdtemp < 0.0) - { fprintf(fplog, "Warning: Njtsd = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsdtemp, ckt->CKTtemp); - printf("Warning: Njtsd = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsdtemp, ckt->CKTtemp); - } - if (model->BSIM4v7njtsswdGiven && model->BSIM4v7njtsswdtemp < 0.0) - { fprintf(fplog, "Warning: Njtsswd = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsswdtemp, ckt->CKTtemp); - printf("Warning: Njtsswd = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsswdtemp, ckt->CKTtemp); - } - if (model->BSIM4v7njtsswgdGiven && model->BSIM4v7njtsswgdtemp < 0.0) - { fprintf(fplog, "Warning: Njtsswgd = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsswgdtemp, ckt->CKTtemp); - printf("Warning: Njtsswgd = %g is negative at temperature = %g.\n", - model->BSIM4v7njtsswgdtemp, ckt->CKTtemp); - } - - if (model->BSIM4v7ntnoi < 0.0) - { fprintf(fplog, "Warning: ntnoi = %g is negative. Set to zero.\n", model->BSIM4v7ntnoi); - printf("Warning: ntnoi = %g is negative. Set to zero.\n", model->BSIM4v7ntnoi); - model->BSIM4v7ntnoi = 0.0; - } - - /* diode model */ - if (model->BSIM4v7SbulkJctBotGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJS = %g is too big. Set to 0.99.\n", model->BSIM4v7SbulkJctBotGradingCoeff); - printf("Warning: MJS = %g is too big. Set to 0.99.\n", model->BSIM4v7SbulkJctBotGradingCoeff); - model->BSIM4v7SbulkJctBotGradingCoeff = 0.99; - } - if (model->BSIM4v7SbulkJctSideGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJSWS = %g is too big. Set to 0.99.\n", model->BSIM4v7SbulkJctSideGradingCoeff); - printf("Warning: MJSWS = %g is too big. Set to 0.99.\n", model->BSIM4v7SbulkJctSideGradingCoeff); - model->BSIM4v7SbulkJctSideGradingCoeff = 0.99; - } - if (model->BSIM4v7SbulkJctGateSideGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJSWGS = %g is too big. Set to 0.99.\n", model->BSIM4v7SbulkJctGateSideGradingCoeff); - printf("Warning: MJSWGS = %g is too big. Set to 0.99.\n", model->BSIM4v7SbulkJctGateSideGradingCoeff); - model->BSIM4v7SbulkJctGateSideGradingCoeff = 0.99; - } - - if (model->BSIM4v7DbulkJctBotGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJD = %g is too big. Set to 0.99.\n", model->BSIM4v7DbulkJctBotGradingCoeff); - printf("Warning: MJD = %g is too big. Set to 0.99.\n", model->BSIM4v7DbulkJctBotGradingCoeff); - model->BSIM4v7DbulkJctBotGradingCoeff = 0.99; - } - if (model->BSIM4v7DbulkJctSideGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJSWD = %g is too big. Set to 0.99.\n", model->BSIM4v7DbulkJctSideGradingCoeff); - printf("Warning: MJSWD = %g is too big. Set to 0.99.\n", model->BSIM4v7DbulkJctSideGradingCoeff); - model->BSIM4v7DbulkJctSideGradingCoeff = 0.99; - } - if (model->BSIM4v7DbulkJctGateSideGradingCoeff >= 0.99) - { fprintf(fplog, "Warning: MJSWGD = %g is too big. Set to 0.99.\n", model->BSIM4v7DbulkJctGateSideGradingCoeff); - printf("Warning: MJSWGD = %g is too big. Set to 0.99.\n", model->BSIM4v7DbulkJctGateSideGradingCoeff); - model->BSIM4v7DbulkJctGateSideGradingCoeff = 0.99; - } - if (model->BSIM4v7wpemod == 1) - { - if (model->BSIM4v7scref <= 0.0) - { fprintf(fplog, "Warning: SCREF = %g is not positive. Set to 1e-6.\n", model->BSIM4v7scref); - printf("Warning: SCREF = %g is not positive. Set to 1e-6.\n", model->BSIM4v7scref); - model->BSIM4v7scref = 1e-6; - } - /*Move these checks to temp.c for sceff calculation*/ - /* - if (here->BSIM4v7sca < 0.0) - { fprintf(fplog, "Warning: SCA = %g is negative. Set to 0.0.\n", here->BSIM4v7sca); - printf("Warning: SCA = %g is negative. Set to 0.0.\n", here->BSIM4v7sca); - here->BSIM4v7sca = 0.0; - } - if (here->BSIM4v7scb < 0.0) - { fprintf(fplog, "Warning: SCB = %g is negative. Set to 0.0.\n", here->BSIM4v7scb); - printf("Warning: SCB = %g is negative. Set to 0.0.\n", here->BSIM4v7scb); - here->BSIM4v7scb = 0.0; - } - if (here->BSIM4v7scc < 0.0) - { fprintf(fplog, "Warning: SCC = %g is negative. Set to 0.0.\n", here->BSIM4v7scc); - printf("Warning: SCC = %g is negative. Set to 0.0.\n", here->BSIM4v7scc); - here->BSIM4v7scc = 0.0; - } - if (here->BSIM4v7sc < 0.0) - { fprintf(fplog, "Warning: SC = %g is negative. Set to 0.0.\n", here->BSIM4v7sc); - printf("Warning: SC = %g is negative. Set to 0.0.\n", here->BSIM4v7sc); - here->BSIM4v7sc = 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"); + wl_free(wlstart); + + if ((strcmp(model->BSIM4v7version, "4.7.0")) && (strncmp(model->BSIM4v7version, "4.70", 4)) && (strncmp(model->BSIM4v7version, "4.7", 3))) + { + printf("Warning: This model is BSIM4.7.0; you specified a wrong version number '%s'.\n", model->BSIM4v7version); } return(Fatal_Flag); diff --git a/src/spicelib/devices/bsim4v7/b4v7temp.c b/src/spicelib/devices/bsim4v7/b4v7temp.c index 588fd5c98..5f9de0fdc 100644 --- a/src/spicelib/devices/bsim4v7/b4v7temp.c +++ b/src/spicelib/devices/bsim4v7/b4v7temp.c @@ -2313,7 +2313,8 @@ int Size_Not_Found, i; if (BSIM4v7checkModel(model, here, ckt)) { - SPfrontEnd->IFerrorf (ERR_FATAL, "Fatal error(s) detected during BSIM4v7.6.0 parameter checking for %s in model %s", model->BSIM4v7modName, here->BSIM4v7name); + SPfrontEnd->IFerrorf(ERR_FATAL, + "detected during BSIM4.7.0 parameter checking for \n model %s of device instance %s\n", model->BSIM4v7modName, here->BSIM4v7name); return(E_BADPARM); } } /* End instance */