Added "dtemp" and cleaned code.

This commit is contained in:
pnenzi 2003-11-11 22:41:20 +00:00
parent c705ef8120
commit 16e22904e0
26 changed files with 56 additions and 121 deletions

View File

@ -25,6 +25,7 @@ IFparm MOS1pTable[] = { /* parameters */
IOPU("icvgs", MOS1_IC_VGS, IF_REAL , "Initial G-S voltage"), IOPU("icvgs", MOS1_IC_VGS, IF_REAL , "Initial G-S voltage"),
IOPU("icvbs", MOS1_IC_VBS, IF_REAL , "Initial B-S voltage"), IOPU("icvbs", MOS1_IC_VBS, IF_REAL , "Initial B-S voltage"),
IOPU("temp", MOS1_TEMP, IF_REAL, "Instance temperature"), IOPU("temp", MOS1_TEMP, IF_REAL, "Instance temperature"),
IOPU("dtemp", MOS1_DTEMP, IF_REAL, "Instance temperature difference"),
IP( "ic", MOS1_IC, IF_REALVEC, "Vector of D-S, G-S, B-S voltages"), IP( "ic", MOS1_IC, IF_REALVEC, "Vector of D-S, G-S, B-S voltages"),
IP( "sens_l", MOS1_L_SENS, IF_FLAG, "flag to request sensitivity WRT length"), IP( "sens_l", MOS1_L_SENS, IF_FLAG, "flag to request sensitivity WRT length"),
IP( "sens_w", MOS1_W_SENS, IF_FLAG, "flag to request sensitivity WRT width"), IP( "sens_w", MOS1_W_SENS, IF_FLAG, "flag to request sensitivity WRT width"),

View File

@ -14,9 +14,7 @@ Modified: 2000 AlansFixes
int int
MOS1acLoad(inModel,ckt) MOS1acLoad(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
MOS1model *model = (MOS1model*)inModel; MOS1model *model = (MOS1model*)inModel;
MOS1instance *here; MOS1instance *here;

View File

@ -15,12 +15,8 @@ Modified: 2000 AlansFixes
/*ARGSUSED*/ /*ARGSUSED*/
int int
MOS1ask(ckt,inst,which,value,select) MOS1ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value,
CKTcircuit *ckt; IFvalue *select)
GENinstance *inst;
int which;
IFvalue *value;
IFvalue *select;
{ {
MOS1instance *here = (MOS1instance*)inst; MOS1instance *here = (MOS1instance*)inst;
double vr; double vr;
@ -31,7 +27,10 @@ MOS1ask(ckt,inst,which,value,select)
static char *msg = "Current and power not available for ac analysis"; static char *msg = "Current and power not available for ac analysis";
switch(which) { switch(which) {
case MOS1_TEMP: case MOS1_TEMP:
value->rValue = here->MOS1temp-CONSTCtoK; value->rValue = here->MOS1temp - CONSTCtoK;
return(OK);
case MOS1_DTEMP:
value->rValue = here->MOS1dtemp;
return(OK); return(OK);
case MOS1_CGS: case MOS1_CGS:
value->rValue = 2* *(ckt->CKTstate0 + here->MOS1capgs); value->rValue = 2* *(ckt->CKTstate0 + here->MOS1capgs);

View File

@ -10,9 +10,7 @@ Author: 1985 Thomas L. Quarles
#include "suffix.h" #include "suffix.h"
int int
MOS1convTest(inModel,ckt) MOS1convTest(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
MOS1model *model = (MOS1model*)inModel; MOS1model *model = (MOS1model*)inModel;
MOS1instance *here; MOS1instance *here;

View File

@ -45,6 +45,7 @@ typedef struct sMOS1instance {
double MOS1sourceConductance; /*conductance of source(or 0):set in setup*/ double MOS1sourceConductance; /*conductance of source(or 0):set in setup*/
double MOS1drainConductance; /*conductance of drain(or 0):set in setup*/ double MOS1drainConductance; /*conductance of drain(or 0):set in setup*/
double MOS1temp; /* operating temperature of this instance */ double MOS1temp; /* operating temperature of this instance */
double MOS1dtemp; /* operating temperature of the instance relative to circuit temperature*/
double MOS1tTransconductance; /* temperature corrected transconductance*/ double MOS1tTransconductance; /* temperature corrected transconductance*/
double MOS1tSurfMob; /* temperature corrected surface mobility */ double MOS1tSurfMob; /* temperature corrected surface mobility */
@ -159,6 +160,7 @@ typedef struct sMOS1instance {
unsigned MOS1off:1; /* non-zero to indicate device is off for dc analysis*/ unsigned MOS1off:1; /* non-zero to indicate device is off for dc analysis*/
unsigned MOS1tempGiven :1; /* instance temperature specified */ unsigned MOS1tempGiven :1; /* instance temperature specified */
unsigned MOS1dtempGiven :1; /* instance delta temperature specified */
unsigned MOS1mGiven :1; unsigned MOS1mGiven :1;
unsigned MOS1lGiven :1; unsigned MOS1lGiven :1;
unsigned MOS1wGiven :1; unsigned MOS1wGiven :1;
@ -411,6 +413,7 @@ typedef struct sMOS1model { /* model structure for a resistor */
#define MOS1_POWER 19 #define MOS1_POWER 19
#define MOS1_TEMP 20 #define MOS1_TEMP 20
#define MOS1_M 21 #define MOS1_M 21
#define MOS1_DTEMP 22
/* model paramerers */ /* model paramerers */
#define MOS1_MOD_VTO 101 #define MOS1_MOD_VTO 101
#define MOS1_MOD_KP 102 #define MOS1_MOD_KP 102

View File

@ -12,10 +12,7 @@ Author: 1985 Thomas L. Quarles
int int
MOS1delete(inModel,name,inst) MOS1delete(GENmodel *inModel, IFuid name, GENinstance **inst)
GENmodel *inModel;
IFuid name;
GENinstance **inst;
{ {
MOS1model *model = (MOS1model *)inModel; MOS1model *model = (MOS1model *)inModel;
MOS1instance **fast = (MOS1instance **)inst; MOS1instance **fast = (MOS1instance **)inst;

View File

@ -11,8 +11,7 @@ Author: 1985 Thomas L. Quarles
void void
MOS1destroy(inModel) MOS1destroy(GENmodel **inModel)
GENmodel **inModel;
{ {
MOS1model **model = (MOS1model**)inModel; MOS1model **model = (MOS1model**)inModel;
MOS1instance *here; MOS1instance *here;

View File

@ -11,10 +11,7 @@ Author: 1988 Jaijeet S Roychowdhury
#include "suffix.h" #include "suffix.h"
int int
MOS1disto(mode,genmodel,ckt) MOS1disto(int mode, GENmodel *genmodel, CKTcircuit *ckt)
GENmodel *genmodel;
CKTcircuit *ckt;
int mode;
/* assuming here that ckt->CKTomega has been initialised to /* assuming here that ckt->CKTomega has been initialised to
* the correct value * the correct value

View File

@ -13,9 +13,7 @@ Author: 1988 Jaijeet S Roychowdhury
#include "suffix.h" #include "suffix.h"
int int
MOS1dSetup(inModel,ckt) MOS1dSetup(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
/* actually load the current value into the /* actually load the current value into the
* sparse matrix previously provided * sparse matrix previously provided
*/ */

View File

@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles
Modified: 2000 AlansFixes Modified: 2000 AlansFixes
**********/ **********/
#ifdef __STDC__
extern int MOS1acLoad(GENmodel *,CKTcircuit*); extern int MOS1acLoad(GENmodel *,CKTcircuit*);
extern int MOS1ask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*); extern int MOS1ask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
extern int MOS1delete(GENmodel*,IFuid,GENinstance**); extern int MOS1delete(GENmodel*,IFuid,GENinstance**);
@ -29,29 +28,3 @@ extern int MOS1convTest(GENmodel*,CKTcircuit*);
extern int MOS1disto(int,GENmodel*,CKTcircuit*); extern int MOS1disto(int,GENmodel*,CKTcircuit*);
extern int MOS1noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); extern int MOS1noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*);
extern int MOS1dSetup(GENmodel*,CKTcircuit*); extern int MOS1dSetup(GENmodel*,CKTcircuit*);
#else /* stdc */
extern int MOS1acLoad();
extern int MOS1ask();
extern int MOS1delete();
extern void MOS1destroy();
extern int MOS1getic();
extern int MOS1load();
extern int MOS1mAsk();
extern int MOS1mDelete();
extern int MOS1mParam();
extern int MOS1param();
extern int MOS1pzLoad();
extern int MOS1sAcLoad();
extern int MOS1sLoad();
extern void MOS1sPrint();
extern int MOS1sSetup();
extern int MOS1sUpdate();
extern int MOS1setup();
extern int MOS1unsetup();
extern int MOS1temp();
extern int MOS1trunc();
extern int MOS1convTest();
extern int MOS1disto();
extern int MOS1noise();
#endif /* stdc */

View File

@ -13,9 +13,7 @@ Author: 1985 Thomas L. Quarles
int int
MOS1getic(inModel,ckt) MOS1getic(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
MOS1model *model = (MOS1model *)inModel; MOS1model *model = (MOS1model *)inModel;
MOS1instance *here; MOS1instance *here;

View File

@ -14,9 +14,7 @@ Modified: 2000 AlansFixes
#include "suffix.h" #include "suffix.h"
int int
MOS1load(inModel,ckt) MOS1load(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
/* actually load the current value into the /* actually load the current value into the
* sparse matrix previously provided * sparse matrix previously provided
*/ */

View File

@ -14,11 +14,7 @@ Author: 1987 Thomas L. Quarles
/*ARGSUSED*/ /*ARGSUSED*/
int int
MOS1mAsk(ckt,inst,which,value) MOS1mAsk(CKTcircuit *ckt, GENmodel *inst, int which, IFvalue *value)
CKTcircuit *ckt;
GENmodel *inst;
int which;
IFvalue *value;
{ {
MOS1model *model = (MOS1model *)inst; MOS1model *model = (MOS1model *)inst;
switch(which) { switch(which) {

View File

@ -12,10 +12,7 @@ Author: 1985 Thomas L. Quarles
int int
MOS1mDelete(inModel,modname,kill) MOS1mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
GENmodel **inModel;
IFuid modname;
GENmodel *kill;
{ {
MOS1model **model = (MOS1model **)inModel; MOS1model **model = (MOS1model **)inModel;
MOS1model *modfast = (MOS1model *)kill; MOS1model *modfast = (MOS1model *)kill;

View File

@ -11,15 +11,12 @@ Author: 1985 Thomas L. Quarles
#include "suffix.h" #include "suffix.h"
int int
MOS1mParam(param,value,inModel) MOS1mParam(int param, IFvalue *value, GENmodel *inModel)
int param;
IFvalue *value;
GENmodel *inModel;
{ {
MOS1model *model = (MOS1model *)inModel; MOS1model *model = (MOS1model *)inModel;
switch(param) { switch(param) {
case MOS1_MOD_TNOM: case MOS1_MOD_TNOM:
model->MOS1tnom = value->rValue+CONSTCtoK; model->MOS1tnom = value->rValue + CONSTCtoK;
model->MOS1tnomGiven = TRUE; model->MOS1tnomGiven = TRUE;
break; break;
case MOS1_MOD_VTO: case MOS1_MOD_VTO:

View File

@ -24,13 +24,8 @@ extern void NevalSrc();
extern double Nintegrate(); extern double Nintegrate();
int int
MOS1noise (mode, operation, genmodel, ckt, data, OnDens) MOS1noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
int mode; Ndata *data, double *OnDens)
int operation;
GENmodel *genmodel;
CKTcircuit *ckt;
Ndata *data;
double *OnDens;
{ {
MOS1model *firstModel = (MOS1model *) genmodel; MOS1model *firstModel = (MOS1model *) genmodel;
MOS1model *model; MOS1model *model;

View File

@ -16,11 +16,7 @@ Modified: 2000 AlansFixes
/* ARGSUSED */ /* ARGSUSED */
int int
MOS1param(param,value,inst,select) MOS1param(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
int param;
IFvalue *value;
GENinstance *inst;
IFvalue *select;
{ {
MOS1instance *here = (MOS1instance *)inst; MOS1instance *here = (MOS1instance *)inst;
switch(param) { switch(param) {
@ -28,6 +24,10 @@ MOS1param(param,value,inst,select)
here->MOS1temp = value->rValue+CONSTCtoK; here->MOS1temp = value->rValue+CONSTCtoK;
here->MOS1tempGiven = TRUE; here->MOS1tempGiven = TRUE;
break; break;
case MOS1_DTEMP:
here->MOS1dtemp = value->rValue;
here->MOS1dtempGiven = TRUE;
break;
case MOS1_M: case MOS1_M:
here->MOS1m = value->rValue; here->MOS1m = value->rValue;
here->MOS1mGiven = TRUE; here->MOS1mGiven = TRUE;

View File

@ -15,10 +15,7 @@ Modified: 2000 AlansFixes
int int
MOS1pzLoad(inModel,ckt,s) MOS1pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
GENmodel *inModel;
CKTcircuit *ckt;
SPcomplex *s;
{ {
MOS1model *model = (MOS1model*)inModel; MOS1model *model = (MOS1model*)inModel;
MOS1instance *here; MOS1instance *here;
@ -72,7 +69,7 @@ MOS1pzLoad(inModel,ckt,s)
xgb = capgb; xgb = capgb;
xbd = here->MOS1capbd; xbd = here->MOS1capbd;
xbs = here->MOS1capbs; xbs = here->MOS1capbs;
/*printf("mos2: xgs=%g, xgd=%g, xgb=%g, xbd=%g, xbs=%g\n", /*printf("mos1: xgs=%g, xgd=%g, xgb=%g, xbd=%g, xbs=%g\n",
xgs,xgd,xgb,xbd,xbs);*/ xgs,xgd,xgb,xbd,xbs);*/
/* /*
* load matrix * load matrix

View File

@ -1,6 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
@ -16,9 +18,7 @@ Author: 1985 Thomas L. Quarles
*/ */
int int
MOS1sAcLoad(inModel,ckt) MOS1sAcLoad(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
MOS1model *model = (MOS1model*)inModel; MOS1model *model = (MOS1model*)inModel;
MOS1instance *here; MOS1instance *here;

View File

@ -16,11 +16,8 @@ Modified: 2000 AlansFixes
#include "suffix.h" #include "suffix.h"
int int
MOS1setup(matrix,inModel,ckt,states) MOS1setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt,
SMPmatrix *matrix; int *states)
GENmodel *inModel;
CKTcircuit *ckt;
int *states;
{ {
MOS1model *model = (MOS1model *)inModel; MOS1model *model = (MOS1model *)inModel;
MOS1instance *here; MOS1instance *here;
@ -214,9 +211,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\
} }
int int
MOS1unsetup(inModel,ckt) MOS1unsetup(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
MOS1model *model; MOS1model *model;
MOS1instance *here; MOS1instance *here;

View File

@ -1,6 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
/* actually load the current sensitivity /* actually load the current sensitivity
@ -15,9 +17,7 @@ Author: 1985 Thomas L. Quarles
#include "suffix.h" #include "suffix.h"
int int
MOS1sLoad(inModel,ckt) MOS1sLoad(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
MOS1model *model = (MOS1model *)inModel; MOS1model *model = (MOS1model *)inModel;
MOS1instance *here; MOS1instance *here;

View File

@ -2,6 +2,8 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: 2000 AlansFixes Modified: 2000 AlansFixes
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
/* Pretty print the sensitivity info for all /* Pretty print the sensitivity info for all
@ -16,9 +18,7 @@ Modified: 2000 AlansFixes
#include "suffix.h" #include "suffix.h"
void void
MOS1sPrint(inModel,ckt) MOS1sPrint(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
/* Pretty print the sensitivity info for all the MOS1 /* Pretty print the sensitivity info for all the MOS1
* devices in the circuit. * devices in the circuit.
*/ */

View File

@ -1,6 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
@ -11,9 +13,7 @@ Author: 1985 Thomas L. Quarles
#include "suffix.h" #include "suffix.h"
int int
MOS1sSetup(info,inModel) MOS1sSetup(SENstruct *info, GENmodel *inModel)
SENstruct *info;
GENmodel *inModel;
/* loop through all the devices and /* loop through all the devices and
* allocate parameter #s to design parameters * allocate parameter #s to design parameters
*/ */

View File

@ -1,6 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
@ -13,9 +15,7 @@ Author: 1985 Thomas L. Quarles
/* update the charge sensitivities and their derivatives */ /* update the charge sensitivities and their derivatives */
int int
MOS1sUpdate(inModel,ckt) MOS1sUpdate(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
MOS1model *model = (MOS1model *)inModel; MOS1model *model = (MOS1model *)inModel;
MOS1instance *here; MOS1instance *here;

View File

@ -12,9 +12,7 @@ Modified: 2000 AlansFixes
#include "suffix.h" #include "suffix.h"
int int
MOS1temp(inModel,ckt) MOS1temp(GENmodel *inModel, CKTcircuit *ckt)
GENmodel *inModel;
CKTcircuit *ckt;
{ {
MOS1model *model = (MOS1model *)inModel; MOS1model *model = (MOS1model *)inModel;
MOS1instance *here; MOS1instance *here;
@ -122,8 +120,12 @@ MOS1temp(inModel,ckt)
if (here->MOS1owner != ARCHme) continue; if (here->MOS1owner != ARCHme) continue;
/* perform the parameter defaulting */ /* perform the parameter defaulting */
if(!here->MOS1dtempGiven) {
here->MOS1dtemp = 0.0;
}
if(!here->MOS1tempGiven) { if(!here->MOS1tempGiven) {
here->MOS1temp = ckt->CKTtemp; here->MOS1temp = ckt->CKTtemp + here->MOS1dtemp;
} }
vt = here->MOS1temp * CONSTKoverQ; vt = here->MOS1temp * CONSTKoverQ;
ratio = here->MOS1temp/model->MOS1tnom; ratio = here->MOS1temp/model->MOS1tnom;

View File

@ -13,10 +13,7 @@ Author: 1985 Thomas L. Quarles
int int
MOS1trunc(inModel,ckt,timeStep) MOS1trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
GENmodel *inModel;
CKTcircuit *ckt;
double *timeStep;
{ {
MOS1model *model = (MOS1model *)inModel; MOS1model *model = (MOS1model *)inModel;
MOS1instance *here; MOS1instance *here;