From b5112c0d47bf6a5e1eb4f712dbfb95948d220c4e Mon Sep 17 00:00:00 2001 From: pnenzi Date: Mon, 8 Dec 2003 21:11:56 +0000 Subject: [PATCH] Added "dtemp". Cleaned the code a bit. Updated DEVICES. --- ChangeLog | 7 +++ DEVICES | 6 +- src/spicelib/devices/mos9/mos9.c | 2 +- src/spicelib/devices/mos9/mos9acld.c | 8 +-- src/spicelib/devices/mos9/mos9ask.c | 9 +-- src/spicelib/devices/mos9/mos9conv.c | 6 +- src/spicelib/devices/mos9/mos9defs.h | 6 +- src/spicelib/devices/mos9/mos9del.c | 6 +- src/spicelib/devices/mos9/mos9dest.c | 4 +- src/spicelib/devices/mos9/mos9dist.c | 4 +- src/spicelib/devices/mos9/mos9dset.c | 10 ++-- src/spicelib/devices/mos9/mos9ext.h | 2 +- src/spicelib/devices/mos9/mos9ic.c | 7 +-- src/spicelib/devices/mos9/mos9load.c | 83 +++++----------------------- src/spicelib/devices/mos9/mos9mask.c | 7 +-- src/spicelib/devices/mos9/mos9mdel.c | 6 +- src/spicelib/devices/mos9/mos9mpar.c | 6 +- src/spicelib/devices/mos9/mos9noi.c | 12 ++-- src/spicelib/devices/mos9/mos9par.c | 12 ++-- src/spicelib/devices/mos9/mos9pzld.c | 7 +-- src/spicelib/devices/mos9/mos9sacl.c | 8 +-- src/spicelib/devices/mos9/mos9set.c | 20 +++---- src/spicelib/devices/mos9/mos9sld.c | 9 ++- src/spicelib/devices/mos9/mos9sprt.c | 14 ++--- src/spicelib/devices/mos9/mos9sset.c | 8 +-- src/spicelib/devices/mos9/mos9supd.c | 8 +-- src/spicelib/devices/mos9/mos9temp.c | 12 ++-- src/spicelib/devices/mos9/mos9trun.c | 3 +- 28 files changed, 104 insertions(+), 188 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97769534a..9afaa36f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-12-08 Paolo Nenzi + + * src/spicelib/devices/mos9/*: Added + "dtemp" parameters. + + * DEVICES: Updated MOS9 status. + 2003-12-08 Paolo Nenzi * src/spicelib/devices/mos6/*: Added "m" diff --git a/DEVICES b/DEVICES index 39480a065..37a993d58 100644 --- a/DEVICES +++ b/DEVICES @@ -262,7 +262,11 @@ MOS9 - Level 9 MOS model Ver: N/A Class: M Level: 9 - Status: TO BE TESTED + Status: + + Enhancements over the original model: + + - Temperature difference from circuit temperature BSIM1 - BSIM model level 1 diff --git a/src/spicelib/devices/mos9/mos9.c b/src/spicelib/devices/mos9/mos9.c index acf6a863d..19ebc2f23 100644 --- a/src/spicelib/devices/mos9/mos9.c +++ b/src/spicelib/devices/mos9/mos9.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "devdefs.h" #include "ifsim.h" #include "mos9defs.h" @@ -39,6 +38,7 @@ IFparm MOS9pTable[] = { /* parameters */ IOPAU("icvbs", MOS9_IC_VBS, IF_REAL , "Initial B-S voltage"), IOPU("ic", MOS9_IC, IF_REALVEC, "Vector of D-S, G-S, B-S voltages"), IOPU("temp", MOS9_TEMP, IF_REAL , "Instance operating temperature"), + IOPU("dtemp", MOS9_DTEMP, IF_REAL , "Instance operating temperature difference"), IP("sens_l", MOS9_L_SENS, IF_FLAG, "flag to request sensitivity WRT length"), IP("sens_w", MOS9_W_SENS, IF_FLAG, "flag to request sensitivity WRT width"), OPU("dnode", MOS9_DNODE, IF_INTEGER, "Number of drain node"), diff --git a/src/spicelib/devices/mos9/mos9acld.c b/src/spicelib/devices/mos9/mos9acld.c index 730b11a2b..dd1b465eb 100644 --- a/src/spicelib/devices/mos9/mos9acld.c +++ b/src/spicelib/devices/mos9/mos9acld.c @@ -7,7 +7,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "cktdefs.h" #include "mos9defs.h" #include "sperror.h" @@ -15,9 +14,7 @@ Modified: Alan Gillespie int -MOS9acLoad(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS9acLoad(GENmodel *inModel, CKTcircuit *ckt) { MOS9model *model = (MOS9model *)inModel; MOS9instance *here; @@ -40,7 +37,8 @@ MOS9acLoad(inModel,ckt) for( ; model != NULL; model = model->MOS9nextModel) { for(here = model->MOS9instances; here!= NULL; here = here->MOS9nextInstance) { - + if (here->MOS9owner != ARCHme) continue; + if (here->MOS9mode < 0) { xnrm=0; xrev=1; diff --git a/src/spicelib/devices/mos9/mos9ask.c b/src/spicelib/devices/mos9/mos9ask.c index a975adf22..cca6a1616 100644 --- a/src/spicelib/devices/mos9/mos9ask.c +++ b/src/spicelib/devices/mos9/mos9ask.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "const.h" #include "ifsim.h" #include "cktdefs.h" @@ -16,12 +15,8 @@ Modified: Alan Gillespie /*ARGSUSED*/ int -MOS9ask(ckt,inst,which,value,select) - CKTcircuit *ckt; - GENinstance *inst; - int which; - IFvalue *value; - IFvalue *select; +MOS9ask(CKTcircuit *ckt, GENinstance *inst, int which, + IFvalue *value, IFvalue *select) { MOS9instance *here = (MOS9instance *)inst; double vr; diff --git a/src/spicelib/devices/mos9/mos9conv.c b/src/spicelib/devices/mos9/mos9conv.c index 15d12daf6..8ae4c7e2c 100644 --- a/src/spicelib/devices/mos9/mos9conv.c +++ b/src/spicelib/devices/mos9/mos9conv.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "cktdefs.h" #include "mos9defs.h" #include "sperror.h" @@ -13,9 +12,7 @@ Modified: Alan Gillespie #include "suffix.h" int -MOS9convTest(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS9convTest(GENmodel *inModel, CKTcircuit *ckt) { MOS9model *model = (MOS9model *)inModel; MOS9instance *here; @@ -37,6 +34,7 @@ MOS9convTest(inModel,ckt) for( ; model != NULL; model = model->MOS9nextModel) { for(here = model->MOS9instances; here!= NULL; here = here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; vbs = model->MOS9type * ( *(ckt->CKTrhs+here->MOS9bNode) - diff --git a/src/spicelib/devices/mos9/mos9defs.h b/src/spicelib/devices/mos9/mos9defs.h index 8c3b27bcc..c90f02e8a 100644 --- a/src/spicelib/devices/mos9/mos9defs.h +++ b/src/spicelib/devices/mos9/mos9defs.h @@ -43,6 +43,7 @@ typedef struct sMOS9instance { double MOS9sourceConductance; /*conductance of source(or 0):set in setup*/ double MOS9drainConductance; /*conductance of drain(or 0):set in setup*/ double MOS9temp; /* operating temperature of this instance */ + double MOS9dtemp; /* instance temperature difference */ double MOS9tTransconductance; /* temperature corrected transconductance*/ double MOS9tSurfMob; /* temperature corrected surface mobility */ @@ -91,6 +92,7 @@ typedef struct sMOS9instance { unsigned MOS9off :1;/* non-zero to indicate device is off for dc analysis*/ unsigned MOS9tempGiven :1; /* instance temperature specified */ + unsigned MOS9dtempGiven :1; /* instance temperature difference specified*/ unsigned MOS9mGiven :1; @@ -498,7 +500,8 @@ typedef struct sMOS9model { /* model structure for a resistor */ #define MOS9_TEMP 77 #define MOS9_SOURCERESIST 78 #define MOS9_DRAINRESIST 79 -#define MOS9_M 80 +#define MOS9_M 80 +#define MOS9_DTEMP 81 /* model parameters */ #define MOS9_MOD_VTO 101 @@ -558,3 +561,4 @@ typedef struct sMOS9model { /* model structure for a resistor */ #include "mos9ext.h" #endif /*MOS9*/ + diff --git a/src/spicelib/devices/mos9/mos9del.c b/src/spicelib/devices/mos9/mos9del.c index 698c83195..0ab9fda46 100644 --- a/src/spicelib/devices/mos9/mos9del.c +++ b/src/spicelib/devices/mos9/mos9del.c @@ -7,17 +7,13 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "mos9defs.h" #include "sperror.h" #include "suffix.h" int -MOS9delete(inModel,name,inst) - GENmodel *inModel; - IFuid name; - GENinstance **inst; +MOS9delete(GENmodel *inModel, IFuid name, GENinstance **inst) { MOS9model *model = (MOS9model *)inModel; MOS9instance **fast = (MOS9instance **)inst; diff --git a/src/spicelib/devices/mos9/mos9dest.c b/src/spicelib/devices/mos9/mos9dest.c index e5ad27659..058929961 100644 --- a/src/spicelib/devices/mos9/mos9dest.c +++ b/src/spicelib/devices/mos9/mos9dest.c @@ -7,14 +7,12 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "mos9defs.h" #include "suffix.h" void -MOS9destroy(inModel) - GENmodel **inModel; +MOS9destroy(GENmodel **inModel) { MOS9model **model = (MOS9model **)inModel; MOS9instance *here; diff --git a/src/spicelib/devices/mos9/mos9dist.c b/src/spicelib/devices/mos9/mos9dist.c index b66209533..1be754247 100644 --- a/src/spicelib/devices/mos9/mos9dist.c +++ b/src/spicelib/devices/mos9/mos9dist.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "cktdefs.h" #include "mos9defs.h" #include "sperror.h" @@ -55,8 +54,9 @@ for( ; model != NULL; model = model->MOS9nextModel ) { /* loop through all the instances of the model */ for (here = model->MOS9instances; here != NULL ; - here=here->MOS9nextInstance) { + here=here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; /* loading starts here */ diff --git a/src/spicelib/devices/mos9/mos9dset.c b/src/spicelib/devices/mos9/mos9dset.c index da335548b..0f69c8523 100644 --- a/src/spicelib/devices/mos9/mos9dset.c +++ b/src/spicelib/devices/mos9/mos9dset.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "cktdefs.h" #include "devdefs.h" #include "mos9defs.h" @@ -16,15 +15,13 @@ Modified: Alan Gillespie #include "suffix.h" int -MOS9dSetup(inModel,ckt) - GENmodel *inModel; - register CKTcircuit *ckt; +MOS9dSetup(GENmodel *inModel, CKTcircuit *ckt) /* actually load the current value into the * sparse matrix previously provided */ { - register MOS9model *model = (MOS9model *)inModel; - register MOS9instance *here; + MOS9model *model = (MOS9model *)inModel; + MOS9instance *here; double Beta; double DrainSatCur; double EffectiveLength; @@ -69,6 +66,7 @@ next: for( ; model != NULL; model = model->MOS9nextModel ) { /* loop through all the instances of the model */ for (here = model->MOS9instances; here != NULL ; here=here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; vt = CONSTKoverQ * here->MOS9temp; diff --git a/src/spicelib/devices/mos9/mos9ext.h b/src/spicelib/devices/mos9/mos9ext.h index d365f6b6d..c2af0a136 100644 --- a/src/spicelib/devices/mos9/mos9ext.h +++ b/src/spicelib/devices/mos9/mos9ext.h @@ -27,4 +27,4 @@ extern int MOS9temp(GENmodel*,CKTcircuit*); extern int MOS9trunc(GENmodel*,CKTcircuit*,double*); extern int MOS9disto(int,GENmodel*,CKTcircuit*); extern int MOS9noise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); -extern int MOS9dSetup(GENmodel*,CKTcircuit*); \ No newline at end of file +extern int MOS9dSetup(GENmodel*,CKTcircuit*); diff --git a/src/spicelib/devices/mos9/mos9ic.c b/src/spicelib/devices/mos9/mos9ic.c index a3beee038..dc807d09c 100644 --- a/src/spicelib/devices/mos9/mos9ic.c +++ b/src/spicelib/devices/mos9/mos9ic.c @@ -7,7 +7,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "cktdefs.h" #include "mos9defs.h" #include "sperror.h" @@ -15,9 +14,7 @@ Modified: Alan Gillespie int -MOS9getic(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS9getic(GENmodel *inModel, CKTcircuit *ckt) { MOS9model *model = (MOS9model *)inModel; MOS9instance *here; @@ -28,6 +25,8 @@ MOS9getic(inModel,ckt) for( ; model ; model = model->MOS9nextModel) { for(here = model->MOS9instances; here ; here = here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; + if(!here->MOS9icVBSGiven) { here->MOS9icVBS = *(ckt->CKTrhs + here->MOS9bNode) - diff --git a/src/spicelib/devices/mos9/mos9load.c b/src/spicelib/devices/mos9/mos9load.c index 0e4b5fb67..48f3f7bb8 100644 --- a/src/spicelib/devices/mos9/mos9load.c +++ b/src/spicelib/devices/mos9/mos9load.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "cktdefs.h" #include "devdefs.h" #include "mos9defs.h" @@ -15,9 +14,7 @@ Modified: Alan Gillespie #include "suffix.h" int -MOS9load(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS9load(GENmodel *inModel, CKTcircuit *ckt) /* actually load the current value into the * sparse matrix previously provided */ @@ -77,7 +74,9 @@ MOS9load(inModel,ckt) double capgd; /* total gate-drain capacitance */ double capgb; /* total gate-bulk capacitance */ int Check; +#ifndef NOBYPASS double tempv; +#endif /*NOBYPASS*/ int error; #ifdef CAPBYPASS int senflag; @@ -108,6 +107,7 @@ next: /* loop through all the instances of the model */ for (here = model->MOS9instances; here != NULL ; here=here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; vt = CONSTKoverQ * here->MOS9temp; Check=1; @@ -122,10 +122,6 @@ next: } SenCond = ckt->CKTsenInfo && here->MOS9senPertFlag; -#ifdef DETAILPROF -asm(" .globl mos9pta"); -asm("mos9pta:"); -#endif /* DETAILPROF */ /* first, we compute a few useful values - these could be * pre-computed, but for historical reasons are still done @@ -198,10 +194,6 @@ asm("mos9pta:"); goto next1; } -#ifdef DETAILPROF -asm(" .globl mos9ptax"); -asm("mos9ptax:"); -#endif /* DETAILPROF */ /* * ok - now to do the start-up operations @@ -256,10 +248,6 @@ asm("mos9ptax:"); #endif /*PREDICTOR*/ /* now some common crunching for some more useful quantities */ -#ifdef DETAILPROF -asm(" .globl mos9ptay"); -asm("mos9ptay:"); -#endif /* DETAILPROF */ vbd=vbs-vds; vgd=vgs-vds; @@ -293,11 +281,7 @@ asm("mos9ptay:"); here->MOS9cbd + here->MOS9gbd * delvbd + here->MOS9gbs * delvbs ; - -#ifdef DETAILPROF -asm(" .globl mos9ptb"); -asm("mos9ptb:"); -#endif /* DETAILPROF */ +#ifndef NOBYPASS /* now lets see if we can bypass (ugh) */ /* the following mess should be one if statement, but * many compilers can't handle it all at once, so it @@ -351,11 +335,7 @@ asm("mos9ptb:"); } goto bypass; } - -#ifdef DETAILPROF -asm(" .globl mos9ptc"); -asm("mos9ptc:"); -#endif /* DETAILPROF */ +#endif /*NOBYPASS*/ /* ok - bypass is out, do it the hard way */ von = model->MOS9type * here->MOS9von; @@ -396,10 +376,6 @@ asm("mos9ptc:"); } else { -#ifdef DETAILPROF -asm(" .globl mos9ptd"); -asm("mos9ptd:"); -#endif /* DETAILPROF */ /* ok - not one of the simple cases, so we have to * look at all of the possibilities for why we were * called. We still just initialize the three voltages @@ -422,10 +398,6 @@ asm("mos9ptd:"); } } -#ifdef DETAILPROF -asm(" .globl mos9pte"); -asm("mos9pte:"); -#endif /* DETAILPROF */ /* * now all the preliminaries are over - we can start doing the * real work @@ -474,10 +446,6 @@ next1: if(vbs <= -3*vt) { here->MOS9mode = -1; } -#ifdef DETAILPROF -asm(" .globl mos9ptf"); -asm("mos9ptf:"); -#endif /* DETAILPROF */ { /* * subroutine moseq3(vds,vbs,vgs,gm,gds,gmbs, @@ -913,10 +881,6 @@ innerline1000:; */ } -#ifdef DETAILPROF -asm(" .globl mos9ptg"); -asm("mos9ptg:"); -#endif /* DETAILPROF */ /* now deal with n vs p polarity */ @@ -1076,10 +1040,7 @@ asm("mos9ptg:"); } #endif /*CAPZEROBYPASS*/ } -#ifdef DETAILPROF -asm(" .globl mos9pth"); -asm("mos9pth:"); -#endif /* DETAILPROF */ + if(SenCond && (ckt->CKTsenInfo->SENmode==TRANSEN)) goto next2; if ( ckt->CKTmode & MODETRAN ) { @@ -1107,10 +1068,7 @@ asm("mos9pth:"); here->MOS9cbs += *(ckt->CKTstate0 + here->MOS9cqbs); } } -#ifdef DETAILPROF -asm(" .globl mos9pti"); -asm("mos9pti:"); -#endif /* DETAILPROF */ + if(SenCond) goto next2; /* @@ -1124,10 +1082,7 @@ asm("mos9pti:"); } } -#ifdef DETAILPROF -asm(" .globl mos9ptj"); -asm("mos9ptj:"); -#endif /* DETAILPROF */ + /* save things away for next time */ @@ -1136,10 +1091,7 @@ next2: *(ckt->CKTstate0 + here->MOS9vbs) = vbs; *(ckt->CKTstate0 + here->MOS9vgs) = vgs; *(ckt->CKTstate0 + here->MOS9vds) = vds; -#ifdef DETAILPROF -asm(" .globl mos9ptk"); -asm("mos9ptk:"); -#endif /* DETAILPROF */ + /* * meyer's capacitor model @@ -1195,10 +1147,7 @@ asm("mos9ptk:"); here->MOS9cgb = capgb; } -#ifdef DETAILPROF -asm(" .globl mos9ptl"); -asm("mos9ptl:"); -#endif /* DETAILPROF */ + /* * store small-signal parameters (for meyer's model) * all parameters already stored, so done... @@ -1242,10 +1191,7 @@ asm("mos9ptl:"); } bypass: if(SenCond) continue; -#ifdef DETAILPROF -asm(" .globl mos9ptm"); -asm("mos9ptm:"); -#endif /* DETAILPROF */ + if ( (ckt->CKTmode & (MODEINITTRAN)) || (! (ckt->CKTmode & (MODETRAN)) ) ) { @@ -1284,10 +1230,7 @@ asm("mos9ptm:"); * store charge storage info for meyer's cap in lx table */ -#ifdef DETAILPROF -asm(" .globl mos9ptn"); -asm("mos9ptn:"); -#endif /* DETAILPROF */ + /* * load current vector */ diff --git a/src/spicelib/devices/mos9/mos9mask.c b/src/spicelib/devices/mos9/mos9mask.c index 30c8031ec..232404350 100644 --- a/src/spicelib/devices/mos9/mos9mask.c +++ b/src/spicelib/devices/mos9/mos9mask.c @@ -7,7 +7,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "const.h" #include "ifsim.h" #include "cktdefs.h" @@ -19,11 +18,7 @@ Modified: Alan Gillespie /*ARGSUSED*/ int -MOS9mAsk(ckt,inst,which,value) - CKTcircuit *ckt; - GENmodel *inst; - int which; - IFvalue *value; +MOS9mAsk(CKTcircuit *ckt, GENmodel *inst, int which, IFvalue *value) { MOS9model *here = (MOS9model *)inst; switch(which) { diff --git a/src/spicelib/devices/mos9/mos9mdel.c b/src/spicelib/devices/mos9/mos9mdel.c index 1165b28f2..85626b8a7 100644 --- a/src/spicelib/devices/mos9/mos9mdel.c +++ b/src/spicelib/devices/mos9/mos9mdel.c @@ -7,17 +7,13 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "mos9defs.h" #include "sperror.h" #include "suffix.h" int -MOS9mDelete(inModel,modname,kill) - GENmodel **inModel; - IFuid modname; - GENmodel *kill; +MOS9mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) { MOS9model **model = (MOS9model **)inModel; MOS9model *modfast = (MOS9model *)kill; diff --git a/src/spicelib/devices/mos9/mos9mpar.c b/src/spicelib/devices/mos9/mos9mpar.c index b21550e23..18ee7aafe 100644 --- a/src/spicelib/devices/mos9/mos9mpar.c +++ b/src/spicelib/devices/mos9/mos9mpar.c @@ -7,7 +7,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "const.h" #include "ifsim.h" #include "mos9defs.h" @@ -16,10 +15,7 @@ Modified: Alan Gillespie int -MOS9mParam(param,value,inModel) - int param; - IFvalue *value; - GENmodel *inModel; +MOS9mParam(int param, IFvalue *value, GENmodel *inModel) { register MOS9model *model = (MOS9model *)inModel; switch(param) { diff --git a/src/spicelib/devices/mos9/mos9noi.c b/src/spicelib/devices/mos9/mos9noi.c index 306694d4b..1353359e6 100644 --- a/src/spicelib/devices/mos9/mos9noi.c +++ b/src/spicelib/devices/mos9/mos9noi.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "mos9defs.h" #include "cktdefs.h" #include "iferrmsg.h" @@ -25,13 +24,8 @@ extern void NevalSrc(); extern double Nintegrate(); int -MOS9noise (mode, operation, genmodel, ckt, data, OnDens) - int mode; - int operation; - GENmodel *genmodel; - CKTcircuit *ckt; - Ndata *data; - double *OnDens; +MOS9noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, + Ndata *data, double *OnDens) { MOS9model *firstModel = (MOS9model *) genmodel; MOS9model *model; @@ -56,6 +50,8 @@ MOS9noise (mode, operation, genmodel, ckt, data, OnDens) for (model=firstModel; model != NULL; model=model->MOS9nextModel) { for (inst=model->MOS9instances; inst != NULL; inst=inst->MOS9nextInstance) { + if (inst->MOS9owner != ARCHme) continue; + switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/mos9/mos9par.c b/src/spicelib/devices/mos9/mos9par.c index 5068a653e..ce6706679 100644 --- a/src/spicelib/devices/mos9/mos9par.c +++ b/src/spicelib/devices/mos9/mos9par.c @@ -7,7 +7,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "const.h" #include "ifsim.h" #include "mos9defs.h" @@ -17,11 +16,8 @@ Modified: Alan Gillespie /* ARGSUSED */ int -MOS9param(param,value,inst,select) - int param; - IFvalue *value; - GENinstance *inst; - IFvalue *select; +MOS9param(int param, IFvalue *value, GENinstance *inst, + IFvalue *select) { MOS9instance *here = (MOS9instance *)inst; switch(param) { @@ -81,6 +77,10 @@ MOS9param(param,value,inst,select) here->MOS9temp = value->rValue+CONSTCtoK; here->MOS9tempGiven = TRUE; break; + case MOS9_DTEMP: + here->MOS9dtemp = value->rValue; + here->MOS9dtempGiven = TRUE; + break; case MOS9_IC: switch(value->v.numValue){ case 3: diff --git a/src/spicelib/devices/mos9/mos9pzld.c b/src/spicelib/devices/mos9/mos9pzld.c index 52576637b..aff63b460 100644 --- a/src/spicelib/devices/mos9/mos9pzld.c +++ b/src/spicelib/devices/mos9/mos9pzld.c @@ -7,7 +7,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "cktdefs.h" #include "complex.h" #include "mos9defs.h" @@ -16,10 +15,7 @@ Modified: Alan Gillespie int -MOS9pzLoad(inModel,ckt,s) - GENmodel *inModel; - CKTcircuit *ckt; - SPcomplex *s; +MOS9pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) { MOS9model *model = (MOS9model *)inModel; MOS9instance *here; @@ -42,6 +38,7 @@ MOS9pzLoad(inModel,ckt,s) for( ; model != NULL; model = model->MOS9nextModel) { for(here = model->MOS9instances; here!= NULL; here = here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; if (here->MOS9mode < 0) { xnrm=0; diff --git a/src/spicelib/devices/mos9/mos9sacl.c b/src/spicelib/devices/mos9/mos9sacl.c index f9944c695..a88b4f50c 100644 --- a/src/spicelib/devices/mos9/mos9sacl.c +++ b/src/spicelib/devices/mos9/mos9sacl.c @@ -2,6 +2,8 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles Modified: Alan Gillespie + +This function is obsolete (was used by an old sensitivity analysis) **********/ /* actually load the current ac sensitivity @@ -9,7 +11,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "smpdefs.h" #include "cktdefs.h" #include "const.h" @@ -18,9 +19,7 @@ Modified: Alan Gillespie #include "suffix.h" int -MOS9sAcLoad(inModel,ckt) -GENmodel *inModel; -CKTcircuit *ckt; +MOS9sAcLoad(GENmodel *inModel, CKTcircuit *ckt) { MOS9model *model = (MOS9model *)inModel; MOS9instance *here; @@ -133,6 +132,7 @@ CKTcircuit *ckt; for( ; model != NULL; model = model->MOS9nextModel) { for(here = model->MOS9instances; here!= NULL; here = here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; /* save the unperturbed values in the state vector */ for(i=0; i <= 16; i++) diff --git a/src/spicelib/devices/mos9/mos9set.c b/src/spicelib/devices/mos9/mos9set.c index 728093b0e..b23969bf0 100644 --- a/src/spicelib/devices/mos9/mos9set.c +++ b/src/spicelib/devices/mos9/mos9set.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "smpdefs.h" #include "cktdefs.h" #include "mos9defs.h" @@ -17,11 +16,7 @@ Modified: Alan Gillespie #define EPSSIL (11.7 * 8.854214871e-12) int -MOS9setup(matrix,inModel,ckt,states) - SMPmatrix *matrix; - GENmodel *inModel; - CKTcircuit *ckt; - int *states; +MOS9setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* load the MOS9 device structure with those pointers needed later * for fast matrix loading */ @@ -152,10 +147,11 @@ MOS9setup(matrix,inModel,ckt,states) CKTnode *tmpNode; IFuid tmpName; - /* allocate a chunk of the state vector */ - here->MOS9states = *states; - *states += MOS9NUMSTATES; - + if (here->MOS9owner == ARCHme) { + /* allocate a chunk of the state vector */ + here->MOS9states = *states; + *states += MOS9NUMSTATES; + } if(!here->MOS9drainAreaGiven) { here->MOS9drainArea = ckt->CKTdefaultMosAD; } @@ -263,9 +259,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ } int -MOS9unsetup(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS9unsetup(GENmodel *inModel, CKTcircuit *ckt) { MOS9model *model; MOS9instance *here; diff --git a/src/spicelib/devices/mos9/mos9sld.c b/src/spicelib/devices/mos9/mos9sld.c index 088653fe0..9917aff3d 100644 --- a/src/spicelib/devices/mos9/mos9sld.c +++ b/src/spicelib/devices/mos9/mos9sld.c @@ -2,6 +2,8 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles Modified: Alan Gillespie + +This function is obsolete (was used by an old sensitivity analysis) **********/ /* actually load the current sensitivity @@ -9,7 +11,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "smpdefs.h" #include "cktdefs.h" #include "mos9defs.h" @@ -17,9 +18,7 @@ Modified: Alan Gillespie #include "suffix.h" int -MOS9sLoad(inModel,ckt) -GENmodel *inModel; -CKTcircuit *ckt; +MOS9sLoad(GENmodel *inModel, CKTcircuit *ckt) { MOS9model *model = (MOS9model *)inModel; MOS9instance *here; @@ -101,7 +100,7 @@ CKTcircuit *ckt; /* loop through all the instances of the model */ for (here = model->MOS9instances; here != NULL ; here=here->MOS9nextInstance) { - + if (here->MOS9owner != ARCHme) continue; #ifdef SENSDEBUG printf("senload instance name %s\n",here->MOS9name); diff --git a/src/spicelib/devices/mos9/mos9sprt.c b/src/spicelib/devices/mos9/mos9sprt.c index 183c104a8..20838277a 100644 --- a/src/spicelib/devices/mos9/mos9sprt.c +++ b/src/spicelib/devices/mos9/mos9sprt.c @@ -2,6 +2,8 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles Modified: Alan Gillespie + +This function is obsolete (was used by an old sensitivity analysis) **********/ /* Pretty print the sensitivity info for all the MOS9 @@ -9,7 +11,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "smpdefs.h" #include "cktdefs.h" #include "mos9defs.h" @@ -17,14 +18,12 @@ Modified: Alan Gillespie #include "suffix.h" void -MOS9sPrint(inModel,ckt) - GENmodel *inModel; - register CKTcircuit *ckt; +MOS9sPrint(GENmodel *inModel, CKTcircuit *ckt) { - register MOS9model *model = (MOS9model *)inModel; - register MOS9instance *here; + MOS9model *model = (MOS9model *)inModel; + MOS9instance *here; - printf("LEVEL 3 MOSFETS (AG) -----------------\n"); + printf("LEVEL 9 MOSFETS (AG) -----------------\n"); /* loop through all the MOS9 models */ for( ; model != NULL; model = model->MOS9nextModel ) { @@ -33,6 +32,7 @@ MOS9sPrint(inModel,ckt) /* loop through all the instances of the model */ for (here = model->MOS9instances; here != NULL ; here=here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; printf(" Instance name:%s\n",here->MOS9name); printf(" Drain, Gate , Source nodes: %s, %s ,%s\n", diff --git a/src/spicelib/devices/mos9/mos9sset.c b/src/spicelib/devices/mos9/mos9sset.c index 9ad775856..85ee3d403 100644 --- a/src/spicelib/devices/mos9/mos9sset.c +++ b/src/spicelib/devices/mos9/mos9sset.c @@ -2,6 +2,8 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles Modified: Alan Gillespie + +This function is obsolete (was used by an old sensitivity analysis) **********/ /* loop through all the devices and @@ -9,7 +11,6 @@ Modified: Alan Gillespie */ #include "ngspice.h" -#include #include "smpdefs.h" #include "cktdefs.h" #include "mos9defs.h" @@ -17,9 +18,7 @@ Modified: Alan Gillespie #include "suffix.h" int -MOS9sSetup(info,inModel) - SENstruct *info; - GENmodel *inModel; +MOS9sSetup(SENstruct *info, GENmodel *inModel) { MOS9model *model = (MOS9model *)inModel; MOS9instance *here; @@ -30,6 +29,7 @@ MOS9sSetup(info,inModel) /* loop through all the instances of the model */ for (here = model->MOS9instances; here != NULL ; here=here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; if(here->MOS9senParmNo){ diff --git a/src/spicelib/devices/mos9/mos9supd.c b/src/spicelib/devices/mos9/mos9supd.c index 21f680d1e..a80edbc7c 100644 --- a/src/spicelib/devices/mos9/mos9supd.c +++ b/src/spicelib/devices/mos9/mos9supd.c @@ -2,9 +2,10 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles Modified: Alan Gillespie + +This function is obsolete (was used by an old sensitivity analysis) **********/ -#include #include "ngspice.h" #include "smpdefs.h" #include "cktdefs.h" @@ -13,9 +14,7 @@ Modified: Alan Gillespie #include "suffix.h" int -MOS9sUpdate(inModel,ckt) -GENmodel *inModel; -CKTcircuit *ckt; +MOS9sUpdate(GENmodel *inModel, CKTcircuit *ckt) { MOS9model *model = (MOS9model *)inModel; MOS9instance *here; @@ -56,6 +55,7 @@ CKTcircuit *ckt; /* loop through all the instances of the model */ for (here = model->MOS9instances; here != NULL ; here=here->MOS9nextInstance) { + if (here->MOS9owner != ARCHme) continue; #ifdef SENSDEBUG diff --git a/src/spicelib/devices/mos9/mos9temp.c b/src/spicelib/devices/mos9/mos9temp.c index f5c00f608..cd8d6dfe3 100644 --- a/src/spicelib/devices/mos9/mos9temp.c +++ b/src/spicelib/devices/mos9/mos9temp.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "cktdefs.h" #include "mos9defs.h" #include "const.h" @@ -16,9 +15,7 @@ Modified: Alan Gillespie #define EPSSIL (11.7 * 8.854214871e-12) int -MOS9temp(inModel,ckt) - GENmodel *inModel; - CKTcircuit *ckt; +MOS9temp(GENmodel *inModel, CKTcircuit *ckt) { MOS9model *model = (MOS9model *)inModel; MOS9instance *here; @@ -127,11 +124,16 @@ MOS9temp(inModel,ckt) double arg; /* 1 - fc */ double sarg; /* (1-fc) ^^ (-mj) */ double sargsw; /* (1-fc) ^^ (-mjsw) */ + if (here->MOS9owner != ARCHme) continue; /* perform the parameter defaulting */ + if(!here->MOS9dtempGiven) { + here->MOS9dtemp = 0.0; + } + if(!here->MOS9tempGiven) { - here->MOS9temp = ckt->CKTtemp; + here->MOS9temp = ckt->CKTtemp + here->MOS9dtemp; } vt = here->MOS9temp * CONSTKoverQ; ratio = here->MOS9temp/model->MOS9tnom; diff --git a/src/spicelib/devices/mos9/mos9trun.c b/src/spicelib/devices/mos9/mos9trun.c index d9d5f26cf..0355aa43d 100644 --- a/src/spicelib/devices/mos9/mos9trun.c +++ b/src/spicelib/devices/mos9/mos9trun.c @@ -5,7 +5,6 @@ Modified: Alan Gillespie **********/ #include "ngspice.h" -#include #include "cktdefs.h" #include "mos9defs.h" #include "sperror.h" @@ -22,6 +21,8 @@ MOS9trunc(inModel,ckt,timeStep) for( ; model != NULL; model = model->MOS9nextModel) { for(here=model->MOS9instances;here!=NULL;here = here->MOS9nextInstance){ + if (here->MOS9owner != ARCHme) continue; + CKTterr(here->MOS9qgs,ckt,timeStep); CKTterr(here->MOS9qgd,ckt,timeStep); CKTterr(here->MOS9qgb,ckt,timeStep);