📄 b4check.c
字号:
/**** BSIM4.4.0 Released by Xuemei (Jane) Xi 03/04/2004 ****//********** * Copyright 2004 Regents of the University of California. All rights reserved. * File: b4check.c of BSIM4.4.0. * Author: 2000 Weidong Liu * Authors: 2001- Xuemei Xi, Jin He, Kanyu Cao, Mohan Dunga, Mansun Chan, Ali Niknejad, Chenming Hu. * Project Director: Prof. Chenming Hu. * Modified by Xuemei Xi, 04/06/2001. * Modified by Xuemei Xi, 10/05/2001. * Modified by Xuemei Xi, 11/15/2002. * Modified by Xuemei Xi, 05/09/2003. * Modified by Xuemei Xi, 03/04/2004. **********/#include "ngspice.h"#include "cktdefs.h"#include "bsim4def.h"#include "trandefs.h"#include "const.h"#include "sperror.h"#include "devdefs.h"#include "suffix.h"intBSIM4checkModel(model, here, ckt)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, Jin He, 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.4.0") != 0) { fprintf(fplog, "Warning: This model is BSIM4.4.0; you specified a wrong version number.\n"); printf("Warning: This model is BSIM4.4.0; you specified a wrong 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"); } } 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 (model->BSIM4toxp <= 0.0) { fprintf(fplog, "Fatal: Toxp = %g is not positive.\n", model->BSIM4toxp); printf("Fatal: Toxp = %g is not positive.\n", model->BSIM4toxp); Fatal_Flag = 1; } 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 (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; } 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 (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 (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 (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 (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 (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 (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 (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((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 ((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 (model->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 ((model->BSIM4ngcon != 1.0) && (model->BSIM4ngcon != 2.0)) { model->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 (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); } /* 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); 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); 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); 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); Fatal_Flag = 1; } } 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); 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); 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); 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->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); } 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); } 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); } 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); } /* 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); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -