diff --git a/src/spicelib/devices/mos2/mos2.c b/src/spicelib/devices/mos2/mos2.c index fa2d12254..976aeba9c 100644 --- a/src/spicelib/devices/mos2/mos2.c +++ b/src/spicelib/devices/mos2/mos2.c @@ -35,7 +35,8 @@ IFparm MOS2pTable[] = { /* parameters */ IOPAU("icvds", MOS2_IC_VDS,IF_REAL , "Initial D-S voltage"), IOPAU("icvgs", MOS2_IC_VGS,IF_REAL , "Initial G-S voltage"), IOPAU("icvbs", MOS2_IC_VBS,IF_REAL , "Initial B-S voltage"), - IOPU("temp", MOS2_TEMP, IF_REAL , "Instance operating temperature"), + IOPU("temp", MOS2_TEMP, IF_REAL ,"Instance operating temperature"), + IOPU("dtemp", MOS2_DTEMP, IF_REAL , "Instance temperature difference"), IP( "ic", MOS2_IC, IF_REALVEC, "Vector of D-S, G-S, B-S voltages"), IP( "sens_l", MOS2_L_SENS,IF_FLAG, "flag to request sensitivity WRT length"), IP( "sens_w", MOS2_W_SENS,IF_FLAG, "flag to request sensitivity WRT width"), diff --git a/src/spicelib/devices/mos2/mos2acld.c b/src/spicelib/devices/mos2/mos2acld.c index 02f69651b..115cf9f27 100644 --- a/src/spicelib/devices/mos2/mos2acld.c +++ b/src/spicelib/devices/mos2/mos2acld.c @@ -14,9 +14,7 @@ Modified: 2000 AlansFixes int -MOS2acLoad(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS2acLoad(GENmodel *inModel, CKTcircuit *ckt) { MOS2model *model = (MOS2model *)inModel; MOS2instance *here; diff --git a/src/spicelib/devices/mos2/mos2ask.c b/src/spicelib/devices/mos2/mos2ask.c index 5217d5286..a5ee7d864 100644 --- a/src/spicelib/devices/mos2/mos2ask.c +++ b/src/spicelib/devices/mos2/mos2ask.c @@ -15,12 +15,8 @@ Modified: 2000 AlansFixes /*ARGSUSED*/ int -MOS2ask(ckt,inst,which,value,select) - CKTcircuit *ckt; - GENinstance *inst; - int which; - IFvalue *value; - IFvalue *select; +MOS2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, + IFvalue *select) { MOS2instance *here = (MOS2instance *)inst; double vr; @@ -33,6 +29,9 @@ MOS2ask(ckt,inst,which,value,select) case MOS2_TEMP: value->rValue = here->MOS2temp-CONSTCtoK; return(OK); + case MOS2_DTEMP: + value->rValue = here->MOS2dtemp; + return(OK); case MOS2_CGS: value->rValue = 2* *(ckt->CKTstate0 + here->MOS2capgs); return(OK); diff --git a/src/spicelib/devices/mos2/mos2conv.c b/src/spicelib/devices/mos2/mos2conv.c index ee2c6e756..c6488fbae 100644 --- a/src/spicelib/devices/mos2/mos2conv.c +++ b/src/spicelib/devices/mos2/mos2conv.c @@ -10,9 +10,7 @@ Author: 1985 Thomas L. Quarles #include "suffix.h" int -MOS2convTest(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS2convTest(GENmodel *inModel, CKTcircuit *ckt) { MOS2model *model = (MOS2model *)inModel; MOS2instance *here; diff --git a/src/spicelib/devices/mos2/mos2defs.h b/src/spicelib/devices/mos2/mos2defs.h index c35efb417..0c2a45ca1 100644 --- a/src/spicelib/devices/mos2/mos2defs.h +++ b/src/spicelib/devices/mos2/mos2defs.h @@ -53,6 +53,7 @@ typedef struct sMOS2instance { unsigned MOS2vonGiven :1; unsigned MOS2vdsatGiven :1; unsigned MOS2tempGiven :1; /* per-instance temperature specified? */ + unsigned MOS2dtempGiven :1; /* per-instance temperature difference specified? */ unsigned MOS2sens_l :1; /* field which indicates whether length of the mosfet is a design parameter or not */ @@ -139,6 +140,7 @@ typedef struct sMOS2instance { #define MOS2dphibd_dw MOS2sens + 69 double MOS2temp; /* temperature at which this instance operates */ + double MOS2dtemp; /* difference of instance temperature from circuit temperature */ double MOS2tTransconductance; /* temperature corrected transconductance*/ double MOS2tSurfMob; /* temperature corrected surface mobility */ double MOS2tPhi; /* temperature corrected Phi */ @@ -491,10 +493,11 @@ typedef struct sMOS2model { /* model structure for a resistor */ #define MOS2_L_SENS_CPLX 74 #define MOS2_L_SENS_DC 75 #define MOS2_W_SENS_DC 76 -#define MOS2_TEMP 77 -#define MOS2_SOURCERESIST 78 -#define MOS2_DRAINRESIST 79 -#define MOS2_M 80 +#define MOS2_TEMP 77 +#define MOS2_SOURCERESIST 78 +#define MOS2_DRAINRESIST 79 +#define MOS2_M 80 +#define MOS2_DTEMP 81 /* model paramerers */ #define MOS2_MOD_VTO 101 diff --git a/src/spicelib/devices/mos2/mos2del.c b/src/spicelib/devices/mos2/mos2del.c index a520f72cc..094cb2bbe 100644 --- a/src/spicelib/devices/mos2/mos2del.c +++ b/src/spicelib/devices/mos2/mos2del.c @@ -12,10 +12,7 @@ Author: 1985 Thomas L. Quarles int -MOS2delete(inModel,name,inst) - GENmodel *inModel; - IFuid name; - GENinstance **inst; +MOS2delete(GENmodel *inModel, IFuid name, GENinstance **inst) { MOS2model *model = (MOS2model *)inModel; MOS2instance **fast = (MOS2instance **)inst; diff --git a/src/spicelib/devices/mos2/mos2dest.c b/src/spicelib/devices/mos2/mos2dest.c index 2dbad2eb7..ef4f4fc02 100644 --- a/src/spicelib/devices/mos2/mos2dest.c +++ b/src/spicelib/devices/mos2/mos2dest.c @@ -11,8 +11,7 @@ Author: 1985 Thomas L. Quarles void -MOS2destroy(inModel) - GENmodel **inModel; +MOS2destroy(GENmodel **inModel) { MOS2model **model = (MOS2model **)inModel; MOS2instance *here; diff --git a/src/spicelib/devices/mos2/mos2dist.c b/src/spicelib/devices/mos2/mos2dist.c index a95669309..3a9318d2d 100644 --- a/src/spicelib/devices/mos2/mos2dist.c +++ b/src/spicelib/devices/mos2/mos2dist.c @@ -11,11 +11,7 @@ Author: 1988 Jaijeet S Roychowdhury #include "suffix.h" int -MOS2disto(mode,genmodel,ckt) - GENmodel *genmodel; - CKTcircuit *ckt; - int mode; - +MOS2disto(int mode,GENmodel *genmodel, CKTcircuit *ckt) /* assuming here that ckt->CKTomega has been initialised to * the correct value */ diff --git a/src/spicelib/devices/mos2/mos2dset.c b/src/spicelib/devices/mos2/mos2dset.c index a073bb592..50ed72ea5 100644 --- a/src/spicelib/devices/mos2/mos2dset.c +++ b/src/spicelib/devices/mos2/mos2dset.c @@ -21,9 +21,7 @@ static double sig1[4] = {1.0, -1.0, 1.0, -1.0}; static double sig2[4] = {1.0, 1.0,-1.0, -1.0}; int -MOS2dSetup(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS2dSetup(GENmodel *inModel, CKTcircuit *ckt) /* actually load the current value into the * sparse matrix previously provided */ diff --git a/src/spicelib/devices/mos2/mos2ext.h b/src/spicelib/devices/mos2/mos2ext.h index a82c0b38a..46a8a3e38 100644 --- a/src/spicelib/devices/mos2/mos2ext.h +++ b/src/spicelib/devices/mos2/mos2ext.h @@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles Modified: 2000 AlansFixes **********/ -#ifdef __STDC__ extern int MOS2acLoad(GENmodel*,CKTcircuit*); extern int MOS2ask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*); extern int MOS2mAsk(CKTcircuit*,GENmodel*,int,IFvalue*); @@ -30,29 +29,3 @@ extern int MOS2disto(int,GENmodel*,CKTcircuit*); extern int MOS2noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); extern int MOS2dSetup(GENmodel*,CKTcircuit*); - -#else /* stdc */ -extern int MOS2acLoad(); -extern int MOS2ask(); -extern int MOS2mAsk(); -extern int MOS2convTest(); -extern int MOS2delete(); -extern void MOS2destroy(); -extern int MOS2getic(); -extern int MOS2load(); -extern int MOS2mDelete(); -extern int MOS2mParam(); -extern int MOS2param(); -extern int MOS2pzLoad(); -extern int MOS2sAcLoad(); -extern int MOS2sLoad(); -extern void MOS2sPrint(); -extern int MOS2sSetup(); -extern int MOS2sUpdate(); -extern int MOS2setup(); -extern int MOS2unsetup(); -extern int MOS2temp(); -extern int MOS2trunc(); -extern int MOS2disto(); -extern int MOS2noise(); -#endif /* stdc */ diff --git a/src/spicelib/devices/mos2/mos2ic.c b/src/spicelib/devices/mos2/mos2ic.c index 942560953..95d5072ea 100644 --- a/src/spicelib/devices/mos2/mos2ic.c +++ b/src/spicelib/devices/mos2/mos2ic.c @@ -13,9 +13,7 @@ Author: 1985 Thomas L. Quarles int -MOS2getic(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS2getic(GENmodel *inModel, CKTcircuit *ckt) { MOS2model *model = (MOS2model *)inModel; MOS2instance *here; diff --git a/src/spicelib/devices/mos2/mos2load.c b/src/spicelib/devices/mos2/mos2load.c index 6a08082dd..fe72cd762 100644 --- a/src/spicelib/devices/mos2/mos2load.c +++ b/src/spicelib/devices/mos2/mos2load.c @@ -20,9 +20,7 @@ static double sig1[4] = {1.0, -1.0, 1.0, -1.0}; static double sig2[4] = {1.0, 1.0,-1.0, -1.0}; int -MOS2load(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS2load(GENmodel *inModel, CKTcircuit *ckt) /* actually load the current value into the * sparse matrix previously provided */ diff --git a/src/spicelib/devices/mos2/mos2mask.c b/src/spicelib/devices/mos2/mos2mask.c index 1b93f65ea..1a1eefc82 100644 --- a/src/spicelib/devices/mos2/mos2mask.c +++ b/src/spicelib/devices/mos2/mos2mask.c @@ -11,11 +11,8 @@ Author: 1985 Thomas L. Quarles #include "suffix.h" int -MOS2mAsk(ckt,inModel,param,value) - CKTcircuit *ckt; - GENmodel *inModel; - int param; - IFvalue *value; +MOS2mAsk(CKTcircuit *ckt, GENmodel *inModel, int param, + IFvalue *value) { MOS2model *model = (MOS2model *)inModel; switch(param) { diff --git a/src/spicelib/devices/mos2/mos2mdel.c b/src/spicelib/devices/mos2/mos2mdel.c index 55af19900..67c0ea12e 100644 --- a/src/spicelib/devices/mos2/mos2mdel.c +++ b/src/spicelib/devices/mos2/mos2mdel.c @@ -12,10 +12,7 @@ Author: 1985 Thomas L. Quarles int -MOS2mDelete(inModel,modname,kill) - GENmodel **inModel; - IFuid modname; - GENmodel *kill; +MOS2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) { MOS2model **model = (MOS2model **)inModel; MOS2model *modfast = (MOS2model *)kill; diff --git a/src/spicelib/devices/mos2/mos2mpar.c b/src/spicelib/devices/mos2/mos2mpar.c index 2436e1718..a7f7693e2 100644 --- a/src/spicelib/devices/mos2/mos2mpar.c +++ b/src/spicelib/devices/mos2/mos2mpar.c @@ -14,10 +14,7 @@ Author: 1985 Thomas L. Quarles int -MOS2mParam(param,value,inModel) - int param; - IFvalue *value; - GENmodel *inModel; +MOS2mParam(int param, IFvalue *value, GENmodel *inModel) { MOS2model *model = (MOS2model *)inModel; switch(param) { diff --git a/src/spicelib/devices/mos2/mos2noi.c b/src/spicelib/devices/mos2/mos2noi.c index c5c928658..8e56b00e6 100644 --- a/src/spicelib/devices/mos2/mos2noi.c +++ b/src/spicelib/devices/mos2/mos2noi.c @@ -24,13 +24,8 @@ extern void NevalSrc(); extern double Nintegrate(); int -MOS2noise (mode, operation, genmodel, ckt, data, OnDens) - int mode; - int operation; - GENmodel *genmodel; - CKTcircuit *ckt; - Ndata *data; - double *OnDens; +MOS2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, + Ndata *data, double *OnDens) { MOS2model *firstModel = (MOS2model *) genmodel; MOS2model *model; diff --git a/src/spicelib/devices/mos2/mos2par.c b/src/spicelib/devices/mos2/mos2par.c index 024a5ff78..652c106f6 100644 --- a/src/spicelib/devices/mos2/mos2par.c +++ b/src/spicelib/devices/mos2/mos2par.c @@ -16,11 +16,8 @@ Modified: 2000 AlansFixes /* ARGSUSED */ int -MOS2param(param,value,inst,select) - int param; - IFvalue *value; - GENinstance *inst; - IFvalue *select; +MOS2param(int param, IFvalue *value, GENinstance *inst, + IFvalue *select) { MOS2instance *here = (MOS2instance *)inst; switch(param) { @@ -28,6 +25,10 @@ MOS2param(param,value,inst,select) here->MOS2temp = value->rValue+CONSTCtoK; here->MOS2tempGiven = TRUE; break; + case MOS2_DTEMP: + here->MOS2dtemp = value->rValue; + here->MOS2dtempGiven = TRUE; + break; case MOS2_M: here->MOS2m = value->rValue; here->MOS2mGiven = TRUE; diff --git a/src/spicelib/devices/mos2/mos2pzld.c b/src/spicelib/devices/mos2/mos2pzld.c index 0681f58ae..7fcff27e2 100644 --- a/src/spicelib/devices/mos2/mos2pzld.c +++ b/src/spicelib/devices/mos2/mos2pzld.c @@ -15,10 +15,7 @@ Modified: 2000 AlansFixes int -MOS2pzLoad(inModel,ckt,s) - GENmodel *inModel; - CKTcircuit *ckt; - SPcomplex *s; +MOS2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) { MOS2model *model = (MOS2model *)inModel; MOS2instance *here; diff --git a/src/spicelib/devices/mos2/mos2sacl.c b/src/spicelib/devices/mos2/mos2sacl.c index 84de9567e..fc619d32f 100644 --- a/src/spicelib/devices/mos2/mos2sacl.c +++ b/src/spicelib/devices/mos2/mos2sacl.c @@ -1,6 +1,8 @@ /********** Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles + +This function is obsolete (was used by an old sensitivity analysis) **********/ /* actually load the current ac sensitivity @@ -16,9 +18,7 @@ Author: 1985 Thomas L. Quarles #include "suffix.h" int -MOS2sAcLoad(inModel,ckt) -GENmodel *inModel; -CKTcircuit *ckt; +MOS2sAcLoad(GENmodel *inModel, CKTcircuit *ckt) { MOS2model *model = (MOS2model *)inModel; MOS2instance *here; diff --git a/src/spicelib/devices/mos2/mos2set.c b/src/spicelib/devices/mos2/mos2set.c index 9f06c37dd..a72786e6e 100644 --- a/src/spicelib/devices/mos2/mos2set.c +++ b/src/spicelib/devices/mos2/mos2set.c @@ -13,11 +13,7 @@ Modified: 2000 AlansFixes #include "suffix.h" int -MOS2setup(matrix,inModel,ckt,states) - SMPmatrix *matrix; - GENmodel *inModel; - CKTcircuit *ckt; - int *states; +MOS2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* load the MOS2 device structure with those pointers needed later * for fast matrix loading */ @@ -238,9 +234,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ } int -MOS2unsetup(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS2unsetup(GENmodel *inModel, CKTcircuit *ckt) { MOS2model *model; MOS2instance *here; diff --git a/src/spicelib/devices/mos2/mos2sld.c b/src/spicelib/devices/mos2/mos2sld.c index 108283be8..19753492f 100644 --- a/src/spicelib/devices/mos2/mos2sld.c +++ b/src/spicelib/devices/mos2/mos2sld.c @@ -1,6 +1,8 @@ /********** Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles + +This function is obsolete (was used by an old sensitivity analysis) **********/ /* actually load the current sensitivity @@ -15,9 +17,7 @@ Author: 1985 Thomas L. Quarles #include "suffix.h" int -MOS2sLoad(inModel,ckt) -GENmodel *inModel; -CKTcircuit *ckt; +MOS2sLoad(GENmodel *inModel, CKTcircuit *ckt) { MOS2model *model = (MOS2model *)inModel; MOS2instance *here; diff --git a/src/spicelib/devices/mos2/mos2sprt.c b/src/spicelib/devices/mos2/mos2sprt.c index 48bdf69b4..878179641 100644 --- a/src/spicelib/devices/mos2/mos2sprt.c +++ b/src/spicelib/devices/mos2/mos2sprt.c @@ -2,6 +2,8 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles Modified: 2000 AlansFixes + +This function is obsolete (was used by an old sensitivity analysis) **********/ #include "ngspice.h" @@ -12,9 +14,7 @@ Modified: 2000 AlansFixes #include "suffix.h" void -MOS2sPrint(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS2sPrint(GENmodel *inModel, CKTcircuit *ckt) /* Pretty print the sensitivity info for all the MOS2 * devices in the circuit. */ diff --git a/src/spicelib/devices/mos2/mos2sset.c b/src/spicelib/devices/mos2/mos2sset.c index 5af865788..79e8442bb 100644 --- a/src/spicelib/devices/mos2/mos2sset.c +++ b/src/spicelib/devices/mos2/mos2sset.c @@ -1,6 +1,8 @@ /********** Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles + +This function is obsolete (was used by an old sensitivity analysis) **********/ #include "ngspice.h" @@ -11,9 +13,7 @@ Author: 1985 Thomas L. Quarles #include "suffix.h" int -MOS2sSetup(info,inModel) -SENstruct *info; -GENmodel *inModel; +MOS2sSetup(SENstruct *info, GENmodel *inModel) /* loop through all the devices and * allocate parameter #s to design parameters */ diff --git a/src/spicelib/devices/mos2/mos2supd.c b/src/spicelib/devices/mos2/mos2supd.c index c2dc6850c..61da0d02a 100644 --- a/src/spicelib/devices/mos2/mos2supd.c +++ b/src/spicelib/devices/mos2/mos2supd.c @@ -1,6 +1,8 @@ /********** Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles + +This function is obsolete (was used by an old sensitivity analysis) **********/ /* update the charge sensitivities and their derivatives */ @@ -13,9 +15,7 @@ Author: 1985 Thomas L. Quarles #include "suffix.h" int -MOS2sUpdate(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS2sUpdate(GENmodel *inModel, CKTcircuit *ckt) { MOS2model *model = (MOS2model *)inModel; MOS2instance *here; diff --git a/src/spicelib/devices/mos2/mos2temp.c b/src/spicelib/devices/mos2/mos2temp.c index b497efb9a..465d7e7fe 100644 --- a/src/spicelib/devices/mos2/mos2temp.c +++ b/src/spicelib/devices/mos2/mos2temp.c @@ -15,9 +15,7 @@ Modified: 2000 AlansFixes #define EPSSIL (11.7 * 8.854214871e-12) int -MOS2temp(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS2temp(GENmodel *inModel, CKTcircuit *ckt) { MOS2model *model = (MOS2model *)inModel; MOS2instance *here; @@ -130,8 +128,12 @@ MOS2temp(inModel,ckt) if (here->MOS2owner != ARCHme) continue; /* perform the parameter defaulting */ + if(!here->MOS2dtempGiven) { + here->MOS2dtemp = 0.0; + } + if(!here->MOS2tempGiven) { - here->MOS2temp = ckt->CKTtemp; + here->MOS2temp = ckt->CKTtemp + here->MOS2dtemp; } here->MOS2mode = 1; here->MOS2von = 0; diff --git a/src/spicelib/devices/mos2/mos2trun.c b/src/spicelib/devices/mos2/mos2trun.c index 9fd5df669..bcec82bb8 100644 --- a/src/spicelib/devices/mos2/mos2trun.c +++ b/src/spicelib/devices/mos2/mos2trun.c @@ -13,10 +13,7 @@ Author: 1985 Thomas L. Quarles int -MOS2trunc(inModel,ckt,timeStep) - GENmodel *inModel; - CKTcircuit *ckt; - double *timeStep; +MOS2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) { MOS2model *model = (MOS2model *)inModel; MOS2instance *here;