devices/bsim3v32, implement BSIM3v32soaCheck()

This commit is contained in:
dwarning 2013-10-30 20:14:22 +01:00 committed by rlar
parent 4e4ea00ba7
commit f9c05885fa
10 changed files with 204 additions and 1 deletions

View File

@ -19,6 +19,7 @@ libbsim3v32_la_SOURCES = \
b3v32par.c \
b3v32pzld.c \
b3v32set.c \
b3v32soachk.c \
b3v32temp.c \
b3v32trunc.c \
bsim3v32def.h \

View File

@ -498,6 +498,13 @@ IOP( "ef", BSIM3v32_MOD_EF, IF_REAL, "Flicker noise frequency exponent"),
IOP( "af", BSIM3v32_MOD_AF, IF_REAL, "Flicker noise exponent"),
IOP( "kf", BSIM3v32_MOD_KF, IF_REAL, "Flicker noise coefficient"),
IOP("vgs_max", BSIM3v32_MOD_VGS_MAX, IF_REAL, "maximum voltage G-S branch"),
IOP("vgd_max", BSIM3v32_MOD_VGD_MAX, IF_REAL, "maximum voltage G-D branch"),
IOP("vgb_max", BSIM3v32_MOD_VGB_MAX, IF_REAL, "maximum voltage G-B branch"),
IOP("vds_max", BSIM3v32_MOD_VDS_MAX, IF_REAL, "maximum voltage D-S branch"),
IOP("vbs_max", BSIM3v32_MOD_VBS_MAX, IF_REAL, "maximum voltage B-S branch"),
IOP("vbd_max", BSIM3v32_MOD_VBD_MAX, IF_REAL, "maximum voltage B-D branch"),
IP( "nmos", BSIM3v32_MOD_NMOS, IF_FLAG, "Flag to indicate NMOS"),
IP( "pmos", BSIM3v32_MOD_PMOS, IF_FLAG, "Flag to indicate PMOS"),
};

View File

@ -1274,6 +1274,26 @@ BSIM3v32mAsk (CKTcircuit *ckt, GENmodel *inst, int which, IFvalue *value)
case BSIM3v32_MOD_KF:
value->rValue = model->BSIM3v32kf;
return(OK);
case BSIM3v32_MOD_VGS_MAX:
value->rValue = model->BSIM3v32vgsMax;
return(OK);
case BSIM3v32_MOD_VGD_MAX:
value->rValue = model->BSIM3v32vgdMax;
return(OK);
case BSIM3v32_MOD_VGB_MAX:
value->rValue = model->BSIM3v32vgbMax;
return(OK);
case BSIM3v32_MOD_VDS_MAX:
value->rValue = model->BSIM3v32vdsMax;
return(OK);
case BSIM3v32_MOD_VBS_MAX:
value->rValue = model->BSIM3v32vbsMax;
return(OK);
case BSIM3v32_MOD_VBD_MAX:
value->rValue = model->BSIM3v32vbdMax;
return(OK);
default:
return(E_BADPARM);
}

View File

@ -1709,6 +1709,32 @@ BSIM3v32mParam(int param, IFvalue *value, GENmodel *inMod)
mod->BSIM3v32kf = value->rValue;
mod->BSIM3v32kfGiven = TRUE;
break;
case BSIM3v32_MOD_VGS_MAX:
mod->BSIM3v32vgsMax = value->rValue;
mod->BSIM3v32vgsMaxGiven = TRUE;
break;
case BSIM3v32_MOD_VGD_MAX:
mod->BSIM3v32vgdMax = value->rValue;
mod->BSIM3v32vgdMaxGiven = TRUE;
break;
case BSIM3v32_MOD_VGB_MAX:
mod->BSIM3v32vgbMax = value->rValue;
mod->BSIM3v32vgbMaxGiven = TRUE;
break;
case BSIM3v32_MOD_VDS_MAX:
mod->BSIM3v32vdsMax = value->rValue;
mod->BSIM3v32vdsMaxGiven = TRUE;
break;
case BSIM3v32_MOD_VBS_MAX:
mod->BSIM3v32vbsMax = value->rValue;
mod->BSIM3v32vbsMaxGiven = TRUE;
break;
case BSIM3v32_MOD_VBD_MAX:
mod->BSIM3v32vbdMax = value->rValue;
mod->BSIM3v32vbdMaxGiven = TRUE;
break;
case BSIM3v32_MOD_NMOS :
if(value->iValue) {
mod->BSIM3v32type = 1;

View File

@ -902,6 +902,20 @@ IFuid tmpName;
model->BSIM3v32af = 1.0;
if (!model->BSIM3v32kfGiven)
model->BSIM3v32kf = 0.0;
if (!model->BSIM3v32vgsMaxGiven)
model->BSIM3v32vgsMax = 1e99;
if (!model->BSIM3v32vgdMaxGiven)
model->BSIM3v32vgdMax = 1e99;
if (!model->BSIM3v32vgbMaxGiven)
model->BSIM3v32vgbMax = 1e99;
if (!model->BSIM3v32vdsMaxGiven)
model->BSIM3v32vdsMax = 1e99;
if (!model->BSIM3v32vbsMaxGiven)
model->BSIM3v32vbsMax = 1e99;
if (!model->BSIM3v32vbdMaxGiven)
model->BSIM3v32vbdMax = 1e99;
/* loop through all the instances of the model */
for (here = model->BSIM3v32instances; here != NULL ;
here=here->BSIM3v32nextInstance)

View File

@ -0,0 +1,110 @@
/**********
Copyright 2013 Dietmar Warning. All rights reserved.
Author: 2013 Dietmar Warning
**********/
#include "ngspice/ngspice.h"
#include "ngspice/cktdefs.h"
#include "bsim3v32def.h"
#include "ngspice/trandefs.h"
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
#include "ngspice/cpdefs.h"
int
BSIM3v32soaCheck(CKTcircuit *ckt, GENmodel *inModel)
{
BSIM3v32model *model = (BSIM3v32model *) inModel;
BSIM3v32instance *here;
double vgs, vgd, vgb, vds, vbs, vbd; /* actual mos voltages */
int maxwarns;
static int warns_vgs = 0, warns_vgd = 0, warns_vgb = 0, warns_vds = 0, warns_vbs = 0, warns_vbd = 0;
if (!ckt) {
warns_vgs = 0;
warns_vgd = 0;
warns_vgb = 0;
warns_vds = 0;
warns_vbs = 0;
warns_vbd = 0;
return OK;
}
maxwarns = ckt->CKTsoaMaxWarns;
for (; model; model = model->BSIM3v32nextModel) {
for (here = model->BSIM3v32instances; here; here = here->BSIM3v32nextInstance) {
vgs = fabs(ckt->CKTrhsOld [here->BSIM3v32gNode] -
ckt->CKTrhsOld [here->BSIM3v32sNodePrime]);
vgd = fabs(ckt->CKTrhsOld [here->BSIM3v32gNode] -
ckt->CKTrhsOld [here->BSIM3v32dNodePrime]);
vgb = fabs(ckt->CKTrhsOld [here->BSIM3v32gNode] -
ckt->CKTrhsOld [here->BSIM3v32bNode]);
vds = fabs(ckt->CKTrhsOld [here->BSIM3v32dNodePrime] -
ckt->CKTrhsOld [here->BSIM3v32sNodePrime]);
vbs = fabs(ckt->CKTrhsOld [here->BSIM3v32bNode] -
ckt->CKTrhsOld [here->BSIM3v32sNodePrime]);
vbd = fabs(ckt->CKTrhsOld [here->BSIM3v32bNode] -
ckt->CKTrhsOld [here->BSIM3v32dNodePrime]);
if (vgs > model->BSIM3v32vgsMax)
if (warns_vgs < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vgs|=%g has exceeded Vgs_max=%g\n",
vgs, model->BSIM3v32vgsMax);
warns_vgs++;
}
if (vgd > model->BSIM3v32vgdMax)
if (warns_vgd < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vgd|=%g has exceeded Vgd_max=%g\n",
vgd, model->BSIM3v32vgdMax);
warns_vgd++;
}
if (vgb > model->BSIM3v32vgbMax)
if (warns_vgb < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vgb|=%g has exceeded Vgb_max=%g\n",
vgb, model->BSIM3v32vgbMax);
warns_vgb++;
}
if (vds > model->BSIM3v32vdsMax)
if (warns_vds < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vds|=%g has exceeded Vds_max=%g\n",
vds, model->BSIM3v32vdsMax);
warns_vds++;
}
if (vbs > model->BSIM3v32vbsMax)
if (warns_vbs < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vbs|=%g has exceeded Vbs_max=%g\n",
vbs, model->BSIM3v32vbsMax);
warns_vbs++;
}
if (vbd > model->BSIM3v32vbdMax)
if (warns_vbd < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vbd|=%g has exceeded Vbd_max=%g\n",
vbd, model->BSIM3v32vbdMax);
warns_vbd++;
}
}
}
return OK;
}

View File

@ -822,6 +822,13 @@ typedef struct sBSIM3v32model
double BSIM3v32af;
double BSIM3v32kf;
double BSIM3v32vgsMax;
double BSIM3v32vgdMax;
double BSIM3v32vgbMax;
double BSIM3v32vdsMax;
double BSIM3v32vbsMax;
double BSIM3v32vbdMax;
struct bsim3v32SizeDependParam *pSizeDependParamKnot;
/* Flags */
@ -1259,6 +1266,13 @@ typedef struct sBSIM3v32model
unsigned BSIM3v32WminGiven :1;
unsigned BSIM3v32WmaxGiven :1;
unsigned BSIM3v32vgsMaxGiven :1;
unsigned BSIM3v32vgdMaxGiven :1;
unsigned BSIM3v32vgbMaxGiven :1;
unsigned BSIM3v32vdsMaxGiven :1;
unsigned BSIM3v32vbsMaxGiven :1;
unsigned BSIM3v32vbdMaxGiven :1;
} BSIM3v32model;
@ -1814,6 +1828,12 @@ typedef struct sBSIM3v32model
#define BSIM3v32_CBDB 792
#define BSIM3v32_CBSB 793
#define BSIM3v32_MOD_VGS_MAX 801
#define BSIM3v32_MOD_VGD_MAX 802
#define BSIM3v32_MOD_VGB_MAX 803
#define BSIM3v32_MOD_VDS_MAX 804
#define BSIM3v32_MOD_VBS_MAX 805
#define BSIM3v32_MOD_VBD_MAX 806
#include "bsim3v32ext.h"

View File

@ -29,3 +29,4 @@ extern int BSIM3v32temp(GENmodel*,CKTcircuit*);
extern int BSIM3v32trunc(GENmodel*,CKTcircuit*,double*);
extern int BSIM3v32noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*);
extern int BSIM3v32unsetup(GENmodel*,CKTcircuit*);
extern int BSIM3v32soaCheck(CKTcircuit *, GENmodel *);

View File

@ -66,7 +66,7 @@ SPICEdev BSIM3v32info = {
/* DEVsenTrunc */ NULL,
/* DEVdisto */ NULL,
/* DEVnoise */ BSIM3v32noise,
/* DEVsoaCheck */ NULL,
/* DEVsoaCheck */ BSIM3v32soaCheck,
#ifdef CIDER
/* DEVdump */ NULL,
/* DEVacct */ NULL,

View File

@ -3904,6 +3904,10 @@
RelativePath="..\src\spicelib\devices\bsim3v32\b3v32set.c"
>
</File>
<File
RelativePath="..\src\spicelib\devices\bsim3v32\b3v32soachk.c"
>
</File>
<File
RelativePath="..\src\spicelib\devices\bsim3v32\b3v32temp.c"
>