Browse Source

devices/hisimhv1, implement HSMHVsoaCheck()

pre-master-46
dwarning 13 years ago
committed by rlar
parent
commit
f6c6fa85a0
  1. 1
      src/spicelib/devices/hisimhv1/Makefile.am
  2. 9
      src/spicelib/devices/hisimhv1/hsmhv.c
  3. 20
      src/spicelib/devices/hisimhv1/hsmhvdef.h
  4. 1
      src/spicelib/devices/hisimhv1/hsmhvext.h
  5. 2
      src/spicelib/devices/hisimhv1/hsmhvinit.c
  6. 19
      src/spicelib/devices/hisimhv1/hsmhvmask.c
  7. 25
      src/spicelib/devices/hisimhv1/hsmhvmpar.c
  8. 7
      src/spicelib/devices/hisimhv1/hsmhvset.c
  9. 110
      src/spicelib/devices/hisimhv1/hsmhvsoachk.c
  10. 4
      visualc/vngspice.vcproj

1
src/spicelib/devices/hisimhv1/Makefile.am

@ -27,6 +27,7 @@ libhisimhv1_la_SOURCES = hisimhv.h \
hsmhvpar.c \ hsmhvpar.c \
hsmhvpzld.c \ hsmhvpzld.c \
hsmhvset.c \ hsmhvset.c \
hsmhvsoachk.c \
hsmhvtemp.c \ hsmhvtemp.c \
hsmhvtemp_eval.h \ hsmhvtemp_eval.h \
hsmhvtrunc.c hsmhvtrunc.c

9
src/spicelib/devices/hisimhv1/hsmhv.c

@ -718,7 +718,14 @@ IFparm HSMHVmPTable[] = { /* model parameters */
IOP("prdvg11", HSMHV_MOD_PRDVG11, IF_REAL, "Cross-term dependence of rdvg11"), IOP("prdvg11", HSMHV_MOD_PRDVG11, IF_REAL, "Cross-term dependence of rdvg11"),
IOP("prs", HSMHV_MOD_PRS, IF_REAL, "Cross-term dependence of rs"), IOP("prs", HSMHV_MOD_PRS, IF_REAL, "Cross-term dependence of rs"),
IOP("prth0", HSMHV_MOD_PRTH0, IF_REAL, "Cross-term dependence of rth0"), IOP("prth0", HSMHV_MOD_PRTH0, IF_REAL, "Cross-term dependence of rth0"),
IOP("pvover", HSMHV_MOD_PVOVER, IF_REAL, "Cross-term dependence of vover")
IOP("pvover", HSMHV_MOD_PVOVER, IF_REAL, "Cross-term dependence of vover"),
IOP("vgs_max", HSMHV_MOD_VGS_MAX, IF_REAL, "maximum voltage G-S branch"),
IOP("vgd_max", HSMHV_MOD_VGD_MAX, IF_REAL, "maximum voltage G-D branch"),
IOP("vgb_max", HSMHV_MOD_VGB_MAX, IF_REAL, "maximum voltage G-B branch"),
IOP("vds_max", HSMHV_MOD_VDS_MAX, IF_REAL, "maximum voltage D-S branch"),
IOP("vbs_max", HSMHV_MOD_VBS_MAX, IF_REAL, "maximum voltage B-S branch"),
IOP("vbd_max", HSMHV_MOD_VBD_MAX, IF_REAL, "maximum voltage B-D branch")
}; };

20
src/spicelib/devices/hisimhv1/hsmhvdef.h

@ -1549,6 +1549,13 @@ typedef struct sHSMHVmodel { /* model structure for a resistor */
double HSMHV_qme12 ; double HSMHV_qme12 ;
double HSMHV_ktnom ; double HSMHV_ktnom ;
double HSMHVvgsMax;
double HSMHVvgdMax;
double HSMHVvgbMax;
double HSMHVvdsMax;
double HSMHVvbsMax;
double HSMHVvbdMax;
HSMHVmodelMKSParam modelMKS ; /* unit-converted parameters */ HSMHVmodelMKSParam modelMKS ; /* unit-converted parameters */
@ -2175,6 +2182,13 @@ typedef struct sHSMHVmodel { /* model structure for a resistor */
unsigned HSMHV_prth0_Given :1; unsigned HSMHV_prth0_Given :1;
unsigned HSMHV_pvover_Given :1; unsigned HSMHV_pvover_Given :1;
unsigned HSMHVvgsMaxGiven :1;
unsigned HSMHVvgdMaxGiven :1;
unsigned HSMHVvgbMaxGiven :1;
unsigned HSMHVvdsMaxGiven :1;
unsigned HSMHVvbsMaxGiven :1;
unsigned HSMHVvbdMaxGiven :1;
} HSMHVmodel; } HSMHVmodel;
#ifndef NMOS #ifndef NMOS
@ -2926,6 +2940,12 @@ typedef struct sHSMHVmodel { /* model structure for a resistor */
#define HSMHV_MOD_TCJBDSWG 96 #define HSMHV_MOD_TCJBDSWG 96
#define HSMHV_MOD_TCJBSSWG 97 #define HSMHV_MOD_TCJBSSWG 97
#define HSMHV_MOD_VGS_MAX 4001
#define HSMHV_MOD_VGD_MAX 4002
#define HSMHV_MOD_VGB_MAX 4003
#define HSMHV_MOD_VDS_MAX 4004
#define HSMHV_MOD_VBS_MAX 4005
#define HSMHV_MOD_VBD_MAX 4006
#include "hsmhvext.h" #include "hsmhvext.h"

1
src/spicelib/devices/hisimhv1/hsmhvext.h

@ -37,3 +37,4 @@ extern int HSMHVunsetup(GENmodel*,CKTcircuit*);
extern int HSMHVtemp(GENmodel*,CKTcircuit*); extern int HSMHVtemp(GENmodel*,CKTcircuit*);
extern int HSMHVtrunc(GENmodel*,CKTcircuit*,double*); extern int HSMHVtrunc(GENmodel*,CKTcircuit*,double*);
extern int HSMHVnoise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); extern int HSMHVnoise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*);
extern int HSMHVsoaCheck(CKTcircuit *, GENmodel *);

2
src/spicelib/devices/hisimhv1/hsmhvinit.c

@ -65,7 +65,7 @@ SPICEdev HSMHVinfo = {
/* DEVsenTrunc */ NULL, /* DEVsenTrunc */ NULL,
/* DEVdisto */ NULL, /* DEVdisto */ NULL,
/* DEVnoise */ HSMHVnoise, /* DEVnoise */ HSMHVnoise,
/* DEVsoaCheck */ NULL,
/* DEVsoaCheck */ HSMHVsoaCheck,
#ifdef CIDER #ifdef CIDER
/* DEVdump */ NULL, /* DEVdump */ NULL,
/* DEVacct */ NULL, /* DEVacct */ NULL,

19
src/spicelib/devices/hisimhv1/hsmhvmask.c

@ -1850,6 +1850,25 @@ int HSMHVmAsk(
value->rValue = model->HSMHV_pvover; value->rValue = model->HSMHV_pvover;
return(OK); return(OK);
case HSMHV_MOD_VGS_MAX:
value->rValue = model->HSMHVvgsMax;
return(OK);
case HSMHV_MOD_VGD_MAX:
value->rValue = model->HSMHVvgdMax;
return(OK);
case HSMHV_MOD_VGB_MAX:
value->rValue = model->HSMHVvgbMax;
return(OK);
case HSMHV_MOD_VDS_MAX:
value->rValue = model->HSMHVvdsMax;
return(OK);
case HSMHV_MOD_VBS_MAX:
value->rValue = model->HSMHVvbsMax;
return(OK);
case HSMHV_MOD_VBD_MAX:
value->rValue = model->HSMHVvbdMax;
return(OK);
default: default:
return(E_BADPARM); return(E_BADPARM);
} }

25
src/spicelib/devices/hisimhv1/hsmhvmpar.c

@ -2446,6 +2446,31 @@ int HSMHVmParam(
mod->HSMHV_pvover_Given = TRUE; mod->HSMHV_pvover_Given = TRUE;
break; break;
case HSMHV_MOD_VGS_MAX:
mod->HSMHVvgsMax = value->rValue;
mod->HSMHVvgsMaxGiven = TRUE;
break;
case HSMHV_MOD_VGD_MAX:
mod->HSMHVvgdMax = value->rValue;
mod->HSMHVvgdMaxGiven = TRUE;
break;
case HSMHV_MOD_VGB_MAX:
mod->HSMHVvgbMax = value->rValue;
mod->HSMHVvgbMaxGiven = TRUE;
break;
case HSMHV_MOD_VDS_MAX:
mod->HSMHVvdsMax = value->rValue;
mod->HSMHVvdsMaxGiven = TRUE;
break;
case HSMHV_MOD_VBS_MAX:
mod->HSMHVvbsMax = value->rValue;
mod->HSMHVvbsMaxGiven = TRUE;
break;
case HSMHV_MOD_VBD_MAX:
mod->HSMHVvbdMax = value->rValue;
mod->HSMHVvbdMaxGiven = TRUE;
break;
default: default:
return(E_BADPARM); return(E_BADPARM);
} }

7
src/spicelib/devices/hisimhv1/hsmhvset.c

@ -738,6 +738,13 @@ int HSMHVsetup(
if ( model->HSMHV_rd26_Given ) model->HSMHV_qovsm = model->HSMHV_rd26 ; if ( model->HSMHV_rd26_Given ) model->HSMHV_qovsm = model->HSMHV_rd26 ;
if ( model->HSMHV_ldrift_Given ) model->HSMHV_ldrift2 = model->HSMHV_ldrift ; if ( model->HSMHV_ldrift_Given ) model->HSMHV_ldrift2 = model->HSMHV_ldrift ;
if (!model->HSMHVvgsMaxGiven) model->HSMHVvgsMax = 1e99;
if (!model->HSMHVvgdMaxGiven) model->HSMHVvgdMax = 1e99;
if (!model->HSMHVvgbMaxGiven) model->HSMHVvgbMax = 1e99;
if (!model->HSMHVvdsMaxGiven) model->HSMHVvdsMax = 1e99;
if (!model->HSMHVvbsMaxGiven) model->HSMHVvbsMax = 1e99;
if (!model->HSMHVvbdMaxGiven) model->HSMHVvbdMax = 1e99;
/* For Symmetrical Device */ /* For Symmetrical Device */
if ( model->HSMHV_cosym ) { if ( model->HSMHV_cosym ) {
if(!model->HSMHV_rs_Given ) if(!model->HSMHV_rs_Given )

110
src/spicelib/devices/hisimhv1/hsmhvsoachk.c

@ -0,0 +1,110 @@
/**********
Copyright 2013 Dietmar Warning. All rights reserved.
Author: 2013 Dietmar Warning
**********/
#include "ngspice/ngspice.h"
#include "ngspice/cktdefs.h"
#include "hsmhvdef.h"
#include "ngspice/trandefs.h"
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
#include "ngspice/cpdefs.h"
int
HSMHVsoaCheck(CKTcircuit *ckt, GENmodel *inModel)
{
HSMHVmodel *model = (HSMHVmodel *) inModel;
HSMHVinstance *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->HSMHVnextModel) {
for (here = model->HSMHVinstances; here; here = here->HSMHVnextInstance) {
vgs = fabs(ckt->CKTrhsOld [here->HSMHVgNode] -
ckt->CKTrhsOld [here->HSMHVsNodePrime]);
vgd = fabs(ckt->CKTrhsOld [here->HSMHVgNode] -
ckt->CKTrhsOld [here->HSMHVdNodePrime]);
vgb = fabs(ckt->CKTrhsOld [here->HSMHVgNode] -
ckt->CKTrhsOld [here->HSMHVbNode]);
vds = fabs(ckt->CKTrhsOld [here->HSMHVdNodePrime] -
ckt->CKTrhsOld [here->HSMHVsNodePrime]);
vbs = fabs(ckt->CKTrhsOld [here->HSMHVbNode] -
ckt->CKTrhsOld [here->HSMHVsNodePrime]);
vbd = fabs(ckt->CKTrhsOld [here->HSMHVbNode] -
ckt->CKTrhsOld [here->HSMHVdNodePrime]);
if (vgs > model->HSMHVvgsMax)
if (warns_vgs < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vgs|=%g has exceeded Vgs_max=%g\n",
vgs, model->HSMHVvgsMax);
warns_vgs++;
}
if (vgd > model->HSMHVvgdMax)
if (warns_vgd < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vgd|=%g has exceeded Vgd_max=%g\n",
vgd, model->HSMHVvgdMax);
warns_vgd++;
}
if (vgb > model->HSMHVvgbMax)
if (warns_vgb < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vgb|=%g has exceeded Vgb_max=%g\n",
vgb, model->HSMHVvgbMax);
warns_vgb++;
}
if (vds > model->HSMHVvdsMax)
if (warns_vds < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vds|=%g has exceeded Vds_max=%g\n",
vds, model->HSMHVvdsMax);
warns_vds++;
}
if (vbs > model->HSMHVvbsMax)
if (warns_vbs < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vbs|=%g has exceeded Vbs_max=%g\n",
vbs, model->HSMHVvbsMax);
warns_vbs++;
}
if (vbd > model->HSMHVvbdMax)
if (warns_vbd < maxwarns) {
soa_printf(ckt, (GENinstance*) here,
"|Vbd|=%g has exceeded Vbd_max=%g\n",
vbd, model->HSMHVvbdMax);
warns_vbd++;
}
}
}
return OK;
}

4
visualc/vngspice.vcproj

@ -5936,6 +5936,10 @@
RelativePath="..\src\spicelib\devices\hisimhv1\hsmhvset.c" RelativePath="..\src\spicelib\devices\hisimhv1\hsmhvset.c"
> >
</File> </File>
<File
RelativePath="..\src\spicelib\devices\hisimhv1\hsmhvsoachk.c"
>
</File>
<File <File
RelativePath="..\src\spicelib\devices\hisimhv1\hsmhvtemp.c" RelativePath="..\src\spicelib\devices\hisimhv1\hsmhvtemp.c"
> >

Loading…
Cancel
Save