diff --git a/src/include/ngspice/mifdefs.h b/src/include/ngspice/mifdefs.h index 0c815b01a..bc2651dd3 100644 --- a/src/include/ngspice/mifdefs.h +++ b/src/include/ngspice/mifdefs.h @@ -52,10 +52,12 @@ NON-STANDARD FEATURES struct MIFinstance { - struct MIFmodel *MIFmodPtr; /* backpointer to model */ - struct MIFinstance *MIFnextInstance; /* pointer to next instance of current model */ - IFuid MIFname; /* pointer to character string naming this instance */ - int MIFstates; /* state info, unused */ + struct GENinstance gen; + +#define MIFmodPtr(inst) ((struct MIFmodel*)((inst)->gen.GENmodPtr)) +#define MIFnextInstance(inst) ((struct MIFinstance*)((inst)->gen.GENnextInstance)) +#define MIFname gen.GENname +#define MIFstates gen.GENstate int num_conn; /* number of connections on the code model */ Mif_Conn_Data_t **conn; /* array of data structures for each connection */ diff --git a/src/spicelib/analysis/cktdisto.c b/src/spicelib/analysis/cktdisto.c index 439f848ac..334c15ac9 100644 --- a/src/spicelib/analysis/cktdisto.c +++ b/src/spicelib/analysis/cktdisto.c @@ -91,7 +91,7 @@ CKTdisto (CKTcircuit *ckt, int mode) for(model = (VSRCmodel *)ckt->CKThead[vcode];model != NULL; model=VSRCnextModel(model)){ for(here=VSRCinstances(model);here!=NULL; - here=here->VSRCnextInstance) { + here=VSRCnextInstance(here)) { /* check if the source has a distortion input*/ @@ -127,7 +127,7 @@ if (((here->VSRCdF1given) && (mode == D_RHSF1)) || for(model= (ISRCmodel *)ckt->CKThead[icode];model != NULL; model=ISRCnextModel(model)){ for(here=ISRCinstances(model);here!=NULL; - here=here->ISRCnextInstance) { + here=ISRCnextInstance(here)) { /* check if the source has a distortion input*/ diff --git a/src/spicelib/analysis/dctrcurv.c b/src/spicelib/analysis/dctrcurv.c index a9004cdbf..80b7ec21d 100644 --- a/src/spicelib/analysis/dctrcurv.c +++ b/src/spicelib/analysis/dctrcurv.c @@ -91,7 +91,7 @@ DCtrCurv(CKTcircuit *ckt, int restart) RESmodel *model; for (model = (RESmodel *)ckt->CKThead[rcode]; model; model = RESnextModel(model)) - for (here = RESinstances(model); here; here = here->RESnextInstance) + for (here = RESinstances(model); here; here = RESnextInstance(here)) if (here->RESname == job->TRCVvName[i]) { job->TRCVvElt[i] = (GENinstance *)here; job->TRCVvSave[i] = here->RESresist; @@ -110,7 +110,7 @@ DCtrCurv(CKTcircuit *ckt, int restart) VSRCmodel *model; for (model = (VSRCmodel *)ckt->CKThead[vcode]; model; model = VSRCnextModel(model)) - for (here = VSRCinstances(model); here; here = here->VSRCnextInstance) + for (here = VSRCinstances(model); here; here = VSRCnextInstance(here)) if (here->VSRCname == job->TRCVvName[i]) { job->TRCVvElt[i] = (GENinstance *)here; job->TRCVvSave[i] = here->VSRCdcValue; @@ -128,7 +128,7 @@ DCtrCurv(CKTcircuit *ckt, int restart) ISRCmodel *model; for (model = (ISRCmodel *)ckt->CKThead[icode]; model; model = ISRCnextModel(model)) - for (here = ISRCinstances(model); here; here = here->ISRCnextInstance) + for (here = ISRCinstances(model); here; here = ISRCnextInstance(here)) if (here->ISRCname == job->TRCVvName[i]) { job->TRCVvElt[i] = (GENinstance *)here; job->TRCVvSave[i] = here->ISRCdcValue; diff --git a/src/spicelib/devices/asrc/asrcacld.c b/src/spicelib/devices/asrc/asrcacld.c index 55adbdf3c..115dd678c 100644 --- a/src/spicelib/devices/asrc/asrcacld.c +++ b/src/spicelib/devices/asrc/asrcacld.c @@ -29,7 +29,7 @@ ASRCacLoad(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); for (; model; model = ASRCnextModel(model)) { - for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { + for (here = ASRCinstances(model); here; here = ASRCnextInstance(here)) { difference = (here->ASRCtemp + here->ASRCdtemp) - 300.15; factor = 1.0 diff --git a/src/spicelib/devices/asrc/asrcconv.c b/src/spicelib/devices/asrc/asrcconv.c index bc57c306b..4fa584a74 100644 --- a/src/spicelib/devices/asrc/asrcconv.c +++ b/src/spicelib/devices/asrc/asrcconv.c @@ -22,7 +22,7 @@ ASRCconvTest(GENmodel *inModel, CKTcircuit *ckt) double rhs; for (; model; model = ASRCnextModel(model)) { - for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { + for (here = ASRCinstances(model); here; here = ASRCnextInstance(here)) { i = here->ASRCtree->numVars; if (asrc_nvals < i) { diff --git a/src/spicelib/devices/asrc/asrcdefs.h b/src/spicelib/devices/asrc/asrcdefs.h index 00cbb4315..d63c4417e 100644 --- a/src/spicelib/devices/asrc/asrcdefs.h +++ b/src/spicelib/devices/asrc/asrcdefs.h @@ -18,11 +18,13 @@ Author: 1985 Thomas L. Quarles /* information to describe a single instance */ typedef struct sASRCinstance { - struct sASRCmodel *ASRCmodPtr; /* backpointer to model */ - struct sASRCinstance *ASRCnextInstance; /* pointer to next instance of - * current model */ - IFuid ASRCname; /* pointer to character string naming this instance */ - int ASRCstates; /* state info */ + struct GENinstance gen; + +#define ASRCmodPtr(inst) ((struct sASRCmodel*)((inst)->gen.GENmodPtr)) +#define ASRCnextInstance(inst) ((struct sASRCinstance*)((inst)->gen.GENnextInstance)) +#define ASRCname gen.GENname +#define ASRCstates gen.GENstate + const int ASRCposNode; /* number of positive node of source */ const int ASRCnegNode; /* number of negative node of source */ diff --git a/src/spicelib/devices/asrc/asrcdest.c b/src/spicelib/devices/asrc/asrcdest.c index fffc5de89..d78392011 100644 --- a/src/spicelib/devices/asrc/asrcdest.c +++ b/src/spicelib/devices/asrc/asrcdest.c @@ -18,7 +18,7 @@ ASRCdestroy(GENmodel **inModel) ASRCmodel *next_mod = ASRCnextModel(mod); ASRCinstance *inst = ASRCinstances(mod); while (inst) { - ASRCinstance *next_inst = inst->ASRCnextInstance; + ASRCinstance *next_inst = ASRCnextInstance(inst); INPfreeTree(inst->ASRCtree); FREE(inst->ASRCacValues); FREE(inst->ASRCposPtr); diff --git a/src/spicelib/devices/asrc/asrcfbr.c b/src/spicelib/devices/asrc/asrcfbr.c index 164a82772..acbf9c9fa 100644 --- a/src/spicelib/devices/asrc/asrcfbr.c +++ b/src/spicelib/devices/asrc/asrcfbr.c @@ -20,7 +20,7 @@ ASRCfindBr(CKTcircuit *ckt, GENmodel *inputModel, IFuid name) CKTnode *tmp; for (; model; model = ASRCnextModel(model)) - for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) + for (here = ASRCinstances(model); here; here = ASRCnextInstance(here)) if (here->ASRCname == name) { if (here->ASRCbranch == 0) { error = CKTmkCur(ckt, &tmp, here->ASRCname, "branch"); diff --git a/src/spicelib/devices/asrc/asrcload.c b/src/spicelib/devices/asrc/asrcload.c index e6c5f230f..35bb5b152 100644 --- a/src/spicelib/devices/asrc/asrcload.c +++ b/src/spicelib/devices/asrc/asrcload.c @@ -30,7 +30,7 @@ ASRCload(GENmodel *inModel, CKTcircuit *ckt) double factor; for (; model; model = ASRCnextModel(model)) { - for (here = ASRCinstances(model); here; here=here->ASRCnextInstance) { + for (here = ASRCinstances(model); here; here=ASRCnextInstance(here)) { difference = (here->ASRCtemp + here->ASRCdtemp) - 300.15; factor = 1.0 diff --git a/src/spicelib/devices/asrc/asrcpzld.c b/src/spicelib/devices/asrc/asrcpzld.c index 2f988047b..48110bd9f 100644 --- a/src/spicelib/devices/asrc/asrcpzld.c +++ b/src/spicelib/devices/asrc/asrcpzld.c @@ -28,7 +28,7 @@ ASRCpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(s); for (; model; model = ASRCnextModel(model)) { - for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { + for (here = ASRCinstances(model); here; here = ASRCnextInstance(here)) { difference = (here->ASRCtemp + here->ASRCdtemp) - 300.15; factor = 1.0 diff --git a/src/spicelib/devices/asrc/asrcset.c b/src/spicelib/devices/asrc/asrcset.c index f6119f99c..f97ff035c 100644 --- a/src/spicelib/devices/asrc/asrcset.c +++ b/src/spicelib/devices/asrc/asrcset.c @@ -32,7 +32,7 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) NG_IGNORE(states); for (; model; model = ASRCnextModel(model)) { - for (here = ASRCinstances(model); here; here=here->ASRCnextInstance) { + for (here = ASRCinstances(model); here; here=ASRCnextInstance(here)) { if (!here->ASRCtree) return E_PARMVAL; @@ -127,7 +127,7 @@ ASRCunsetup(GENmodel *inModel, CKTcircuit *ckt) ASRCinstance *here; for (; model; model = ASRCnextModel(model)) - for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { + for (here = ASRCinstances(model); here; here = ASRCnextInstance(here)) { if (here->ASRCbranch > 0) CKTdltNNum(ckt, here->ASRCbranch); here->ASRCbranch = 0; diff --git a/src/spicelib/devices/asrc/asrctemp.c b/src/spicelib/devices/asrc/asrctemp.c index b6caa31ab..5e316b903 100644 --- a/src/spicelib/devices/asrc/asrctemp.c +++ b/src/spicelib/devices/asrc/asrctemp.c @@ -16,7 +16,7 @@ ASRCtemp(GENmodel *inModel, CKTcircuit *ckt) ASRCinstance *here; for (; model; model = ASRCnextModel(model)) { - for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { + for (here = ASRCinstances(model); here; here = ASRCnextInstance(here)) { /* Default Value Processing for Source Instance */ diff --git a/src/spicelib/devices/bjt/bjtacld.c b/src/spicelib/devices/bjt/bjtacld.c index 064c999da..fcdfa7cb3 100644 --- a/src/spicelib/devices/bjt/bjtacld.c +++ b/src/spicelib/devices/bjt/bjtacld.c @@ -39,7 +39,7 @@ BJTacLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = BJTnextModel(model)) { for( here = BJTinstances(model); here!= NULL; - here = here->BJTnextInstance) { + here = BJTnextInstance(here)) { m = here->BJTm; diff --git a/src/spicelib/devices/bjt/bjtask.c b/src/spicelib/devices/bjt/bjtask.c index cf14cb42a..f40676907 100644 --- a/src/spicelib/devices/bjt/bjtask.c +++ b/src/spicelib/devices/bjt/bjtask.c @@ -96,7 +96,7 @@ BJTask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue return(OK); case BJT_QUEST_CB: value->rValue = *(ckt->CKTstate0 + here->BJTcb); - if (here->BJTmodPtr->BJTsubs==LATERAL) { + if (BJTmodPtr(here)->BJTsubs==LATERAL) { value->rValue -= *(ckt->CKTstate0 + here->BJTcdsub); if ((ckt->CKTcurrentAnalysis & DOING_TRAN) && !(ckt->CKTmode & MODETRANOP)) { @@ -248,7 +248,7 @@ BJTask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue (ckt->CKTmode & MODETRANOP)) { value->rValue = 0; } else { - value->rValue = -(here->BJTmodPtr->BJTsubs * + value->rValue = -(BJTmodPtr(here)->BJTsubs * (*(ckt->CKTstate0 + here->BJTcqsub) + *(ckt->CKTstate0 + here->BJTcdsub))); } @@ -263,7 +263,7 @@ BJTask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue } else { value->rValue = -*(ckt->CKTstate0 + here->BJTcc); value->rValue -= *(ckt->CKTstate0 + here->BJTcb); - if (here->BJTmodPtr->BJTsubs==VERTICAL) { + if (BJTmodPtr(here)->BJTsubs==VERTICAL) { value->rValue += *(ckt->CKTstate0 + here->BJTcdsub); if ((ckt->CKTcurrentAnalysis & DOING_TRAN) && !(ckt->CKTmode & MODETRANOP)) { diff --git a/src/spicelib/devices/bjt/bjtconv.c b/src/spicelib/devices/bjt/bjtconv.c index b99185a06..515499e81 100644 --- a/src/spicelib/devices/bjt/bjtconv.c +++ b/src/spicelib/devices/bjt/bjtconv.c @@ -33,7 +33,7 @@ BJTconvTest(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = BJTnextModel(model)) { - for(here=BJTinstances(model);here!=NULL;here = here->BJTnextInstance){ + for(here=BJTinstances(model);here!=NULL;here = BJTnextInstance(here)){ vbe=model->BJTtype*( *(ckt->CKTrhsOld+here->BJTbasePrimeNode)- diff --git a/src/spicelib/devices/bjt/bjtdefs.h b/src/spicelib/devices/bjt/bjtdefs.h index cc7007b8c..37d511cac 100644 --- a/src/spicelib/devices/bjt/bjtdefs.h +++ b/src/spicelib/devices/bjt/bjtdefs.h @@ -17,11 +17,12 @@ Author: 1985 Thomas L. Quarles /* data needed to describe a single instance */ typedef struct sBJTinstance { - struct sBJTmodel *BJTmodPtr; /* backpointer to model */ - struct sBJTinstance *BJTnextInstance; /* pointer to next instance of - * current model*/ - IFuid BJTname; /* pointer to character string naming this instance */ - int BJTstate; /* pointer to start of state vector for bjt */ + struct GENinstance gen; + +#define BJTmodPtr(inst) ((struct sBJTmodel*)((inst)->gen.GENmodPtr)) +#define BJTnextInstance(inst) ((struct sBJTinstance*)((inst)->gen.GENnextInstance)) +#define BJTname gen.GENname +#define BJTstate gen.GENstate const int BJTcolNode; /* number of collector node of bjt */ const int BJTbaseNode; /* number of base node of bjt */ diff --git a/src/spicelib/devices/bjt/bjtdest.c b/src/spicelib/devices/bjt/bjtdest.c index 8815539ee..ec42e4ed1 100644 --- a/src/spicelib/devices/bjt/bjtdest.c +++ b/src/spicelib/devices/bjt/bjtdest.c @@ -22,7 +22,7 @@ BJTdestroy(GENmodel **inModel) BJTmodel *next_mod = BJTnextModel(mod); BJTinstance *inst = BJTinstances(mod); while (inst) { - BJTinstance *next_inst = inst->BJTnextInstance; + BJTinstance *next_inst = BJTnextInstance(inst); FREE(inst->BJTsens); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/bjt/bjtdisto.c b/src/spicelib/devices/bjt/bjtdisto.c index 0af1dbe3d..15eb50346 100644 --- a/src/spicelib/devices/bjt/bjtdisto.c +++ b/src/spicelib/devices/bjt/bjtdisto.c @@ -57,7 +57,7 @@ BJTdisto(int mode, GENmodel *genmodel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { /* getting Volterra kernels */ /* until further notice x = vbe, y = vbc, z= vbed */ diff --git a/src/spicelib/devices/bjt/bjtdset.c b/src/spicelib/devices/bjt/bjtdset.c index 862f51150..9f498a728 100644 --- a/src/spicelib/devices/bjt/bjtdset.c +++ b/src/spicelib/devices/bjt/bjtdset.c @@ -145,7 +145,7 @@ int BJTdSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { vt = here->BJTtemp * CONSTKoverQ; diff --git a/src/spicelib/devices/bjt/bjtgetic.c b/src/spicelib/devices/bjt/bjtgetic.c index 775fa9c03..7bc1fa500 100644 --- a/src/spicelib/devices/bjt/bjtgetic.c +++ b/src/spicelib/devices/bjt/bjtgetic.c @@ -30,7 +30,7 @@ BJTgetic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = BJTnextModel(model)) { - for(here = BJTinstances(model); here ; here = here->BJTnextInstance) { + for(here = BJTinstances(model); here ; here = BJTnextInstance(here)) { if(!here->BJTicVBEGiven) { here->BJTicVBE = diff --git a/src/spicelib/devices/bjt/bjtload.c b/src/spicelib/devices/bjt/bjtload.c index a807fe24b..628e8e95c 100644 --- a/src/spicelib/devices/bjt/bjtload.c +++ b/src/spicelib/devices/bjt/bjtload.c @@ -143,7 +143,7 @@ BJTload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { vt = here->BJTtemp * CONSTKoverQ; diff --git a/src/spicelib/devices/bjt/bjtnoise.c b/src/spicelib/devices/bjt/bjtnoise.c index 44a1e4deb..8cbf4b48c 100644 --- a/src/spicelib/devices/bjt/bjtnoise.c +++ b/src/spicelib/devices/bjt/bjtnoise.c @@ -52,7 +52,7 @@ BJTnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, for (model=firstModel; model != NULL; model=BJTnextModel(model)) { for (inst=BJTinstances(model); inst != NULL; - inst=inst->BJTnextInstance) { + inst=BJTnextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/bjt/bjtpzld.c b/src/spicelib/devices/bjt/bjtpzld.c index 69685c809..eca48c04f 100644 --- a/src/spicelib/devices/bjt/bjtpzld.c +++ b/src/spicelib/devices/bjt/bjtpzld.c @@ -35,7 +35,7 @@ BJTpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = BJTnextModel(model)) { for( here = BJTinstances(model); here!= NULL; - here = here->BJTnextInstance) { + here = BJTnextInstance(here)) { m = here->BJTm; diff --git a/src/spicelib/devices/bjt/bjtsacl.c b/src/spicelib/devices/bjt/bjtsacl.c index 97921a0dd..2ea3f5492 100644 --- a/src/spicelib/devices/bjt/bjtsacl.c +++ b/src/spicelib/devices/bjt/bjtsacl.c @@ -96,7 +96,7 @@ BJTsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { /* save the unperturbed values in the state vector */ diff --git a/src/spicelib/devices/bjt/bjtsetup.c b/src/spicelib/devices/bjt/bjtsetup.c index 803971a44..db071ddbc 100644 --- a/src/spicelib/devices/bjt/bjtsetup.c +++ b/src/spicelib/devices/bjt/bjtsetup.c @@ -346,7 +346,7 @@ BJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { CKTnode *tmpNode; IFuid tmpName; @@ -479,7 +479,7 @@ BJTunsetup( model = BJTnextModel(model)) { for (here = BJTinstances(model); here != NULL; - here=here->BJTnextInstance) + here=BJTnextInstance(here)) { if (here->BJTemitPrimeNode > 0 && here->BJTemitPrimeNode != here->BJTemitNode) diff --git a/src/spicelib/devices/bjt/bjtsload.c b/src/spicelib/devices/bjt/bjtsload.c index bb99e341f..d3fad135c 100644 --- a/src/spicelib/devices/bjt/bjtsload.c +++ b/src/spicelib/devices/bjt/bjtsload.c @@ -90,7 +90,7 @@ BJTsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { #ifdef SENSDEBUG printf("base = %d , baseprm = %d ,col = %d, colprm = %d\n", diff --git a/src/spicelib/devices/bjt/bjtsoachk.c b/src/spicelib/devices/bjt/bjtsoachk.c index 69665bd69..b13d85d27 100644 --- a/src/spicelib/devices/bjt/bjtsoachk.c +++ b/src/spicelib/devices/bjt/bjtsoachk.c @@ -32,7 +32,7 @@ BJTsoaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = BJTnextModel(model)) { - for (here = BJTinstances(model); here; here=here->BJTnextInstance) { + for (here = BJTinstances(model); here; here=BJTnextInstance(here)) { vbe = fabs(ckt->CKTrhsOld [here->BJTbasePrimeNode] - ckt->CKTrhsOld [here->BJTemitPrimeNode]); diff --git a/src/spicelib/devices/bjt/bjtsprt.c b/src/spicelib/devices/bjt/bjtsprt.c index d0a5bc6dd..922ba9f84 100644 --- a/src/spicelib/devices/bjt/bjtsprt.c +++ b/src/spicelib/devices/bjt/bjtsprt.c @@ -33,7 +33,7 @@ BJTsPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { ckt->CKTsenInfo->SEN_parmVal[here->BJTsenParmNo] = here->BJTarea; diff --git a/src/spicelib/devices/bjt/bjtsset.c b/src/spicelib/devices/bjt/bjtsset.c index 0dfc14034..3d0c986b6 100644 --- a/src/spicelib/devices/bjt/bjtsset.c +++ b/src/spicelib/devices/bjt/bjtsset.c @@ -35,7 +35,7 @@ BJTsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { if(here->BJTsenParmNo){ here->BJTsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/bjt/bjtsupd.c b/src/spicelib/devices/bjt/bjtsupd.c index 8d5170527..69727fe9c 100644 --- a/src/spicelib/devices/bjt/bjtsupd.c +++ b/src/spicelib/devices/bjt/bjtsupd.c @@ -47,7 +47,7 @@ BJTsUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { sxpbe = 0; sxpbc = 0; diff --git a/src/spicelib/devices/bjt/bjttemp.c b/src/spicelib/devices/bjt/bjttemp.c index 05da5c001..df5c99f73 100644 --- a/src/spicelib/devices/bjt/bjttemp.c +++ b/src/spicelib/devices/bjt/bjttemp.c @@ -101,7 +101,7 @@ BJTtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = BJTinstances(model); here != NULL ; - here=here->BJTnextInstance) { + here=BJTnextInstance(here)) { double arg1, pbfact1, egfet1; if(!here->BJTdtempGiven) diff --git a/src/spicelib/devices/bjt/bjttrunc.c b/src/spicelib/devices/bjt/bjttrunc.c index 72a3c79b9..abee58deb 100644 --- a/src/spicelib/devices/bjt/bjttrunc.c +++ b/src/spicelib/devices/bjt/bjttrunc.c @@ -25,7 +25,7 @@ BJTtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) BJTinstance *here; for( ; model != NULL; model = BJTnextModel(model)) { - for(here=BJTinstances(model);here!=NULL;here = here->BJTnextInstance){ + for(here=BJTinstances(model);here!=NULL;here = BJTnextInstance(here)){ CKTterr(here->BJTqbe,ckt,timeStep); CKTterr(here->BJTqbc,ckt,timeStep); diff --git a/src/spicelib/devices/bsim1/b1acld.c b/src/spicelib/devices/bsim1/b1acld.c index caf3993f9..f4fb90638 100644 --- a/src/spicelib/devices/bsim1/b1acld.c +++ b/src/spicelib/devices/bsim1/b1acld.c @@ -55,7 +55,7 @@ B1acLoad(GENmodel *inModel, CKTcircuit *ckt) omega = ckt->CKTomega; for( ; model != NULL; model = B1nextModel(model)) { for(here = B1instances(model); here!= NULL; - here = here->B1nextInstance) { + here = B1nextInstance(here)) { if (here->B1mode >= 0) { xnrm=1; diff --git a/src/spicelib/devices/bsim1/b1cvtest.c b/src/spicelib/devices/bsim1/b1cvtest.c index 08b4facc6..8257d0a61 100644 --- a/src/spicelib/devices/bsim1/b1cvtest.c +++ b/src/spicelib/devices/bsim1/b1cvtest.c @@ -45,7 +45,7 @@ B1convTest(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = B1instances(model); here != NULL ; - here=here->B1nextInstance) { + here=B1nextInstance(here)) { vbs = model->B1type * ( *(ckt->CKTrhsOld+here->B1bNode) - diff --git a/src/spicelib/devices/bsim1/b1dest.c b/src/spicelib/devices/bsim1/b1dest.c index fdefaf0b5..f4e98b008 100644 --- a/src/spicelib/devices/bsim1/b1dest.c +++ b/src/spicelib/devices/bsim1/b1dest.c @@ -17,7 +17,7 @@ B1destroy(GENmodel **inModel) B1model *next_mod = B1nextModel(mod); B1instance *inst = B1instances(mod); while (inst) { - B1instance *next_inst = inst->B1nextInstance; + B1instance *next_inst = B1nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim1/b1disto.c b/src/spicelib/devices/bsim1/b1disto.c index e86cd93c6..85631dc5a 100644 --- a/src/spicelib/devices/bsim1/b1disto.c +++ b/src/spicelib/devices/bsim1/b1disto.c @@ -50,7 +50,7 @@ for( ; model != NULL; model = B1nextModel(model) ) { /* loop through all the instances of the model */ for (here = B1instances(model); here != NULL ; - here=here->B1nextInstance) { + here=B1nextInstance(here)) { /* loading starts here */ diff --git a/src/spicelib/devices/bsim1/b1dset.c b/src/spicelib/devices/bsim1/b1dset.c index a240305a7..1a9e46d48 100644 --- a/src/spicelib/devices/bsim1/b1dset.c +++ b/src/spicelib/devices/bsim1/b1dset.c @@ -129,7 +129,7 @@ B1dSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = B1instances(model); here != NULL ; - here=here->B1nextInstance) { + here=B1nextInstance(here)) { EffectiveLength=here->B1l - model->B1deltaL * 1.e-6;/* m */ DrainArea = here->B1m * here->B1drainArea; diff --git a/src/spicelib/devices/bsim1/b1getic.c b/src/spicelib/devices/bsim1/b1getic.c index 6042bab28..0c27248f9 100644 --- a/src/spicelib/devices/bsim1/b1getic.c +++ b/src/spicelib/devices/bsim1/b1getic.c @@ -24,7 +24,7 @@ B1getic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = B1nextModel(model)) { - for(here = B1instances(model); here ; here = here->B1nextInstance) { + for(here = B1instances(model); here ; here = B1nextInstance(here)) { if(!here->B1icVBSGiven) { here->B1icVBS = diff --git a/src/spicelib/devices/bsim1/b1ld.c b/src/spicelib/devices/bsim1/b1ld.c index 50db2d573..770a86a22 100644 --- a/src/spicelib/devices/bsim1/b1ld.c +++ b/src/spicelib/devices/bsim1/b1ld.c @@ -133,7 +133,7 @@ B1load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = B1instances(model); here != NULL ; - here=here->B1nextInstance) { + here=B1nextInstance(here)) { EffectiveLength=here->B1l - model->B1deltaL * 1.e-6;/* m */ DrainArea = here->B1drainArea; diff --git a/src/spicelib/devices/bsim1/b1noi.c b/src/spicelib/devices/bsim1/b1noi.c index 28052e22b..f79b1bade 100644 --- a/src/spicelib/devices/bsim1/b1noi.c +++ b/src/spicelib/devices/bsim1/b1noi.c @@ -46,7 +46,7 @@ B1noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, }; for (model=firstModel; model != NULL; model=B1nextModel(model)) { - for (inst=B1instances(model); inst != NULL; inst=inst->B1nextInstance) { + for (inst=B1instances(model); inst != NULL; inst=B1nextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/bsim1/b1pzld.c b/src/spicelib/devices/bsim1/b1pzld.c index f8ea202d3..4cf41458d 100644 --- a/src/spicelib/devices/bsim1/b1pzld.c +++ b/src/spicelib/devices/bsim1/b1pzld.c @@ -55,7 +55,7 @@ B1pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = B1nextModel(model)) { for(here = B1instances(model); here!= NULL; - here = here->B1nextInstance) { + here = B1nextInstance(here)) { if (here->B1mode >= 0) { xnrm=1; diff --git a/src/spicelib/devices/bsim1/b1set.c b/src/spicelib/devices/bsim1/b1set.c index f64472657..f2086d2f2 100644 --- a/src/spicelib/devices/bsim1/b1set.c +++ b/src/spicelib/devices/bsim1/b1set.c @@ -271,7 +271,7 @@ B1setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, /* loop through all the instances of the model */ for (here = B1instances(model); here != NULL ; - here=here->B1nextInstance) { + here=B1nextInstance(here)) { CKTnode *tmpNode; IFuid tmpName; @@ -410,7 +410,7 @@ B1unsetup(GENmodel *inModel, CKTcircuit *ckt) model = B1nextModel(model)) { for (here = B1instances(model); here != NULL; - here=here->B1nextInstance) + here=B1nextInstance(here)) { if (here->B1sNodePrime > 0 && here->B1sNodePrime != here->B1sNode) diff --git a/src/spicelib/devices/bsim1/b1temp.c b/src/spicelib/devices/bsim1/b1temp.c index df1ab910c..a051acb6e 100644 --- a/src/spicelib/devices/bsim1/b1temp.c +++ b/src/spicelib/devices/bsim1/b1temp.c @@ -46,7 +46,7 @@ B1temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = B1instances(model); here != NULL ; - here=here->B1nextInstance) { + here=B1nextInstance(here)) { if( (EffChanLength = here->B1l - model->B1deltaL *1e-6 )<=0) { SPfrontEnd->IFerrorf (ERR_FATAL, diff --git a/src/spicelib/devices/bsim1/b1trunc.c b/src/spicelib/devices/bsim1/b1trunc.c index 0703dabfc..114d6e0c4 100644 --- a/src/spicelib/devices/bsim1/b1trunc.c +++ b/src/spicelib/devices/bsim1/b1trunc.c @@ -20,7 +20,7 @@ B1trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) #endif /* STEPDEBUG */ for( ; model != NULL; model = B1nextModel(model)) { - for(here=B1instances(model);here!=NULL;here = here->B1nextInstance){ + for(here=B1instances(model);here!=NULL;here = B1nextInstance(here)){ #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim1/bsim1def.h b/src/spicelib/devices/bsim1/bsim1def.h index 27a967cb6..33377e4e6 100644 --- a/src/spicelib/devices/bsim1/bsim1def.h +++ b/src/spicelib/devices/bsim1/bsim1def.h @@ -20,11 +20,12 @@ Author: 1985 Hong June Park, Thomas L. Quarles /* information needed for each instance */ typedef struct sBSIM1instance { - struct sBSIM1model *B1modPtr; /* pointer to model */ - struct sBSIM1instance *B1nextInstance; /* pointer to next instance of - *current model*/ - IFuid B1name; /* pointer to character string naming this instance */ - int B1states; /* index into state table for this device */ + struct GENinstance gen; + +#define B1modPtr(inst) ((struct sBSIM1model*)((inst)->gen.GENmodPtr)) +#define B1nextInstance(inst) ((struct sBSIM1instance*)((inst)->gen.GENnextInstance)) +#define B1name gen.GENname +#define B1states gen.GENstate const int B1dNode; /* number of the gate node of the mosfet */ const int B1gNode; /* number of the gate node of the mosfet */ diff --git a/src/spicelib/devices/bsim2/b2acld.c b/src/spicelib/devices/bsim2/b2acld.c index c966c022e..5368feece 100644 --- a/src/spicelib/devices/bsim2/b2acld.c +++ b/src/spicelib/devices/bsim2/b2acld.c @@ -56,7 +56,7 @@ B2acLoad(GENmodel *inModel, CKTcircuit *ckt) omega = ckt->CKTomega; for( ; model != NULL; model = B2nextModel(model)) { for(here = B2instances(model); here!= NULL; - here = here->B2nextInstance) { + here = B2nextInstance(here)) { if (here->B2mode >= 0) { xnrm=1; diff --git a/src/spicelib/devices/bsim2/b2cvtest.c b/src/spicelib/devices/bsim2/b2cvtest.c index 649fa52dc..095be8751 100644 --- a/src/spicelib/devices/bsim2/b2cvtest.c +++ b/src/spicelib/devices/bsim2/b2cvtest.c @@ -45,7 +45,7 @@ B2convTest(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = B2instances(model); here != NULL ; - here=here->B2nextInstance) { + here=B2nextInstance(here)) { vbs = model->B2type * ( *(ckt->CKTrhsOld+here->B2bNode) - diff --git a/src/spicelib/devices/bsim2/b2dest.c b/src/spicelib/devices/bsim2/b2dest.c index 4cf024c49..c292b96df 100644 --- a/src/spicelib/devices/bsim2/b2dest.c +++ b/src/spicelib/devices/bsim2/b2dest.c @@ -17,7 +17,7 @@ B2destroy(GENmodel **inModel) B2model *next_mod = B2nextModel(mod); B2instance *inst = B2instances(mod); while (inst) { - B2instance *next_inst = inst->B2nextInstance; + B2instance *next_inst = B2nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim2/b2getic.c b/src/spicelib/devices/bsim2/b2getic.c index 97e6f4558..7edf25c6a 100644 --- a/src/spicelib/devices/bsim2/b2getic.c +++ b/src/spicelib/devices/bsim2/b2getic.c @@ -24,7 +24,7 @@ B2getic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = B2nextModel(model)) { - for(here = B2instances(model); here ; here = here->B2nextInstance) { + for(here = B2instances(model); here ; here = B2nextInstance(here)) { if(!here->B2icVBSGiven) { here->B2icVBS = diff --git a/src/spicelib/devices/bsim2/b2ld.c b/src/spicelib/devices/bsim2/b2ld.c index 8844f1c42..fda4549de 100644 --- a/src/spicelib/devices/bsim2/b2ld.c +++ b/src/spicelib/devices/bsim2/b2ld.c @@ -134,7 +134,7 @@ B2load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = B2instances(model); here != NULL ; - here=here->B2nextInstance) { + here=B2nextInstance(here)) { EffectiveLength=here->B2l - model->B2deltaL * 1.e-6;/* m */ DrainArea = here->B2drainArea; diff --git a/src/spicelib/devices/bsim2/b2noi.c b/src/spicelib/devices/bsim2/b2noi.c index 5042e678b..45df28ae0 100644 --- a/src/spicelib/devices/bsim2/b2noi.c +++ b/src/spicelib/devices/bsim2/b2noi.c @@ -46,7 +46,7 @@ B2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, }; for (model=firstModel; model != NULL; model=B2nextModel(model)) { - for (inst=B2instances(model); inst != NULL; inst=inst->B2nextInstance) { + for (inst=B2instances(model); inst != NULL; inst=B2nextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/bsim2/b2pzld.c b/src/spicelib/devices/bsim2/b2pzld.c index f90d6e9d2..e0b75eea5 100644 --- a/src/spicelib/devices/bsim2/b2pzld.c +++ b/src/spicelib/devices/bsim2/b2pzld.c @@ -55,7 +55,7 @@ B2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = B2nextModel(model)) { for(here = B2instances(model); here!= NULL; - here = here->B2nextInstance) { + here = B2nextInstance(here)) { if (here->B2mode >= 0) { xnrm=1; diff --git a/src/spicelib/devices/bsim2/b2set.c b/src/spicelib/devices/bsim2/b2set.c index 068df7c54..2349d28c8 100644 --- a/src/spicelib/devices/bsim2/b2set.c +++ b/src/spicelib/devices/bsim2/b2set.c @@ -432,7 +432,7 @@ B2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = B2instances(model); here != NULL ; - here=here->B2nextInstance) { + here=B2nextInstance(here)) { /* allocate a chunk of the state vector */ here->B2states = *states; @@ -579,7 +579,7 @@ B2unsetup( model = B2nextModel(model)) { for (here = B2instances(model); here != NULL; - here=here->B2nextInstance) + here=B2nextInstance(here)) { if (here->B2sNodePrime > 0 && here->B2sNodePrime != here->B2sNode) diff --git a/src/spicelib/devices/bsim2/b2temp.c b/src/spicelib/devices/bsim2/b2temp.c index d46e50b59..cf5829e86 100644 --- a/src/spicelib/devices/bsim2/b2temp.c +++ b/src/spicelib/devices/bsim2/b2temp.c @@ -51,7 +51,7 @@ B2temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = B2instances(model); here != NULL ; - here=here->B2nextInstance) { + here=B2nextInstance(here)) { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; diff --git a/src/spicelib/devices/bsim2/b2trunc.c b/src/spicelib/devices/bsim2/b2trunc.c index 74a448b2c..1f25f30e0 100644 --- a/src/spicelib/devices/bsim2/b2trunc.c +++ b/src/spicelib/devices/bsim2/b2trunc.c @@ -19,7 +19,7 @@ B2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) #endif /* STEPDEBUG */ for( ; model != NULL; model = B2nextModel(model)) { - for(here=B2instances(model);here!=NULL;here = here->B2nextInstance){ + for(here=B2instances(model);here!=NULL;here = B2nextInstance(here)){ #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim2/bsim2def.h b/src/spicelib/devices/bsim2/bsim2def.h index b9fffd83b..d0e99656d 100644 --- a/src/spicelib/devices/bsim2/bsim2def.h +++ b/src/spicelib/devices/bsim2/bsim2def.h @@ -16,11 +16,12 @@ Author: 1988 Min-Chie Jeng, Hong June Park, Thomas L. Quarles /* information needed for each instance */ typedef struct sBSIM2instance { - struct sBSIM2model *B2modPtr; /* pointer to model */ - struct sBSIM2instance *B2nextInstance; /* pointer to next instance of - *current model*/ - IFuid B2name; /* pointer to character string naming this instance */ - int B2states; /* index into state table for this device */ + struct GENinstance gen; + +#define B2modPtr(inst) ((struct sBSIM2model*)((inst)->gen.GENmodPtr)) +#define B2nextInstance(inst) ((struct sBSIM2instance*)((inst)->gen.GENnextInstance)) +#define B2name gen.GENname +#define B2states gen.GENstate const int B2dNode; /* number of the gate node of the mosfet */ const int B2gNode; /* number of the gate node of the mosfet */ diff --git a/src/spicelib/devices/bsim3/b3acld.c b/src/spicelib/devices/bsim3/b3acld.c index e80047888..508ea0c60 100644 --- a/src/spicelib/devices/bsim3/b3acld.c +++ b/src/spicelib/devices/bsim3/b3acld.c @@ -45,7 +45,7 @@ double m; omega = ckt->CKTomega; for (; model != NULL; model = BSIM3nextModel(model)) { for (here = BSIM3instances(model); here!= NULL; - here = here->BSIM3nextInstance) + here = BSIM3nextInstance(here)) { Csd = -(here->BSIM3cddb + here->BSIM3cgdb + here->BSIM3cbdb); Csg = -(here->BSIM3cdgb + here->BSIM3cggb + here->BSIM3cbgb); diff --git a/src/spicelib/devices/bsim3/b3cvtest.c b/src/spicelib/devices/bsim3/b3cvtest.c index f616c3514..d8bab342e 100644 --- a/src/spicelib/devices/bsim3/b3cvtest.c +++ b/src/spicelib/devices/bsim3/b3cvtest.c @@ -32,7 +32,7 @@ double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; for (; model != NULL; model = BSIM3nextModel(model)) { /* loop through all the instances of the model */ for (here = BSIM3instances(model); here != NULL ; - here=here->BSIM3nextInstance) + here=BSIM3nextInstance(here)) { vbs = model->BSIM3type * (*(ckt->CKTrhsOld+here->BSIM3bNode) diff --git a/src/spicelib/devices/bsim3/b3dest.c b/src/spicelib/devices/bsim3/b3dest.c index f861b3cee..6369ddb5c 100644 --- a/src/spicelib/devices/bsim3/b3dest.c +++ b/src/spicelib/devices/bsim3/b3dest.c @@ -37,7 +37,7 @@ BSIM3destroy(GENmodel **inModel) /** end of extra code **/ while (inst) { - BSIM3instance *next_inst = inst->BSIM3nextInstance; + BSIM3instance *next_inst = BSIM3nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim3/b3getic.c b/src/spicelib/devices/bsim3/b3getic.c index 857faeaed..00467f176 100644 --- a/src/spicelib/devices/bsim3/b3getic.c +++ b/src/spicelib/devices/bsim3/b3getic.c @@ -24,7 +24,7 @@ BSIM3model *model = (BSIM3model*)inModel; BSIM3instance *here; for (; model ; model = BSIM3nextModel(model)) - { for (here = BSIM3instances(model); here; here = here->BSIM3nextInstance) + { for (here = BSIM3instances(model); here; here = BSIM3nextInstance(here)) { if (!here->BSIM3icVBSGiven) { here->BSIM3icVBS = *(ckt->CKTrhs + here->BSIM3bNode) diff --git a/src/spicelib/devices/bsim3/b3ld.c b/src/spicelib/devices/bsim3/b3ld.c index 70a4853c9..c85c990c4 100644 --- a/src/spicelib/devices/bsim3/b3ld.c +++ b/src/spicelib/devices/bsim3/b3ld.c @@ -65,7 +65,7 @@ CKTcircuit *ckt) int BSIM3LoadOMP(BSIM3instance *here, CKTcircuit *ckt) { -BSIM3model *model = here->BSIM3modPtr; +BSIM3model *model = BSIM3modPtr(here); #else BSIM3model *model = (BSIM3model*)inModel; BSIM3instance *here; @@ -181,7 +181,7 @@ ChargeComputationNeeded = #ifndef USE_OMP for (; model != NULL; model = BSIM3nextModel(model)) { for (here = BSIM3instances(model); here != NULL; - here = here->BSIM3nextInstance) + here = BSIM3nextInstance(here)) { #endif Check = 1; @@ -3136,7 +3136,7 @@ void BSIM3LoadRhsMat(GENmodel *inModel, CKTcircuit *ckt) for(idx = 0; idx < InstCount; idx++) { here = InstArray[idx]; - model = here->BSIM3modPtr; + model = BSIM3modPtr(here); /* Update b for Ax = b */ (*(ckt->CKTrhs + here->BSIM3gNode) -= here->BSIM3rhsG); (*(ckt->CKTrhs + here->BSIM3bNode) -= here->BSIM3rhsB); diff --git a/src/spicelib/devices/bsim3/b3noi.c b/src/spicelib/devices/bsim3/b3noi.c index 6c7c62b09..6d1edfb06 100644 --- a/src/spicelib/devices/bsim3/b3noi.c +++ b/src/spicelib/devices/bsim3/b3noi.c @@ -141,7 +141,7 @@ int i; for (; model != NULL; model = BSIM3nextModel(model)) { for (here = BSIM3instances(model); here != NULL; - here = here->BSIM3nextInstance) + here = BSIM3nextInstance(here)) { pParam = here->pParam; switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/bsim3/b3pzld.c b/src/spicelib/devices/bsim3/b3pzld.c index 5c03f2616..32343cee7 100644 --- a/src/spicelib/devices/bsim3/b3pzld.c +++ b/src/spicelib/devices/bsim3/b3pzld.c @@ -39,7 +39,7 @@ double m; for (; model != NULL; model = BSIM3nextModel(model)) { for (here = BSIM3instances(model); here!= NULL; - here = here->BSIM3nextInstance) + here = BSIM3nextInstance(here)) { if (here->BSIM3mode >= 0) { Gm = here->BSIM3gm; diff --git a/src/spicelib/devices/bsim3/b3set.c b/src/spicelib/devices/bsim3/b3set.c index 6479eacaa..dfec9894a 100644 --- a/src/spicelib/devices/bsim3/b3set.c +++ b/src/spicelib/devices/bsim3/b3set.c @@ -921,7 +921,7 @@ BSIM3instance **InstArray; /* loop through all the instances of the model */ for (here = BSIM3instances(model); here != NULL ; - here=here->BSIM3nextInstance) + here=BSIM3nextInstance(here)) { /* allocate a chunk of the state vector */ here->BSIM3states = *states; @@ -1133,7 +1133,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ { /* loop through all the instances of the model */ for (here = BSIM3instances(model); here != NULL ; - here=here->BSIM3nextInstance) + here=BSIM3nextInstance(here)) { InstCount++; } @@ -1145,7 +1145,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ { /* loop through all the instances of the model */ for (here = BSIM3instances(model); here != NULL ; - here=here->BSIM3nextInstance) + here=BSIM3nextInstance(here)) { InstArray[idx] = here; idx++; @@ -1171,7 +1171,7 @@ BSIM3unsetup( model = BSIM3nextModel(model)) { for (here = BSIM3instances(model); here != NULL; - here=here->BSIM3nextInstance) + here=BSIM3nextInstance(here)) { if (here->BSIM3qNode > 0) CKTdltNNum(ckt, here->BSIM3qNode); diff --git a/src/spicelib/devices/bsim3/b3soachk.c b/src/spicelib/devices/bsim3/b3soachk.c index f6951fd1d..324715b7d 100644 --- a/src/spicelib/devices/bsim3/b3soachk.c +++ b/src/spicelib/devices/bsim3/b3soachk.c @@ -35,7 +35,7 @@ BSIM3soaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = BSIM3nextModel(model)) { - for (here = BSIM3instances(model); here; here = here->BSIM3nextInstance) { + for (here = BSIM3instances(model); here; here = BSIM3nextInstance(here)) { vgs = ckt->CKTrhsOld [here->BSIM3gNode] - ckt->CKTrhsOld [here->BSIM3sNodePrime]; diff --git a/src/spicelib/devices/bsim3/b3temp.c b/src/spicelib/devices/bsim3/b3temp.c index bccc0dc4b..19bd337f5 100644 --- a/src/spicelib/devices/bsim3/b3temp.c +++ b/src/spicelib/devices/bsim3/b3temp.c @@ -144,7 +144,7 @@ int Size_Not_Found, error; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ for (here = BSIM3instances(model); here != NULL; - here = here->BSIM3nextInstance) + here = BSIM3nextInstance(here)) { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; diff --git a/src/spicelib/devices/bsim3/b3trunc.c b/src/spicelib/devices/bsim3/b3trunc.c index a4d026d87..42c539665 100644 --- a/src/spicelib/devices/bsim3/b3trunc.c +++ b/src/spicelib/devices/bsim3/b3trunc.c @@ -30,7 +30,7 @@ BSIM3instance *here; for (; model != NULL; model = BSIM3nextModel(model)) { for (here = BSIM3instances(model); here != NULL; - here = here->BSIM3nextInstance) + here = BSIM3nextInstance(here)) { #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim3/bsim3def.h b/src/spicelib/devices/bsim3/bsim3def.h index b87720d7b..a0275aaea 100644 --- a/src/spicelib/devices/bsim3/bsim3def.h +++ b/src/spicelib/devices/bsim3/bsim3def.h @@ -18,10 +18,13 @@ File: bsim3def.h typedef struct sBSIM3instance { - struct sBSIM3model *BSIM3modPtr; - struct sBSIM3instance *BSIM3nextInstance; - IFuid BSIM3name; - int BSIM3states; /* index into state table for this device */ + struct GENinstance gen; + +#define BSIM3modPtr(inst) ((struct sBSIM3model*)((inst)->gen.GENmodPtr)) +#define BSIM3nextInstance(inst) ((struct sBSIM3instance*)((inst)->gen.GENnextInstance)) +#define BSIM3name gen.GENname +#define BSIM3states gen.GENstate + const int BSIM3dNode; const int BSIM3gNode; const int BSIM3sNode; diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddacld.c b/src/spicelib/devices/bsim3soi_dd/b3soiddacld.c index 08a049342..91f68efd7 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddacld.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddacld.c @@ -52,7 +52,7 @@ double m; { for (here = B3SOIDDinstances(model); here!= NULL; - here = here->B3SOIDDnextInstance) + here = B3SOIDDnextInstance(here)) { selfheat = (model->B3SOIDDshMod == 1) && (here->B3SOIDDrth0 != 0.0); if (here->B3SOIDDdebugMod > 2) diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddcvtest.c b/src/spicelib/devices/bsim3soi_dd/b3soiddcvtest.c index 9762b568c..61ca19895 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddcvtest.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddcvtest.c @@ -32,7 +32,7 @@ double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; for (; model != NULL; model = B3SOIDDnextModel(model)) { /* loop through all the instances of the model */ for (here = B3SOIDDinstances(model); here != NULL ; - here=here->B3SOIDDnextInstance) + here=B3SOIDDnextInstance(here)) { vbs = model->B3SOIDDtype * (*(ckt->CKTrhsOld+here->B3SOIDDbNode) diff --git a/src/spicelib/devices/bsim3soi_dd/b3soidddef.h b/src/spicelib/devices/bsim3soi_dd/b3soidddef.h index b2d92df28..e96d2bab0 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soidddef.h +++ b/src/spicelib/devices/bsim3soi_dd/b3soidddef.h @@ -21,10 +21,12 @@ Modified by Paolo Nenzi 2002 typedef struct sB3SOIDDinstance { - struct sB3SOIDDmodel *B3SOIDDmodPtr; - struct sB3SOIDDinstance *B3SOIDDnextInstance; - IFuid B3SOIDDname; - int B3SOIDDstates; /* index into state table for this device */ + struct GENinstance gen; + +#define B3SOIDDmodPtr(inst) ((struct sB3SOIDDmodel*)((inst)->gen.GENmodPtr)) +#define B3SOIDDnextInstance(inst) ((struct sB3SOIDDinstance*)((inst)->gen.GENnextInstance)) +#define B3SOIDDname gen.GENname +#define B3SOIDDstates gen.GENstate const int B3SOIDDdNode; const int B3SOIDDgNode; diff --git a/src/spicelib/devices/bsim3soi_dd/b3soidddest.c b/src/spicelib/devices/bsim3soi_dd/b3soidddest.c index 6282f0ed4..59050a008 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soidddest.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soidddest.c @@ -24,7 +24,7 @@ B3SOIDDdestroy(GENmodel **inModel) B3SOIDDmodel *next_mod = B3SOIDDnextModel(mod); B3SOIDDinstance *inst = B3SOIDDinstances(mod); while (inst) { - B3SOIDDinstance *next_inst = inst->B3SOIDDnextInstance; + B3SOIDDinstance *next_inst = B3SOIDDnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddgetic.c b/src/spicelib/devices/bsim3soi_dd/b3soiddgetic.c index 739034bb6..3cbf187a5 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddgetic.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddgetic.c @@ -24,7 +24,7 @@ B3SOIDDmodel *model = (B3SOIDDmodel*)inModel; B3SOIDDinstance *here; for (; model ; model = B3SOIDDnextModel(model)) - { for (here = B3SOIDDinstances(model); here; here = here->B3SOIDDnextInstance) + { for (here = B3SOIDDinstances(model); here; here = B3SOIDDnextInstance(here)) { if(!here->B3SOIDDicVBSGiven) { here->B3SOIDDicVBS = *(ckt->CKTrhs + here->B3SOIDDbNode) diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddld.c b/src/spicelib/devices/bsim3soi_dd/b3soiddld.c index d1e76c16e..388fc1aad 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddld.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddld.c @@ -306,7 +306,7 @@ double m; for (; model != NULL; model = B3SOIDDnextModel(model)) { for (here = B3SOIDDinstances(model); here != NULL; - here = here->B3SOIDDnextInstance) + here = B3SOIDDnextInstance(here)) { Check = 0; ByPass = 0; diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddnoi.c b/src/spicelib/devices/bsim3soi_dd/b3soiddnoi.c index 6d8785317..94c37df30 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddnoi.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddnoi.c @@ -129,7 +129,7 @@ int i; for (; model != NULL; model = B3SOIDDnextModel(model)) { for (here = B3SOIDDinstances(model); here != NULL; - here = here->B3SOIDDnextInstance) + here = B3SOIDDnextInstance(here)) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddpzld.c b/src/spicelib/devices/bsim3soi_dd/b3soiddpzld.c index 92099124f..c2c02bfae 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddpzld.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddpzld.c @@ -36,7 +36,7 @@ double m; for (; model != NULL; model = B3SOIDDnextModel(model)) { for (here = B3SOIDDinstances(model); here!= NULL; - here = here->B3SOIDDnextInstance) + here = B3SOIDDnextInstance(here)) { if (here->B3SOIDDmode >= 0) { Gm = here->B3SOIDDgm; diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddset.c b/src/spicelib/devices/bsim3soi_dd/b3soiddset.c index 88dc788a7..c83a59206 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddset.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddset.c @@ -875,7 +875,7 @@ IFuid tmpName; /* loop through all the instances of the model */ for (here = B3SOIDDinstances(model); here != NULL ; - here=here->B3SOIDDnextInstance) + here=B3SOIDDnextInstance(here)) { /* allocate a chunk of the state vector */ here->B3SOIDDstates = *states; @@ -1360,7 +1360,7 @@ B3SOIDDunsetup(GENmodel *inModel, CKTcircuit *ckt) model = B3SOIDDnextModel(model)) { for (here = B3SOIDDinstances(model); here != NULL; - here=here->B3SOIDDnextInstance) + here=B3SOIDDnextInstance(here)) { /* here for debugging purpose only */ if (here->B3SOIDDdum5Node > 0) diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddtemp.c b/src/spicelib/devices/bsim3soi_dd/b3soiddtemp.c index 614561e6e..2f49556ef 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddtemp.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddtemp.c @@ -73,7 +73,7 @@ int Size_Not_Found; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ for (here = B3SOIDDinstances(model); here != NULL; - here = here->B3SOIDDnextInstance) + here = B3SOIDDnextInstance(here)) { here->B3SOIDDrbodyext = here->B3SOIDDbodySquares * model->B3SOIDDrbsh; diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddtrunc.c b/src/spicelib/devices/bsim3soi_dd/b3soiddtrunc.c index 29fd7ca69..dd3750f73 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddtrunc.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddtrunc.c @@ -29,7 +29,7 @@ B3SOIDDinstance *here; for (; model != NULL; model = B3SOIDDnextModel(model)) { for (here = B3SOIDDinstances(model); here != NULL; - here = here->B3SOIDDnextInstance) + here = B3SOIDDnextInstance(here)) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdacld.c b/src/spicelib/devices/bsim3soi_fd/b3soifdacld.c index 8ab173a76..27d9aa87c 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdacld.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdacld.c @@ -53,7 +53,7 @@ double m; { for (here = B3SOIFDinstances(model); here!= NULL; - here = here->B3SOIFDnextInstance) + here = B3SOIFDnextInstance(here)) { selfheat = (model->B3SOIFDshMod == 1) && (here->B3SOIFDrth0 != 0.0); if (here->B3SOIFDdebugMod > 2) diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdcvtest.c b/src/spicelib/devices/bsim3soi_fd/b3soifdcvtest.c index cc6788a36..6fa55b44f 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdcvtest.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdcvtest.c @@ -32,7 +32,7 @@ double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; for (; model != NULL; model = B3SOIFDnextModel(model)) { /* loop through all the instances of the model */ for (here = B3SOIFDinstances(model); here != NULL ; - here=here->B3SOIFDnextInstance) + here=B3SOIFDnextInstance(here)) { vbs = model->B3SOIFDtype * (*(ckt->CKTrhsOld+here->B3SOIFDbNode) diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifddef.h b/src/spicelib/devices/bsim3soi_fd/b3soifddef.h index 3a75e88ef..1a606d373 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifddef.h +++ b/src/spicelib/devices/bsim3soi_fd/b3soifddef.h @@ -21,10 +21,12 @@ File: b3soifddef.h typedef struct sB3SOIFDinstance { - struct sB3SOIFDmodel *B3SOIFDmodPtr; - struct sB3SOIFDinstance *B3SOIFDnextInstance; - IFuid B3SOIFDname; - int B3SOIFDstates; /* index into state table for this device */ + struct GENinstance gen; + +#define B3SOIFDmodPtr(inst) ((struct sB3SOIFDmodel*)((inst)->gen.GENmodPtr)) +#define B3SOIFDnextInstance(inst) ((struct sB3SOIFDinstance*)((inst)->gen.GENnextInstance)) +#define B3SOIFDname gen.GENname +#define B3SOIFDstates gen.GENstate const int B3SOIFDdNode; const int B3SOIFDgNode; diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifddest.c b/src/spicelib/devices/bsim3soi_fd/b3soifddest.c index aac1caa30..a6eae009b 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifddest.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifddest.c @@ -24,7 +24,7 @@ B3SOIFDdestroy(GENmodel **inModel) B3SOIFDmodel *next_mod = B3SOIFDnextModel(mod); B3SOIFDinstance *inst = B3SOIFDinstances(mod); while (inst) { - B3SOIFDinstance *next_inst = inst->B3SOIFDnextInstance; + B3SOIFDinstance *next_inst = B3SOIFDnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdgetic.c b/src/spicelib/devices/bsim3soi_fd/b3soifdgetic.c index ac8dd04e1..e9673aba7 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdgetic.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdgetic.c @@ -24,7 +24,7 @@ B3SOIFDmodel *model = (B3SOIFDmodel*)inModel; B3SOIFDinstance *here; for (; model ; model = B3SOIFDnextModel(model)) - { for (here = B3SOIFDinstances(model); here; here = here->B3SOIFDnextInstance) + { for (here = B3SOIFDinstances(model); here; here = B3SOIFDnextInstance(here)) { if(!here->B3SOIFDicVBSGiven) { here->B3SOIFDicVBS = *(ckt->CKTrhs + here->B3SOIFDbNode) diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdld.c b/src/spicelib/devices/bsim3soi_fd/b3soifdld.c index 26f8d8bb4..8967217a5 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdld.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdld.c @@ -276,7 +276,7 @@ double m; for (; model != NULL; model = B3SOIFDnextModel(model)) { for (here = B3SOIFDinstances(model); here != NULL; - here = here->B3SOIFDnextInstance) + here = B3SOIFDnextInstance(here)) { Check = 0; ByPass = 0; diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdnoi.c b/src/spicelib/devices/bsim3soi_fd/b3soifdnoi.c index 3128176c4..9af38e22f 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdnoi.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdnoi.c @@ -129,7 +129,7 @@ int i; for (; model != NULL; model = B3SOIFDnextModel(model)) { for (here = B3SOIFDinstances(model); here != NULL; - here = here->B3SOIFDnextInstance) + here = B3SOIFDnextInstance(here)) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdpzld.c b/src/spicelib/devices/bsim3soi_fd/b3soifdpzld.c index 0617afaba..152b2618d 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdpzld.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdpzld.c @@ -35,7 +35,7 @@ double m; for (; model != NULL; model = B3SOIFDnextModel(model)) { for (here = B3SOIFDinstances(model); here!= NULL; - here = here->B3SOIFDnextInstance) + here = B3SOIFDnextInstance(here)) { if (here->B3SOIFDmode >= 0) { Gm = here->B3SOIFDgm; diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdset.c b/src/spicelib/devices/bsim3soi_fd/b3soifdset.c index 2a516d4c4..122d0eb32 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdset.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdset.c @@ -876,7 +876,7 @@ IFuid tmpName; /* loop through all the instances of the model */ for (here = B3SOIFDinstances(model); here != NULL ; - here=here->B3SOIFDnextInstance) + here=B3SOIFDnextInstance(here)) { /* allocate a chunk of the state vector */ here->B3SOIFDstates = *states; @@ -1349,7 +1349,7 @@ B3SOIFDunsetup(GENmodel *inModel, CKTcircuit *ckt) model = B3SOIFDnextModel(model)) { for (here = B3SOIFDinstances(model); here != NULL; - here=here->B3SOIFDnextInstance) + here=B3SOIFDnextInstance(here)) { /* here for debugging purpose only */ if (here->B3SOIFDdum5Node > 0) diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdtemp.c b/src/spicelib/devices/bsim3soi_fd/b3soifdtemp.c index 2b30c8108..b1433d857 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdtemp.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdtemp.c @@ -72,7 +72,7 @@ int Size_Not_Found; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ for (here = B3SOIFDinstances(model); here != NULL; - here = here->B3SOIFDnextInstance) + here = B3SOIFDnextInstance(here)) { here->B3SOIFDrbodyext = here->B3SOIFDbodySquares * model->B3SOIFDrbsh; diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdtrunc.c b/src/spicelib/devices/bsim3soi_fd/b3soifdtrunc.c index 58d3e00dd..46f575b4f 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdtrunc.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdtrunc.c @@ -29,7 +29,7 @@ B3SOIFDinstance *here; for (; model != NULL; model = B3SOIFDnextModel(model)) { for (here = B3SOIFDinstances(model); here != NULL; - here = here->B3SOIFDnextInstance) + here = B3SOIFDnextInstance(here)) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdacld.c b/src/spicelib/devices/bsim3soi_pd/b3soipdacld.c index 8de72830f..273db4294 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdacld.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdacld.c @@ -53,7 +53,7 @@ double m; { for (here = B3SOIPDinstances(model); here!= NULL; - here = here->B3SOIPDnextInstance) + here = B3SOIPDnextInstance(here)) { selfheat = (model->B3SOIPDshMod == 1) && (here->B3SOIPDrth0 != 0.0); if (here->B3SOIPDmode >= 0) diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdcvtest.c b/src/spicelib/devices/bsim3soi_pd/b3soipdcvtest.c index 74963385c..b12763c7a 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdcvtest.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdcvtest.c @@ -32,7 +32,7 @@ double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; for (; model != NULL; model = B3SOIPDnextModel(model)) { /* loop through all the instances of the model */ for (here = B3SOIPDinstances(model); here != NULL ; - here=here->B3SOIPDnextInstance) + here=B3SOIPDnextInstance(here)) { vbs = model->B3SOIPDtype * (*(ckt->CKTrhsOld+here->B3SOIPDbNode) diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipddef.h b/src/spicelib/devices/bsim3soi_pd/b3soipddef.h index 687bb8bbb..bae8223d8 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipddef.h +++ b/src/spicelib/devices/bsim3soi_pd/b3soipddef.h @@ -25,10 +25,12 @@ Modified by Paolo Nenzi 2002 typedef struct sB3SOIPDinstance { - struct sB3SOIPDmodel *B3SOIPDmodPtr; - struct sB3SOIPDinstance *B3SOIPDnextInstance; - IFuid B3SOIPDname; - int B3SOIPDstates; /* index into state table for this device */ + struct GENinstance gen; + +#define B3SOIPDmodPtr(inst) ((struct sB3SOIPDmodel*)((inst)->gen.GENmodPtr)) +#define B3SOIPDnextInstance(inst) ((struct sB3SOIPDinstance*)((inst)->gen.GENnextInstance)) +#define B3SOIPDname gen.GENname +#define B3SOIPDstates gen.GENstate const int B3SOIPDdNode; const int B3SOIPDgNode; diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipddest.c b/src/spicelib/devices/bsim3soi_pd/b3soipddest.c index a0cc84829..6c0ec9e4a 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipddest.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipddest.c @@ -24,7 +24,7 @@ B3SOIPDdestroy(GENmodel **inModel) B3SOIPDmodel *next_mod = B3SOIPDnextModel(mod); B3SOIPDinstance *inst = B3SOIPDinstances(mod); while (inst) { - B3SOIPDinstance *next_inst = inst->B3SOIPDnextInstance; + B3SOIPDinstance *next_inst = B3SOIPDnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdgetic.c b/src/spicelib/devices/bsim3soi_pd/b3soipdgetic.c index 62beac77b..b05507989 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdgetic.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdgetic.c @@ -24,7 +24,7 @@ B3SOIPDmodel *model = (B3SOIPDmodel*)inModel; B3SOIPDinstance *here; for (; model ; model = B3SOIPDnextModel(model)) - { for (here = B3SOIPDinstances(model); here; here = here->B3SOIPDnextInstance) + { for (here = B3SOIPDinstances(model); here; here = B3SOIPDnextInstance(here)) { if(!here->B3SOIPDicVBSGiven) { here->B3SOIPDicVBS = *(ckt->CKTrhs + here->B3SOIPDbNode) diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdld.c b/src/spicelib/devices/bsim3soi_pd/b3soipdld.c index ff5c8c73e..65a6855cd 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdld.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdld.c @@ -293,7 +293,7 @@ double m; for (; model != NULL; model = B3SOIPDnextModel(model)) { for (here = B3SOIPDinstances(model); here != NULL; - here = here->B3SOIPDnextInstance) + here = B3SOIPDnextInstance(here)) { Check = 0; ByPass = 0; diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdnoi.c b/src/spicelib/devices/bsim3soi_pd/b3soipdnoi.c index cdc962008..9aff8aeff 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdnoi.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdnoi.c @@ -133,7 +133,7 @@ int i; for (; model != NULL; model = B3SOIPDnextModel(model)) { for (here = B3SOIPDinstances(model); here != NULL; - here = here->B3SOIPDnextInstance) + here = B3SOIPDnextInstance(here)) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdpzld.c b/src/spicelib/devices/bsim3soi_pd/b3soipdpzld.c index 7d93ff689..b2800435d 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdpzld.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdpzld.c @@ -35,7 +35,7 @@ double m; for (; model != NULL; model = B3SOIPDnextModel(model)) { for (here = B3SOIPDinstances(model); here!= NULL; - here = here->B3SOIPDnextInstance) + here = B3SOIPDnextInstance(here)) { if (here->B3SOIPDmode >= 0) { Gm = here->B3SOIPDgm; diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdset.c b/src/spicelib/devices/bsim3soi_pd/b3soipdset.c index 6acb8b224..7b757fdb3 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdset.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdset.c @@ -1049,7 +1049,7 @@ IFuid tmpName; /* loop through all the instances of the model */ for (here = B3SOIPDinstances(model); here != NULL ; - here=here->B3SOIPDnextInstance) + here=B3SOIPDnextInstance(here)) { /* allocate a chunk of the state vector */ here->B3SOIPDstates = *states; @@ -1464,7 +1464,7 @@ B3SOIPDunsetup( model = B3SOIPDnextModel(model)) { for (here = B3SOIPDinstances(model); here != NULL; - here=here->B3SOIPDnextInstance) + here=B3SOIPDnextInstance(here)) { /* here for debugging purpose only */ if (here->B3SOIPDqjdNode > 0) diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdtemp.c b/src/spicelib/devices/bsim3soi_pd/b3soipdtemp.c index 65e88a977..0d4f15e16 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdtemp.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdtemp.c @@ -91,7 +91,7 @@ double tmp3, T7; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ for (here = B3SOIPDinstances(model); here != NULL; - here = here->B3SOIPDnextInstance) + here = B3SOIPDnextInstance(here)) { here->B3SOIPDrbodyext = here->B3SOIPDbodySquares * model->B3SOIPDrbsh; diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdtrunc.c b/src/spicelib/devices/bsim3soi_pd/b3soipdtrunc.c index 4c1c669d3..2c90823da 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdtrunc.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdtrunc.c @@ -29,7 +29,7 @@ B3SOIPDinstance *here; for (; model != NULL; model = B3SOIPDnextModel(model)) { for (here = B3SOIPDinstances(model); here != NULL; - here = here->B3SOIPDnextInstance) + here = B3SOIPDnextInstance(here)) { #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim3v0/b3v0acld.c b/src/spicelib/devices/bsim3v0/b3v0acld.c index 2248035b2..3de6e2fd3 100644 --- a/src/spicelib/devices/bsim3v0/b3v0acld.c +++ b/src/spicelib/devices/bsim3v0/b3v0acld.c @@ -31,7 +31,7 @@ double m; for (here = BSIM3v0instances(model); here!= NULL; - here = here->BSIM3v0nextInstance) + here = BSIM3v0nextInstance(here)) { if (here->BSIM3v0mode >= 0) { Gm = here->BSIM3v0gm; diff --git a/src/spicelib/devices/bsim3v0/b3v0cvtest.c b/src/spicelib/devices/bsim3v0/b3v0cvtest.c index 9bc3d82ef..5ba77179e 100644 --- a/src/spicelib/devices/bsim3v0/b3v0cvtest.c +++ b/src/spicelib/devices/bsim3v0/b3v0cvtest.c @@ -26,7 +26,7 @@ double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; for (; model != NULL; model = BSIM3v0nextModel(model)) { /* loop through all the instances of the model */ for (here = BSIM3v0instances(model); here != NULL ; - here=here->BSIM3v0nextInstance) + here=BSIM3v0nextInstance(here)) { vbs = model->BSIM3v0type * (*(ckt->CKTrhsOld+here->BSIM3v0bNode) diff --git a/src/spicelib/devices/bsim3v0/b3v0dest.c b/src/spicelib/devices/bsim3v0/b3v0dest.c index 179bc4c59..2741d3267 100644 --- a/src/spicelib/devices/bsim3v0/b3v0dest.c +++ b/src/spicelib/devices/bsim3v0/b3v0dest.c @@ -18,7 +18,7 @@ BSIM3v0destroy(GENmodel **inModel) BSIM3v0model *next_mod = BSIM3v0nextModel(mod); BSIM3v0instance *inst = BSIM3v0instances(mod); while (inst) { - BSIM3v0instance *next_inst = inst->BSIM3v0nextInstance; + BSIM3v0instance *next_inst = BSIM3v0nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim3v0/b3v0getic.c b/src/spicelib/devices/bsim3v0/b3v0getic.c index 20d9fa0bf..80bb26822 100644 --- a/src/spicelib/devices/bsim3v0/b3v0getic.c +++ b/src/spicelib/devices/bsim3v0/b3v0getic.c @@ -18,7 +18,7 @@ BSIM3v0model *model = (BSIM3v0model*)inModel; BSIM3v0instance *here; for (; model ; model = BSIM3v0nextModel(model)) - { for (here = BSIM3v0instances(model); here; here = here->BSIM3v0nextInstance) + { for (here = BSIM3v0instances(model); here; here = BSIM3v0nextInstance(here)) { if(!here->BSIM3v0icVBSGiven) { here->BSIM3v0icVBS = *(ckt->CKTrhs + here->BSIM3v0bNode) diff --git a/src/spicelib/devices/bsim3v0/b3v0ld.c b/src/spicelib/devices/bsim3v0/b3v0ld.c index a265dada6..668fd277c 100644 --- a/src/spicelib/devices/bsim3v0/b3v0ld.c +++ b/src/spicelib/devices/bsim3v0/b3v0ld.c @@ -121,7 +121,7 @@ double m = 1.0; for (; model != NULL; model = BSIM3v0nextModel(model)) { for (here = BSIM3v0instances(model); here != NULL; - here = here->BSIM3v0nextInstance) + here = BSIM3v0nextInstance(here)) { Check = 1; ByPass = 0; diff --git a/src/spicelib/devices/bsim3v0/b3v0noi.c b/src/spicelib/devices/bsim3v0/b3v0noi.c index 753746a1e..965ee6186 100644 --- a/src/spicelib/devices/bsim3v0/b3v0noi.c +++ b/src/spicelib/devices/bsim3v0/b3v0noi.c @@ -102,7 +102,7 @@ int i; for (; model != NULL; model = BSIM3v0nextModel(model)) { for (here = BSIM3v0instances(model); here != NULL; - here = here->BSIM3v0nextInstance) + here = BSIM3v0nextInstance(here)) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim3v0/b3v0pzld.c b/src/spicelib/devices/bsim3v0/b3v0pzld.c index b8c57d9e3..7a0e1e77c 100644 --- a/src/spicelib/devices/bsim3v0/b3v0pzld.c +++ b/src/spicelib/devices/bsim3v0/b3v0pzld.c @@ -28,7 +28,7 @@ double m; for (; model != NULL; model = BSIM3v0nextModel(model)) { for (here = BSIM3v0instances(model); here!= NULL; - here = here->BSIM3v0nextInstance) + here = BSIM3v0nextInstance(here)) { if (here->BSIM3v0mode >= 0) { Gm = here->BSIM3v0gm; diff --git a/src/spicelib/devices/bsim3v0/b3v0set.c b/src/spicelib/devices/bsim3v0/b3v0set.c index 058c1b8d6..33ded8d31 100644 --- a/src/spicelib/devices/bsim3v0/b3v0set.c +++ b/src/spicelib/devices/bsim3v0/b3v0set.c @@ -750,7 +750,7 @@ IFuid tmpName; model->BSIM3v0kf = 0.0; /* loop through all the instances of the model */ for (here = BSIM3v0instances(model); here != NULL ; - here=here->BSIM3v0nextInstance) + here=BSIM3v0nextInstance(here)) { /* allocate a chunk of the state vector */ here->BSIM3v0states = *states; @@ -902,7 +902,7 @@ BSIM3v0unsetup(GENmodel *inModel, CKTcircuit *ckt) model = BSIM3v0nextModel(model)) { for (here = BSIM3v0instances(model); here != NULL; - here=here->BSIM3v0nextInstance) + here=BSIM3v0nextInstance(here)) { if (here->BSIM3v0qNode > 0) CKTdltNNum(ckt, here->BSIM3v0qNode); diff --git a/src/spicelib/devices/bsim3v0/b3v0temp.c b/src/spicelib/devices/bsim3v0/b3v0temp.c index 7f7184cfe..a5bab526d 100644 --- a/src/spicelib/devices/bsim3v0/b3v0temp.c +++ b/src/spicelib/devices/bsim3v0/b3v0temp.c @@ -50,7 +50,7 @@ int Size_Not_Found; /* loop through all the instances of the model */ for (here = BSIM3v0instances(model); here != NULL; - here=here->BSIM3v0nextInstance) + here=BSIM3v0nextInstance(here)) { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; diff --git a/src/spicelib/devices/bsim3v0/b3v0trunc.c b/src/spicelib/devices/bsim3v0/b3v0trunc.c index 0d98cd711..0774f296f 100644 --- a/src/spicelib/devices/bsim3v0/b3v0trunc.c +++ b/src/spicelib/devices/bsim3v0/b3v0trunc.c @@ -23,7 +23,7 @@ BSIM3v0instance *here; for (; model != NULL; model = BSIM3v0nextModel(model)) { for (here = BSIM3v0instances(model); here != NULL; - here = here->BSIM3v0nextInstance) + here = BSIM3v0nextInstance(here)) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim3v0/bsim3v0def.h b/src/spicelib/devices/bsim3v0/bsim3v0def.h index 35ca31fe5..95ef1a8b3 100644 --- a/src/spicelib/devices/bsim3v0/bsim3v0def.h +++ b/src/spicelib/devices/bsim3v0/bsim3v0def.h @@ -15,11 +15,13 @@ File: bsim3v0def.h typedef struct sBSIM3v0instance { - struct sBSIM3v0model *BSIM3v0modPtr; - struct sBSIM3v0instance *BSIM3v0nextInstance; - IFuid BSIM3v0name; - int BSIM3v0states; /* index into state table for this device */ - + struct GENinstance gen; + +#define BSIM3v0modPtr(inst) ((struct sBSIM3v0model*)((inst)->gen.GENmodPtr)) +#define BSIM3v0nextInstance(inst) ((struct sBSIM3v0instance*)((inst)->gen.GENnextInstance)) +#define BSIM3v0name gen.GENname +#define BSIM3v0states gen.GENstate + const int BSIM3v0dNode; const int BSIM3v0gNode; const int BSIM3v0sNode; diff --git a/src/spicelib/devices/bsim3v1/b3v1acld.c b/src/spicelib/devices/bsim3v1/b3v1acld.c index 8f5a9c736..3790d2453 100644 --- a/src/spicelib/devices/bsim3v1/b3v1acld.c +++ b/src/spicelib/devices/bsim3v1/b3v1acld.c @@ -37,7 +37,7 @@ BSIM3v1acLoad (GENmodel * inModel, CKTcircuit * ckt) for (here = BSIM3v1instances(model); here != NULL; - here = here->BSIM3v1nextInstance) + here = BSIM3v1nextInstance(here)) { if (here->BSIM3v1mode >= 0) { diff --git a/src/spicelib/devices/bsim3v1/b3v1cvtest.c b/src/spicelib/devices/bsim3v1/b3v1cvtest.c index 668b92c93..9cbc13bfa 100644 --- a/src/spicelib/devices/bsim3v1/b3v1cvtest.c +++ b/src/spicelib/devices/bsim3v1/b3v1cvtest.c @@ -32,7 +32,7 @@ double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; for (; model != NULL; model = BSIM3v1nextModel(model)) { /* loop through all the instances of the model */ for (here = BSIM3v1instances(model); here != NULL ; - here=here->BSIM3v1nextInstance) + here=BSIM3v1nextInstance(here)) { vbs = model->BSIM3v1type * (*(ckt->CKTrhsOld+here->BSIM3v1bNode) diff --git a/src/spicelib/devices/bsim3v1/b3v1dest.c b/src/spicelib/devices/bsim3v1/b3v1dest.c index 5a3b11068..cb2f6fdd7 100644 --- a/src/spicelib/devices/bsim3v1/b3v1dest.c +++ b/src/spicelib/devices/bsim3v1/b3v1dest.c @@ -24,7 +24,7 @@ BSIM3v1destroy(GENmodel **inModel) BSIM3v1model *next_mod = BSIM3v1nextModel(mod); BSIM3v1instance *inst = BSIM3v1instances(mod); while (inst) { - BSIM3v1instance *next_inst = inst->BSIM3v1nextInstance; + BSIM3v1instance *next_inst = BSIM3v1nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim3v1/b3v1getic.c b/src/spicelib/devices/bsim3v1/b3v1getic.c index 40c759bcb..e8d8a9ad9 100644 --- a/src/spicelib/devices/bsim3v1/b3v1getic.c +++ b/src/spicelib/devices/bsim3v1/b3v1getic.c @@ -24,7 +24,7 @@ BSIM3v1model *model = (BSIM3v1model*)inModel; BSIM3v1instance *here; for (; model ; model = BSIM3v1nextModel(model)) - { for (here = BSIM3v1instances(model); here; here = here->BSIM3v1nextInstance) + { for (here = BSIM3v1instances(model); here; here = BSIM3v1nextInstance(here)) { if(!here->BSIM3v1icVBSGiven) { here->BSIM3v1icVBS = *(ckt->CKTrhs + here->BSIM3v1bNode) diff --git a/src/spicelib/devices/bsim3v1/b3v1ld.c b/src/spicelib/devices/bsim3v1/b3v1ld.c index fbca8308f..4adc73e4a 100644 --- a/src/spicelib/devices/bsim3v1/b3v1ld.c +++ b/src/spicelib/devices/bsim3v1/b3v1ld.c @@ -127,7 +127,7 @@ int ByPass, Check, ChargeComputationNeeded = 0, error; for (; model != NULL; model = BSIM3v1nextModel(model)) { for (here = BSIM3v1instances(model); here != NULL; - here = here->BSIM3v1nextInstance) + here = BSIM3v1nextInstance(here)) { Check = 1; ByPass = 0; diff --git a/src/spicelib/devices/bsim3v1/b3v1noi.c b/src/spicelib/devices/bsim3v1/b3v1noi.c index 4a6683f0c..df950dd7a 100644 --- a/src/spicelib/devices/bsim3v1/b3v1noi.c +++ b/src/spicelib/devices/bsim3v1/b3v1noi.c @@ -125,7 +125,7 @@ int i; for (; model != NULL; model = BSIM3v1nextModel(model)) { for (here = BSIM3v1instances(model); here != NULL; - here = here->BSIM3v1nextInstance) + here = BSIM3v1nextInstance(here)) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim3v1/b3v1pzld.c b/src/spicelib/devices/bsim3v1/b3v1pzld.c index 134b8def7..d8989fbb0 100644 --- a/src/spicelib/devices/bsim3v1/b3v1pzld.c +++ b/src/spicelib/devices/bsim3v1/b3v1pzld.c @@ -34,7 +34,7 @@ double m; for (; model != NULL; model = BSIM3v1nextModel(model)) { for (here = BSIM3v1instances(model); here!= NULL; - here = here->BSIM3v1nextInstance) + here = BSIM3v1nextInstance(here)) { if (here->BSIM3v1mode >= 0) { Gm = here->BSIM3v1gm; diff --git a/src/spicelib/devices/bsim3v1/b3v1set.c b/src/spicelib/devices/bsim3v1/b3v1set.c index 331e04676..bb2f55689 100644 --- a/src/spicelib/devices/bsim3v1/b3v1set.c +++ b/src/spicelib/devices/bsim3v1/b3v1set.c @@ -776,7 +776,7 @@ IFuid tmpName; model->BSIM3v1kf = 0.0; /* loop through all the instances of the model */ for (here = BSIM3v1instances(model); here != NULL ; - here=here->BSIM3v1nextInstance) + here=BSIM3v1nextInstance(here)) { /* allocate a chunk of the state vector */ here->BSIM3v1states = *states; @@ -962,7 +962,7 @@ BSIM3v1unsetup(GENmodel *inModel, CKTcircuit *ckt) model = BSIM3v1nextModel(model)) { for (here = BSIM3v1instances(model); here != NULL; - here=here->BSIM3v1nextInstance) + here=BSIM3v1nextInstance(here)) { if (here->BSIM3v1qNode > 0) CKTdltNNum(ckt, here->BSIM3v1qNode); diff --git a/src/spicelib/devices/bsim3v1/b3v1temp.c b/src/spicelib/devices/bsim3v1/b3v1temp.c index a4cbb1d53..f8b0bc0d7 100644 --- a/src/spicelib/devices/bsim3v1/b3v1temp.c +++ b/src/spicelib/devices/bsim3v1/b3v1temp.c @@ -90,7 +90,7 @@ int Size_Not_Found; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ for (here = BSIM3v1instances(model); here != NULL; - here = here->BSIM3v1nextInstance) + here = BSIM3v1nextInstance(here)) { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; diff --git a/src/spicelib/devices/bsim3v1/b3v1trunc.c b/src/spicelib/devices/bsim3v1/b3v1trunc.c index 310c79c80..80cae9be5 100644 --- a/src/spicelib/devices/bsim3v1/b3v1trunc.c +++ b/src/spicelib/devices/bsim3v1/b3v1trunc.c @@ -29,7 +29,7 @@ BSIM3v1instance *here; for (; model != NULL; model = BSIM3v1nextModel(model)) { for (here = BSIM3v1instances(model); here != NULL; - here = here->BSIM3v1nextInstance) + here = BSIM3v1nextInstance(here)) { #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim3v1/bsim3v1def.h b/src/spicelib/devices/bsim3v1/bsim3v1def.h index 9767db169..68d9b1231 100644 --- a/src/spicelib/devices/bsim3v1/bsim3v1def.h +++ b/src/spicelib/devices/bsim3v1/bsim3v1def.h @@ -16,10 +16,12 @@ File: bsim3v1def.h typedef struct sBSIM3v1instance { - struct sBSIM3v1model *BSIM3v1modPtr; - struct sBSIM3v1instance *BSIM3v1nextInstance; - IFuid BSIM3v1name; - int BSIM3v1states; /* index into state table for this device */ + struct GENinstance gen; + +#define BSIM3v1modPtr(inst) ((struct sBSIM3v1model*)((inst)->gen.GENmodPtr)) +#define BSIM3v1nextInstance(inst) ((struct sBSIM3v1instance*)((inst)->gen.GENnextInstance)) +#define BSIM3v1name gen.GENname +#define BSIM3v1states gen.GENstate const int BSIM3v1dNode; const int BSIM3v1gNode; diff --git a/src/spicelib/devices/bsim3v32/b3v32acld.c b/src/spicelib/devices/bsim3v32/b3v32acld.c index 03045a42a..ee9326940 100644 --- a/src/spicelib/devices/bsim3v32/b3v32acld.c +++ b/src/spicelib/devices/bsim3v32/b3v32acld.c @@ -38,7 +38,7 @@ double m; omega = ckt->CKTomega; for (; model != NULL; model = BSIM3v32nextModel(model)) { for (here = BSIM3v32instances(model); here!= NULL; - here = here->BSIM3v32nextInstance) + here = BSIM3v32nextInstance(here)) { if (here->BSIM3v32mode >= 0) { Gm = here->BSIM3v32gm; diff --git a/src/spicelib/devices/bsim3v32/b3v32ask.c b/src/spicelib/devices/bsim3v32/b3v32ask.c index aa85e5f11..2b057b77b 100644 --- a/src/spicelib/devices/bsim3v32/b3v32ask.c +++ b/src/spicelib/devices/bsim3v32/b3v32ask.c @@ -22,7 +22,7 @@ BSIM3v32ask (CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *select) { BSIM3v32instance *here = (BSIM3v32instance*)inst; -BSIM3v32model *model = here->BSIM3v32modPtr; /* for lmlt */ +BSIM3v32model *model = BSIM3v32modPtr(here); /* for lmlt */ NG_IGNORE(select); diff --git a/src/spicelib/devices/bsim3v32/b3v32cvtest.c b/src/spicelib/devices/bsim3v32/b3v32cvtest.c index fc6e9b6c1..0df873973 100644 --- a/src/spicelib/devices/bsim3v32/b3v32cvtest.c +++ b/src/spicelib/devices/bsim3v32/b3v32cvtest.c @@ -31,7 +31,7 @@ double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; for (; model != NULL; model = BSIM3v32nextModel(model)) { /* loop through all the instances of the model */ for (here = BSIM3v32instances(model); here != NULL ; - here=here->BSIM3v32nextInstance) + here=BSIM3v32nextInstance(here)) { vbs = model->BSIM3v32type * (*(ckt->CKTrhsOld+here->BSIM3v32bNode) diff --git a/src/spicelib/devices/bsim3v32/b3v32dest.c b/src/spicelib/devices/bsim3v32/b3v32dest.c index 388c6a057..5e006d64e 100644 --- a/src/spicelib/devices/bsim3v32/b3v32dest.c +++ b/src/spicelib/devices/bsim3v32/b3v32dest.c @@ -36,7 +36,7 @@ BSIM3v32destroy (GENmodel **inModel) } /** end of extra code **/ while (inst) { - BSIM3v32instance *next_inst = inst->BSIM3v32nextInstance; + BSIM3v32instance *next_inst = BSIM3v32nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim3v32/b3v32getic.c b/src/spicelib/devices/bsim3v32/b3v32getic.c index 168f57794..ccb47a93a 100644 --- a/src/spicelib/devices/bsim3v32/b3v32getic.c +++ b/src/spicelib/devices/bsim3v32/b3v32getic.c @@ -22,7 +22,7 @@ BSIM3v32model *model = (BSIM3v32model*)inModel; BSIM3v32instance *here; for (; model ; model = BSIM3v32nextModel(model)) - { for (here = BSIM3v32instances(model); here; here = here->BSIM3v32nextInstance) + { for (here = BSIM3v32instances(model); here; here = BSIM3v32nextInstance(here)) { if (!here->BSIM3v32icVBSGiven) { here->BSIM3v32icVBS = *(ckt->CKTrhs + here->BSIM3v32bNode) diff --git a/src/spicelib/devices/bsim3v32/b3v32ld.c b/src/spicelib/devices/bsim3v32/b3v32ld.c index 339347a35..19d8283b9 100644 --- a/src/spicelib/devices/bsim3v32/b3v32ld.c +++ b/src/spicelib/devices/bsim3v32/b3v32ld.c @@ -61,7 +61,7 @@ BSIM3v32load (GENmodel *inModel, CKTcircuit *ckt) int BSIM3v32LoadOMP(BSIM3v32instance *here, CKTcircuit *ckt) { - BSIM3v32model *model = here->BSIM3v32modPtr; + BSIM3v32model *model = BSIM3v32modPtr(here); #else BSIM3v32model *model = (BSIM3v32model*)inModel; BSIM3v32instance *here; @@ -173,7 +173,7 @@ ChargeComputationNeeded = #ifndef USE_OMP for (; model != NULL; model = BSIM3v32nextModel(model)) { for (here = BSIM3v32instances(model); here != NULL; - here = here->BSIM3v32nextInstance) + here = BSIM3v32nextInstance(here)) { #endif Check = 1; @@ -3438,7 +3438,7 @@ void BSIM3v32LoadRhsMat(GENmodel *inModel, CKTcircuit *ckt) for (idx = 0; idx < InstCount; idx++) { here = InstArray[idx]; - model = here->BSIM3v32modPtr; + model = BSIM3v32modPtr(here); /* Update b for Ax = b */ (*(ckt->CKTrhs + here->BSIM3v32gNode) -= here->BSIM3v32rhsG); (*(ckt->CKTrhs + here->BSIM3v32bNode) -= here->BSIM3v32rhsB); diff --git a/src/spicelib/devices/bsim3v32/b3v32noi.c b/src/spicelib/devices/bsim3v32/b3v32noi.c index dc711dcd9..dedcf957f 100644 --- a/src/spicelib/devices/bsim3v32/b3v32noi.c +++ b/src/spicelib/devices/bsim3v32/b3v32noi.c @@ -210,7 +210,7 @@ int i; for (; model != NULL; model = BSIM3v32nextModel(model)) { for (here = BSIM3v32instances(model); here != NULL; - here = here->BSIM3v32nextInstance) + here = BSIM3v32nextInstance(here)) { pParam = here->pParam; switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/bsim3v32/b3v32pzld.c b/src/spicelib/devices/bsim3v32/b3v32pzld.c index 3e8f59c16..dff705cc1 100644 --- a/src/spicelib/devices/bsim3v32/b3v32pzld.c +++ b/src/spicelib/devices/bsim3v32/b3v32pzld.c @@ -38,7 +38,7 @@ double m; for (; model != NULL; model = BSIM3v32nextModel(model)) { for (here = BSIM3v32instances(model); here!= NULL; - here = here->BSIM3v32nextInstance) + here = BSIM3v32nextInstance(here)) { if (here->BSIM3v32mode >= 0) { Gm = here->BSIM3v32gm; diff --git a/src/spicelib/devices/bsim3v32/b3v32set.c b/src/spicelib/devices/bsim3v32/b3v32set.c index 8158191e5..456a98095 100644 --- a/src/spicelib/devices/bsim3v32/b3v32set.c +++ b/src/spicelib/devices/bsim3v32/b3v32set.c @@ -937,7 +937,7 @@ BSIM3v32instance **InstArray; /* loop through all the instances of the model */ for (here = BSIM3v32instances(model); here != NULL ; - here=here->BSIM3v32nextInstance) + here=BSIM3v32nextInstance(here)) { /* allocate a chunk of the state vector */ here->BSIM3v32states = *states; @@ -1145,7 +1145,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ { /* loop through all the instances of the model */ for (here = BSIM3v32instances(model); here != NULL; - here = here->BSIM3v32nextInstance) + here = BSIM3v32nextInstance(here)) { InstCount++; } @@ -1157,7 +1157,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ { /* loop through all the instances of the model */ for (here = BSIM3v32instances(model); here != NULL; - here = here->BSIM3v32nextInstance) + here = BSIM3v32nextInstance(here)) { InstArray[idx] = here; idx++; @@ -1183,7 +1183,7 @@ BSIM3v32unsetup( model = BSIM3v32nextModel(model)) { for (here = BSIM3v32instances(model); here != NULL; - here=here->BSIM3v32nextInstance) + here=BSIM3v32nextInstance(here)) { if (here->BSIM3v32qNode > 0) CKTdltNNum(ckt, here->BSIM3v32qNode); diff --git a/src/spicelib/devices/bsim3v32/b3v32soachk.c b/src/spicelib/devices/bsim3v32/b3v32soachk.c index 8e212e6d4..52ed26a74 100644 --- a/src/spicelib/devices/bsim3v32/b3v32soachk.c +++ b/src/spicelib/devices/bsim3v32/b3v32soachk.c @@ -35,7 +35,7 @@ BSIM3v32soaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = BSIM3v32nextModel(model)) { - for (here = BSIM3v32instances(model); here; here = here->BSIM3v32nextInstance) { + for (here = BSIM3v32instances(model); here; here = BSIM3v32nextInstance(here)) { vgs = ckt->CKTrhsOld [here->BSIM3v32gNode] - ckt->CKTrhsOld [here->BSIM3v32sNodePrime]; diff --git a/src/spicelib/devices/bsim3v32/b3v32temp.c b/src/spicelib/devices/bsim3v32/b3v32temp.c index 1b40caf87..e969c3087 100644 --- a/src/spicelib/devices/bsim3v32/b3v32temp.c +++ b/src/spicelib/devices/bsim3v32/b3v32temp.c @@ -210,7 +210,7 @@ int Size_Not_Found, error; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ for (here = BSIM3v32instances(model); here != NULL; - here = here->BSIM3v32nextInstance) + here = BSIM3v32nextInstance(here)) { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; diff --git a/src/spicelib/devices/bsim3v32/b3v32trunc.c b/src/spicelib/devices/bsim3v32/b3v32trunc.c index 17e60f689..af96b7969 100644 --- a/src/spicelib/devices/bsim3v32/b3v32trunc.c +++ b/src/spicelib/devices/bsim3v32/b3v32trunc.c @@ -28,7 +28,7 @@ BSIM3v32instance *here; for (; model != NULL; model = BSIM3v32nextModel(model)) { for (here = BSIM3v32instances(model); here != NULL; - here = here->BSIM3v32nextInstance) + here = BSIM3v32nextInstance(here)) { #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim3v32/bsim3v32def.h b/src/spicelib/devices/bsim3v32/bsim3v32def.h index 51d1364d3..2e7d408e1 100644 --- a/src/spicelib/devices/bsim3v32/bsim3v32def.h +++ b/src/spicelib/devices/bsim3v32/bsim3v32def.h @@ -18,10 +18,13 @@ File: bsim3v32def.h typedef struct sBSIM3v32instance { - struct sBSIM3v32model *BSIM3v32modPtr; - struct sBSIM3v32instance *BSIM3v32nextInstance; - IFuid BSIM3v32name; - int BSIM3v32states; /* index into state table for this device */ + struct GENinstance gen; + +#define BSIM3v32modPtr(inst) ((struct sBSIM3v32model*)((inst)->gen.GENmodPtr)) +#define BSIM3v32nextInstance(inst) ((struct sBSIM3v32instance*)((inst)->gen.GENnextInstance)) +#define BSIM3v32name gen.GENname +#define BSIM3v32states gen.GENstate + const int BSIM3v32dNode; const int BSIM3v32gNode; const int BSIM3v32sNode; diff --git a/src/spicelib/devices/bsim4/b4acld.c b/src/spicelib/devices/bsim4/b4acld.c index e03a2161e..40b59228d 100644 --- a/src/spicelib/devices/bsim4/b4acld.c +++ b/src/spicelib/devices/bsim4/b4acld.c @@ -106,7 +106,7 @@ double m; omega = ckt->CKTomega; for (; model != NULL; model = BSIM4nextModel(model)) { for (here = BSIM4instances(model); here!= NULL; - here = here->BSIM4nextInstance) + here = BSIM4nextInstance(here)) { pParam = here->pParam; capbd = here->BSIM4capbd; diff --git a/src/spicelib/devices/bsim4/b4cvtest.c b/src/spicelib/devices/bsim4/b4cvtest.c index 56ce48fb8..47551ed84 100644 --- a/src/spicelib/devices/bsim4/b4cvtest.c +++ b/src/spicelib/devices/bsim4/b4cvtest.c @@ -88,7 +88,7 @@ double tol0, tol1, tol2, tol3, tol4, tol5, tol6; for (; model != NULL; model = BSIM4nextModel(model)) { for (here = BSIM4instances(model); here != NULL ; - here=here->BSIM4nextInstance) + here=BSIM4nextInstance(here)) { vds = model->BSIM4type * (*(ckt->CKTrhsOld + here->BSIM4dNodePrime) diff --git a/src/spicelib/devices/bsim4/b4dest.c b/src/spicelib/devices/bsim4/b4dest.c index 8a91e603b..c3d330e39 100644 --- a/src/spicelib/devices/bsim4/b4dest.c +++ b/src/spicelib/devices/bsim4/b4dest.c @@ -85,7 +85,7 @@ BSIM4destroy(GENmodel **inModel) } /** end of extra code **/ while (inst) { - BSIM4instance *next_inst = inst->BSIM4nextInstance; + BSIM4instance *next_inst = BSIM4nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim4/b4getic.c b/src/spicelib/devices/bsim4/b4getic.c index 6167ed960..2a42311fd 100644 --- a/src/spicelib/devices/bsim4/b4getic.c +++ b/src/spicelib/devices/bsim4/b4getic.c @@ -74,7 +74,7 @@ BSIM4model *model = (BSIM4model*)inModel; BSIM4instance *here; for (; model ; model = BSIM4nextModel(model)) - { for (here = BSIM4instances(model); here; here = here->BSIM4nextInstance) + { for (here = BSIM4instances(model); here; here = BSIM4nextInstance(here)) { if (!here->BSIM4icVDSGiven) { here->BSIM4icVDS = *(ckt->CKTrhs + here->BSIM4dNode) diff --git a/src/spicelib/devices/bsim4/b4ld.c b/src/spicelib/devices/bsim4/b4ld.c index 049738097..ea1321033 100644 --- a/src/spicelib/devices/bsim4/b4ld.c +++ b/src/spicelib/devices/bsim4/b4ld.c @@ -131,7 +131,7 @@ CKTcircuit *ckt) int BSIM4LoadOMP(BSIM4instance *here, CKTcircuit *ckt) { -BSIM4model *model = here->BSIM4modPtr; +BSIM4model *model = BSIM4modPtr(here); #else BSIM4model *model = (BSIM4model*)inModel; BSIM4instance *here; @@ -288,7 +288,7 @@ ChargeComputationNeeded = #ifndef USE_OMP for (; model != NULL; model = BSIM4nextModel(model)) { for (here = BSIM4instances(model); here != NULL; - here = here->BSIM4nextInstance) + here = BSIM4nextInstance(here)) { #endif @@ -5456,7 +5456,7 @@ void BSIM4LoadRhsMat(GENmodel *inModel, CKTcircuit *ckt) for(idx = 0; idx < InstCount; idx++) { here = InstArray[idx]; - model = here->BSIM4modPtr; + model = BSIM4modPtr(here); /* Update b for Ax = b */ (*(ckt->CKTrhs + here->BSIM4dNodePrime) += here->BSIM4rhsdPrime); (*(ckt->CKTrhs + here->BSIM4gNodePrime) -= here->BSIM4rhsgPrime); diff --git a/src/spicelib/devices/bsim4/b4noi.c b/src/spicelib/devices/bsim4/b4noi.c index 63a98a318..816d0288d 100644 --- a/src/spicelib/devices/bsim4/b4noi.c +++ b/src/spicelib/devices/bsim4/b4noi.c @@ -175,7 +175,7 @@ double m; lnNdens[BSIM4CORLNOIZ] = N_MINLOG; } for (here = BSIM4instances(model); here != NULL; - here = here->BSIM4nextInstance) + here = BSIM4nextInstance(here)) { pParam = here->pParam; switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/bsim4/b4pzld.c b/src/spicelib/devices/bsim4/b4pzld.c index 57ec67f75..379d7cd1e 100644 --- a/src/spicelib/devices/bsim4/b4pzld.c +++ b/src/spicelib/devices/bsim4/b4pzld.c @@ -101,7 +101,7 @@ double m; for (; model != NULL; model = BSIM4nextModel(model)) { for (here = BSIM4instances(model); here!= NULL; - here = here->BSIM4nextInstance) + here = BSIM4nextInstance(here)) { pParam = here->pParam; capbd = here->BSIM4capbd; diff --git a/src/spicelib/devices/bsim4/b4set.c b/src/spicelib/devices/bsim4/b4set.c index b59b1b1e2..7064de907 100644 --- a/src/spicelib/devices/bsim4/b4set.c +++ b/src/spicelib/devices/bsim4/b4set.c @@ -2336,7 +2336,7 @@ BSIM4instance **InstArray; */ for (here = BSIM4instances(model); here != NULL ; - here=here->BSIM4nextInstance) + here=BSIM4nextInstance(here)) { /* allocate a chunk of the state vector */ here->BSIM4states = *states; @@ -2724,7 +2724,7 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL { /* loop through all the instances of the model */ for (here = BSIM4instances(model); here != NULL ; - here=here->BSIM4nextInstance) + here=BSIM4nextInstance(here)) { InstCount++; } @@ -2736,7 +2736,7 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL { /* loop through all the instances of the model */ for (here = BSIM4instances(model); here != NULL ; - here=here->BSIM4nextInstance) + here=BSIM4nextInstance(here)) { InstArray[idx] = here; idx++; @@ -2763,7 +2763,7 @@ CKTcircuit *ckt) model = BSIM4nextModel(model)) { for (here = BSIM4instances(model); here != NULL; - here=here->BSIM4nextInstance) + here=BSIM4nextInstance(here)) { if (here->BSIM4qNode > 0) CKTdltNNum(ckt, here->BSIM4qNode); diff --git a/src/spicelib/devices/bsim4/b4soachk.c b/src/spicelib/devices/bsim4/b4soachk.c index edffb4657..8af08a64e 100644 --- a/src/spicelib/devices/bsim4/b4soachk.c +++ b/src/spicelib/devices/bsim4/b4soachk.c @@ -35,7 +35,7 @@ BSIM4soaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = BSIM4nextModel(model)) { - for (here = BSIM4instances(model); here; here = here->BSIM4nextInstance) { + for (here = BSIM4instances(model); here; here = BSIM4nextInstance(here)) { vgs = ckt->CKTrhsOld [here->BSIM4gNodePrime] - ckt->CKTrhsOld [here->BSIM4sNodePrime]; diff --git a/src/spicelib/devices/bsim4/b4temp.c b/src/spicelib/devices/bsim4/b4temp.c index 7f367570c..5c4cd12a1 100644 --- a/src/spicelib/devices/bsim4/b4temp.c +++ b/src/spicelib/devices/bsim4/b4temp.c @@ -443,7 +443,7 @@ int Size_Not_Found, i; /* loop through all the instances of the model */ for (here = BSIM4instances(model); here != NULL; - here = here->BSIM4nextInstance) + here = BSIM4nextInstance(here)) { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; diff --git a/src/spicelib/devices/bsim4/b4trunc.c b/src/spicelib/devices/bsim4/b4trunc.c index 1578fc853..3d4ec53ba 100644 --- a/src/spicelib/devices/bsim4/b4trunc.c +++ b/src/spicelib/devices/bsim4/b4trunc.c @@ -80,7 +80,7 @@ BSIM4instance *here; for (; model != NULL; model = BSIM4nextModel(model)) { for (here = BSIM4instances(model); here != NULL; - here = here->BSIM4nextInstance) + here = BSIM4nextInstance(here)) { #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim4/bsim4def.h b/src/spicelib/devices/bsim4/bsim4def.h index adfe62fa8..adbcf76a4 100644 --- a/src/spicelib/devices/bsim4/bsim4def.h +++ b/src/spicelib/devices/bsim4/bsim4def.h @@ -69,10 +69,13 @@ typedef struct sBSIM4instance { - struct sBSIM4model *BSIM4modPtr; - struct sBSIM4instance *BSIM4nextInstance; - IFuid BSIM4name; - int BSIM4states; /* index into state table for this device */ + struct GENinstance gen; + +#define BSIM4modPtr(inst) ((struct sBSIM4model*)((inst)->gen.GENmodPtr)) +#define BSIM4nextInstance(inst) ((struct sBSIM4instance*)((inst)->gen.GENnextInstance)) +#define BSIM4name gen.GENname +#define BSIM4states gen.GENstate + const int BSIM4dNode; const int BSIM4gNodeExt; const int BSIM4sNode; diff --git a/src/spicelib/devices/bsim4v5/b4v5acld.c b/src/spicelib/devices/bsim4v5/b4v5acld.c index 230097a2b..190e70b80 100644 --- a/src/spicelib/devices/bsim4v5/b4v5acld.c +++ b/src/spicelib/devices/bsim4v5/b4v5acld.c @@ -57,7 +57,7 @@ double m; omega = ckt->CKTomega; for (; model != NULL; model = BSIM4v5nextModel(model)) { for (here = BSIM4v5instances(model); here!= NULL; - here = here->BSIM4v5nextInstance) + here = BSIM4v5nextInstance(here)) { pParam = here->pParam; capbd = here->BSIM4v5capbd; diff --git a/src/spicelib/devices/bsim4v5/b4v5cvtest.c b/src/spicelib/devices/bsim4v5/b4v5cvtest.c index d86acb86b..b807b57b6 100644 --- a/src/spicelib/devices/bsim4v5/b4v5cvtest.c +++ b/src/spicelib/devices/bsim4v5/b4v5cvtest.c @@ -41,7 +41,7 @@ double tol0, tol1, tol2, tol3, tol4, tol5, tol6; for (; model != NULL; model = BSIM4v5nextModel(model)) { for (here = BSIM4v5instances(model); here != NULL ; - here=here->BSIM4v5nextInstance) + here=BSIM4v5nextInstance(here)) { vds = model->BSIM4v5type * (*(ckt->CKTrhsOld + here->BSIM4v5dNodePrime) diff --git a/src/spicelib/devices/bsim4v5/b4v5dest.c b/src/spicelib/devices/bsim4v5/b4v5dest.c index 7dcd9e103..74caa02b5 100644 --- a/src/spicelib/devices/bsim4v5/b4v5dest.c +++ b/src/spicelib/devices/bsim4v5/b4v5dest.c @@ -35,7 +35,7 @@ BSIM4v5destroy(GENmodel **inModel) } /** end of extra code **/ while (inst) { - BSIM4v5instance *next_inst = inst->BSIM4v5nextInstance; + BSIM4v5instance *next_inst = BSIM4v5nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim4v5/b4v5getic.c b/src/spicelib/devices/bsim4v5/b4v5getic.c index c7c5a956a..d4a6a9702 100644 --- a/src/spicelib/devices/bsim4v5/b4v5getic.c +++ b/src/spicelib/devices/bsim4v5/b4v5getic.c @@ -24,7 +24,7 @@ BSIM4v5model *model = (BSIM4v5model*)inModel; BSIM4v5instance *here; for (; model ; model = BSIM4v5nextModel(model)) - { for (here = BSIM4v5instances(model); here; here = here->BSIM4v5nextInstance) + { for (here = BSIM4v5instances(model); here; here = BSIM4v5nextInstance(here)) { if (!here->BSIM4v5icVDSGiven) { here->BSIM4v5icVDS = *(ckt->CKTrhs + here->BSIM4v5dNode) diff --git a/src/spicelib/devices/bsim4v5/b4v5ld.c b/src/spicelib/devices/bsim4v5/b4v5ld.c index 48b6cce96..dda45a395 100644 --- a/src/spicelib/devices/bsim4v5/b4v5ld.c +++ b/src/spicelib/devices/bsim4v5/b4v5ld.c @@ -84,7 +84,7 @@ CKTcircuit *ckt) int BSIM4v5LoadOMP(BSIM4v5instance *here, CKTcircuit *ckt) { -BSIM4v5model *model = here->BSIM4v5modPtr; +BSIM4v5model *model = BSIM4v5modPtr(here); #else BSIM4v5model *model = (BSIM4v5model*)inModel; BSIM4v5instance *here; @@ -239,7 +239,7 @@ ChargeComputationNeeded = 1; #ifndef USE_OMP for (; model != NULL; model = BSIM4v5nextModel(model)) { for (here = BSIM4v5instances(model); here != NULL; - here = here->BSIM4v5nextInstance) + here = BSIM4v5nextInstance(here)) { #endif @@ -4998,7 +4998,7 @@ void BSIM4v5LoadRhsMat(GENmodel *inModel, CKTcircuit *ckt) for(idx = 0; idx < InstCount; idx++) { here = InstArray[idx]; - model = here->BSIM4v5modPtr; + model = BSIM4v5modPtr(here); /* Update b for Ax = b */ (*(ckt->CKTrhs + here->BSIM4v5dNodePrime) += here->BSIM4v5rhsdPrime); (*(ckt->CKTrhs + here->BSIM4v5gNodePrime) -= here->BSIM4v5rhsgPrime); diff --git a/src/spicelib/devices/bsim4v5/b4v5noi.c b/src/spicelib/devices/bsim4v5/b4v5noi.c index 4da173302..c56e2d246 100644 --- a/src/spicelib/devices/bsim4v5/b4v5noi.c +++ b/src/spicelib/devices/bsim4v5/b4v5noi.c @@ -121,7 +121,7 @@ int i; for (; model != NULL; model = BSIM4v5nextModel(model)) { for (here = BSIM4v5instances(model); here != NULL; - here = here->BSIM4v5nextInstance) + here = BSIM4v5nextInstance(here)) { pParam = here->pParam; switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/bsim4v5/b4v5pzld.c b/src/spicelib/devices/bsim4v5/b4v5pzld.c index a107f1781..808349bbe 100644 --- a/src/spicelib/devices/bsim4v5/b4v5pzld.c +++ b/src/spicelib/devices/bsim4v5/b4v5pzld.c @@ -52,7 +52,7 @@ double m; for (; model != NULL; model = BSIM4v5nextModel(model)) { for (here = BSIM4v5instances(model); here!= NULL; - here = here->BSIM4v5nextInstance) + here = BSIM4v5nextInstance(here)) { pParam = here->pParam; capbd = here->BSIM4v5capbd; diff --git a/src/spicelib/devices/bsim4v5/b4v5set.c b/src/spicelib/devices/bsim4v5/b4v5set.c index fa03b5724..71dd06a16 100644 --- a/src/spicelib/devices/bsim4v5/b4v5set.c +++ b/src/spicelib/devices/bsim4v5/b4v5set.c @@ -1691,7 +1691,7 @@ BSIM4v5instance **InstArray; */ for (here = BSIM4v5instances(model); here != NULL ; - here=here->BSIM4v5nextInstance) + here=BSIM4v5nextInstance(here)) { /* allocate a chunk of the state vector */ here->BSIM4v5states = *states; @@ -2102,7 +2102,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ { /* loop through all the instances of the model */ for (here = BSIM4v5instances(model); here != NULL; - here = here->BSIM4v5nextInstance) + here = BSIM4v5nextInstance(here)) { InstCount++; } @@ -2114,7 +2114,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ { /* loop through all the instances of the model */ for (here = BSIM4v5instances(model); here != NULL; - here = here->BSIM4v5nextInstance) + here = BSIM4v5nextInstance(here)) { InstArray[idx] = here; idx++; @@ -2141,7 +2141,7 @@ BSIM4v5unsetup( model = BSIM4v5nextModel(model)) { for (here = BSIM4v5instances(model); here != NULL; - here=here->BSIM4v5nextInstance) + here=BSIM4v5nextInstance(here)) { if (here->BSIM4v5qNode > 0) CKTdltNNum(ckt, here->BSIM4v5qNode); diff --git a/src/spicelib/devices/bsim4v5/b4v5soachk.c b/src/spicelib/devices/bsim4v5/b4v5soachk.c index 71468f0c2..43cfbdb88 100644 --- a/src/spicelib/devices/bsim4v5/b4v5soachk.c +++ b/src/spicelib/devices/bsim4v5/b4v5soachk.c @@ -35,7 +35,7 @@ BSIM4v5soaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = BSIM4v5nextModel(model)) { - for (here = BSIM4v5instances(model); here; here = here->BSIM4v5nextInstance) { + for (here = BSIM4v5instances(model); here; here = BSIM4v5nextInstance(here)) { vgs = ckt->CKTrhsOld [here->BSIM4v5gNodePrime] - ckt->CKTrhsOld [here->BSIM4v5sNodePrime]; diff --git a/src/spicelib/devices/bsim4v5/b4v5temp.c b/src/spicelib/devices/bsim4v5/b4v5temp.c index 838767341..aa2fdc3eb 100644 --- a/src/spicelib/devices/bsim4v5/b4v5temp.c +++ b/src/spicelib/devices/bsim4v5/b4v5temp.c @@ -338,7 +338,7 @@ int Size_Not_Found, i; /* loop through all the instances of the model */ for (here = BSIM4v5instances(model); here != NULL; - here = here->BSIM4v5nextInstance) + here = BSIM4v5nextInstance(here)) { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; diff --git a/src/spicelib/devices/bsim4v5/b4v5trunc.c b/src/spicelib/devices/bsim4v5/b4v5trunc.c index 69836faaf..38fd89423 100644 --- a/src/spicelib/devices/bsim4v5/b4v5trunc.c +++ b/src/spicelib/devices/bsim4v5/b4v5trunc.c @@ -30,7 +30,7 @@ BSIM4v5instance *here; for (; model != NULL; model = BSIM4v5nextModel(model)) { for (here = BSIM4v5instances(model); here != NULL; - here = here->BSIM4v5nextInstance) + here = BSIM4v5nextInstance(here)) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim4v5/bsim4v5def.h b/src/spicelib/devices/bsim4v5/bsim4v5def.h index 61f98c471..e5ce81350 100644 --- a/src/spicelib/devices/bsim4v5/bsim4v5def.h +++ b/src/spicelib/devices/bsim4v5/bsim4v5def.h @@ -20,10 +20,13 @@ File: bsim4v5def.h typedef struct sBSIM4v5instance { - struct sBSIM4v5model *BSIM4v5modPtr; - struct sBSIM4v5instance *BSIM4v5nextInstance; - IFuid BSIM4v5name; - int BSIM4v5states; /* index into state table for this device */ + struct GENinstance gen; + +#define BSIM4v5modPtr(inst) ((struct sBSIM4v5model*)((inst)->gen.GENmodPtr)) +#define BSIM4v5nextInstance(inst) ((struct sBSIM4v5instance*)((inst)->gen.GENnextInstance)) +#define BSIM4v5name gen.GENname +#define BSIM4v5states gen.GENstate + const int BSIM4v5dNode; const int BSIM4v5gNodeExt; const int BSIM4v5sNode; diff --git a/src/spicelib/devices/bsim4v6/b4v6acld.c b/src/spicelib/devices/bsim4v6/b4v6acld.c index f84c846a9..25cf0b82c 100644 --- a/src/spicelib/devices/bsim4v6/b4v6acld.c +++ b/src/spicelib/devices/bsim4v6/b4v6acld.c @@ -59,7 +59,7 @@ double m; omega = ckt->CKTomega; for (; model != NULL; model = BSIM4v6nextModel(model)) { for (here = BSIM4v6instances(model); here!= NULL; - here = here->BSIM4v6nextInstance) + here = BSIM4v6nextInstance(here)) { pParam = here->pParam; capbd = here->BSIM4v6capbd; diff --git a/src/spicelib/devices/bsim4v6/b4v6cvtest.c b/src/spicelib/devices/bsim4v6/b4v6cvtest.c index c4cb5afb3..765ce4e2e 100644 --- a/src/spicelib/devices/bsim4v6/b4v6cvtest.c +++ b/src/spicelib/devices/bsim4v6/b4v6cvtest.c @@ -43,7 +43,7 @@ double tol0, tol1, tol2, tol3, tol4, tol5, tol6; for (; model != NULL; model = BSIM4v6nextModel(model)) { for (here = BSIM4v6instances(model); here != NULL ; - here=here->BSIM4v6nextInstance) + here=BSIM4v6nextInstance(here)) { vds = model->BSIM4v6type * (*(ckt->CKTrhsOld + here->BSIM4v6dNodePrime) diff --git a/src/spicelib/devices/bsim4v6/b4v6dest.c b/src/spicelib/devices/bsim4v6/b4v6dest.c index 7e851f491..8c49ac248 100644 --- a/src/spicelib/devices/bsim4v6/b4v6dest.c +++ b/src/spicelib/devices/bsim4v6/b4v6dest.c @@ -37,7 +37,7 @@ BSIM4v6destroy(GENmodel **inModel) } /** end of extra code **/ while (inst) { - BSIM4v6instance *next_inst = inst->BSIM4v6nextInstance; + BSIM4v6instance *next_inst = BSIM4v6nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim4v6/b4v6getic.c b/src/spicelib/devices/bsim4v6/b4v6getic.c index 318a33511..f6dc246dd 100644 --- a/src/spicelib/devices/bsim4v6/b4v6getic.c +++ b/src/spicelib/devices/bsim4v6/b4v6getic.c @@ -26,7 +26,7 @@ BSIM4v6model *model = (BSIM4v6model*)inModel; BSIM4v6instance *here; for (; model ; model = BSIM4v6nextModel(model)) - { for (here = BSIM4v6instances(model); here; here = here->BSIM4v6nextInstance) + { for (here = BSIM4v6instances(model); here; here = BSIM4v6nextInstance(here)) { if (!here->BSIM4v6icVDSGiven) { here->BSIM4v6icVDS = *(ckt->CKTrhs + here->BSIM4v6dNode) diff --git a/src/spicelib/devices/bsim4v6/b4v6ld.c b/src/spicelib/devices/bsim4v6/b4v6ld.c index f4068ce45..c5bb49f9d 100644 --- a/src/spicelib/devices/bsim4v6/b4v6ld.c +++ b/src/spicelib/devices/bsim4v6/b4v6ld.c @@ -95,7 +95,7 @@ CKTcircuit *ckt) int BSIM4v6LoadOMP(BSIM4v6instance *here, CKTcircuit *ckt) { -BSIM4v6model *model = here->BSIM4v6modPtr; +BSIM4v6model *model = BSIM4v6modPtr(here); #else BSIM4v6model *model = (BSIM4v6model*)inModel; BSIM4v6instance *here; @@ -250,7 +250,7 @@ ChargeComputationNeeded = #ifndef USE_OMP for (; model != NULL; model = BSIM4v6nextModel(model)) { for (here = BSIM4v6instances(model); here != NULL; - here = here->BSIM4v6nextInstance) + here = BSIM4v6nextInstance(here)) { #endif @@ -5210,7 +5210,7 @@ void BSIM4v6LoadRhsMat(GENmodel *inModel, CKTcircuit *ckt) for(idx = 0; idx < InstCount; idx++) { here = InstArray[idx]; - model = here->BSIM4v6modPtr; + model = BSIM4v6modPtr(here); /* Update b for Ax = b */ (*(ckt->CKTrhs + here->BSIM4v6dNodePrime) += here->BSIM4v6rhsdPrime); (*(ckt->CKTrhs + here->BSIM4v6gNodePrime) -= here->BSIM4v6rhsgPrime); diff --git a/src/spicelib/devices/bsim4v6/b4v6noi.c b/src/spicelib/devices/bsim4v6/b4v6noi.c index ff68e381d..0cba94207 100644 --- a/src/spicelib/devices/bsim4v6/b4v6noi.c +++ b/src/spicelib/devices/bsim4v6/b4v6noi.c @@ -122,7 +122,7 @@ int i; for (; model != NULL; model = BSIM4v6nextModel(model)) { for (here = BSIM4v6instances(model); here != NULL; - here = here->BSIM4v6nextInstance) + here = BSIM4v6nextInstance(here)) { pParam = here->pParam; switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/bsim4v6/b4v6pzld.c b/src/spicelib/devices/bsim4v6/b4v6pzld.c index b7d2350cd..6e8d83a26 100644 --- a/src/spicelib/devices/bsim4v6/b4v6pzld.c +++ b/src/spicelib/devices/bsim4v6/b4v6pzld.c @@ -54,7 +54,7 @@ double m; for (; model != NULL; model = BSIM4v6nextModel(model)) { for (here = BSIM4v6instances(model); here!= NULL; - here = here->BSIM4v6nextInstance) + here = BSIM4v6nextInstance(here)) { pParam = here->pParam; capbd = here->BSIM4v6capbd; diff --git a/src/spicelib/devices/bsim4v6/b4v6set.c b/src/spicelib/devices/bsim4v6/b4v6set.c index de0744eb8..bc376318b 100644 --- a/src/spicelib/devices/bsim4v6/b4v6set.c +++ b/src/spicelib/devices/bsim4v6/b4v6set.c @@ -2052,7 +2052,7 @@ BSIM4v6instance **InstArray; */ for (here = BSIM4v6instances(model); here != NULL ; - here=here->BSIM4v6nextInstance) + here=BSIM4v6nextInstance(here)) { /* allocate a chunk of the state vector */ here->BSIM4v6states = *states; @@ -2437,7 +2437,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ { /* loop through all the instances of the model */ for (here = BSIM4v6instances(model); here != NULL ; - here=here->BSIM4v6nextInstance) + here=BSIM4v6nextInstance(here)) { InstCount++; } @@ -2449,7 +2449,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ { /* loop through all the instances of the model */ for (here = BSIM4v6instances(model); here != NULL ; - here=here->BSIM4v6nextInstance) + here=BSIM4v6nextInstance(here)) { InstArray[idx] = here; idx++; @@ -2474,7 +2474,7 @@ BSIM4v6unsetup(GENmodel *inModel, CKTcircuit *ckt) model = BSIM4v6nextModel(model)) { for (here = BSIM4v6instances(model); here != NULL; - here=here->BSIM4v6nextInstance) + here=BSIM4v6nextInstance(here)) { if (here->BSIM4v6qNode > 0) CKTdltNNum(ckt, here->BSIM4v6qNode); diff --git a/src/spicelib/devices/bsim4v6/b4v6soachk.c b/src/spicelib/devices/bsim4v6/b4v6soachk.c index a0f8cf642..b508cc43a 100644 --- a/src/spicelib/devices/bsim4v6/b4v6soachk.c +++ b/src/spicelib/devices/bsim4v6/b4v6soachk.c @@ -35,7 +35,7 @@ BSIM4v6soaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = BSIM4v6nextModel(model)) { - for (here = BSIM4v6instances(model); here; here = here->BSIM4v6nextInstance) { + for (here = BSIM4v6instances(model); here; here = BSIM4v6nextInstance(here)) { vgs = ckt->CKTrhsOld [here->BSIM4v6gNodePrime] - ckt->CKTrhsOld [here->BSIM4v6sNodePrime]; diff --git a/src/spicelib/devices/bsim4v6/b4v6temp.c b/src/spicelib/devices/bsim4v6/b4v6temp.c index 745afb671..804ae78f4 100644 --- a/src/spicelib/devices/bsim4v6/b4v6temp.c +++ b/src/spicelib/devices/bsim4v6/b4v6temp.c @@ -386,7 +386,7 @@ int Size_Not_Found, i; /* loop through all the instances of the model */ for (here = BSIM4v6instances(model); here != NULL; - here = here->BSIM4v6nextInstance) + here = BSIM4v6nextInstance(here)) { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; diff --git a/src/spicelib/devices/bsim4v6/b4v6trunc.c b/src/spicelib/devices/bsim4v6/b4v6trunc.c index 39a079b8d..8951c198a 100644 --- a/src/spicelib/devices/bsim4v6/b4v6trunc.c +++ b/src/spicelib/devices/bsim4v6/b4v6trunc.c @@ -32,7 +32,7 @@ BSIM4v6instance *here; for (; model != NULL; model = BSIM4v6nextModel(model)) { for (here = BSIM4v6instances(model); here != NULL; - here = here->BSIM4v6nextInstance) + here = BSIM4v6nextInstance(here)) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim4v6/bsim4v6def.h b/src/spicelib/devices/bsim4v6/bsim4v6def.h index 11f589219..e25ad742e 100644 --- a/src/spicelib/devices/bsim4v6/bsim4v6def.h +++ b/src/spicelib/devices/bsim4v6/bsim4v6def.h @@ -29,10 +29,13 @@ Modified by Wenwei Yang, 07/31/2008. typedef struct sBSIM4v6instance { - struct sBSIM4v6model *BSIM4v6modPtr; - struct sBSIM4v6instance *BSIM4v6nextInstance; - IFuid BSIM4v6name; - int BSIM4v6states; /* index into state table for this device */ + struct GENinstance gen; + +#define BSIM4v6modPtr(inst) ((struct sBSIM4v6model*)((inst)->gen.GENmodPtr)) +#define BSIM4v6nextInstance(inst) ((struct sBSIM4v6instance*)((inst)->gen.GENnextInstance)) +#define BSIM4v6name gen.GENname +#define BSIM4v6states gen.GENstate + const int BSIM4v6dNode; const int BSIM4v6gNodeExt; const int BSIM4v6sNode; diff --git a/src/spicelib/devices/bsim4v7/b4v7acld.c b/src/spicelib/devices/bsim4v7/b4v7acld.c index 968dc8567..e3ced126f 100644 --- a/src/spicelib/devices/bsim4v7/b4v7acld.c +++ b/src/spicelib/devices/bsim4v7/b4v7acld.c @@ -59,7 +59,7 @@ double m; omega = ckt->CKTomega; for (; model != NULL; model = BSIM4v7nextModel(model)) { for (here = BSIM4v7instances(model); here!= NULL; - here = here->BSIM4v7nextInstance) + here = BSIM4v7nextInstance(here)) { pParam = here->pParam; capbd = here->BSIM4v7capbd; diff --git a/src/spicelib/devices/bsim4v7/b4v7cvtest.c b/src/spicelib/devices/bsim4v7/b4v7cvtest.c index 97b4454d5..8e20f716f 100644 --- a/src/spicelib/devices/bsim4v7/b4v7cvtest.c +++ b/src/spicelib/devices/bsim4v7/b4v7cvtest.c @@ -43,7 +43,7 @@ double tol0, tol1, tol2, tol3, tol4, tol5, tol6; for (; model != NULL; model = BSIM4v7nextModel(model)) { for (here = BSIM4v7instances(model); here != NULL ; - here=here->BSIM4v7nextInstance) + here=BSIM4v7nextInstance(here)) { vds = model->BSIM4v7type * (*(ckt->CKTrhsOld + here->BSIM4v7dNodePrime) diff --git a/src/spicelib/devices/bsim4v7/b4v7dest.c b/src/spicelib/devices/bsim4v7/b4v7dest.c index 7dfbc143c..a09a87719 100644 --- a/src/spicelib/devices/bsim4v7/b4v7dest.c +++ b/src/spicelib/devices/bsim4v7/b4v7dest.c @@ -37,7 +37,7 @@ BSIM4v7destroy(GENmodel **inModel) } /** end of extra code **/ while (inst) { - BSIM4v7instance *next_inst = inst->BSIM4v7nextInstance; + BSIM4v7instance *next_inst = BSIM4v7nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim4v7/b4v7getic.c b/src/spicelib/devices/bsim4v7/b4v7getic.c index 2a9f319e4..553a41366 100644 --- a/src/spicelib/devices/bsim4v7/b4v7getic.c +++ b/src/spicelib/devices/bsim4v7/b4v7getic.c @@ -26,7 +26,7 @@ BSIM4v7model *model = (BSIM4v7model*)inModel; BSIM4v7instance *here; for (; model ; model = BSIM4v7nextModel(model)) - { for (here = BSIM4v7instances(model); here; here = here->BSIM4v7nextInstance) + { for (here = BSIM4v7instances(model); here; here = BSIM4v7nextInstance(here)) { if (!here->BSIM4v7icVDSGiven) { here->BSIM4v7icVDS = *(ckt->CKTrhs + here->BSIM4v7dNode) diff --git a/src/spicelib/devices/bsim4v7/b4v7ld.c b/src/spicelib/devices/bsim4v7/b4v7ld.c index 7fb4d252e..d984a14d8 100644 --- a/src/spicelib/devices/bsim4v7/b4v7ld.c +++ b/src/spicelib/devices/bsim4v7/b4v7ld.c @@ -93,7 +93,7 @@ CKTcircuit *ckt) int BSIM4v7LoadOMP(BSIM4v7instance *here, CKTcircuit *ckt) { -BSIM4v7model *model = here->BSIM4v7modPtr; +BSIM4v7model *model = BSIM4v7modPtr(here); #else BSIM4v7model *model = (BSIM4v7model*)inModel; BSIM4v7instance *here; @@ -250,7 +250,7 @@ ChargeComputationNeeded = #ifndef USE_OMP for (; model != NULL; model = BSIM4v7nextModel(model)) { for (here = BSIM4v7instances(model); here != NULL; - here = here->BSIM4v7nextInstance) + here = BSIM4v7nextInstance(here)) { #endif @@ -5365,7 +5365,7 @@ void BSIM4v7LoadRhsMat(GENmodel *inModel, CKTcircuit *ckt) for(idx = 0; idx < InstCount; idx++) { here = InstArray[idx]; - model = here->BSIM4v7modPtr; + model = BSIM4v7modPtr(here); /* Update b for Ax = b */ (*(ckt->CKTrhs + here->BSIM4v7dNodePrime) += here->BSIM4v7rhsdPrime); (*(ckt->CKTrhs + here->BSIM4v7gNodePrime) -= here->BSIM4v7rhsgPrime); diff --git a/src/spicelib/devices/bsim4v7/b4v7noi.c b/src/spicelib/devices/bsim4v7/b4v7noi.c index efca6c9f9..c9626255e 100644 --- a/src/spicelib/devices/bsim4v7/b4v7noi.c +++ b/src/spicelib/devices/bsim4v7/b4v7noi.c @@ -136,7 +136,7 @@ double m; lnNdens[BSIM4v7CORLNOIZ] = N_MINLOG; } for (here = BSIM4v7instances(model); here != NULL; - here = here->BSIM4v7nextInstance) + here = BSIM4v7nextInstance(here)) { pParam = here->pParam; switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/bsim4v7/b4v7pzld.c b/src/spicelib/devices/bsim4v7/b4v7pzld.c index 39e099251..641eb7067 100644 --- a/src/spicelib/devices/bsim4v7/b4v7pzld.c +++ b/src/spicelib/devices/bsim4v7/b4v7pzld.c @@ -54,7 +54,7 @@ double m; for (; model != NULL; model = BSIM4v7nextModel(model)) { for (here = BSIM4v7instances(model); here!= NULL; - here = here->BSIM4v7nextInstance) + here = BSIM4v7nextInstance(here)) { pParam = here->pParam; capbd = here->BSIM4v7capbd; diff --git a/src/spicelib/devices/bsim4v7/b4v7set.c b/src/spicelib/devices/bsim4v7/b4v7set.c index 7238a4565..0c8275447 100644 --- a/src/spicelib/devices/bsim4v7/b4v7set.c +++ b/src/spicelib/devices/bsim4v7/b4v7set.c @@ -2203,7 +2203,7 @@ BSIM4v7instance **InstArray; */ for (here = BSIM4v7instances(model); here != NULL ; - here=here->BSIM4v7nextInstance) + here=BSIM4v7nextInstance(here)) { /* allocate a chunk of the state vector */ here->BSIM4v7states = *states; @@ -2592,7 +2592,7 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL { /* loop through all the instances of the model */ for (here = BSIM4v7instances(model); here != NULL ; - here=here->BSIM4v7nextInstance) + here=BSIM4v7nextInstance(here)) { InstCount++; } @@ -2604,7 +2604,7 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL { /* loop through all the instances of the model */ for (here = BSIM4v7instances(model); here != NULL ; - here=here->BSIM4v7nextInstance) + here=BSIM4v7nextInstance(here)) { InstArray[idx] = here; idx++; @@ -2631,7 +2631,7 @@ CKTcircuit *ckt) model = BSIM4v7nextModel(model)) { for (here = BSIM4v7instances(model); here != NULL; - here=here->BSIM4v7nextInstance) + here=BSIM4v7nextInstance(here)) { if (here->BSIM4v7qNode > 0) CKTdltNNum(ckt, here->BSIM4v7qNode); diff --git a/src/spicelib/devices/bsim4v7/b4v7soachk.c b/src/spicelib/devices/bsim4v7/b4v7soachk.c index ffe3a0767..a1e7777dc 100644 --- a/src/spicelib/devices/bsim4v7/b4v7soachk.c +++ b/src/spicelib/devices/bsim4v7/b4v7soachk.c @@ -35,7 +35,7 @@ BSIM4v7soaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = BSIM4v7nextModel(model)) { - for (here = BSIM4v7instances(model); here; here = here->BSIM4v7nextInstance) { + for (here = BSIM4v7instances(model); here; here = BSIM4v7nextInstance(here)) { vgs = ckt->CKTrhsOld [here->BSIM4v7gNodePrime] - ckt->CKTrhsOld [here->BSIM4v7sNodePrime]; diff --git a/src/spicelib/devices/bsim4v7/b4v7temp.c b/src/spicelib/devices/bsim4v7/b4v7temp.c index 4cf8cf5d0..2cbc3f477 100644 --- a/src/spicelib/devices/bsim4v7/b4v7temp.c +++ b/src/spicelib/devices/bsim4v7/b4v7temp.c @@ -407,7 +407,7 @@ int Size_Not_Found, i; /* loop through all the instances of the model */ for (here = BSIM4v7instances(model); here != NULL; - here = here->BSIM4v7nextInstance) + here = BSIM4v7nextInstance(here)) { pSizeDependParamKnot = model->pSizeDependParamKnot; Size_Not_Found = 1; diff --git a/src/spicelib/devices/bsim4v7/b4v7trunc.c b/src/spicelib/devices/bsim4v7/b4v7trunc.c index 2cd4dd5df..9aea00696 100644 --- a/src/spicelib/devices/bsim4v7/b4v7trunc.c +++ b/src/spicelib/devices/bsim4v7/b4v7trunc.c @@ -32,7 +32,7 @@ BSIM4v7instance *here; for (; model != NULL; model = BSIM4v7nextModel(model)) { for (here = BSIM4v7instances(model); here != NULL; - here = here->BSIM4v7nextInstance) + here = BSIM4v7nextInstance(here)) { #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim4v7/bsim4v7def.h b/src/spicelib/devices/bsim4v7/bsim4v7def.h index d8fad8307..21038dde8 100644 --- a/src/spicelib/devices/bsim4v7/bsim4v7def.h +++ b/src/spicelib/devices/bsim4v7/bsim4v7def.h @@ -30,10 +30,13 @@ Modified by Wenwei Yang, 07/31/2008. typedef struct sBSIM4v7instance { - struct sBSIM4v7model *BSIM4v7modPtr; - struct sBSIM4v7instance *BSIM4v7nextInstance; - IFuid BSIM4v7name; - int BSIM4v7states; /* index into state table for this device */ + struct GENinstance gen; + +#define BSIM4v7modPtr(inst) ((struct sBSIM4v7model*)((inst)->gen.GENmodPtr)) +#define BSIM4v7nextInstance(inst) ((struct sBSIM4v7instance*)((inst)->gen.GENnextInstance)) +#define BSIM4v7name gen.GENname +#define BSIM4v7states gen.GENstate + const int BSIM4v7dNode; const int BSIM4v7gNodeExt; const int BSIM4v7sNode; diff --git a/src/spicelib/devices/bsimsoi/b4soiacld.c b/src/spicelib/devices/bsimsoi/b4soiacld.c index 18cdc9f1e..d629e5bbb 100644 --- a/src/spicelib/devices/bsimsoi/b4soiacld.c +++ b/src/spicelib/devices/bsimsoi/b4soiacld.c @@ -79,7 +79,7 @@ double m; { for (here = B4SOIinstances(model); here!= NULL; - here = here->B4SOInextInstance) + here = B4SOInextInstance(here)) { selfheat = (model->B4SOIshMod == 1) && (here->B4SOIrth0 != 0.0); if (here->B4SOImode >= 0) diff --git a/src/spicelib/devices/bsimsoi/b4soicvtest.c b/src/spicelib/devices/bsimsoi/b4soicvtest.c index ddb171e29..0abfc9405 100644 --- a/src/spicelib/devices/bsimsoi/b4soicvtest.c +++ b/src/spicelib/devices/bsimsoi/b4soicvtest.c @@ -39,7 +39,7 @@ double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; for (; model != NULL; model = B4SOInextModel(model)) { /* loop through all the instances of the model */ for (here = B4SOIinstances(model); here != NULL ; - here=here->B4SOInextInstance) + here=B4SOInextInstance(here)) { vbs = model->B4SOItype * (*(ckt->CKTrhsOld+here->B4SOIbNode) diff --git a/src/spicelib/devices/bsimsoi/b4soidef.h b/src/spicelib/devices/bsimsoi/b4soidef.h index f223bb0e7..3e0af3355 100644 --- a/src/spicelib/devices/bsimsoi/b4soidef.h +++ b/src/spicelib/devices/bsimsoi/b4soidef.h @@ -26,10 +26,12 @@ File: b4soidef.h typedef struct sB4SOIinstance { - struct sB4SOImodel *B4SOImodPtr; - struct sB4SOIinstance *B4SOInextInstance; - IFuid B4SOIname; - int B4SOIstates; /* index into state table for this device */ + struct GENinstance gen; + +#define B4SOImodPtr(inst) ((struct sB4SOImodel*)((inst)->gen.GENmodPtr)) +#define B4SOInextInstance(inst) ((struct sB4SOIinstance*)((inst)->gen.GENnextInstance)) +#define B4SOIname gen.GENname +#define B4SOIstates gen.GENstate const int B4SOIdNode; const int B4SOIgNodeExt; /* v3.1 changed gNode to gNodeExt */ diff --git a/src/spicelib/devices/bsimsoi/b4soidest.c b/src/spicelib/devices/bsimsoi/b4soidest.c index 9f89e84e1..bf4843cc3 100644 --- a/src/spicelib/devices/bsimsoi/b4soidest.c +++ b/src/spicelib/devices/bsimsoi/b4soidest.c @@ -28,7 +28,7 @@ B4SOIdestroy(GENmodel **inModel) B4SOImodel *next_mod = B4SOInextModel(mod); B4SOIinstance *inst = B4SOIinstances(mod); while (inst) { - B4SOIinstance *next_inst = inst->B4SOInextInstance; + B4SOIinstance *next_inst = B4SOInextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsimsoi/b4soigetic.c b/src/spicelib/devices/bsimsoi/b4soigetic.c index f4e5f75a0..73478bad2 100644 --- a/src/spicelib/devices/bsimsoi/b4soigetic.c +++ b/src/spicelib/devices/bsimsoi/b4soigetic.c @@ -31,7 +31,7 @@ B4SOImodel *model = (B4SOImodel*)inModel; B4SOIinstance *here; for (; model ; model = B4SOInextModel(model)) - { for (here = B4SOIinstances(model); here; here = here->B4SOInextInstance) + { for (here = B4SOIinstances(model); here; here = B4SOInextInstance(here)) { if(!here->B4SOIicVBSGiven) { here->B4SOIicVBS = *(ckt->CKTrhs + here->B4SOIbNode) diff --git a/src/spicelib/devices/bsimsoi/b4soild.c b/src/spicelib/devices/bsimsoi/b4soild.c index 5bccb32ef..40661718f 100644 --- a/src/spicelib/devices/bsimsoi/b4soild.c +++ b/src/spicelib/devices/bsimsoi/b4soild.c @@ -127,7 +127,7 @@ B4SOIload( } int B4SOILoadOMP(B4SOIinstance *here, CKTcircuit *ckt) { - B4SOImodel *model = here->B4SOImodPtr; + B4SOImodel *model = B4SOImodPtr(here); #else register B4SOImodel *model = (B4SOImodel*)inModel; register B4SOIinstance *here; @@ -491,7 +491,7 @@ int B4SOILoadOMP(B4SOIinstance *here, CKTcircuit *ckt) { #ifndef USE_OMP for (; model != NULL; model = B4SOInextModel(model)) { for (here = B4SOIinstances(model); here != NULL; - here = here->B4SOInextInstance) + here = B4SOInextInstance(here)) { #endif @@ -10969,7 +10969,7 @@ void B4SOILoadRhsMat(GENmodel *inModel, CKTcircuit *ckt) for(idx = 0; idx < InstCount; idx++) { here = InstArray[idx]; - model = here->B4SOImodPtr; + model = B4SOImodPtr(here); /* Update b for Ax = b */ /* v3.1 */ diff --git a/src/spicelib/devices/bsimsoi/b4soinoi.c b/src/spicelib/devices/bsimsoi/b4soinoi.c index 791d0205c..b61f9b8d0 100644 --- a/src/spicelib/devices/bsimsoi/b4soinoi.c +++ b/src/spicelib/devices/bsimsoi/b4soinoi.c @@ -149,7 +149,7 @@ double m; for (; model != NULL; model = B4SOInextModel(model)) { for (here = B4SOIinstances(model); here != NULL; - here = here->B4SOInextInstance) + here = B4SOInextInstance(here)) { m = here->B4SOIm; diff --git a/src/spicelib/devices/bsimsoi/b4soipzld.c b/src/spicelib/devices/bsimsoi/b4soipzld.c index 5418e51cb..51362257a 100644 --- a/src/spicelib/devices/bsimsoi/b4soipzld.c +++ b/src/spicelib/devices/bsimsoi/b4soipzld.c @@ -42,7 +42,7 @@ double m; for (; model != NULL; model = B4SOInextModel(model)) { for (here = B4SOIinstances(model); here!= NULL; - here = here->B4SOInextInstance) + here = B4SOInextInstance(here)) { if (here->B4SOImode >= 0) { Gm = here->B4SOIgm; diff --git a/src/spicelib/devices/bsimsoi/b4soiset.c b/src/spicelib/devices/bsimsoi/b4soiset.c index 8c501ca3b..7ef46e136 100644 --- a/src/spicelib/devices/bsimsoi/b4soiset.c +++ b/src/spicelib/devices/bsimsoi/b4soiset.c @@ -2102,7 +2102,7 @@ B4SOIinstance **InstArray; model->B4SOIpvoffcv = 0.0; /* loop through all the instances of the model */ for (here = B4SOIinstances(model); here != NULL ; - here=here->B4SOInextInstance) + here=B4SOInextInstance(here)) { /* allocate a chunk of the state vector */ here->B4SOIstates = *states; *states += B4SOInumStates; @@ -2729,7 +2729,7 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL { /* loop through all the instances of the model */ for (here = B4SOIinstances(model); here != NULL ; - here=here->B4SOInextInstance) + here=B4SOInextInstance(here)) { InstCount++; } @@ -2741,7 +2741,7 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL { /* loop through all the instances of the model */ for (here = B4SOIinstances(model); here != NULL ; - here=here->B4SOInextInstance) + here=B4SOInextInstance(here)) { InstArray[idx] = here; idx++; @@ -2768,7 +2768,7 @@ B4SOIunsetup( model = B4SOInextModel(model)) { for (here = B4SOIinstances(model); here != NULL; - here=here->B4SOInextInstance) + here=B4SOInextInstance(here)) { /* here for debugging purpose only */ if (here->B4SOIqjdNode > 0) diff --git a/src/spicelib/devices/bsimsoi/b4soisoachk.c b/src/spicelib/devices/bsimsoi/b4soisoachk.c index 573dab0d9..44a77f40e 100644 --- a/src/spicelib/devices/bsimsoi/b4soisoachk.c +++ b/src/spicelib/devices/bsimsoi/b4soisoachk.c @@ -35,7 +35,7 @@ B4SOIsoaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = B4SOInextModel(model)) { - for (here = B4SOIinstances(model); here; here = here->B4SOInextInstance) { + for (here = B4SOIinstances(model); here; here = B4SOInextInstance(here)) { vgs = ckt->CKTrhsOld [here->B4SOIgNode] - ckt->CKTrhsOld [here->B4SOIsNodePrime]; diff --git a/src/spicelib/devices/bsimsoi/b4soitemp.c b/src/spicelib/devices/bsimsoi/b4soitemp.c index 17f03ed7d..c6a1496db 100644 --- a/src/spicelib/devices/bsimsoi/b4soitemp.c +++ b/src/spicelib/devices/bsimsoi/b4soitemp.c @@ -161,7 +161,7 @@ B4SOItemp( /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ for (here = B4SOIinstances(model); here != NULL; - here = here->B4SOInextInstance) + here = B4SOInextInstance(here)) { here->B4SOIrbodyext = here->B4SOIbodySquares * model->B4SOIrbsh; diff --git a/src/spicelib/devices/bsimsoi/b4soitrunc.c b/src/spicelib/devices/bsimsoi/b4soitrunc.c index 529cd599e..1dd9cd64b 100644 --- a/src/spicelib/devices/bsimsoi/b4soitrunc.c +++ b/src/spicelib/devices/bsimsoi/b4soitrunc.c @@ -36,7 +36,7 @@ register B4SOIinstance *here; for (; model != NULL; model = B4SOInextModel(model)) { for (here = B4SOIinstances(model); here != NULL; - here = here->B4SOInextInstance) + here = B4SOInextInstance(here)) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/cap/capacld.c b/src/spicelib/devices/cap/capacld.c index fa7d54a0c..95b1d43ee 100644 --- a/src/spicelib/devices/cap/capacld.c +++ b/src/spicelib/devices/cap/capacld.c @@ -23,7 +23,7 @@ CAPacLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = CAPnextModel(model)) { for( here = CAPinstances(model); here != NULL; - here = here->CAPnextInstance) { + here = CAPnextInstance(here)) { m = here->CAPm; diff --git a/src/spicelib/devices/cap/capdefs.h b/src/spicelib/devices/cap/capdefs.h index 7686d1b27..f5d39d064 100644 --- a/src/spicelib/devices/cap/capdefs.h +++ b/src/spicelib/devices/cap/capdefs.h @@ -19,11 +19,13 @@ Modified: September 2003 Paolo Nenzi /* information to describe each instance */ typedef struct sCAPinstance { - struct sCAPmodel *CAPmodPtr; /* backpointer to model */ - struct sCAPinstance *CAPnextInstance; /* pointer to next instance of - * current model*/ - IFuid CAPname; /* pointer to character string naming this instance */ - int CAPstate; /* pointer to start of capacitor state vector */ + struct GENinstance gen; + +#define CAPmodPtr(inst) ((struct sCAPmodel*)((inst)->gen.GENmodPtr)) +#define CAPnextInstance(inst) ((struct sCAPinstance*)((inst)->gen.GENnextInstance)) +#define CAPname gen.GENname +#define CAPstate gen.GENstate + const int CAPposNode; /* number of positive node of capacitor */ const int CAPnegNode; /* number of negative node of capacitor */ diff --git a/src/spicelib/devices/cap/capdest.c b/src/spicelib/devices/cap/capdest.c index 74871c521..2f772f1ba 100644 --- a/src/spicelib/devices/cap/capdest.c +++ b/src/spicelib/devices/cap/capdest.c @@ -18,7 +18,7 @@ CAPdestroy(GENmodel **inModel) CAPmodel *next_mod = CAPnextModel(mod); CAPinstance *inst = CAPinstances(mod); while (inst) { - CAPinstance *next_inst = inst->CAPnextInstance; + CAPinstance *next_inst = CAPnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/cap/capgetic.c b/src/spicelib/devices/cap/capgetic.c index c7a9e9fff..4e2020a8f 100644 --- a/src/spicelib/devices/cap/capgetic.c +++ b/src/spicelib/devices/cap/capgetic.c @@ -23,7 +23,7 @@ CAPgetic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = CAPnextModel(model)) { - for(here = CAPinstances(model); here ; here = here->CAPnextInstance) { + for(here = CAPinstances(model); here ; here = CAPnextInstance(here)) { if(!here->CAPicGiven) { here->CAPinitCond = diff --git a/src/spicelib/devices/cap/capload.c b/src/spicelib/devices/cap/capload.c index 20916cb75..2b573437a 100644 --- a/src/spicelib/devices/cap/capload.c +++ b/src/spicelib/devices/cap/capload.c @@ -39,7 +39,7 @@ CAPload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CAPinstances(model); here != NULL ; - here=here->CAPnextInstance) { + here=CAPnextInstance(here)) { m = here->CAPm; diff --git a/src/spicelib/devices/cap/cappzld.c b/src/spicelib/devices/cap/cappzld.c index 85fd92999..2153bbd6c 100644 --- a/src/spicelib/devices/cap/cappzld.c +++ b/src/spicelib/devices/cap/cappzld.c @@ -28,7 +28,7 @@ CAPpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = CAPnextModel(model)) { for( here = CAPinstances(model);here != NULL; - here = here->CAPnextInstance) { + here = CAPnextInstance(here)) { val = here->CAPcapac; m = here->CAPm; diff --git a/src/spicelib/devices/cap/capsacl.c b/src/spicelib/devices/cap/capsacl.c index 1067da668..960874953 100644 --- a/src/spicelib/devices/cap/capsacl.c +++ b/src/spicelib/devices/cap/capsacl.c @@ -35,7 +35,7 @@ CAPsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CAPinstances(model); here != NULL ; - here=here->CAPnextInstance) { + here=CAPnextInstance(here)) { if(here->CAPsenParmNo){ vcap = *(ckt->CKTrhsOld+here->CAPposNode) - diff --git a/src/spicelib/devices/cap/capsetup.c b/src/spicelib/devices/cap/capsetup.c index c2230cb9b..cff407cfc 100644 --- a/src/spicelib/devices/cap/capsetup.c +++ b/src/spicelib/devices/cap/capsetup.c @@ -89,7 +89,7 @@ CAPsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = CAPinstances(model); here != NULL ; - here=here->CAPnextInstance) { + here=CAPnextInstance(here)) { /* Default Value Processing for Capacitor Instance */ if (!here->CAPlengthGiven) { diff --git a/src/spicelib/devices/cap/capsload.c b/src/spicelib/devices/cap/capsload.c index fab1468e9..e0e3bee35 100644 --- a/src/spicelib/devices/cap/capsload.c +++ b/src/spicelib/devices/cap/capsload.c @@ -56,7 +56,7 @@ CAPsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CAPinstances(model); here != NULL ; - here=here->CAPnextInstance) { + here=CAPnextInstance(here)) { #ifdef SENSDEBUG printf("senload instance name %s\n",here->CAPname); diff --git a/src/spicelib/devices/cap/capsoachk.c b/src/spicelib/devices/cap/capsoachk.c index bf40f8a84..38615b4a4 100644 --- a/src/spicelib/devices/cap/capsoachk.c +++ b/src/spicelib/devices/cap/capsoachk.c @@ -30,7 +30,7 @@ CAPsoaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = CAPnextModel(model)) { - for (here = CAPinstances(model); here; here = here->CAPnextInstance) { + for (here = CAPinstances(model); here; here = CAPnextInstance(here)) { vc = fabs(ckt->CKTrhsOld [here->CAPposNode] - ckt->CKTrhsOld [here->CAPnegNode]); diff --git a/src/spicelib/devices/cap/capsprt.c b/src/spicelib/devices/cap/capsprt.c index 8a2042f48..371114bed 100644 --- a/src/spicelib/devices/cap/capsprt.c +++ b/src/spicelib/devices/cap/capsprt.c @@ -34,7 +34,7 @@ CAPsPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CAPinstances(model); here != NULL ; - here=here->CAPnextInstance) { + here=CAPnextInstance(here)) { printf(" Instance name:%s\n",here->CAPname); printf(" Positive, negative nodes: %s, %s\n", diff --git a/src/spicelib/devices/cap/capsset.c b/src/spicelib/devices/cap/capsset.c index a707a043b..0d2743824 100644 --- a/src/spicelib/devices/cap/capsset.c +++ b/src/spicelib/devices/cap/capsset.c @@ -32,7 +32,7 @@ CAPsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = CAPinstances(model); here != NULL ; - here=here->CAPnextInstance) { + here=CAPnextInstance(here)) { if(here->CAPsenParmNo){ here->CAPsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/cap/capsupd.c b/src/spicelib/devices/cap/capsupd.c index 1ba304a90..9c7f8d917 100644 --- a/src/spicelib/devices/cap/capsupd.c +++ b/src/spicelib/devices/cap/capsupd.c @@ -44,7 +44,7 @@ CAPsUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CAPinstances(model); here != NULL ; - here=here->CAPnextInstance) { + here=CAPnextInstance(here)) { vcap = *(ckt->CKTrhsOld+here->CAPposNode) - *(ckt->CKTrhsOld+here->CAPnegNode) ; diff --git a/src/spicelib/devices/cap/captemp.c b/src/spicelib/devices/cap/captemp.c index 95fce3255..a19869c0f 100644 --- a/src/spicelib/devices/cap/captemp.c +++ b/src/spicelib/devices/cap/captemp.c @@ -33,7 +33,7 @@ CAPtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CAPinstances(model); here != NULL ; - here=here->CAPnextInstance) { + here=CAPnextInstance(here)) { /* Default Value Processing for Capacitor Instance */ if(!here->CAPtempGiven) { diff --git a/src/spicelib/devices/cap/captrunc.c b/src/spicelib/devices/cap/captrunc.c index eabc656b5..4a1116b9a 100644 --- a/src/spicelib/devices/cap/captrunc.c +++ b/src/spicelib/devices/cap/captrunc.c @@ -21,7 +21,7 @@ CAPtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) for( ; model!= NULL; model = CAPnextModel(model)) { for(here = CAPinstances(model) ; here != NULL ; - here = here->CAPnextInstance) { + here = CAPnextInstance(here)) { CKTterr(here->CAPqcap,ckt,timeStep); } diff --git a/src/spicelib/devices/cccs/cccsdefs.h b/src/spicelib/devices/cccs/cccsdefs.h index bc78902ef..c9f972781 100644 --- a/src/spicelib/devices/cccs/cccsdefs.h +++ b/src/spicelib/devices/cccs/cccsdefs.h @@ -16,11 +16,12 @@ Author: 1985 Thomas L. Quarles /* information needed for each instance */ typedef struct sCCCSinstance { - struct sCCCSmodel *CCCSmodPtr; /* backpointer to model */ - struct sCCCSinstance *CCCSnextInstance; /* pointer to next instance of - *current model*/ - IFuid CCCSname; /* pointer to character string naming this instance */ - int CCCSstate; /* not used */ + struct GENinstance gen; + +#define CCCSmodPtr(inst) ((struct sCCCSmodel*)((inst)->gen.GENmodPtr)) +#define CCCSnextInstance(inst) ((struct sCCCSinstance*)((inst)->gen.GENnextInstance)) +#define CCCSname gen.GENname +#define CCCSstate gen.GENstate const int CCCSposNode; /* number of positive node of source */ const int CCCSnegNode; /* number of negative node of source */ diff --git a/src/spicelib/devices/cccs/cccsdest.c b/src/spicelib/devices/cccs/cccsdest.c index 9721392ed..0d3f5fd44 100644 --- a/src/spicelib/devices/cccs/cccsdest.c +++ b/src/spicelib/devices/cccs/cccsdest.c @@ -17,7 +17,7 @@ CCCSdestroy(GENmodel **inModel) CCCSmodel *next_mod = CCCSnextModel(mod); CCCSinstance *inst = CCCSinstances(mod); while (inst) { - CCCSinstance *next_inst = inst->CCCSnextInstance; + CCCSinstance *next_inst = CCCSnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/cccs/cccsload.c b/src/spicelib/devices/cccs/cccsload.c index ad8179edb..649c6369e 100644 --- a/src/spicelib/devices/cccs/cccsload.c +++ b/src/spicelib/devices/cccs/cccsload.c @@ -30,7 +30,7 @@ CCCSload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CCCSinstances(model); here != NULL ; - here=here->CCCSnextInstance) { + here=CCCSnextInstance(here)) { *(here->CCCSposContBrPtr) += here->CCCScoeff ; *(here->CCCSnegContBrPtr) -= here->CCCScoeff ; diff --git a/src/spicelib/devices/cccs/cccspzld.c b/src/spicelib/devices/cccs/cccspzld.c index 4605cb885..fdab74d59 100644 --- a/src/spicelib/devices/cccs/cccspzld.c +++ b/src/spicelib/devices/cccs/cccspzld.c @@ -32,7 +32,7 @@ CCCSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for (here = CCCSinstances(model); here != NULL ; - here=here->CCCSnextInstance) { + here=CCCSnextInstance(here)) { *(here->CCCSposContBrPtr) += here->CCCScoeff ; *(here->CCCSnegContBrPtr) -= here->CCCScoeff ; diff --git a/src/spicelib/devices/cccs/cccssacl.c b/src/spicelib/devices/cccs/cccssacl.c index d7a57c53a..9528614b3 100644 --- a/src/spicelib/devices/cccs/cccssacl.c +++ b/src/spicelib/devices/cccs/cccssacl.c @@ -30,7 +30,7 @@ CCCSsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CCCSinstances(model); here != NULL ; - here=here->CCCSnextInstance) { + here=CCCSnextInstance(here)) { if(here->CCCSsenParmNo){ diff --git a/src/spicelib/devices/cccs/cccsset.c b/src/spicelib/devices/cccs/cccsset.c index 5c5e0ba3b..0999a9880 100644 --- a/src/spicelib/devices/cccs/cccsset.c +++ b/src/spicelib/devices/cccs/cccsset.c @@ -31,7 +31,7 @@ CCCSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = CCCSinstances(model); here != NULL ; - here=here->CCCSnextInstance) { + here=CCCSnextInstance(here)) { here->CCCScontBranch = CKTfndBranch(ckt,here->CCCScontName); if(here->CCCScontBranch == 0) { diff --git a/src/spicelib/devices/cccs/cccssld.c b/src/spicelib/devices/cccs/cccssld.c index ead9584b8..1fa64b0ca 100644 --- a/src/spicelib/devices/cccs/cccssld.c +++ b/src/spicelib/devices/cccs/cccssld.c @@ -29,7 +29,7 @@ CCCSsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CCCSinstances(model); here != NULL ; - here=here->CCCSnextInstance) { + here=CCCSnextInstance(here)) { if(here->CCCSsenParmNo){ ic = *(ckt->CKTrhsOld + here->CCCScontBranch); diff --git a/src/spicelib/devices/cccs/cccssprt.c b/src/spicelib/devices/cccs/cccssprt.c index 5409f4a04..955da2ed7 100644 --- a/src/spicelib/devices/cccs/cccssprt.c +++ b/src/spicelib/devices/cccs/cccssprt.c @@ -31,7 +31,7 @@ CCCSsPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CCCSinstances(model); here != NULL ; - here=here->CCCSnextInstance) { + here=CCCSnextInstance(here)) { printf(" Instance name:%s\n",here->CCCSname); printf(" Positive, negative nodes: %s, %s\n", diff --git a/src/spicelib/devices/cccs/cccssset.c b/src/spicelib/devices/cccs/cccssset.c index 18319f7b4..0b13a21e7 100644 --- a/src/spicelib/devices/cccs/cccssset.c +++ b/src/spicelib/devices/cccs/cccssset.c @@ -28,7 +28,7 @@ CCCSsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = CCCSinstances(model); here != NULL ; - here=here->CCCSnextInstance) { + here=CCCSnextInstance(here)) { if(here->CCCSsenParmNo){ here->CCCSsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/ccvs/ccvsdefs.h b/src/spicelib/devices/ccvs/ccvsdefs.h index e33a7eb7f..b5c9a9010 100644 --- a/src/spicelib/devices/ccvs/ccvsdefs.h +++ b/src/spicelib/devices/ccvs/ccvsdefs.h @@ -16,11 +16,12 @@ Author: 1985 Thomas L. Quarles /* information used to describe a single instance */ typedef struct sCCVSinstance { - struct sCCVSmodel *CCVSmodPtr; /* backpointer to model */ - struct sCCVSinstance *CCVSnextInstance; /* pointer to next instance of - *current model*/ - IFuid CCVSname; /* pointer to character string naming this instance */ - int CCVSstate; /* not used */ + struct GENinstance gen; + +#define CCVSmodPtr(inst) ((struct sCCVSmodel*)((inst)->gen.GENmodPtr)) +#define CCVSnextInstance(inst) ((struct sCCVSinstance*)((inst)->gen.GENnextInstance)) +#define CCVSname gen.GENname +#define CCVSstate gen.GENstate const int CCVSposNode; /* number of positive node of source */ const int CCVSnegNode; /* number of negative node of source */ diff --git a/src/spicelib/devices/ccvs/ccvsdest.c b/src/spicelib/devices/ccvs/ccvsdest.c index c32ef9fdb..225b43ef2 100644 --- a/src/spicelib/devices/ccvs/ccvsdest.c +++ b/src/spicelib/devices/ccvs/ccvsdest.c @@ -17,7 +17,7 @@ CCVSdestroy(GENmodel **inModel) CCVSmodel *next_mod = CCVSnextModel(mod); CCVSinstance *inst = CCVSinstances(mod); while (inst) { - CCVSinstance *next_inst = inst->CCVSnextInstance; + CCVSinstance *next_inst = CCVSnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/ccvs/ccvsfbr.c b/src/spicelib/devices/ccvs/ccvsfbr.c index 1a5e35bbc..e7d211a35 100644 --- a/src/spicelib/devices/ccvs/ccvsfbr.c +++ b/src/spicelib/devices/ccvs/ccvsfbr.c @@ -22,7 +22,7 @@ CCVSfindBr(CKTcircuit *ckt, GENmodel *inModel, IFuid name) for( ; model != NULL; model = CCVSnextModel(model)) { for (here = CCVSinstances(model); here != NULL; - here = here->CCVSnextInstance) { + here = CCVSnextInstance(here)) { if(here->CCVSname == name) { if(here->CCVSbranch == 0) { error = CKTmkCur(ckt,&tmp, here->CCVSname,"branch"); diff --git a/src/spicelib/devices/ccvs/ccvsload.c b/src/spicelib/devices/ccvs/ccvsload.c index 3c98f301e..09e9150a9 100644 --- a/src/spicelib/devices/ccvs/ccvsload.c +++ b/src/spicelib/devices/ccvs/ccvsload.c @@ -30,7 +30,7 @@ CCVSload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CCVSinstances(model); here != NULL ; - here=here->CCVSnextInstance) { + here=CCVSnextInstance(here)) { *(here->CCVSposIbrPtr) += 1.0 ; *(here->CCVSnegIbrPtr) -= 1.0 ; diff --git a/src/spicelib/devices/ccvs/ccvspzld.c b/src/spicelib/devices/ccvs/ccvspzld.c index fa3ae730a..f7ea55997 100644 --- a/src/spicelib/devices/ccvs/ccvspzld.c +++ b/src/spicelib/devices/ccvs/ccvspzld.c @@ -32,7 +32,7 @@ CCVSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for (here = CCVSinstances(model); here != NULL ; - here=here->CCVSnextInstance) { + here=CCVSnextInstance(here)) { *(here->CCVSposIbrPtr) += 1.0 ; *(here->CCVSnegIbrPtr) -= 1.0 ; diff --git a/src/spicelib/devices/ccvs/ccvssacl.c b/src/spicelib/devices/ccvs/ccvssacl.c index ba44fd354..7311e2283 100644 --- a/src/spicelib/devices/ccvs/ccvssacl.c +++ b/src/spicelib/devices/ccvs/ccvssacl.c @@ -28,7 +28,7 @@ CCVSsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CCVSinstances(model); here != NULL ; - here=here->CCVSnextInstance) { + here=CCVSnextInstance(here)) { if(here->CCVSsenParmNo){ ic = *(ckt->CKTrhsOld + here->CCVScontBranch); diff --git a/src/spicelib/devices/ccvs/ccvsset.c b/src/spicelib/devices/ccvs/ccvsset.c index 50b6d5c32..7b09cc0ff 100644 --- a/src/spicelib/devices/ccvs/ccvsset.c +++ b/src/spicelib/devices/ccvs/ccvsset.c @@ -29,7 +29,7 @@ CCVSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = CCVSinstances(model); here != NULL ; - here=here->CCVSnextInstance) { + here=CCVSnextInstance(here)) { if(here->CCVSposNode == here->CCVSnegNode) { SPfrontEnd->IFerrorf (ERR_FATAL, @@ -75,7 +75,7 @@ CCVSunsetup(GENmodel *inModel, CKTcircuit *ckt) model = CCVSnextModel(model)) { for (here = CCVSinstances(model); here != NULL; - here=here->CCVSnextInstance) + here=CCVSnextInstance(here)) { if (here->CCVSbranch) { CKTdltNNum(ckt, here->CCVSbranch); diff --git a/src/spicelib/devices/ccvs/ccvssld.c b/src/spicelib/devices/ccvs/ccvssld.c index 65289822e..541cf4acf 100644 --- a/src/spicelib/devices/ccvs/ccvssld.c +++ b/src/spicelib/devices/ccvs/ccvssld.c @@ -28,7 +28,7 @@ CCVSsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CCVSinstances(model); here != NULL ; - here=here->CCVSnextInstance) { + here=CCVSnextInstance(here)) { if(here->CCVSsenParmNo){ ic = *(ckt->CKTrhsOld + here->CCVScontBranch); diff --git a/src/spicelib/devices/ccvs/ccvssprt.c b/src/spicelib/devices/ccvs/ccvssprt.c index d16d05881..e27851ee8 100644 --- a/src/spicelib/devices/ccvs/ccvssprt.c +++ b/src/spicelib/devices/ccvs/ccvssprt.c @@ -30,7 +30,7 @@ CCVSsPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CCVSinstances(model); here != NULL ; - here=here->CCVSnextInstance) { + here=CCVSnextInstance(here)) { printf(" Instance name:%s\n",here->CCVSname); printf(" Positive, negative nodes: %s, %s\n", diff --git a/src/spicelib/devices/ccvs/ccvssset.c b/src/spicelib/devices/ccvs/ccvssset.c index 76b82c6b8..7ff9ea1df 100644 --- a/src/spicelib/devices/ccvs/ccvssset.c +++ b/src/spicelib/devices/ccvs/ccvssset.c @@ -27,7 +27,7 @@ CCVSsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = CCVSinstances(model); here != NULL ; - here=here->CCVSnextInstance) { + here=CCVSnextInstance(here)) { if(here->CCVSsenParmNo){ here->CCVSsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/cpl/cpldefs.h b/src/spicelib/devices/cpl/cpldefs.h index 923300ab9..f096765a3 100644 --- a/src/spicelib/devices/cpl/cpldefs.h +++ b/src/spicelib/devices/cpl/cpldefs.h @@ -16,12 +16,12 @@ reserved. /* information used to describe a single instance */ typedef struct sCPLinstance { - struct sCPLmodel *CPLmodPtr; /* backpointer to model */ - struct sCPLinstance *CPLnextInstance; /* pointer to next instance of - * current model*/ + struct GENinstance gen; - IFuid CPLname; /* pointer to character string naming this instance */ - int CPLstate; /* not used */ +#define CPLmodPtr(inst) ((struct sCPLmodel*)((inst)->gen.GENmodPtr)) +#define CPLnextInstance(inst) ((struct sCPLinstance*)((inst)->gen.GENnextInstance)) +#define CPLname gen.GENname +#define CPLstate gen.GENstate int *CPLposNodes; int *CPLnegNodes; diff --git a/src/spicelib/devices/cpl/cpldest.c b/src/spicelib/devices/cpl/cpldest.c index 375c55df9..2e2469c4d 100644 --- a/src/spicelib/devices/cpl/cpldest.c +++ b/src/spicelib/devices/cpl/cpldest.c @@ -18,7 +18,7 @@ CPLdestroy(GENmodel **inModel) CPLmodel *next_mod = CPLnextModel(mod); CPLinstance *inst = CPLinstances(mod); while (inst) { - CPLinstance *next_inst = inst->CPLnextInstance; + CPLinstance *next_inst = CPLnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/cpl/cplload.c b/src/spicelib/devices/cpl/cplload.c index 3402ebaab..51d3861ed 100644 --- a/src/spicelib/devices/cpl/cplload.c +++ b/src/spicelib/devices/cpl/cplload.c @@ -72,7 +72,7 @@ CPLload(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = CPLnextModel(model) ) { for (here = CPLinstances(model); here != NULL ; - here=here->CPLnextInstance) { + here=CPLnextInstance(here)) { cp = here->cplines; @@ -127,7 +127,7 @@ CPLload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CPLinstances(model); here != NULL ; - here=here->CPLnextInstance) { + here=CPLnextInstance(here)) { double mintaul = 123456789.0; @@ -157,7 +157,7 @@ CPLload(GENmodel *inModel, CKTcircuit *ckt) for (m = 0; m < noL; m++) { if (here->CPLlengthGiven) g = model->Rm[resindex] * here->CPLlength; - else g = model->Rm[resindex] * here->CPLmodPtr->length; + else g = model->Rm[resindex] * CPLmodPtr(here)->length; *(here->CPLposIbr1Ptr[m]) += 1.0; *(here->CPLnegIbr2Ptr[m]) += 1.0; *(here->CPLibr1Ibr1Ptr[m]) += 1.0; diff --git a/src/spicelib/devices/cpl/cplsetup.c b/src/spicelib/devices/cpl/cplsetup.c index 30ab21924..30c5d8e18 100644 --- a/src/spicelib/devices/cpl/cplsetup.c +++ b/src/spicelib/devices/cpl/cplsetup.c @@ -177,7 +177,7 @@ CPLsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) /* loop through all the instances of the model */ for (here = CPLinstances(model); here != NULL ; - here=here->CPLnextInstance) { + here=CPLnextInstance(here)) { if (!here->CPLlengthGiven) here->CPLlength=0.0; @@ -301,7 +301,7 @@ CPLunsetup(GENmodel *inModel, CKTcircuit *ckt) for (model = (CPLmodel *) inModel; model != NULL; model = CPLnextModel(model)) { for (here = CPLinstances(model); here != NULL; - here = here->CPLnextInstance) { + here = CPLnextInstance(here)) { noL = here->dimension; @@ -418,18 +418,18 @@ ReadCpL(CPLinstance *here, CKTcircuit *ckt) C_m[i][j] = C_m[j][i]; L_m[i][j] = L_m[j][i]; } else { - f = here->CPLmodPtr->Rm[counter]; - R_m[i][j] = here->CPLmodPtr->Rm[counter] = MAX(f, 1.0e-4); - G_m[i][j] = here->CPLmodPtr->Gm[counter]; - L_m[i][j] = here->CPLmodPtr->Lm[counter]; - C_m[i][j] = here->CPLmodPtr->Cm[counter]; + f = CPLmodPtr(here)->Rm[counter]; + R_m[i][j] = CPLmodPtr(here)->Rm[counter] = MAX(f, 1.0e-4); + G_m[i][j] = CPLmodPtr(here)->Gm[counter]; + L_m[i][j] = CPLmodPtr(here)->Lm[counter]; + C_m[i][j] = CPLmodPtr(here)->Cm[counter]; counter++; } } } if (here->CPLlengthGiven) length = here->CPLlength; - else length = here->CPLmodPtr->length; + else length = CPLmodPtr(here)->length; for (i = 0; i < noL; i++) lines[i]->g = 1.0 / (R_m[i][i] * length); diff --git a/src/spicelib/devices/csw/cswacld.c b/src/spicelib/devices/csw/cswacld.c index 529f3b916..de2a2def8 100644 --- a/src/spicelib/devices/csw/cswacld.c +++ b/src/spicelib/devices/csw/cswacld.c @@ -30,7 +30,7 @@ CSWacLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CSWinstances(model); here != NULL ; - here=here->CSWnextInstance) { + here=CSWnextInstance(here)) { current_state = (int)*(ckt->CKTstate0 + here->CSWstate); diff --git a/src/spicelib/devices/csw/cswdefs.h b/src/spicelib/devices/csw/cswdefs.h index 1f2d97656..e552ff0e1 100644 --- a/src/spicelib/devices/csw/cswdefs.h +++ b/src/spicelib/devices/csw/cswdefs.h @@ -19,11 +19,12 @@ Modified: 2000 AlansFixes /* information to describe each instance */ typedef struct sCSWinstance { - struct sCSWmodel *CSWmodPtr; /* backpointer to model */ - struct sCSWinstance *CSWnextInstance; /* pointer to next instance of - * current model*/ - IFuid CSWname; /* pointer to character string naming this instance */ - int CSWstate; /* pointer to start of switch's section of state vector */ + struct GENinstance gen; + +#define CSWmodPtr(inst) ((struct sCSWmodel*)((inst)->gen.GENmodPtr)) +#define CSWnextInstance(inst) ((struct sCSWinstance*)((inst)->gen.GENnextInstance)) +#define CSWname gen.GENname +#define CSWstate gen.GENstate const int CSWposNode; /* number of positive node of switch */ const int CSWnegNode; /* number of negative node of switch */ diff --git a/src/spicelib/devices/csw/cswdest.c b/src/spicelib/devices/csw/cswdest.c index 9059653eb..b9a80044d 100644 --- a/src/spicelib/devices/csw/cswdest.c +++ b/src/spicelib/devices/csw/cswdest.c @@ -17,7 +17,7 @@ CSWdestroy(GENmodel **inModel) CSWmodel *next_mod = CSWnextModel(mod); CSWinstance *inst = CSWinstances(mod); while (inst) { - CSWinstance *next_inst = inst->CSWnextInstance; + CSWinstance *next_inst = CSWnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/csw/cswload.c b/src/spicelib/devices/csw/cswload.c index cc59c3a48..74789e55e 100644 --- a/src/spicelib/devices/csw/cswload.c +++ b/src/spicelib/devices/csw/cswload.c @@ -35,7 +35,7 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = CSWinstances(model); here != NULL ; - here=here->CSWnextInstance) { + here=CSWnextInstance(here)) { old_current_state = *(ckt->CKTstates[0] + here->CSWstate); previous_state = *(ckt->CKTstates[1] + here->CSWstate); diff --git a/src/spicelib/devices/csw/cswnoise.c b/src/spicelib/devices/csw/cswnoise.c index 1c79472c2..81c4700e7 100644 --- a/src/spicelib/devices/csw/cswnoise.c +++ b/src/spicelib/devices/csw/cswnoise.c @@ -37,7 +37,7 @@ CSWnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *d for (model=firstModel; model != NULL; model=CSWnextModel(model)) { - for (inst=CSWinstances(model); inst != NULL; inst=inst->CSWnextInstance) { + for (inst=CSWinstances(model); inst != NULL; inst=CSWnextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/csw/cswpzld.c b/src/spicelib/devices/csw/cswpzld.c index d4253075f..95cf972b0 100644 --- a/src/spicelib/devices/csw/cswpzld.c +++ b/src/spicelib/devices/csw/cswpzld.c @@ -34,7 +34,7 @@ CSWpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for (here = CSWinstances(model); here != NULL ; - here=here->CSWnextInstance) { + here=CSWnextInstance(here)) { current_state = (int)*(ckt->CKTstate0 + here->CSWstate); diff --git a/src/spicelib/devices/csw/cswsetup.c b/src/spicelib/devices/csw/cswsetup.c index ee95f18c7..4bc86b025 100644 --- a/src/spicelib/devices/csw/cswsetup.c +++ b/src/spicelib/devices/csw/cswsetup.c @@ -42,7 +42,7 @@ CSWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = CSWinstances(model); here != NULL ; - here=here->CSWnextInstance) { + here=CSWnextInstance(here)) { /* Default Value Processing for Switch Instance */ here->CSWstate = *states; diff --git a/src/spicelib/devices/csw/cswtrunc.c b/src/spicelib/devices/csw/cswtrunc.c index 394aca753..ec41a311b 100644 --- a/src/spicelib/devices/csw/cswtrunc.c +++ b/src/spicelib/devices/csw/cswtrunc.c @@ -23,7 +23,7 @@ CSWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) for( ; model!= NULL; model = CSWnextModel(model)) { for(here = CSWinstances(model) ; here != NULL ; - here = here->CSWnextInstance) { + here = CSWnextInstance(here)) { lastChange = *(ckt->CKTstate0+(here->CSWstate+1)) - *(ckt->CKTstate1+(here->CSWstate+1)); if (*(ckt->CKTstate0+(here->CSWstate))==0) { diff --git a/src/spicelib/devices/dio/dioacld.c b/src/spicelib/devices/dio/dioacld.c index 8b330381c..3e2e8348b 100644 --- a/src/spicelib/devices/dio/dioacld.c +++ b/src/spicelib/devices/dio/dioacld.c @@ -27,7 +27,7 @@ DIOacLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { gspr=here->DIOtConductance*here->DIOarea; geq= *(ckt->CKTstate0 + here->DIOconduct); xceq= *(ckt->CKTstate0 + here->DIOcapCurrent) * ckt->CKTomega; diff --git a/src/spicelib/devices/dio/dioconv.c b/src/spicelib/devices/dio/dioconv.c index a78e7c151..2d95267c0 100644 --- a/src/spicelib/devices/dio/dioconv.c +++ b/src/spicelib/devices/dio/dioconv.c @@ -26,7 +26,7 @@ DIOconvTest(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { /* * initialization diff --git a/src/spicelib/devices/dio/diodefs.h b/src/spicelib/devices/dio/diodefs.h index 5992e2911..aea5fbe2c 100644 --- a/src/spicelib/devices/dio/diodefs.h +++ b/src/spicelib/devices/dio/diodefs.h @@ -18,11 +18,13 @@ Modified by Paolo Nenzi 2003 and Dietmar Warning 2012 /* information needed per instance */ typedef struct sDIOinstance { - struct sDIOmodel *DIOmodPtr; /* backpointer to model */ - struct sDIOinstance *DIOnextInstance; /* pointer to next instance of - * current model*/ - IFuid DIOname; /* pointer to character string naming this instance */ - int DIOstate; /* pointer to start of state vector for diode */ + struct GENinstance gen; + +#define DIOmodPtr(inst) ((struct sDIOmodel*)((inst)->gen.GENmodPtr)) +#define DIOnextInstance(inst) ((struct sDIOinstance*)((inst)->gen.GENnextInstance)) +#define DIOname gen.GENname +#define DIOstate gen.GENstate + const int DIOposNode; /* number of positive node of diode */ const int DIOnegNode; /* number of negative node of diode */ int DIOposPrimeNode; /* number of positive prime node of diode */ diff --git a/src/spicelib/devices/dio/diodest.c b/src/spicelib/devices/dio/diodest.c index 5b84f6f3c..549fcf433 100644 --- a/src/spicelib/devices/dio/diodest.c +++ b/src/spicelib/devices/dio/diodest.c @@ -17,7 +17,7 @@ DIOdestroy(GENmodel **inModel) DIOmodel *next_mod = DIOnextModel(mod); DIOinstance *inst = DIOinstances(mod); while (inst) { - DIOinstance *next_inst = inst->DIOnextInstance; + DIOinstance *next_inst = DIOnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/dio/diodisto.c b/src/spicelib/devices/dio/diodisto.c index f708927b7..64d1f535c 100644 --- a/src/spicelib/devices/dio/diodisto.c +++ b/src/spicelib/devices/dio/diodisto.c @@ -41,7 +41,7 @@ for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { /* loading starts here */ diff --git a/src/spicelib/devices/dio/diodset.c b/src/spicelib/devices/dio/diodset.c index 93ea78ad6..4ac521d6c 100644 --- a/src/spicelib/devices/dio/diodset.c +++ b/src/spicelib/devices/dio/diodset.c @@ -49,7 +49,7 @@ DIOdSetup(DIOmodel *model, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { /* * this routine loads diodes for dc and transient analyses. diff --git a/src/spicelib/devices/dio/diogetic.c b/src/spicelib/devices/dio/diogetic.c index d6cbfcbc4..4a1335cdd 100644 --- a/src/spicelib/devices/dio/diogetic.c +++ b/src/spicelib/devices/dio/diogetic.c @@ -23,7 +23,7 @@ DIOgetic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = DIOnextModel(model)) { - for(here = DIOinstances(model); here ; here = here->DIOnextInstance) { + for(here = DIOinstances(model); here ; here = DIOnextInstance(here)) { if(!here->DIOinitCondGiven) { here->DIOinitCond = diff --git a/src/spicelib/devices/dio/dioload.c b/src/spicelib/devices/dio/dioload.c index 944a9d269..9943e8c74 100644 --- a/src/spicelib/devices/dio/dioload.c +++ b/src/spicelib/devices/dio/dioload.c @@ -67,7 +67,7 @@ DIOload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { /* * this routine loads diodes for dc and transient analyses. diff --git a/src/spicelib/devices/dio/dionoise.c b/src/spicelib/devices/dio/dionoise.c index 35bd43447..dcdadc4e3 100644 --- a/src/spicelib/devices/dio/dionoise.c +++ b/src/spicelib/devices/dio/dionoise.c @@ -47,7 +47,7 @@ DIOnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, }; for (model=firstModel; model != NULL; model=DIOnextModel(model)) { - for (inst=DIOinstances(model); inst != NULL; inst=inst->DIOnextInstance) { + for (inst=DIOinstances(model); inst != NULL; inst=DIOnextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/dio/diopzld.c b/src/spicelib/devices/dio/diopzld.c index 16a3df20f..58d6ae788 100644 --- a/src/spicelib/devices/dio/diopzld.c +++ b/src/spicelib/devices/dio/diopzld.c @@ -28,7 +28,7 @@ DIOpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { gspr=here->DIOtConductance*here->DIOarea; geq= *(ckt->CKTstate0 + here->DIOconduct); xceq= *(ckt->CKTstate0 + here->DIOcapCurrent); diff --git a/src/spicelib/devices/dio/diosacl.c b/src/spicelib/devices/dio/diosacl.c index e6e13f2d3..b39927fce 100644 --- a/src/spicelib/devices/dio/diosacl.c +++ b/src/spicelib/devices/dio/diosacl.c @@ -76,7 +76,7 @@ DIOsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { /* save the unperturbed values in the state vector */ for(i=0; i <= 4; i++) { diff --git a/src/spicelib/devices/dio/diosetup.c b/src/spicelib/devices/dio/diosetup.c index b6fde6a79..5cb3ea393 100644 --- a/src/spicelib/devices/dio/diosetup.c +++ b/src/spicelib/devices/dio/diosetup.c @@ -162,7 +162,7 @@ DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { if(!here->DIOareaGiven) { if((!here->DIOwGiven) && (!here->DIOlGiven)) { @@ -253,7 +253,7 @@ DIOunsetup( model = DIOnextModel(model)) { for (here = DIOinstances(model); here != NULL; - here=here->DIOnextInstance) + here=DIOnextInstance(here)) { if (here->DIOposPrimeNode > 0 diff --git a/src/spicelib/devices/dio/diosload.c b/src/spicelib/devices/dio/diosload.c index 41d4cab98..8e99ef344 100644 --- a/src/spicelib/devices/dio/diosload.c +++ b/src/spicelib/devices/dio/diosload.c @@ -67,7 +67,7 @@ DIOsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { #ifdef SENSDEBUG fprintf(stdout,"pos = %d , posprm = %d ,neg = %d, senparmno = %d\n", diff --git a/src/spicelib/devices/dio/diosoachk.c b/src/spicelib/devices/dio/diosoachk.c index 710fb533b..410c00996 100644 --- a/src/spicelib/devices/dio/diosoachk.c +++ b/src/spicelib/devices/dio/diosoachk.c @@ -31,7 +31,7 @@ DIOsoaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = DIOnextModel(model)) { - for (here = DIOinstances(model); here; here = here->DIOnextInstance) { + for (here = DIOinstances(model); here; here = DIOnextInstance(here)) { vd = ckt->CKTrhsOld [here->DIOposPrimeNode] - ckt->CKTrhsOld [here->DIOnegNode]; diff --git a/src/spicelib/devices/dio/diosprt.c b/src/spicelib/devices/dio/diosprt.c index 90e0a5d7c..c1e702d1f 100644 --- a/src/spicelib/devices/dio/diosprt.c +++ b/src/spicelib/devices/dio/diosprt.c @@ -33,7 +33,7 @@ DIOsPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { printf(" Instance name:%s\n",here->DIOname); printf(" Positive, negative nodes: %s, %s\n", diff --git a/src/spicelib/devices/dio/diosset.c b/src/spicelib/devices/dio/diosset.c index 9c37ee2c4..e329a62e1 100644 --- a/src/spicelib/devices/dio/diosset.c +++ b/src/spicelib/devices/dio/diosset.c @@ -30,7 +30,7 @@ DIOsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { if(here->DIOsenParmNo){ here->DIOsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/dio/diosupd.c b/src/spicelib/devices/dio/diosupd.c index dd35220b4..bc3fe717b 100644 --- a/src/spicelib/devices/dio/diosupd.c +++ b/src/spicelib/devices/dio/diosupd.c @@ -46,7 +46,7 @@ DIOsUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = DIOinstances(model); here != NULL ; - here=here->DIOnextInstance) { + here=DIOnextInstance(here)) { #ifdef SENSDEBUG printf("capd = %.7e \n",here->DIOcap); diff --git a/src/spicelib/devices/dio/diotemp.c b/src/spicelib/devices/dio/diotemp.c index fdc5bdfa3..04afda1bd 100644 --- a/src/spicelib/devices/dio/diotemp.c +++ b/src/spicelib/devices/dio/diotemp.c @@ -70,7 +70,7 @@ DIOtemp(GENmodel *inModel, CKTcircuit *ckt) xfc=log(1-model->DIOdepletionCapCoeff); xfcs=log(1-model->DIOdepletionSWcapCoeff); - for(here=DIOinstances(model);here;here=here->DIOnextInstance) { + for(here=DIOinstances(model);here;here=DIOnextInstance(here)) { double egfet1,arg1,fact1,pbfact1,pbo,gmaold,pboSW,gmaSWold; double fact2,pbfact,arg,egfet,gmanew,gmaSWnew; /* loop through all the instances */ diff --git a/src/spicelib/devices/dio/diotrunc.c b/src/spicelib/devices/dio/diotrunc.c index 1c6880fa3..5c64086f9 100644 --- a/src/spicelib/devices/dio/diotrunc.c +++ b/src/spicelib/devices/dio/diotrunc.c @@ -19,7 +19,7 @@ DIOtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) DIOinstance *here; for( ; model != NULL; model = DIOnextModel(model)) { - for(here=DIOinstances(model);here!=NULL;here = here->DIOnextInstance){ + for(here=DIOinstances(model);here!=NULL;here = DIOnextInstance(here)){ CKTterr(here->DIOcapCharge,ckt,timeStep); } } diff --git a/src/spicelib/devices/hfet1/hfetacl.c b/src/spicelib/devices/hfet1/hfetacl.c index 0ddf3c7e8..e0031f5c9 100644 --- a/src/spicelib/devices/hfet1/hfetacl.c +++ b/src/spicelib/devices/hfet1/hfetacl.c @@ -31,7 +31,7 @@ HFETAacLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = HFETAnextModel(model) ) { for( here = HFETAinstances(model); here != NULL; - here = here->HFETAnextInstance) { + here = HFETAnextInstance(here)) { gm = *(ckt->CKTstate0 + here->HFETAgm); gds = *(ckt->CKTstate0 + here->HFETAgds); diff --git a/src/spicelib/devices/hfet1/hfetdefs.h b/src/spicelib/devices/hfet1/hfetdefs.h index a706a6917..5ecc737dd 100644 --- a/src/spicelib/devices/hfet1/hfetdefs.h +++ b/src/spicelib/devices/hfet1/hfetdefs.h @@ -15,11 +15,13 @@ Modified: Paolo Nenzi #define HFETAnumStates 24 typedef struct sHFETAinstance { - struct sHFETAmodel *HFETAmodPtr; - struct sHFETAinstance *HFETAnextInstance; - IFuid HFETAname; - int HFETAstate; /* index into state table for this device */ - + struct GENinstance gen; + +#define HFETAmodPtr(inst) ((struct sHFETAmodel*)((inst)->gen.GENmodPtr)) +#define HFETAnextInstance(inst) ((struct sHFETAinstance*)((inst)->gen.GENnextInstance)) +#define HFETAname gen.GENname +#define HFETAstate gen.GENstate + const int HFETAdrainNode; const int HFETAgateNode; const int HFETAsourceNode; diff --git a/src/spicelib/devices/hfet1/hfetdest.c b/src/spicelib/devices/hfet1/hfetdest.c index 234c96a49..7225ce137 100644 --- a/src/spicelib/devices/hfet1/hfetdest.c +++ b/src/spicelib/devices/hfet1/hfetdest.c @@ -17,7 +17,7 @@ HFETAdestroy(GENmodel **inModel) HFETAmodel *next_mod = HFETAnextModel(mod); HFETAinstance *inst = HFETAinstances(mod); while (inst) { - HFETAinstance *next_inst = inst->HFETAnextInstance; + HFETAinstance *next_inst = HFETAnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/hfet1/hfetgetic.c b/src/spicelib/devices/hfet1/hfetgetic.c index 5d196681a..26ef89b72 100644 --- a/src/spicelib/devices/hfet1/hfetgetic.c +++ b/src/spicelib/devices/hfet1/hfetgetic.c @@ -21,7 +21,7 @@ HFETAgetic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = HFETAnextModel(model)) { - for(here = HFETAinstances(model); here ; here = here->HFETAnextInstance) { + for(here = HFETAinstances(model); here ; here = HFETAnextInstance(here)) { if(!here->HFETAicVDSGiven) { here->HFETAicVDS = diff --git a/src/spicelib/devices/hfet1/hfetload.c b/src/spicelib/devices/hfet1/hfetload.c index 735f2056b..69c35641b 100644 --- a/src/spicelib/devices/hfet1/hfetload.c +++ b/src/spicelib/devices/hfet1/hfetload.c @@ -88,7 +88,7 @@ int HFETAload(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = HFETAnextModel(model) ) { for (here = HFETAinstances(model); here != NULL ; - here=here->HFETAnextInstance) { + here=HFETAnextInstance(here)) { vcrit = here->HFETAvcrit; vt = CONSTKoverQ * here->HFETAtemp; diff --git a/src/spicelib/devices/hfet1/hfetpzl.c b/src/spicelib/devices/hfet1/hfetpzl.c index ee5b0a5de..3546efcf5 100644 --- a/src/spicelib/devices/hfet1/hfetpzl.c +++ b/src/spicelib/devices/hfet1/hfetpzl.c @@ -34,7 +34,7 @@ HFETApzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = HFETAnextModel(model) ) { for( here = HFETAinstances(model); here != NULL; - here = here->HFETAnextInstance) { + here = HFETAnextInstance(here)) { gm = *(ckt->CKTstate0 + here->HFETAgm); gds = *(ckt->CKTstate0 + here->HFETAgds); diff --git a/src/spicelib/devices/hfet1/hfetsetup.c b/src/spicelib/devices/hfet1/hfetsetup.c index 54cf23eed..a48528a51 100644 --- a/src/spicelib/devices/hfet1/hfetsetup.c +++ b/src/spicelib/devices/hfet1/hfetsetup.c @@ -230,7 +230,7 @@ HFETAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = HFETAinstances(model); here != NULL ; - here=here->HFETAnextInstance) { + here=HFETAnextInstance(here)) { if(!here->HFETAlengthGiven) { here->HFETAlength = 1e-6; @@ -410,7 +410,7 @@ HFETAunsetup(GENmodel *inModel, CKTcircuit *ckt) model = HFETAnextModel(model)) { for (here = HFETAinstances(model); here != NULL; - here=here->HFETAnextInstance) + here=HFETAnextInstance(here)) { if (here->HFETAsourcePrmPrmNode > 0 && here->HFETAsourcePrmPrmNode != here->HFETAsourcePrimeNode) diff --git a/src/spicelib/devices/hfet1/hfettemp.c b/src/spicelib/devices/hfet1/hfettemp.c index 36e06defe..f0c742e3d 100644 --- a/src/spicelib/devices/hfet1/hfettemp.c +++ b/src/spicelib/devices/hfet1/hfettemp.c @@ -57,7 +57,7 @@ HFETAtemp(GENmodel *inModel, CKTcircuit *ckt) IN_VT1 = VTO+CHARGE*NMAX*DI/EPSI; for (here = HFETAinstances(model); here != NULL ; - here=here->HFETAnextInstance) { + here=HFETAnextInstance(here)) { if(!here->HFETAdtempGiven) { here->HFETAdtemp = 0.0; diff --git a/src/spicelib/devices/hfet1/hfettrunc.c b/src/spicelib/devices/hfet1/hfettrunc.c index 3e6928e44..7670ddd42 100644 --- a/src/spicelib/devices/hfet1/hfettrunc.c +++ b/src/spicelib/devices/hfet1/hfettrunc.c @@ -17,7 +17,7 @@ HFETAtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) HFETAinstance *here; for( ; model != NULL; model = HFETAnextModel(model)) { - for(here=HFETAinstances(model);here!=NULL;here = here->HFETAnextInstance){ + for(here=HFETAinstances(model);here!=NULL;here = HFETAnextInstance(here)){ CKTterr(here->HFETAqgs,ckt,timeStep); CKTterr(here->HFETAqgd,ckt,timeStep); diff --git a/src/spicelib/devices/hfet2/hfet2acl.c b/src/spicelib/devices/hfet2/hfet2acl.c index 24cd041d3..acb63ea47 100644 --- a/src/spicelib/devices/hfet2/hfet2acl.c +++ b/src/spicelib/devices/hfet2/hfet2acl.c @@ -29,7 +29,7 @@ int HFET2acLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = HFET2nextModel(model) ) { for( here = HFET2instances(model); here != NULL; - here = here->HFET2nextInstance) { + here = HFET2nextInstance(here)) { m = here->HFET2m; diff --git a/src/spicelib/devices/hfet2/hfet2defs.h b/src/spicelib/devices/hfet2/hfet2defs.h index a4b7247f9..8724292b7 100644 --- a/src/spicelib/devices/hfet2/hfet2defs.h +++ b/src/spicelib/devices/hfet2/hfet2defs.h @@ -9,11 +9,13 @@ typedef struct sHFET2instance { - struct sHFET2model *HFET2modPtr; - struct sHFET2instance *HFET2nextInstance; - IFuid HFET2name; - int HFET2state; /* index into state table for this device */ - + struct GENinstance gen; + +#define HFET2modPtr(inst) ((struct sHFET2model*)((inst)->gen.GENmodPtr)) +#define HFET2nextInstance(inst) ((struct sHFET2instance*)((inst)->gen.GENnextInstance)) +#define HFET2name gen.GENname +#define HFET2state gen.GENstate + int HFET2drainNode; int HFET2gateNode; int HFET2sourceNode; diff --git a/src/spicelib/devices/hfet2/hfet2dest.c b/src/spicelib/devices/hfet2/hfet2dest.c index 20182cf01..18e44fa63 100644 --- a/src/spicelib/devices/hfet2/hfet2dest.c +++ b/src/spicelib/devices/hfet2/hfet2dest.c @@ -17,7 +17,7 @@ HFET2destroy(GENmodel **inModel) HFET2model *next_mod = HFET2nextModel(mod); HFET2instance *inst = HFET2instances(mod); while (inst) { - HFET2instance *next_inst = inst->HFET2nextInstance; + HFET2instance *next_inst = HFET2nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/hfet2/hfet2getic.c b/src/spicelib/devices/hfet2/hfet2getic.c index 905749d82..d605d9053 100644 --- a/src/spicelib/devices/hfet2/hfet2getic.c +++ b/src/spicelib/devices/hfet2/hfet2getic.c @@ -17,7 +17,7 @@ int HFET2getic(GENmodel *inModel, CKTcircuit *ckt) HFET2instance *here; for( ; model ; model = HFET2nextModel(model)) { - for(here = HFET2instances(model); here ; here = here->HFET2nextInstance) { + for(here = HFET2instances(model); here ; here = HFET2nextInstance(here)) { if(!here->HFET2icVDSGiven) { here->HFET2icVDS = *(ckt->CKTrhs + here->HFET2drainNode) - diff --git a/src/spicelib/devices/hfet2/hfet2load.c b/src/spicelib/devices/hfet2/hfet2load.c index 1a2bbc0f8..2b09ca3c5 100644 --- a/src/spicelib/devices/hfet2/hfet2load.c +++ b/src/spicelib/devices/hfet2/hfet2load.c @@ -66,7 +66,7 @@ int HFET2load(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = HFET2nextModel(model) ) { for(here = HFET2instances(model); here != NULL; - here=here->HFET2nextInstance) { + here=HFET2nextInstance(here)) { gdpr = model->HFET2drainConduct; gspr = model->HFET2sourceConduct; diff --git a/src/spicelib/devices/hfet2/hfet2pzl.c b/src/spicelib/devices/hfet2/hfet2pzl.c index 24a630fc6..8c25e1e32 100644 --- a/src/spicelib/devices/hfet2/hfet2pzl.c +++ b/src/spicelib/devices/hfet2/hfet2pzl.c @@ -31,7 +31,7 @@ int HFET2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = HFET2nextModel(model) ) { for( here = HFET2instances(model); here != NULL; - here = here->HFET2nextInstance) { + here = HFET2nextInstance(here)) { m = here->HFET2m; diff --git a/src/spicelib/devices/hfet2/hfet2setup.c b/src/spicelib/devices/hfet2/hfet2setup.c index 7998ec540..5d5ebb658 100644 --- a/src/spicelib/devices/hfet2/hfet2setup.c +++ b/src/spicelib/devices/hfet2/hfet2setup.c @@ -121,7 +121,7 @@ int HFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state for (here = HFET2instances(model); here != NULL; - here=here->HFET2nextInstance) { + here=HFET2nextInstance(here)) { CKTnode *tmpNode; IFuid tmpName; @@ -214,7 +214,7 @@ HFET2unsetup(GENmodel *inModel, CKTcircuit *ckt) model = HFET2nextModel(model)) { for (here = HFET2instances(model); here != NULL; - here=here->HFET2nextInstance) + here=HFET2nextInstance(here)) { if (here->HFET2drainPrimeNode > 0 && here->HFET2drainPrimeNode != here->HFET2drainNode) diff --git a/src/spicelib/devices/hfet2/hfet2temp.c b/src/spicelib/devices/hfet2/hfet2temp.c index d804bc8e9..873ccf617 100644 --- a/src/spicelib/devices/hfet2/hfet2temp.c +++ b/src/spicelib/devices/hfet2/hfet2temp.c @@ -37,7 +37,7 @@ CKTcircuit *ckt) VT2 = VTO; DELTA2 = DELTA*DELTA; for (here = HFET2instances(model); here != NULL; - here=here->HFET2nextInstance) { + here=HFET2nextInstance(here)) { if(!here->HFET2dtempGiven) here->HFET2dtemp = 0.0; diff --git a/src/spicelib/devices/hfet2/hfet2trunc.c b/src/spicelib/devices/hfet2/hfet2trunc.c index cbfe31022..abe00f969 100644 --- a/src/spicelib/devices/hfet2/hfet2trunc.c +++ b/src/spicelib/devices/hfet2/hfet2trunc.c @@ -17,7 +17,7 @@ double *tiHFET2tep) for( ; model != NULL; model = HFET2nextModel(model)) { for(here=HFET2instances(model);here!=NULL; - here = here->HFET2nextInstance){ + here = HFET2nextInstance(here)){ CKTterr(here->HFET2qgs,ckt,tiHFET2tep); CKTterr(here->HFET2qgd,ckt,tiHFET2tep); diff --git a/src/spicelib/devices/hisim2/hsm2acld.c b/src/spicelib/devices/hisim2/hsm2acld.c index d13ace236..4de444590 100644 --- a/src/spicelib/devices/hisim2/hsm2acld.c +++ b/src/spicelib/devices/hisim2/hsm2acld.c @@ -111,7 +111,7 @@ int HSM2acLoad( omega = ckt->CKTomega; for ( ; model != NULL; model = HSM2nextModel(model) ) { - for ( here = HSM2instances(model); here!= NULL; here = here->HSM2nextInstance ) { + for ( here = HSM2instances(model); here!= NULL; here = HSM2nextInstance(here) ) { gdpr = here->HSM2drainConductance; gspr = here->HSM2sourceConductance; diff --git a/src/spicelib/devices/hisim2/hsm2cvtest.c b/src/spicelib/devices/hisim2/hsm2cvtest.c index ff2554809..5c072b475 100644 --- a/src/spicelib/devices/hisim2/hsm2cvtest.c +++ b/src/spicelib/devices/hisim2/hsm2cvtest.c @@ -77,7 +77,7 @@ int HSM2convTest( for ( ; model != NULL; model = HSM2nextModel(model) ) { /* loop through all the instances of the model */ for ( here = HSM2instances(model); here != NULL ; - here = here->HSM2nextInstance ) { + here = HSM2nextInstance(here) ) { vbs = model->HSM2_type * (*(ckt->CKTrhsOld+here->HSM2bNode) - *(ckt->CKTrhsOld+here->HSM2sNodePrime)); diff --git a/src/spicelib/devices/hisim2/hsm2def.h b/src/spicelib/devices/hisim2/hsm2def.h index ecf799219..dee49847a 100644 --- a/src/spicelib/devices/hisim2/hsm2def.h +++ b/src/spicelib/devices/hisim2/hsm2def.h @@ -137,11 +137,12 @@ typedef struct sHSM2hereMKSParam { /* information needed for each instance */ typedef struct sHSM2instance { - struct sHSM2model *HSM2modPtr; /* pointer to model */ - struct sHSM2instance *HSM2nextInstance; /* pointer to next instance of - current model*/ - IFuid HSM2name; /* pointer to character string naming this instance */ - int HSM2states; /* index into state table for this device */ + struct GENinstance gen; + +#define HSM2modPtr(inst) ((struct sHSM2model*)((inst)->gen.GENmodPtr)) +#define HSM2nextInstance(inst) ((struct sHSM2instance*)((inst)->gen.GENnextInstance)) +#define HSM2name gen.GENname +#define HSM2states gen.GENstate const int HSM2dNode; /* number of the drain node of the mosfet */ const int HSM2gNode; /* number of the gate node of the mosfet */ diff --git a/src/spicelib/devices/hisim2/hsm2dest.c b/src/spicelib/devices/hisim2/hsm2dest.c index 18c73de39..dc7b5ffde 100644 --- a/src/spicelib/devices/hisim2/hsm2dest.c +++ b/src/spicelib/devices/hisim2/hsm2dest.c @@ -73,7 +73,7 @@ HSM2destroy(GENmodel **inModel) HSM2model *next_mod = HSM2nextModel(mod); HSM2instance *inst = HSM2instances(mod); while (inst) { - HSM2instance *next_inst = inst->HSM2nextInstance; + HSM2instance *next_inst = HSM2nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/hisim2/hsm2getic.c b/src/spicelib/devices/hisim2/hsm2getic.c index 1ff76761c..3e9dd0ef0 100644 --- a/src/spicelib/devices/hisim2/hsm2getic.c +++ b/src/spicelib/devices/hisim2/hsm2getic.c @@ -72,7 +72,7 @@ int HSM2getic( */ for ( ;model ;model = HSM2nextModel(model) ) { - for ( here = HSM2instances(model); here ;here = here->HSM2nextInstance ) { + for ( here = HSM2instances(model); here ;here = HSM2nextInstance(here) ) { if (!here->HSM2_icVBS_Given) { here->HSM2_icVBS = *(ckt->CKTrhs + here->HSM2bNode) - diff --git a/src/spicelib/devices/hisim2/hsm2ld.c b/src/spicelib/devices/hisim2/hsm2ld.c index 350a73305..7bae2b9a4 100644 --- a/src/spicelib/devices/hisim2/hsm2ld.c +++ b/src/spicelib/devices/hisim2/hsm2ld.c @@ -247,7 +247,7 @@ int HSM2load( int HSM2LoadOMP(HSM2instance *here, CKTcircuit *ckt) { - HSM2model *model = here->HSM2modPtr; + HSM2model *model = HSM2modPtr(here); #else HSM2model *model = (HSM2model*)inModel; HSM2instance *here; @@ -317,7 +317,7 @@ tm0 = gtodsecld() ; model->HSM2_bypass_enable = BYPASS_enable ; for (here = HSM2instances(model); here != NULL ; - here = here->HSM2nextInstance) { + here = HSM2nextInstance(here)) { #endif /* pParam = &here->pParam ;*/ showPhysVal = 0; @@ -1502,7 +1502,7 @@ void HSM2LoadRhsMat(GENmodel *inModel, CKTcircuit *ckt) for (idx = 0; idx < InstCount; idx++) { here = InstArray[idx]; - model = here->HSM2modPtr; + model = HSM2modPtr(here); /* Update b for Ax = b */ *(ckt->CKTrhs + here->HSM2dNodePrime) += here->HSM2rhsdPrime; *(ckt->CKTrhs + here->HSM2gNodePrime) -= here->HSM2rhsgPrime; diff --git a/src/spicelib/devices/hisim2/hsm2noi.c b/src/spicelib/devices/hisim2/hsm2noi.c index 951466782..dc5a4da93 100644 --- a/src/spicelib/devices/hisim2/hsm2noi.c +++ b/src/spicelib/devices/hisim2/hsm2noi.c @@ -111,7 +111,7 @@ int HSM2noise ( for ( ;model != NULL; model = HSM2nextModel(model) ) { for ( here = HSM2instances(model); here != NULL; - here = here->HSM2nextInstance ) { + here = HSM2nextInstance(here) ) { switch (operation) { case N_OPEN: /* see if we have to to produce a summary report */ diff --git a/src/spicelib/devices/hisim2/hsm2pzld.c b/src/spicelib/devices/hisim2/hsm2pzld.c index 2ce8dd7bb..e2540d62a 100644 --- a/src/spicelib/devices/hisim2/hsm2pzld.c +++ b/src/spicelib/devices/hisim2/hsm2pzld.c @@ -46,7 +46,7 @@ int HSM2pzLoad( for ( ;model != NULL ;model = HSM2nextModel(model) ) { for ( here = HSM2instances(model) ;here!= NULL ; - here = here->HSM2nextInstance ) { + here = HSM2nextInstance(here) ) { if ( here->HSM2_mode >= 0 ) { gm = here->HSM2_gm; gmbs = here->HSM2_gmbs; diff --git a/src/spicelib/devices/hisim2/hsm2set.c b/src/spicelib/devices/hisim2/hsm2set.c index 24308cd42..e88c5fdd4 100644 --- a/src/spicelib/devices/hisim2/hsm2set.c +++ b/src/spicelib/devices/hisim2/hsm2set.c @@ -812,7 +812,7 @@ int HSM2setup( /* loop through all the instances of the model */ for ( here = HSM2instances(model) ;here != NULL ; - here = here->HSM2nextInstance ) { + here = HSM2nextInstance(here) ) { /* allocate a chunk of the state vector */ here->HSM2states = *states; if (model->HSM2_conqs) @@ -1271,7 +1271,7 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL { /* loop through all the instances of the model */ for (here = HSM2instances(model); here != NULL ; - here = here->HSM2nextInstance) + here = HSM2nextInstance(here)) { InstCount++; } @@ -1283,7 +1283,7 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL { /* loop through all the instances of the model */ for (here = HSM2instances(model); here != NULL ; - here = here->HSM2nextInstance) + here = HSM2nextInstance(here)) { InstArray[idx] = here; idx++; @@ -1310,7 +1310,7 @@ HSM2unsetup( model = HSM2nextModel(model)) { for (here = HSM2instances(model); here != NULL; - here=here->HSM2nextInstance) + here=HSM2nextInstance(here)) { if (here->HSM2sbNode > 0 && here->HSM2sbNode != here->HSM2bNode) diff --git a/src/spicelib/devices/hisim2/hsm2soachk.c b/src/spicelib/devices/hisim2/hsm2soachk.c index 9d77db581..ae12d0f48 100644 --- a/src/spicelib/devices/hisim2/hsm2soachk.c +++ b/src/spicelib/devices/hisim2/hsm2soachk.c @@ -35,7 +35,7 @@ HSM2soaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = HSM2nextModel(model)) { - for (here = HSM2instances(model); here; here = here->HSM2nextInstance) { + for (here = HSM2instances(model); here; here = HSM2nextInstance(here)) { vgs = ckt->CKTrhsOld [here->HSM2gNode] - ckt->CKTrhsOld [here->HSM2sNodePrime]; diff --git a/src/spicelib/devices/hisim2/hsm2temp.c b/src/spicelib/devices/hisim2/hsm2temp.c index e34e0a737..f24400ba0 100644 --- a/src/spicelib/devices/hisim2/hsm2temp.c +++ b/src/spicelib/devices/hisim2/hsm2temp.c @@ -145,7 +145,7 @@ int HSM2temp( modelMKS = &model->modelMKS ; - for ( here = HSM2instances(model); here; here = here->HSM2nextInstance ) { + for ( here = HSM2instances(model); here; here = HSM2nextInstance(here) ) { pParam = &here->pParam ; hereMKS = &here->hereMKS ; diff --git a/src/spicelib/devices/hisim2/hsm2trunc.c b/src/spicelib/devices/hisim2/hsm2trunc.c index 7270a9648..9cc81a904 100644 --- a/src/spicelib/devices/hisim2/hsm2trunc.c +++ b/src/spicelib/devices/hisim2/hsm2trunc.c @@ -73,7 +73,7 @@ int HSM2trunc( for ( ;model != NULL ;model = HSM2nextModel(model) ) { for ( here=HSM2instances(model) ;here!=NULL ; - here = here->HSM2nextInstance ) { + here = HSM2nextInstance(here) ) { #ifdef STEPDEBUG debugtemp = *timeStep; #endif /* STEPDEBUG */ diff --git a/src/spicelib/devices/hisimhv1/hsmhvacld.c b/src/spicelib/devices/hisimhv1/hsmhvacld.c index 0afa1f1ba..72f95f21f 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvacld.c +++ b/src/spicelib/devices/hisimhv1/hsmhvacld.c @@ -50,7 +50,7 @@ int HSMHVacLoad( omega = ckt->CKTomega; for ( ; model != NULL; model = HSMHVnextModel(model) ) { - for ( here = HSMHVinstances(model); here!= NULL; here = here->HSMHVnextInstance ) { + for ( here = HSMHVinstances(model); here!= NULL; here = HSMHVnextInstance(here) ) { flg_nqs = model->HSMHV_conqs ; flg_subNode = here->HSMHVsubNode ; /* if flg_subNode > 0, external(/internal) substrate node exists */ diff --git a/src/spicelib/devices/hisimhv1/hsmhvcvtest.c b/src/spicelib/devices/hisimhv1/hsmhvcvtest.c index af96cdc0a..86a263955 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvcvtest.c +++ b/src/spicelib/devices/hisimhv1/hsmhvcvtest.c @@ -51,7 +51,7 @@ int HSMHVconvTest( for ( ; model != NULL; model = HSMHVnextModel(model) ) { /* loop through all the instances of the model */ for ( here = HSMHVinstances(model); here != NULL ; - here = here->HSMHVnextInstance ) { + here = HSMHVnextInstance(here) ) { vds = model->HSMHV_type * (*(ckt->CKTrhsOld+here->HSMHVdNodePrime) - diff --git a/src/spicelib/devices/hisimhv1/hsmhvdef.h b/src/spicelib/devices/hisimhv1/hsmhvdef.h index 7e5cf1187..3d2fb6a17 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvdef.h +++ b/src/spicelib/devices/hisimhv1/hsmhvdef.h @@ -213,11 +213,12 @@ typedef struct sHSMHVhereMKSParam { /* information needed for each instance */ typedef struct sHSMHVinstance { - struct sHSMHVmodel *HSMHVmodPtr; /* pointer to model */ - struct sHSMHVinstance *HSMHVnextInstance; /* pointer to next instance of - current model*/ - IFuid HSMHVname; /* pointer to character string naming this instance */ - int HSMHVstates; /* index into state table for this device */ + struct GENinstance gen; + +#define HSMHVmodPtr(inst) ((struct sHSMHVmodel*)((inst)->gen.GENmodPtr)) +#define HSMHVnextInstance(inst) ((struct sHSMHVinstance*)((inst)->gen.GENnextInstance)) +#define HSMHVname gen.GENname +#define HSMHVstates gen.GENstate const int HSMHVdNode; /* number of the drain node of the mosfet */ const int HSMHVgNode; /* number of the gate node of the mosfet */ diff --git a/src/spicelib/devices/hisimhv1/hsmhvdest.c b/src/spicelib/devices/hisimhv1/hsmhvdest.c index 9466b275e..9e83fbbcf 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvdest.c +++ b/src/spicelib/devices/hisimhv1/hsmhvdest.c @@ -29,7 +29,7 @@ HSMHVdestroy(GENmodel **inModel) HSMHVmodel *next_mod = HSMHVnextModel(mod); HSMHVinstance *inst = HSMHVinstances(mod); while (inst) { - HSMHVinstance *next_inst = inst->HSMHVnextInstance; + HSMHVinstance *next_inst = HSMHVnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/hisimhv1/hsmhvgetic.c b/src/spicelib/devices/hisimhv1/hsmhvgetic.c index ae1374c0f..fc2377644 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvgetic.c +++ b/src/spicelib/devices/hisimhv1/hsmhvgetic.c @@ -33,7 +33,7 @@ int HSMHVgetic( */ for ( ;model ;model = HSMHVnextModel(model) ) { - for ( here = HSMHVinstances(model); here ;here = here->HSMHVnextInstance ) { + for ( here = HSMHVinstances(model); here ;here = HSMHVnextInstance(here) ) { if (!here->HSMHV_icVBS_Given) { here->HSMHV_icVBS = *(ckt->CKTrhs + here->HSMHVbNode) - diff --git a/src/spicelib/devices/hisimhv1/hsmhvld.c b/src/spicelib/devices/hisimhv1/hsmhvld.c index 91e9de916..3511c8131 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvld.c +++ b/src/spicelib/devices/hisimhv1/hsmhvld.c @@ -366,7 +366,7 @@ int HSMHVload( /* modelMKS = &model->modelMKS ;*/ for (here = HSMHVinstances(model); here != NULL ; - here = here->HSMHVnextInstance) { + here = HSMHVnextInstance(here)) { /* hereMKS = &here->hereMKS ;*/ pParam = &here->pParam ; diff --git a/src/spicelib/devices/hisimhv1/hsmhvnoi.c b/src/spicelib/devices/hisimhv1/hsmhvnoi.c index a7df4dd93..27a15b12e 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvnoi.c +++ b/src/spicelib/devices/hisimhv1/hsmhvnoi.c @@ -66,7 +66,7 @@ int HSMHVnoise ( for ( ;model != NULL; model = HSMHVnextModel(model) ) { for ( here = HSMHVinstances(model); here != NULL; - here = here->HSMHVnextInstance ) { + here = HSMHVnextInstance(here) ) { switch (operation) { case N_OPEN: /* see if we have to to produce a summary report */ diff --git a/src/spicelib/devices/hisimhv1/hsmhvpzld.c b/src/spicelib/devices/hisimhv1/hsmhvpzld.c index 8f7ece4a7..658e80dd2 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvpzld.c +++ b/src/spicelib/devices/hisimhv1/hsmhvpzld.c @@ -50,7 +50,7 @@ int HSMHVpzLoad( for ( ;model != NULL ;model = HSMHVnextModel(model) ) { for ( here = HSMHVinstances(model) ;here!= NULL ; - here = here->HSMHVnextInstance ) { + here = HSMHVnextInstance(here) ) { flg_nqs = model->HSMHV_conqs ; diff --git a/src/spicelib/devices/hisimhv1/hsmhvset.c b/src/spicelib/devices/hisimhv1/hsmhvset.c index 3a6270838..a35d82c6e 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvset.c +++ b/src/spicelib/devices/hisimhv1/hsmhvset.c @@ -780,7 +780,7 @@ int HSMHVsetup( /* loop through all the instances of the model */ for ( here = HSMHVinstances(model) ;here != NULL ; - here = here->HSMHVnextInstance ) { + here = HSMHVnextInstance(here) ) { /* allocate a chunk of the state vector */ here->HSMHVstates = *states; if (model->HSMHV_conqs) @@ -1473,7 +1473,7 @@ HSMHVunsetup( model = HSMHVnextModel(model)) { for (here = HSMHVinstances(model); here != NULL; - here=here->HSMHVnextInstance) + here=HSMHVnextInstance(here)) { if (here->HSMHVqbNode > 0) CKTdltNNum(ckt, here->HSMHVqbNode); diff --git a/src/spicelib/devices/hisimhv1/hsmhvsoachk.c b/src/spicelib/devices/hisimhv1/hsmhvsoachk.c index ece18e8a7..bda45be86 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvsoachk.c +++ b/src/spicelib/devices/hisimhv1/hsmhvsoachk.c @@ -35,7 +35,7 @@ HSMHVsoaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = HSMHVnextModel(model)) { - for (here = HSMHVinstances(model); here; here = here->HSMHVnextInstance) { + for (here = HSMHVinstances(model); here; here = HSMHVnextInstance(here)) { vgs = ckt->CKTrhsOld [here->HSMHVgNode] - ckt->CKTrhsOld [here->HSMHVsNodePrime]; diff --git a/src/spicelib/devices/hisimhv1/hsmhvtemp.c b/src/spicelib/devices/hisimhv1/hsmhvtemp.c index db0baccc3..19667b956 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvtemp.c +++ b/src/spicelib/devices/hisimhv1/hsmhvtemp.c @@ -95,7 +95,7 @@ int HSMHVtemp( model->HSMHV_qme12 = model->HSMHV_qme1 / ( model->HSMHV_qme2 * model->HSMHV_qme2 ) ; } - for ( here = HSMHVinstances(model); here; here = here->HSMHVnextInstance ) { + for ( here = HSMHVinstances(model); here; here = HSMHVnextInstance(here) ) { pParam = &here->pParam ; diff --git a/src/spicelib/devices/hisimhv1/hsmhvtrunc.c b/src/spicelib/devices/hisimhv1/hsmhvtrunc.c index 439507ae0..5a991a6aa 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvtrunc.c +++ b/src/spicelib/devices/hisimhv1/hsmhvtrunc.c @@ -35,7 +35,7 @@ int HSMHVtrunc( for ( ;model != NULL ;model = HSMHVnextModel(model) ) { for ( here=HSMHVinstances(model) ;here!=NULL ; - here = here->HSMHVnextInstance ) { + here = HSMHVnextInstance(here) ) { #ifdef STEPDEBUG debugtemp = *timeStep; #endif /* STEPDEBUG */ diff --git a/src/spicelib/devices/hisimhv2/hsmhv2acld.c b/src/spicelib/devices/hisimhv2/hsmhv2acld.c index 34aed48df..0ce9fcef1 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2acld.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2acld.c @@ -92,7 +92,7 @@ int HSMHV2acLoad( omega = ckt->CKTomega; for ( ; model != NULL; model = HSMHV2nextModel(model) ) { - for ( here = HSMHV2instances(model); here!= NULL; here = here->HSMHV2nextInstance ) { + for ( here = HSMHV2instances(model); here!= NULL; here = HSMHV2nextInstance(here) ) { flg_nqs = model->HSMHV2_conqs ; flg_subNode = here->HSMHV2subNode ; /* if flg_subNode > 0, external(/internal) substrate node exists */ diff --git a/src/spicelib/devices/hisimhv2/hsmhv2cvtest.c b/src/spicelib/devices/hisimhv2/hsmhv2cvtest.c index 35ad02949..0fbdd0a36 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2cvtest.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2cvtest.c @@ -93,7 +93,7 @@ int HSMHV2convTest( for ( ; model != NULL; model = HSMHV2nextModel(model) ) { /* loop through all the instances of the model */ for ( here = HSMHV2instances(model); here != NULL ; - here = here->HSMHV2nextInstance ) { + here = HSMHV2nextInstance(here) ) { vds = model->HSMHV2_type * (*(ckt->CKTrhsOld+here->HSMHV2dNodePrime) - diff --git a/src/spicelib/devices/hisimhv2/hsmhv2def.h b/src/spicelib/devices/hisimhv2/hsmhv2def.h index cf0953281..0544b5ee6 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2def.h +++ b/src/spicelib/devices/hisimhv2/hsmhv2def.h @@ -261,11 +261,12 @@ typedef struct sHSMHV2hereMKSParam { /* information needed for each instance */ typedef struct sHSMHV2instance { - struct sHSMHV2model *HSMHV2modPtr; /* pointer to model */ - struct sHSMHV2instance *HSMHV2nextInstance; /* pointer to next instance of - current model*/ - IFuid HSMHV2name; /* pointer to character string naming this instance */ - int HSMHV2states; /* index into state table for this device */ + struct GENinstance gen; + +#define HSMHV2modPtr(inst) ((struct sHSMHV2model*)((inst)->gen.GENmodPtr)) +#define HSMHV2nextInstance(inst) ((struct sHSMHV2instance*)((inst)->gen.GENnextInstance)) +#define HSMHV2name gen.GENname +#define HSMHV2states gen.GENstate const int HSMHV2dNode; /* number of the drain node of the mosfet */ const int HSMHV2gNode; /* number of the gate node of the mosfet */ diff --git a/src/spicelib/devices/hisimhv2/hsmhv2dest.c b/src/spicelib/devices/hisimhv2/hsmhv2dest.c index 47aa5ad0c..cb02f7f79 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2dest.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2dest.c @@ -71,7 +71,7 @@ HSMHV2destroy(GENmodel **inModel) HSMHV2model *next_mod = HSMHV2nextModel(mod); HSMHV2instance *inst = HSMHV2instances(mod); while (inst) { - HSMHV2instance *next_inst = inst->HSMHV2nextInstance; + HSMHV2instance *next_inst = HSMHV2nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/hisimhv2/hsmhv2getic.c b/src/spicelib/devices/hisimhv2/hsmhv2getic.c index 4be8a7954..78db1266e 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2getic.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2getic.c @@ -75,7 +75,7 @@ int HSMHV2getic( */ for ( ;model ;model = HSMHV2nextModel(model) ) { - for ( here = HSMHV2instances(model); here ;here = here->HSMHV2nextInstance ) { + for ( here = HSMHV2instances(model); here ;here = HSMHV2nextInstance(here) ) { if (!here->HSMHV2_icVBS_Given) { here->HSMHV2_icVBS = *(ckt->CKTrhs + here->HSMHV2bNode) - diff --git a/src/spicelib/devices/hisimhv2/hsmhv2ld.c b/src/spicelib/devices/hisimhv2/hsmhv2ld.c index 361309119..dee9c72fc 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2ld.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2ld.c @@ -413,7 +413,7 @@ int HSMHV2load( modelMKS = &model->modelMKS ; for (here = HSMHV2instances(model); here != NULL ; - here = here->HSMHV2nextInstance) { + here = HSMHV2nextInstance(here)) { hereMKS = &here->hereMKS ; pParam = &here->pParam ; diff --git a/src/spicelib/devices/hisimhv2/hsmhv2noi.c b/src/spicelib/devices/hisimhv2/hsmhv2noi.c index fbe4842f9..fc6bc309f 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2noi.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2noi.c @@ -108,7 +108,7 @@ int HSMHV2noise ( for ( ;model != NULL; model = HSMHV2nextModel(model) ) { for ( here = HSMHV2instances(model); here != NULL; - here = here->HSMHV2nextInstance ) { + here = HSMHV2nextInstance(here) ) { switch (operation) { case N_OPEN: /* see if we have to to produce a summary report */ diff --git a/src/spicelib/devices/hisimhv2/hsmhv2pzld.c b/src/spicelib/devices/hisimhv2/hsmhv2pzld.c index 0d50d1f83..4ca14db00 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2pzld.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2pzld.c @@ -92,7 +92,7 @@ int HSMHV2pzLoad( for ( ;model != NULL ;model = HSMHV2nextModel(model) ) { for ( here = HSMHV2instances(model) ;here!= NULL ; - here = here->HSMHV2nextInstance ) { + here = HSMHV2nextInstance(here) ) { flg_nqs = model->HSMHV2_conqs ; diff --git a/src/spicelib/devices/hisimhv2/hsmhv2set.c b/src/spicelib/devices/hisimhv2/hsmhv2set.c index 22ca27383..b2121eef4 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2set.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2set.c @@ -1000,7 +1000,7 @@ int HSMHV2setup( /* loop through all the instances of the model */ for ( here = HSMHV2instances(model) ;here != NULL ; - here = here->HSMHV2nextInstance ) { + here = HSMHV2nextInstance(here) ) { /* allocate a chunk of the state vector */ here->HSMHV2states = *states; if (model->HSMHV2_conqs) @@ -1742,7 +1742,7 @@ HSMHV2unsetup( model = HSMHV2nextModel(model)) { for (here = HSMHV2instances(model); here != NULL; - here=here->HSMHV2nextInstance) + here=HSMHV2nextInstance(here)) { if (here->HSMHV2tempNode > 0 && here->HSMHV2tempNode != here->HSMHV2tempNodeExt && diff --git a/src/spicelib/devices/hisimhv2/hsmhv2soachk.c b/src/spicelib/devices/hisimhv2/hsmhv2soachk.c index a3ad7ada3..29d70b8fe 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2soachk.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2soachk.c @@ -35,7 +35,7 @@ HSMHV2soaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = HSMHV2nextModel(model)) { - for (here = HSMHV2instances(model); here; here = here->HSMHV2nextInstance) { + for (here = HSMHV2instances(model); here; here = HSMHV2nextInstance(here)) { vgs = ckt->CKTrhsOld [here->HSMHV2gNode] - ckt->CKTrhsOld [here->HSMHV2sNodePrime]; diff --git a/src/spicelib/devices/hisimhv2/hsmhv2temp.c b/src/spicelib/devices/hisimhv2/hsmhv2temp.c index d3daa57fd..15d4d133d 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2temp.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2temp.c @@ -134,7 +134,7 @@ int HSMHV2temp( model->HSMHV2_qme12 = model->HSMHV2_qme1 / ( model->HSMHV2_qme2 * model->HSMHV2_qme2 ) ; } - for ( here = HSMHV2instances(model); here; here = here->HSMHV2nextInstance ) { + for ( here = HSMHV2instances(model); here; here = HSMHV2nextInstance(here) ) { pParam = &here->pParam ; diff --git a/src/spicelib/devices/hisimhv2/hsmhv2trunc.c b/src/spicelib/devices/hisimhv2/hsmhv2trunc.c index c6db3c1d8..fb64be0b5 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2trunc.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2trunc.c @@ -76,7 +76,7 @@ int HSMHV2trunc( for ( ;model != NULL ;model = HSMHV2nextModel(model) ) { for ( here=HSMHV2instances(model) ;here!=NULL ; - here = here->HSMHV2nextInstance ) { + here = HSMHV2nextInstance(here) ) { #ifdef STEPDEBUG debugtemp = *timeStep; #endif /* STEPDEBUG */ diff --git a/src/spicelib/devices/ind/indacld.c b/src/spicelib/devices/ind/indacld.c index 573699e57..812ed7d50 100644 --- a/src/spicelib/devices/ind/indacld.c +++ b/src/spicelib/devices/ind/indacld.c @@ -22,7 +22,7 @@ INDacLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = INDnextModel(model)) { for( here = INDinstances(model);here != NULL; - here = here->INDnextInstance) { + here = INDnextInstance(here)) { m = (here->INDm); diff --git a/src/spicelib/devices/ind/inddefs.h b/src/spicelib/devices/ind/inddefs.h index 9c59ad0f2..36590f131 100644 --- a/src/spicelib/devices/ind/inddefs.h +++ b/src/spicelib/devices/ind/inddefs.h @@ -27,11 +27,13 @@ typedef struct sMUTmodel MUTmodel; /* information needed for each instance */ struct sINDinstance { - INDmodel *INDmodPtr; /* backpointer to model */ - INDinstance *INDnextInstance; /* pointer to next instance of - * current model */ - IFuid INDname; /* pointer to character string naming this instance */ - int INDstate; /* pointer to beginning of state vector for inductor */ + struct GENinstance gen; + +#define INDmodPtr(inst) ((INDmodel*)((inst)->gen.GENmodPtr)) +#define INDnextInstance(inst) ((INDinstance*)((inst)->gen.GENnextInstance)) +#define INDname gen.GENname +#define INDstate gen.GENstate + const int INDposNode; /* number of positive node of inductor */ const int INDnegNode; /* number of negative node of inductor */ @@ -121,11 +123,13 @@ struct sINDmodel { /* model structure for an inductor */ /* information needed for each instance */ struct sMUTinstance { - MUTmodel *MUTmodPtr; /* backpointer to model */ - MUTinstance *MUTnextInstance; /* pointer to next instance of - * current model */ - IFuid MUTname; /* pointer to character string naming this instance */ - int MUTstates; /* state info, unused */ + struct GENinstance gen; + +#define MUTmodPtr(inst) ((MUTmodel*)((inst)->gen.GENmodPtr)) +#define MUTnextInstance(inst) ((MUTinstance*)((inst)->gen.GENnextInstance)) +#define MUTname gen.GENname +#define MUTstates gen.GENstate + double MUTcoupling; /* mutual inductance input by user */ double MUTfactor; /* mutual inductance scaled for internal use */ IFuid MUTindName1; /* name of coupled inductor 1 */ diff --git a/src/spicelib/devices/ind/inddest.c b/src/spicelib/devices/ind/inddest.c index b807531ae..c463dc3b1 100644 --- a/src/spicelib/devices/ind/inddest.c +++ b/src/spicelib/devices/ind/inddest.c @@ -17,7 +17,7 @@ INDdestroy(GENmodel **inModel) INDmodel *next_mod = INDnextModel(mod); INDinstance *inst = INDinstances(mod); while (inst) { - INDinstance *next_inst = inst->INDnextInstance; + INDinstance *next_inst = INDnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/ind/indload.c b/src/spicelib/devices/ind/indload.c index 11d95d8ce..44d892da0 100644 --- a/src/spicelib/devices/ind/indload.c +++ b/src/spicelib/devices/ind/indload.c @@ -36,7 +36,7 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { m = (here->INDm); @@ -59,7 +59,7 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (muthere = MUTinstances(mutmodel); muthere != NULL ; - muthere=muthere->MUTnextInstance) { + muthere=MUTnextInstance(muthere)) { if(!(ckt->CKTmode& (MODEDC|MODEINITPRED))) { *(ckt->CKTstate0 + muthere->MUTind1->INDflux) += @@ -82,7 +82,7 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { #endif /*MUTUAL*/ if(ckt->CKTmode & MODEDC) { diff --git a/src/spicelib/devices/ind/indpzld.c b/src/spicelib/devices/ind/indpzld.c index 07fdbeadc..335694bc1 100644 --- a/src/spicelib/devices/ind/indpzld.c +++ b/src/spicelib/devices/ind/indpzld.c @@ -25,7 +25,7 @@ INDpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = INDnextModel(model)) { for( here = INDinstances(model);here != NULL; - here = here->INDnextInstance) { + here = INDnextInstance(here)) { val = here->INDinduct / here->INDm; diff --git a/src/spicelib/devices/ind/indsacl.c b/src/spicelib/devices/ind/indsacl.c index 412fe3206..a3dff76cb 100644 --- a/src/spicelib/devices/ind/indsacl.c +++ b/src/spicelib/devices/ind/indsacl.c @@ -57,7 +57,7 @@ INDsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { #ifdef MUTUAL } @@ -69,7 +69,7 @@ INDsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (muthere = MUTinstances(mutmodel); muthere != NULL ; - muthere=muthere->MUTnextInstance) { + muthere=MUTnextInstance(muthere)) { if(muthere->MUTsenParmNo || muthere->MUTind1->INDsenParmNo || @@ -141,7 +141,7 @@ INDsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { #endif /* MUTUAL */ if(here->INDsenParmNo){ cind = *(ckt->CKTrhsOld + here->INDbrEq); diff --git a/src/spicelib/devices/ind/indsetup.c b/src/spicelib/devices/ind/indsetup.c index a731ddf5b..dd4657369 100644 --- a/src/spicelib/devices/ind/indsetup.c +++ b/src/spicelib/devices/ind/indsetup.c @@ -73,7 +73,7 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { here->INDflux = *states; *states += 2 ; @@ -116,7 +116,7 @@ INDunsetup(GENmodel *inModel, CKTcircuit *ckt) model = INDnextModel(model)) { for (here = INDinstances(model); here != NULL; - here=here->INDnextInstance) + here=INDnextInstance(here)) { if (here->INDbrEq > 0) CKTdltNNum(ckt, here->INDbrEq); diff --git a/src/spicelib/devices/ind/indsload.c b/src/spicelib/devices/ind/indsload.c index 91b714a43..1a2a2e9ae 100644 --- a/src/spicelib/devices/ind/indsload.c +++ b/src/spicelib/devices/ind/indsload.c @@ -63,7 +63,7 @@ INDsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { #ifdef MUTUAL } @@ -75,7 +75,7 @@ INDsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (muthere = MUTinstances(mutmodel); muthere != NULL ; - muthere=muthere->MUTnextInstance) { + muthere=MUTnextInstance(muthere)) { if(muthere->MUTsenParmNo || muthere->MUTind1->INDsenParmNo || @@ -120,7 +120,7 @@ INDsLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { #endif /* MUTUAL */ cind = *(ckt->CKTrhsOld + here->INDbrEq); diff --git a/src/spicelib/devices/ind/indsprt.c b/src/spicelib/devices/ind/indsprt.c index d790f93a9..49a49ac03 100644 --- a/src/spicelib/devices/ind/indsprt.c +++ b/src/spicelib/devices/ind/indsprt.c @@ -30,7 +30,7 @@ INDsPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { printf(" Instance name:%s\n",here->INDname); printf(" Positive, negative nodes: %s, %s\n", diff --git a/src/spicelib/devices/ind/indsset.c b/src/spicelib/devices/ind/indsset.c index 7a3bbb6c2..3e53d055f 100644 --- a/src/spicelib/devices/ind/indsset.c +++ b/src/spicelib/devices/ind/indsset.c @@ -27,7 +27,7 @@ INDsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { if(here->INDsenParmNo){ here->INDsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/ind/indsupd.c b/src/spicelib/devices/ind/indsupd.c index 76044b23f..a220cfce3 100644 --- a/src/spicelib/devices/ind/indsupd.c +++ b/src/spicelib/devices/ind/indsupd.c @@ -47,7 +47,7 @@ INDsUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { for(iparmno = 1;iparmno<=info->SENparms;iparmno++){ @@ -77,7 +77,7 @@ INDsUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (muthere = MUTinstances(mutmodel); muthere != NULL ; - muthere=muthere->MUTnextInstance) { + muthere=MUTnextInstance(muthere)) { cind1 = *(ckt->CKTrhsOld + muthere->MUTind1->INDbrEq); @@ -127,7 +127,7 @@ INDsUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { #endif /* MUTUAL */ for(iparmno = 1;iparmno<=info->SENparms;iparmno++){ diff --git a/src/spicelib/devices/ind/indtemp.c b/src/spicelib/devices/ind/indtemp.c index b51c43061..e06ce4ed9 100644 --- a/src/spicelib/devices/ind/indtemp.c +++ b/src/spicelib/devices/ind/indtemp.c @@ -28,7 +28,7 @@ INDtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; - here=here->INDnextInstance) { + here=INDnextInstance(here)) { /* Default Value Processing for Inductor Instance */ diff --git a/src/spicelib/devices/ind/indtrunc.c b/src/spicelib/devices/ind/indtrunc.c index ab67ba3ae..62b15d3e1 100644 --- a/src/spicelib/devices/ind/indtrunc.c +++ b/src/spicelib/devices/ind/indtrunc.c @@ -19,7 +19,7 @@ INDtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) INDinstance *here; for( ; model!= NULL; model = INDnextModel(model)) { for(here = INDinstances(model) ; here != NULL ; - here = here->INDnextInstance) { + here = INDnextInstance(here)) { CKTterr(here->INDflux,ckt,timeStep); } diff --git a/src/spicelib/devices/ind/mutacld.c b/src/spicelib/devices/ind/mutacld.c index 20d9a4dba..6d817fb5b 100644 --- a/src/spicelib/devices/ind/mutacld.c +++ b/src/spicelib/devices/ind/mutacld.c @@ -22,7 +22,7 @@ MUTacLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MUTnextModel(model)) { for( here = MUTinstances(model);here != NULL; - here = here->MUTnextInstance) { + here = MUTnextInstance(here)) { val = ckt->CKTomega * here->MUTfactor; *(here->MUTbr1br2Ptr +1) -= val; diff --git a/src/spicelib/devices/ind/mutdest.c b/src/spicelib/devices/ind/mutdest.c index eff50a817..5395dce93 100644 --- a/src/spicelib/devices/ind/mutdest.c +++ b/src/spicelib/devices/ind/mutdest.c @@ -19,7 +19,7 @@ MUTdestroy(GENmodel **inModel) MUTmodel *next_mod = MUTnextModel(mod); MUTinstance *inst = MUTinstances(mod); while (inst) { - MUTinstance *next_inst = inst->MUTnextInstance; + MUTinstance *next_inst = MUTnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/ind/mutpzld.c b/src/spicelib/devices/ind/mutpzld.c index 84cba21a2..89029de14 100644 --- a/src/spicelib/devices/ind/mutpzld.c +++ b/src/spicelib/devices/ind/mutpzld.c @@ -26,7 +26,7 @@ MUTpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = MUTnextModel(model)) { for( here = MUTinstances(model);here != NULL; - here = here->MUTnextInstance) { + here = MUTnextInstance(here)) { val = here->MUTfactor; *(here->MUTbr1br2Ptr ) -= val * s->real; diff --git a/src/spicelib/devices/ind/mutsetup.c b/src/spicelib/devices/ind/mutsetup.c index 539857e59..23ea9ebb7 100644 --- a/src/spicelib/devices/ind/mutsetup.c +++ b/src/spicelib/devices/ind/mutsetup.c @@ -35,7 +35,7 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) NG_IGNORE(states); for (; model; model = MUTnextModel(model)) - for (here = MUTinstances(model); here; here = here->MUTnextInstance) { + for (here = MUTinstances(model); here; here = MUTnextInstance(here)) { int ktype = CKTtypelook("Inductor"); diff --git a/src/spicelib/devices/ind/mutsprt.c b/src/spicelib/devices/ind/mutsprt.c index e543e6dd9..eb18b1ccc 100644 --- a/src/spicelib/devices/ind/mutsprt.c +++ b/src/spicelib/devices/ind/mutsprt.c @@ -35,7 +35,7 @@ MUTsPrint(GENmodel *inModel, CKTcircuit* ckt) /* loop through all the instances of the model */ for (here = MUTinstances(model); here != NULL ; - here=here->MUTnextInstance) { + here=MUTnextInstance(here)) { printf(" Instance name:%s\n",here->MUTname); printf(" Mutual Inductance: %g ",here->MUTcoupling); diff --git a/src/spicelib/devices/ind/mutsset.c b/src/spicelib/devices/ind/mutsset.c index b2df06ba7..8f6bd0678 100644 --- a/src/spicelib/devices/ind/mutsset.c +++ b/src/spicelib/devices/ind/mutsset.c @@ -30,7 +30,7 @@ MUTsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = MUTinstances(model); here != NULL ; - here=here->MUTnextInstance) { + here=MUTnextInstance(here)) { if(here->MUTsenParmNo){ here->MUTsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/ind/muttemp.c b/src/spicelib/devices/ind/muttemp.c index 3de593774..30c589adc 100644 --- a/src/spicelib/devices/ind/muttemp.c +++ b/src/spicelib/devices/ind/muttemp.c @@ -43,7 +43,7 @@ MUTtemp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); for (; model; model = MUTnextModel(model)) - for (here = MUTinstances(model); here; here = here->MUTnextInstance) { + for (here = MUTinstances(model); here; here = MUTnextInstance(here)) { /* Value Processing for mutual inductors */ diff --git a/src/spicelib/devices/isrc/isrcacct.c b/src/spicelib/devices/isrc/isrcacct.c index c5127a061..87ced25ab 100644 --- a/src/spicelib/devices/isrc/isrcacct.c +++ b/src/spicelib/devices/isrc/isrcacct.c @@ -34,7 +34,7 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel) /* loop through all the instances of the model */ for (here = ISRCinstances(model); here != NULL ; - here=here->ISRCnextInstance) { + here=ISRCnextInstance(here)) { if(!(ckt->CKTmode & (MODETRAN | MODETRANOP))) { /* not transient, so shouldn't be here */ diff --git a/src/spicelib/devices/isrc/isrcacld.c b/src/spicelib/devices/isrc/isrcacld.c index acf01889d..96084fde6 100644 --- a/src/spicelib/devices/isrc/isrcacld.c +++ b/src/spicelib/devices/isrc/isrcacld.c @@ -21,7 +21,7 @@ ISRCacLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = ISRCinstances(model); here != NULL ; - here=here->ISRCnextInstance) { + here=ISRCnextInstance(here)) { double acReal, acImag; diff --git a/src/spicelib/devices/isrc/isrcdefs.h b/src/spicelib/devices/isrc/isrcdefs.h index 839f9ed74..25806868d 100644 --- a/src/spicelib/devices/isrc/isrcdefs.h +++ b/src/spicelib/devices/isrc/isrcdefs.h @@ -19,11 +19,12 @@ Author: 1985 Thomas L. Quarles /* information needed for each instance */ typedef struct sISRCinstance { - struct sISRCmodel *ISRCmodPtr; /* backpointer to model */ - struct sISRCinstance *ISRCnextInstance; /* pointer to next instance of - *current model */ - IFuid ISRCname; /* pointer to character string naming this instance */ - int ISRCstate; /* not used */ + struct GENinstance gen; + +#define ISRCmodPtr(inst) ((struct sISRCmodel*)((inst)->gen.GENmodPtr)) +#define ISRCnextInstance(inst) ((struct sISRCinstance*)((inst)->gen.GENnextInstance)) +#define ISRCname gen.GENname +#define ISRCstate gen.GENstate const int ISRCnegNode; /* number of negative node of source */ const int ISRCposNode; /* number of positive node of source */ diff --git a/src/spicelib/devices/isrc/isrcdest.c b/src/spicelib/devices/isrc/isrcdest.c index d874b7dc3..5a47a33eb 100644 --- a/src/spicelib/devices/isrc/isrcdest.c +++ b/src/spicelib/devices/isrc/isrcdest.c @@ -17,7 +17,7 @@ ISRCdestroy(GENmodel **inModel) ISRCmodel *next_mod = ISRCnextModel(mod); ISRCinstance *inst = ISRCinstances(mod); while (inst) { - ISRCinstance *next_inst = inst->ISRCnextInstance; + ISRCinstance *next_inst = ISRCnextInstance(inst); FREE(inst->ISRCcoeffs); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/isrc/isrcload.c b/src/spicelib/devices/isrc/isrcload.c index bcdbe0782..084a4b85c 100644 --- a/src/spicelib/devices/isrc/isrcload.c +++ b/src/spicelib/devices/isrc/isrcload.c @@ -39,7 +39,7 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = ISRCinstances(model); here != NULL ; - here=here->ISRCnextInstance) { + here=ISRCnextInstance(here)) { m = here->ISRCmValue; diff --git a/src/spicelib/devices/isrc/isrctemp.c b/src/spicelib/devices/isrc/isrctemp.c index 67e70f736..45480d5d5 100644 --- a/src/spicelib/devices/isrc/isrctemp.c +++ b/src/spicelib/devices/isrc/isrctemp.c @@ -27,7 +27,7 @@ ISRCtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = ISRCinstances(model); here != NULL ; - here=here->ISRCnextInstance) { + here=ISRCnextInstance(here)) { if(here->ISRCacGiven && !here->ISRCacMGiven) { here->ISRCacMag = 1; diff --git a/src/spicelib/devices/jfet/jfetacld.c b/src/spicelib/devices/jfet/jfetacld.c index 0f6c2a635..98515fa21 100644 --- a/src/spicelib/devices/jfet/jfetacld.c +++ b/src/spicelib/devices/jfet/jfetacld.c @@ -31,7 +31,7 @@ JFETacLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = JFETnextModel(model) ) { for( here = JFETinstances(model); here != NULL; - here = here->JFETnextInstance) { + here = JFETnextInstance(here)) { gdpr=model->JFETdrainConduct * here->JFETarea; gspr=model->JFETsourceConduct * here->JFETarea; diff --git a/src/spicelib/devices/jfet/jfetdefs.h b/src/spicelib/devices/jfet/jfetdefs.h index 41e4b6b48..b2df09e06 100644 --- a/src/spicelib/devices/jfet/jfetdefs.h +++ b/src/spicelib/devices/jfet/jfetdefs.h @@ -21,11 +21,13 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern /* information used to describe a single instance */ typedef struct sJFETinstance { - struct sJFETmodel *JFETmodPtr; /* backpointer to model */ - struct sJFETinstance *JFETnextInstance; /* pointer to next instance of - * current model*/ - IFuid JFETname; /* pointer to character string naming this instance */ - int JFETstate; /* pointer to start of state vector for jfet */ + struct GENinstance gen; + +#define JFETmodPtr(inst) ((struct sJFETmodel*)((inst)->gen.GENmodPtr)) +#define JFETnextInstance(inst) ((struct sJFETinstance*)((inst)->gen.GENnextInstance)) +#define JFETname gen.GENname +#define JFETstate gen.GENstate + const int JFETdrainNode; /* number of drain node of jfet */ const int JFETgateNode; /* number of gate node of jfet */ const int JFETsourceNode; /* number of source node of jfet */ diff --git a/src/spicelib/devices/jfet/jfetdest.c b/src/spicelib/devices/jfet/jfetdest.c index 1614e3f34..919bb6a8e 100644 --- a/src/spicelib/devices/jfet/jfetdest.c +++ b/src/spicelib/devices/jfet/jfetdest.c @@ -17,7 +17,7 @@ JFETdestroy(GENmodel **inModel) JFETmodel *next_mod = JFETnextModel(mod); JFETinstance *inst = JFETinstances(mod); while (inst) { - JFETinstance *next_inst = inst->JFETnextInstance; + JFETinstance *next_inst = JFETnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/jfet/jfetdist.c b/src/spicelib/devices/jfet/jfetdist.c index c7d243db3..6be080bec 100644 --- a/src/spicelib/devices/jfet/jfetdist.c +++ b/src/spicelib/devices/jfet/jfetdist.c @@ -44,7 +44,7 @@ for( ; model != NULL; model = JFETnextModel(model) ) { /* loop through all the instances of the model */ for (here = JFETinstances(model); here != NULL ; - here=here->JFETnextInstance) { + here=JFETnextInstance(here)) { /* loading starts here */ diff --git a/src/spicelib/devices/jfet/jfetdset.c b/src/spicelib/devices/jfet/jfetdset.c index 1e4397ad7..5e600eeb6 100644 --- a/src/spicelib/devices/jfet/jfetdset.c +++ b/src/spicelib/devices/jfet/jfetdset.c @@ -71,7 +71,7 @@ JFETdSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = JFETinstances(model); here != NULL ; - here=here->JFETnextInstance) { + here=JFETnextInstance(here)) { /* * dc model parameters diff --git a/src/spicelib/devices/jfet/jfetic.c b/src/spicelib/devices/jfet/jfetic.c index fd91b458b..222c0e576 100644 --- a/src/spicelib/devices/jfet/jfetic.c +++ b/src/spicelib/devices/jfet/jfetic.c @@ -23,7 +23,7 @@ JFETgetic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = JFETnextModel(model)) { - for(here = JFETinstances(model); here ; here = here->JFETnextInstance) { + for(here = JFETinstances(model); here ; here = JFETnextInstance(here)) { if(!here->JFETicVDSGiven) { here->JFETicVDS = diff --git a/src/spicelib/devices/jfet/jfetload.c b/src/spicelib/devices/jfet/jfetload.c index e30485261..c70bfd89b 100644 --- a/src/spicelib/devices/jfet/jfetload.c +++ b/src/spicelib/devices/jfet/jfetload.c @@ -84,7 +84,7 @@ JFETload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = JFETinstances(model); here != NULL ; - here=here->JFETnextInstance) { + here=JFETnextInstance(here)) { /* * dc model parameters diff --git a/src/spicelib/devices/jfet/jfetnoi.c b/src/spicelib/devices/jfet/jfetnoi.c index 1acd21c00..5b70f97e5 100644 --- a/src/spicelib/devices/jfet/jfetnoi.c +++ b/src/spicelib/devices/jfet/jfetnoi.c @@ -47,7 +47,7 @@ JFETnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata * }; for (model=firstModel; model != NULL; model=JFETnextModel(model)) { - for (inst=JFETinstances(model); inst != NULL; inst=inst->JFETnextInstance) { + for (inst=JFETinstances(model); inst != NULL; inst=JFETnextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/jfet/jfetpzld.c b/src/spicelib/devices/jfet/jfetpzld.c index 4b523e006..8265877f5 100644 --- a/src/spicelib/devices/jfet/jfetpzld.c +++ b/src/spicelib/devices/jfet/jfetpzld.c @@ -32,7 +32,7 @@ JFETpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = JFETnextModel(model) ) { for( here = JFETinstances(model); here != NULL; - here = here->JFETnextInstance) { + here = JFETnextInstance(here)) { m = here->JFETm; diff --git a/src/spicelib/devices/jfet/jfetset.c b/src/spicelib/devices/jfet/jfetset.c index 272822b24..37741ea2a 100644 --- a/src/spicelib/devices/jfet/jfetset.c +++ b/src/spicelib/devices/jfet/jfetset.c @@ -101,7 +101,7 @@ JFETsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = JFETinstances(model); here != NULL ; - here=here->JFETnextInstance) { + here=JFETnextInstance(here)) { if(!here->JFETareaGiven) { here->JFETarea = 1; @@ -193,7 +193,7 @@ JFETunsetup(GENmodel *inModel, CKTcircuit *ckt) model = JFETnextModel(model)) { for (here = JFETinstances(model); here != NULL; - here=here->JFETnextInstance) + here=JFETnextInstance(here)) { if (here->JFETdrainPrimeNode > 0 && here->JFETdrainPrimeNode != here->JFETdrainNode) diff --git a/src/spicelib/devices/jfet/jfettemp.c b/src/spicelib/devices/jfet/jfettemp.c index d0c7cc99e..212ca10dd 100644 --- a/src/spicelib/devices/jfet/jfettemp.c +++ b/src/spicelib/devices/jfet/jfettemp.c @@ -78,7 +78,7 @@ JFETtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = JFETinstances(model); here != NULL ; - here=here->JFETnextInstance) { + here=JFETnextInstance(here)) { if(!(here->JFETdtempGiven)) { here->JFETdtemp = 0.0; diff --git a/src/spicelib/devices/jfet/jfettrun.c b/src/spicelib/devices/jfet/jfettrun.c index e089705ed..14d4c9f3f 100644 --- a/src/spicelib/devices/jfet/jfettrun.c +++ b/src/spicelib/devices/jfet/jfettrun.c @@ -19,7 +19,7 @@ JFETtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) JFETinstance *here; for( ; model != NULL; model = JFETnextModel(model)) { - for(here=JFETinstances(model);here!=NULL;here = here->JFETnextInstance){ + for(here=JFETinstances(model);here!=NULL;here = JFETnextInstance(here)){ CKTterr(here->JFETqgs,ckt,timeStep); CKTterr(here->JFETqgd,ckt,timeStep); diff --git a/src/spicelib/devices/jfet2/jfet2acld.c b/src/spicelib/devices/jfet2/jfet2acld.c index 116961212..932bb1bb4 100644 --- a/src/spicelib/devices/jfet2/jfet2acld.c +++ b/src/spicelib/devices/jfet2/jfet2acld.c @@ -35,7 +35,7 @@ JFET2acLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = JFET2nextModel(model) ) { for( here = JFET2instances(model); here != NULL; - here = here->JFET2nextInstance) { + here = JFET2nextInstance(here)) { gdpr=model->JFET2drainConduct * here->JFET2area; gspr=model->JFET2sourceConduct * here->JFET2area; diff --git a/src/spicelib/devices/jfet2/jfet2defs.h b/src/spicelib/devices/jfet2/jfet2defs.h index 7585639bf..6f26a77d4 100644 --- a/src/spicelib/devices/jfet2/jfet2defs.h +++ b/src/spicelib/devices/jfet2/jfet2defs.h @@ -26,11 +26,13 @@ Modified to add PS model and new parameter definitions ( Anthony E. Parker ) /* information used to describe a single instance */ typedef struct sJFET2instance { - struct sJFET2model *JFET2modPtr; /* backpointer to model */ - struct sJFET2instance *JFET2nextInstance; /* pointer to next instance of - * current model*/ - IFuid JFET2name; /* pointer to character string naming this instance */ - int JFET2state; /* pointer to start of state vector for jfet */ + struct GENinstance gen; + +#define JFET2modPtr(inst) ((struct sJFET2model*)((inst)->gen.GENmodPtr)) +#define JFET2nextInstance(inst) ((struct sJFET2instance*)((inst)->gen.GENnextInstance)) +#define JFET2name gen.GENname +#define JFET2state gen.GENstate + const int JFET2drainNode; /* number of drain node of jfet */ const int JFET2gateNode; /* number of gate node of jfet */ const int JFET2sourceNode; /* number of source node of jfet */ diff --git a/src/spicelib/devices/jfet2/jfet2dest.c b/src/spicelib/devices/jfet2/jfet2dest.c index 5b1c03d1a..e06662d13 100644 --- a/src/spicelib/devices/jfet2/jfet2dest.c +++ b/src/spicelib/devices/jfet2/jfet2dest.c @@ -21,7 +21,7 @@ JFET2destroy(GENmodel **inModel) JFET2model *next_mod = JFET2nextModel(mod); JFET2instance *inst = JFET2instances(mod); while (inst) { - JFET2instance *next_inst = inst->JFET2nextInstance; + JFET2instance *next_inst = JFET2nextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/jfet2/jfet2ic.c b/src/spicelib/devices/jfet2/jfet2ic.c index b5a9eca80..c4bfc5404 100644 --- a/src/spicelib/devices/jfet2/jfet2ic.c +++ b/src/spicelib/devices/jfet2/jfet2ic.c @@ -27,7 +27,7 @@ JFET2getic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = JFET2nextModel(model)) { - for(here = JFET2instances(model); here ; here = here->JFET2nextInstance) { + for(here = JFET2instances(model); here ; here = JFET2nextInstance(here)) { if(!here->JFET2icVDSGiven) { here->JFET2icVDS = *(ckt->CKTrhs + here->JFET2drainNode) - diff --git a/src/spicelib/devices/jfet2/jfet2load.c b/src/spicelib/devices/jfet2/jfet2load.c index 7e5951bbb..ba99c9b98 100644 --- a/src/spicelib/devices/jfet2/jfet2load.c +++ b/src/spicelib/devices/jfet2/jfet2load.c @@ -64,7 +64,7 @@ JFET2load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = JFET2instances(model); here != NULL ; - here=here->JFET2nextInstance) { + here=JFET2nextInstance(here)) { /* * dc model parameters */ diff --git a/src/spicelib/devices/jfet2/jfet2noi.c b/src/spicelib/devices/jfet2/jfet2noi.c index 60c964860..18742e097 100644 --- a/src/spicelib/devices/jfet2/jfet2noi.c +++ b/src/spicelib/devices/jfet2/jfet2noi.c @@ -51,7 +51,7 @@ JFET2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata }; for (model=firstModel; model != NULL; model=JFET2nextModel(model)) { - for (inst=JFET2instances(model); inst != NULL; inst=inst->JFET2nextInstance) { + for (inst=JFET2instances(model); inst != NULL; inst=JFET2nextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/jfet2/jfet2set.c b/src/spicelib/devices/jfet2/jfet2set.c index 9b4574636..396e645e3 100644 --- a/src/spicelib/devices/jfet2/jfet2set.c +++ b/src/spicelib/devices/jfet2/jfet2set.c @@ -39,7 +39,7 @@ JFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = JFET2instances(model); here != NULL ; - here=here->JFET2nextInstance) { + here=JFET2nextInstance(here)) { if(!here->JFET2areaGiven) { here->JFET2area = 1; @@ -133,7 +133,7 @@ JFET2unsetup(GENmodel *inModel, CKTcircuit *ckt) model = JFET2nextModel(model)) { for (here = JFET2instances(model); here != NULL; - here=here->JFET2nextInstance) + here=JFET2nextInstance(here)) { if (here->JFET2drainPrimeNode > 0 && here->JFET2drainPrimeNode != here->JFET2drainNode) diff --git a/src/spicelib/devices/jfet2/jfet2temp.c b/src/spicelib/devices/jfet2/jfet2temp.c index cfbfc0faa..eb1f23cf3 100644 --- a/src/spicelib/devices/jfet2/jfet2temp.c +++ b/src/spicelib/devices/jfet2/jfet2temp.c @@ -79,7 +79,7 @@ JFET2temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = JFET2instances(model); here != NULL ; - here=here->JFET2nextInstance) { + here=JFET2nextInstance(here)) { if(!(here->JFET2dtempGiven)) { here->JFET2dtemp = 0.0; diff --git a/src/spicelib/devices/jfet2/jfet2trun.c b/src/spicelib/devices/jfet2/jfet2trun.c index 8e5288a9b..a05e09cb5 100644 --- a/src/spicelib/devices/jfet2/jfet2trun.c +++ b/src/spicelib/devices/jfet2/jfet2trun.c @@ -23,7 +23,7 @@ JFET2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) JFET2instance *here; for( ; model != NULL; model = JFET2nextModel(model)) { - for(here=JFET2instances(model);here!=NULL;here = here->JFET2nextInstance){ + for(here=JFET2instances(model);here!=NULL;here = JFET2nextInstance(here)){ CKTterr(here->JFET2qgs,ckt,timeStep); CKTterr(here->JFET2qgd,ckt,timeStep); diff --git a/src/spicelib/devices/ltra/ltraacct.c b/src/spicelib/devices/ltra/ltraacct.c index a5404aeb6..4215db20a 100644 --- a/src/spicelib/devices/ltra/ltraacct.c +++ b/src/spicelib/devices/ltra/ltraacct.c @@ -47,7 +47,7 @@ LTRAaccept(CKTcircuit *ckt, GENmodel *inModel) } /* loop through all the instances of the model */ for (here = LTRAinstances(model); here != NULL; - here = here->LTRAnextInstance) { + here = LTRAnextInstance(here)) { if (ckt->CKTmode & MODEINITTRAN) { here->LTRAinstListSize = 10; @@ -271,7 +271,7 @@ LTRAaccept(CKTcircuit *ckt, GENmodel *inModel) model = (LTRAmodel *) inModel; for (; model != NULL; model = LTRAnextModel(model)) { for (here = LTRAinstances(model); here != NULL; - here = here->LTRAnextInstance) { + here = LTRAnextInstance(here)) { *(here->LTRAv1 + ckt->CKTtimeIndex - 1) = *(here->LTRAv1 + ckt->CKTtimeIndex); *(here->LTRAv2 + ckt->CKTtimeIndex - 1) = *(here->LTRAv2 + diff --git a/src/spicelib/devices/ltra/ltraacld.c b/src/spicelib/devices/ltra/ltraacld.c index 39ecca245..ed2b7ccb2 100644 --- a/src/spicelib/devices/ltra/ltraacld.c +++ b/src/spicelib/devices/ltra/ltraacld.c @@ -104,7 +104,7 @@ LTRAacLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = LTRAinstances(model); here != NULL; - here = here->LTRAnextInstance) { + here = LTRAnextInstance(here)) { *(here->LTRAibr1Pos1Ptr + 0) += y0_r; *(here->LTRAibr1Pos1Ptr + 1) += y0_i; diff --git a/src/spicelib/devices/ltra/ltraask.c b/src/spicelib/devices/ltra/ltraask.c index 901b69747..022e73374 100644 --- a/src/spicelib/devices/ltra/ltraask.c +++ b/src/spicelib/devices/ltra/ltraask.c @@ -39,16 +39,16 @@ LTRAask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * value->iValue = here->LTRAnegNode2; return (OK); case LTRA_MOD_Z0: - value->rValue = here->LTRAmodPtr->LTRAimped; + value->rValue = LTRAmodPtr(here)->LTRAimped; return (OK); case LTRA_MOD_TD: - value->rValue = here->LTRAmodPtr->LTRAtd; + value->rValue = LTRAmodPtr(here)->LTRAtd; return (OK); case LTRA_MOD_NL: - value->rValue = here->LTRAmodPtr->LTRAnl; + value->rValue = LTRAmodPtr(here)->LTRAnl; return (OK); case LTRA_MOD_FREQ: - value->rValue = here->LTRAmodPtr->LTRAf; + value->rValue = LTRAmodPtr(here)->LTRAf; return (OK); case LTRA_V1: value->rValue = here->LTRAinitVolt1; @@ -63,10 +63,10 @@ LTRAask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * value->rValue = here->LTRAinitCur2; return (OK); case LTRA_MOD_RELTOL: - value->rValue = here->LTRAmodPtr->LTRAreltol; + value->rValue = LTRAmodPtr(here)->LTRAreltol; return (OK); case LTRA_MOD_ABSTOL: - value->rValue = here->LTRAmodPtr->LTRAabstol; + value->rValue = LTRAmodPtr(here)->LTRAabstol; return (OK); case LTRA_BR_EQ1: value->rValue = here->LTRAbrEq1; diff --git a/src/spicelib/devices/ltra/ltradefs.h b/src/spicelib/devices/ltra/ltradefs.h index 14fb38793..79ad981a8 100644 --- a/src/spicelib/devices/ltra/ltradefs.h +++ b/src/spicelib/devices/ltra/ltradefs.h @@ -18,11 +18,13 @@ Author: 1990 Jaijeet S. Roychowdhury /* information used to describe a single instance */ typedef struct sLTRAinstance { - struct sLTRAmodel *LTRAmodPtr; /* backpointer to model */ - struct sLTRAinstance *LTRAnextInstance; /* pointer to next instance of - * current model*/ - IFuid LTRAname; /* pointer to character string naming this instance */ - int LTRAstate; /* not used */ + struct GENinstance gen; + +#define LTRAmodPtr(inst) ((struct sLTRAmodel*)((inst)->gen.GENmodPtr)) +#define LTRAnextInstance(inst) ((struct sLTRAinstance*)((inst)->gen.GENnextInstance)) +#define LTRAname gen.GENname +#define LTRAstate gen.GENstate + const int LTRAposNode1; /* number of positive node of end 1 of t. line */ const int LTRAnegNode1; /* number of negative node of end 1 of t. line */ const int LTRAposNode2; /* number of positive node of end 2 of t. line */ diff --git a/src/spicelib/devices/ltra/ltradest.c b/src/spicelib/devices/ltra/ltradest.c index 336336c29..9fc9eeea5 100644 --- a/src/spicelib/devices/ltra/ltradest.c +++ b/src/spicelib/devices/ltra/ltradest.c @@ -17,7 +17,7 @@ LTRAdestroy(GENmodel **inModel) LTRAmodel *next_mod = LTRAnextModel(mod); LTRAinstance *inst = LTRAinstances(mod); while (inst) { - LTRAinstance *next_inst = inst->LTRAnextInstance; + LTRAinstance *next_inst = LTRAnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/ltra/ltraload.c b/src/spicelib/devices/ltra/ltraload.c index 65935162e..401e604e9 100644 --- a/src/spicelib/devices/ltra/ltraload.c +++ b/src/spicelib/devices/ltra/ltraload.c @@ -220,7 +220,7 @@ LTRAload(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the instances of the model */ for (here = LTRAinstances(model); here != NULL; - here = here->LTRAnextInstance) { + here = LTRAnextInstance(here)) { if ((ckt->CKTmode & MODEDC) || (model->LTRAspecialCase == LTRA_MOD_RG)) { diff --git a/src/spicelib/devices/ltra/ltraset.c b/src/spicelib/devices/ltra/ltraset.c index 6b5ec0c6b..77ab088ea 100644 --- a/src/spicelib/devices/ltra/ltraset.c +++ b/src/spicelib/devices/ltra/ltraset.c @@ -170,7 +170,7 @@ LTRAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) } /* loop through all the instances of the model */ for (here = LTRAinstances(model); here != NULL; - here = here->LTRAnextInstance) { + here = LTRAnextInstance(here)) { if (here->LTRAbrEq1 == 0) { error = CKTmkVolt(ckt, &tmp, here->LTRAname, "i1"); @@ -228,7 +228,7 @@ LTRAunsetup(GENmodel *inModel, CKTcircuit *ckt) for (model = (LTRAmodel *) inModel; model != NULL; model = LTRAnextModel(model)) { for (here = LTRAinstances(model); here != NULL; - here = here->LTRAnextInstance) { + here = LTRAnextInstance(here)) { if (here->LTRAbrEq2 > 0) CKTdltNNum(ckt, here->LTRAbrEq2); here->LTRAbrEq2 = 0; diff --git a/src/spicelib/devices/ltra/ltratemp.c b/src/spicelib/devices/ltra/ltratemp.c index 9ea9c0ac1..8a5ab1839 100644 --- a/src/spicelib/devices/ltra/ltratemp.c +++ b/src/spicelib/devices/ltra/ltratemp.c @@ -148,7 +148,7 @@ LTRAtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = LTRAinstances(model); here != NULL; - here = here->LTRAnextInstance) { + here = LTRAnextInstance(here)) { here->LTRAv1 = NULL; here->LTRAi1 = NULL; diff --git a/src/spicelib/devices/ltra/ltratrun.c b/src/spicelib/devices/ltra/ltratrun.c index b3cb44d7a..7837a3863 100644 --- a/src/spicelib/devices/ltra/ltratrun.c +++ b/src/spicelib/devices/ltra/ltratrun.c @@ -27,7 +27,7 @@ LTRAtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) for (; model != NULL; model = LTRAnextModel(model)) { /* loop through all the instances of the model */ for (here = LTRAinstances(model); here != NULL; - here = here->LTRAnextInstance) { + here = LTRAnextInstance(here)) { switch (model->LTRAspecialCase) { diff --git a/src/spicelib/devices/mes/mesacl.c b/src/spicelib/devices/mes/mesacl.c index 5bddff6f6..96a4f6a34 100644 --- a/src/spicelib/devices/mes/mesacl.c +++ b/src/spicelib/devices/mes/mesacl.c @@ -31,7 +31,7 @@ MESacLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MESnextModel(model) ) { for( here = MESinstances(model); here != NULL; - here = here->MESnextInstance) { + here = MESnextInstance(here)) { m = here->MESm; diff --git a/src/spicelib/devices/mes/mesdefs.h b/src/spicelib/devices/mes/mesdefs.h index fb090acd5..957836c42 100644 --- a/src/spicelib/devices/mes/mesdefs.h +++ b/src/spicelib/devices/mes/mesdefs.h @@ -20,11 +20,13 @@ Author: 1985 S. Hwang /* information used to describe a single instance */ typedef struct sMESinstance { - struct sMESmodel *MESmodPtr; /* backpointer to model */ - struct sMESinstance *MESnextInstance; /* pointer to next instance of - * current model*/ - IFuid MESname; /* pointer to character string naming this instance */ - int MESstate; /* pointer to start of state vector for mesfet */ + struct GENinstance gen; + +#define MESmodPtr(inst) ((struct sMESmodel*)((inst)->gen.GENmodPtr)) +#define MESnextInstance(inst) ((struct sMESinstance*)((inst)->gen.GENnextInstance)) +#define MESname gen.GENname +#define MESstate gen.GENstate + const int MESdrainNode; /* number of drain node of mesfet */ const int MESgateNode; /* number of gate node of mesfet */ const int MESsourceNode; /* number of source node of mesfet */ diff --git a/src/spicelib/devices/mes/mesdest.c b/src/spicelib/devices/mes/mesdest.c index 40bfa0ab9..b83f934cb 100644 --- a/src/spicelib/devices/mes/mesdest.c +++ b/src/spicelib/devices/mes/mesdest.c @@ -17,7 +17,7 @@ MESdestroy(GENmodel **inModel) MESmodel *next_mod = MESnextModel(mod); MESinstance *inst = MESinstances(mod); while (inst) { - MESinstance *next_inst = inst->MESnextInstance; + MESinstance *next_inst = MESnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/mes/mesdisto.c b/src/spicelib/devices/mes/mesdisto.c index e0c0e204e..4c1cd782b 100644 --- a/src/spicelib/devices/mes/mesdisto.c +++ b/src/spicelib/devices/mes/mesdisto.c @@ -44,7 +44,7 @@ for( ; model != NULL; model = MESnextModel(model) ) { /* loop through all the instances of the model */ for (here = MESinstances(model); here != NULL ; - here=here->MESnextInstance) { + here=MESnextInstance(here)) { /* loading starts here */ diff --git a/src/spicelib/devices/mes/mesdset.c b/src/spicelib/devices/mes/mesdset.c index 7540efe8f..0a4caadc6 100644 --- a/src/spicelib/devices/mes/mesdset.c +++ b/src/spicelib/devices/mes/mesdset.c @@ -59,7 +59,7 @@ MESdSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MESinstances(model); here != NULL ; - here=here->MESnextInstance) { + here=MESnextInstance(here)) { /* * dc model parameters diff --git a/src/spicelib/devices/mes/mesgetic.c b/src/spicelib/devices/mes/mesgetic.c index 11084dd5e..8622a9585 100644 --- a/src/spicelib/devices/mes/mesgetic.c +++ b/src/spicelib/devices/mes/mesgetic.c @@ -23,7 +23,7 @@ MESgetic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = MESnextModel(model)) { - for(here = MESinstances(model); here ; here = here->MESnextInstance) { + for(here = MESinstances(model); here ; here = MESnextInstance(here)) { if(!here->MESicVDSGiven) { here->MESicVDS = diff --git a/src/spicelib/devices/mes/mesload.c b/src/spicelib/devices/mes/mesload.c index bbb8cf35b..c40167bff 100644 --- a/src/spicelib/devices/mes/mesload.c +++ b/src/spicelib/devices/mes/mesload.c @@ -89,7 +89,7 @@ MESload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MESinstances(model); here != NULL ; - here=here->MESnextInstance) { + here=MESnextInstance(here)) { /* * dc model parameters diff --git a/src/spicelib/devices/mes/mesnoise.c b/src/spicelib/devices/mes/mesnoise.c index 1e7b94868..8cb3c9d9f 100644 --- a/src/spicelib/devices/mes/mesnoise.c +++ b/src/spicelib/devices/mes/mesnoise.c @@ -46,7 +46,7 @@ MESnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *d }; for (model=firstModel; model != NULL; model=MESnextModel(model)) { - for (inst=MESinstances(model); inst != NULL; inst=inst->MESnextInstance) { + for (inst=MESinstances(model); inst != NULL; inst=MESnextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/mes/mespzld.c b/src/spicelib/devices/mes/mespzld.c index 91918cfaf..244232c72 100644 --- a/src/spicelib/devices/mes/mespzld.c +++ b/src/spicelib/devices/mes/mespzld.c @@ -32,7 +32,7 @@ MESpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = MESnextModel(model) ) { for( here = MESinstances(model); here != NULL; - here = here->MESnextInstance) { + here = MESnextInstance(here)) { m = here->MESm; diff --git a/src/spicelib/devices/mes/messetup.c b/src/spicelib/devices/mes/messetup.c index 176bc9228..d14da13cc 100644 --- a/src/spicelib/devices/mes/messetup.c +++ b/src/spicelib/devices/mes/messetup.c @@ -74,7 +74,7 @@ MESsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = MESinstances(model); here != NULL ; - here=here->MESnextInstance) { + here=MESnextInstance(here)) { if(!here->MESareaGiven) { here->MESarea = 1.0; @@ -166,7 +166,7 @@ MESunsetup(GENmodel *inModel, CKTcircuit *ckt) model = MESnextModel(model)) { for (here = MESinstances(model); here != NULL; - here=here->MESnextInstance) + here=MESnextInstance(here)) { if (here->MESdrainPrimeNode > 0 && here->MESdrainPrimeNode != here->MESdrainNode) diff --git a/src/spicelib/devices/mes/mestrunc.c b/src/spicelib/devices/mes/mestrunc.c index b262e6760..b6d8f5354 100644 --- a/src/spicelib/devices/mes/mestrunc.c +++ b/src/spicelib/devices/mes/mestrunc.c @@ -19,7 +19,7 @@ MEStrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MESinstance *here; for( ; model != NULL; model = MESnextModel(model)) { - for(here=MESinstances(model);here!=NULL;here = here->MESnextInstance){ + for(here=MESinstances(model);here!=NULL;here = MESnextInstance(here)){ CKTterr(here->MESqgs,ckt,timeStep); CKTterr(here->MESqgd,ckt,timeStep); diff --git a/src/spicelib/devices/mesa/mesaacl.c b/src/spicelib/devices/mesa/mesaacl.c index 85a767c5b..04e58e4dd 100644 --- a/src/spicelib/devices/mesa/mesaacl.c +++ b/src/spicelib/devices/mesa/mesaacl.c @@ -33,7 +33,7 @@ MESAacLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MESAnextModel(model) ) { for( here = MESAinstances(model); here != NULL; - here = here->MESAnextInstance) { + here = MESAnextInstance(here)) { f = ckt->CKTomega/2/M_PI; if(here->MESAdelf == 0) diff --git a/src/spicelib/devices/mesa/mesadefs.h b/src/spicelib/devices/mesa/mesadefs.h index 834801512..e5ed3453f 100644 --- a/src/spicelib/devices/mesa/mesadefs.h +++ b/src/spicelib/devices/mesa/mesadefs.h @@ -18,12 +18,13 @@ Author: Trond Ytterdal /* information used to describe a single instance */ typedef struct sMESAinstance { - struct sMESAmodel *MESAmodPtr; /* backpointer to model */ - struct sMESAinstance *MESAnextInstance; /* pointer to next instance of - * current model*/ - IFuid MESAname; /* pointer to character string naming this instance */ - int MESAstate; /* pointer to start of state vector for MESAfet */ - + struct GENinstance gen; + +#define MESAmodPtr(inst) ((struct sMESAmodel*)((inst)->gen.GENmodPtr)) +#define MESAnextInstance(inst) ((struct sMESAinstance*)((inst)->gen.GENnextInstance)) +#define MESAname gen.GENname +#define MESAstate gen.GENstate + const int MESAdrainNode; /* number of drain node of MESAfet */ const int MESAgateNode; /* number of gate node of MESAfet */ const int MESAsourceNode; /* number of source node of MESAfet */ diff --git a/src/spicelib/devices/mesa/mesadest.c b/src/spicelib/devices/mesa/mesadest.c index 880edf492..5173c3555 100644 --- a/src/spicelib/devices/mesa/mesadest.c +++ b/src/spicelib/devices/mesa/mesadest.c @@ -17,7 +17,7 @@ MESAdestroy(GENmodel **inModel) MESAmodel *next_mod = MESAnextModel(mod); MESAinstance *inst = MESAinstances(mod); while (inst) { - MESAinstance *next_inst = inst->MESAnextInstance; + MESAinstance *next_inst = MESAnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/mesa/mesagetic.c b/src/spicelib/devices/mesa/mesagetic.c index ec7906797..13f6d44cd 100644 --- a/src/spicelib/devices/mesa/mesagetic.c +++ b/src/spicelib/devices/mesa/mesagetic.c @@ -21,7 +21,7 @@ MESAgetic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = MESAnextModel(model)) { - for(here = MESAinstances(model); here ; here = here->MESAnextInstance) { + for(here = MESAinstances(model); here ; here = MESAnextInstance(here)) { if(!here->MESAicVDSGiven) { here->MESAicVDS = diff --git a/src/spicelib/devices/mesa/mesaload.c b/src/spicelib/devices/mesa/mesaload.c index 8d2b5789e..39c1420bb 100644 --- a/src/spicelib/devices/mesa/mesaload.c +++ b/src/spicelib/devices/mesa/mesaload.c @@ -99,7 +99,7 @@ MESAload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MESAinstances(model); here != NULL ; - here=here->MESAnextInstance) { + here=MESAnextInstance(here)) { /* * dc model parameters diff --git a/src/spicelib/devices/mesa/mesapzl.c b/src/spicelib/devices/mesa/mesapzl.c index eaf941a28..0970cf358 100644 --- a/src/spicelib/devices/mesa/mesapzl.c +++ b/src/spicelib/devices/mesa/mesapzl.c @@ -33,7 +33,7 @@ MESApzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = MESAnextModel(model) ) { for( here = MESAinstances(model); here != NULL; - here = here->MESAnextInstance) { + here = MESAnextInstance(here)) { f = ckt->CKTomega/2/M_PI; if(here->MESAdelf == 0) diff --git a/src/spicelib/devices/mesa/mesasetup.c b/src/spicelib/devices/mesa/mesasetup.c index f75a8554e..4b61a4884 100644 --- a/src/spicelib/devices/mesa/mesasetup.c +++ b/src/spicelib/devices/mesa/mesasetup.c @@ -228,7 +228,7 @@ MESAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = MESAinstances(model); here != NULL ; - here=here->MESAnextInstance) { + here=MESAnextInstance(here)) { if(!here->MESAlengthGiven) { here->MESAlength = 1e-6; @@ -417,7 +417,7 @@ MESAunsetup(GENmodel *inModel, CKTcircuit *ckt) model = MESAnextModel(model)) { for (here = MESAinstances(model); here != NULL; - here=here->MESAnextInstance) + here=MESAnextInstance(here)) { if (here->MESAdrainPrmPrmNode > 0 && here->MESAdrainPrmPrmNode != here->MESAdrainPrimeNode) diff --git a/src/spicelib/devices/mesa/mesatemp.c b/src/spicelib/devices/mesa/mesatemp.c index 131d3f92c..9542207bd 100644 --- a/src/spicelib/devices/mesa/mesatemp.c +++ b/src/spicelib/devices/mesa/mesatemp.c @@ -41,7 +41,7 @@ MESAtemp(GENmodel *inModel, CKTcircuit *ckt) model->MESAdeltaSqr = model->MESAdelta*model->MESAdelta; for (here = MESAinstances(model); here != NULL ; - here=here->MESAnextInstance) { + here=MESAnextInstance(here)) { vt = CONSTKoverQ * here->MESAts; if(model->MESAmu1 == 0 && model->MESAmu2 == 0) diff --git a/src/spicelib/devices/mesa/mesatrunc.c b/src/spicelib/devices/mesa/mesatrunc.c index da9273677..300aa3f6c 100644 --- a/src/spicelib/devices/mesa/mesatrunc.c +++ b/src/spicelib/devices/mesa/mesatrunc.c @@ -18,7 +18,7 @@ MESAtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) for( ; model != NULL; model = MESAnextModel(model)) { for(here=MESAinstances(model);here!=NULL; - here = here->MESAnextInstance){ + here = MESAnextInstance(here)){ CKTterr(here->MESAqgs,ckt,timeStep); CKTterr(here->MESAqgd,ckt,timeStep); diff --git a/src/spicelib/devices/mos1/mos1acld.c b/src/spicelib/devices/mos1/mos1acld.c index 32181207a..5cc8ca312 100644 --- a/src/spicelib/devices/mos1/mos1acld.c +++ b/src/spicelib/devices/mos1/mos1acld.c @@ -35,7 +35,7 @@ MOS1acLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS1nextModel(model)) { for(here = MOS1instances(model); here!= NULL; - here = here->MOS1nextInstance) { + here = MOS1nextInstance(here)) { if (here->MOS1mode < 0) { xnrm=0; diff --git a/src/spicelib/devices/mos1/mos1ask.c b/src/spicelib/devices/mos1/mos1ask.c index d913c162d..8d182044d 100644 --- a/src/spicelib/devices/mos1/mos1ask.c +++ b/src/spicelib/devices/mos1/mos1ask.c @@ -182,7 +182,7 @@ MOS1ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, case MOS1_CAPGS: value->rValue = 2* *(ckt->CKTstate0 + here->MOS1capgs); /* add overlap capacitance */ - value->rValue += (here->MOS1modPtr->MOS1gateSourceOverlapCapFactor) + value->rValue += (MOS1modPtr(here)->MOS1gateSourceOverlapCapFactor) * here->MOS1m * (here->MOS1w); return(OK); @@ -195,7 +195,7 @@ MOS1ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, case MOS1_CAPGD: value->rValue = 2* *(ckt->CKTstate0 + here->MOS1capgd); /* add overlap capacitance */ - value->rValue += (here->MOS1modPtr->MOS1gateDrainOverlapCapFactor) + value->rValue += (MOS1modPtr(here)->MOS1gateDrainOverlapCapFactor) * here->MOS1m * (here->MOS1w); return(OK); @@ -208,10 +208,10 @@ MOS1ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, case MOS1_CAPGB: value->rValue = 2* *(ckt->CKTstate0 + here->MOS1capgb); /* add overlap capacitance */ - value->rValue += (here->MOS1modPtr->MOS1gateBulkOverlapCapFactor) + value->rValue += (MOS1modPtr(here)->MOS1gateBulkOverlapCapFactor) * here->MOS1m * (here->MOS1l - -2*(here->MOS1modPtr->MOS1latDiff)); + -2*(MOS1modPtr(here)->MOS1latDiff)); return(OK); case MOS1_QGB: value->rValue = *(ckt->CKTstate0 + here->MOS1qgb); diff --git a/src/spicelib/devices/mos1/mos1conv.c b/src/spicelib/devices/mos1/mos1conv.c index c10a5892b..ec333a12b 100644 --- a/src/spicelib/devices/mos1/mos1conv.c +++ b/src/spicelib/devices/mos1/mos1conv.c @@ -31,7 +31,7 @@ MOS1convTest(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS1nextModel(model)) { for(here = MOS1instances(model); here!= NULL; - here = here->MOS1nextInstance) { + here = MOS1nextInstance(here)) { vbs = model->MOS1type * ( *(ckt->CKTrhs+here->MOS1bNode) - diff --git a/src/spicelib/devices/mos1/mos1defs.h b/src/spicelib/devices/mos1/mos1defs.h index fb45d2af9..ccb847694 100644 --- a/src/spicelib/devices/mos1/mos1defs.h +++ b/src/spicelib/devices/mos1/mos1defs.h @@ -18,11 +18,12 @@ Modified: 2000 AlansFixes /* information needed for each instance */ typedef struct sMOS1instance { - struct sMOS1model *MOS1modPtr; /* backpointer to model */ - struct sMOS1instance *MOS1nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS1name; /* pointer to character string naming this instance */ - int MOS1states; /* index into state table for this device */ + struct GENinstance gen; + +#define MOS1modPtr(inst) ((struct sMOS1model*)((inst)->gen.GENmodPtr)) +#define MOS1nextInstance(inst) ((struct sMOS1instance*)((inst)->gen.GENnextInstance)) +#define MOS1name gen.GENname +#define MOS1states gen.GENstate const int MOS1dNode; /* number of the gate node of the mosfet */ const int MOS1gNode; /* number of the gate node of the mosfet */ diff --git a/src/spicelib/devices/mos1/mos1dest.c b/src/spicelib/devices/mos1/mos1dest.c index a01c0ed4d..1538b6b4d 100644 --- a/src/spicelib/devices/mos1/mos1dest.c +++ b/src/spicelib/devices/mos1/mos1dest.c @@ -17,7 +17,7 @@ MOS1destroy(GENmodel **inModel) MOS1model *next_mod = MOS1nextModel(mod); MOS1instance *inst = MOS1instances(mod); while (inst) { - MOS1instance *next_inst = inst->MOS1nextInstance; + MOS1instance *next_inst = MOS1nextInstance(inst); FREE(inst->MOS1sens); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/mos1/mos1dist.c b/src/spicelib/devices/mos1/mos1dist.c index 0d1b2373f..b320a1a38 100644 --- a/src/spicelib/devices/mos1/mos1dist.c +++ b/src/spicelib/devices/mos1/mos1dist.c @@ -50,7 +50,7 @@ for( ; model != NULL; model = MOS1nextModel(model) ) { /* loop through all the instances of the model */ for (here = MOS1instances(model); here != NULL ; - here=here->MOS1nextInstance) { + here=MOS1nextInstance(here)) { /* loading starts here */ diff --git a/src/spicelib/devices/mos1/mos1dset.c b/src/spicelib/devices/mos1/mos1dset.c index ef3416832..38bcf3f93 100644 --- a/src/spicelib/devices/mos1/mos1dset.c +++ b/src/spicelib/devices/mos1/mos1dset.c @@ -83,7 +83,7 @@ MOS1dSetup(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS1nextModel(model) ) { /* loop through all the instances of the model */ for (here = MOS1instances(model); here != NULL ; - here=here->MOS1nextInstance) { + here=MOS1nextInstance(here)) { vt = CONSTKoverQ * here->MOS1temp; EffectiveLength=here->MOS1l - 2*model->MOS1latDiff; diff --git a/src/spicelib/devices/mos1/mos1ic.c b/src/spicelib/devices/mos1/mos1ic.c index 9e6347e8b..934e00248 100644 --- a/src/spicelib/devices/mos1/mos1ic.c +++ b/src/spicelib/devices/mos1/mos1ic.c @@ -23,7 +23,7 @@ MOS1getic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = MOS1nextModel(model)) { - for(here = MOS1instances(model); here ; here = here->MOS1nextInstance) { + for(here = MOS1instances(model); here ; here = MOS1nextInstance(here)) { if(!here->MOS1icVBSGiven) { here->MOS1icVBS = diff --git a/src/spicelib/devices/mos1/mos1load.c b/src/spicelib/devices/mos1/mos1load.c index db4ef11e9..062b40ce1 100644 --- a/src/spicelib/devices/mos1/mos1load.c +++ b/src/spicelib/devices/mos1/mos1load.c @@ -99,7 +99,7 @@ MOS1load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS1instances(model); here != NULL ; - here=here->MOS1nextInstance) { + here=MOS1nextInstance(here)) { vt = CONSTKoverQ * here->MOS1temp; Check=1; diff --git a/src/spicelib/devices/mos1/mos1noi.c b/src/spicelib/devices/mos1/mos1noi.c index 6539d4074..9b97961af 100644 --- a/src/spicelib/devices/mos1/mos1noi.c +++ b/src/spicelib/devices/mos1/mos1noi.c @@ -58,7 +58,7 @@ MOS1noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, coxSquared = model->MOS1oxideCapFactor; } coxSquared *= coxSquared; - for (inst=MOS1instances(model); inst != NULL; inst=inst->MOS1nextInstance) { + for (inst=MOS1instances(model); inst != NULL; inst=MOS1nextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/mos1/mos1pzld.c b/src/spicelib/devices/mos1/mos1pzld.c index a013ea166..c260527ea 100644 --- a/src/spicelib/devices/mos1/mos1pzld.c +++ b/src/spicelib/devices/mos1/mos1pzld.c @@ -36,7 +36,7 @@ MOS1pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = MOS1nextModel(model)) { for(here = MOS1instances(model); here!= NULL; - here = here->MOS1nextInstance) { + here = MOS1nextInstance(here)) { if (here->MOS1mode < 0) { xnrm=0; diff --git a/src/spicelib/devices/mos1/mos1sacl.c b/src/spicelib/devices/mos1/mos1sacl.c index 6ae3e2c43..03f8272b5 100644 --- a/src/spicelib/devices/mos1/mos1sacl.c +++ b/src/spicelib/devices/mos1/mos1sacl.c @@ -130,7 +130,7 @@ MOS1sAcLoad(GENmodel *inModel, CKTcircuit *ckt) info->SENstatus = PERTURBATION; for( ; model != NULL; model = MOS1nextModel(model)) { for(here = MOS1instances(model); here!= NULL; - here = here->MOS1nextInstance) { + here = MOS1nextInstance(here)) { /* save the unperturbed values in the state vector */ for(i=0; i <= 16; i++) diff --git a/src/spicelib/devices/mos1/mos1set.c b/src/spicelib/devices/mos1/mos1set.c index df352a08f..0ec9fd27d 100644 --- a/src/spicelib/devices/mos1/mos1set.c +++ b/src/spicelib/devices/mos1/mos1set.c @@ -90,7 +90,7 @@ MOS1setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, /* loop through all the instances of the model */ for (here = MOS1instances(model); here != NULL ; - here=here->MOS1nextInstance) { + here=MOS1nextInstance(here)) { /* allocate a chunk of the state vector */ here->MOS1states = *states; @@ -221,7 +221,7 @@ MOS1unsetup(GENmodel *inModel, CKTcircuit *ckt) model = MOS1nextModel(model)) { for (here = MOS1instances(model); here != NULL; - here=here->MOS1nextInstance) + here=MOS1nextInstance(here)) { if (here->MOS1sNodePrime > 0 && here->MOS1sNodePrime != here->MOS1sNode) diff --git a/src/spicelib/devices/mos1/mos1sld.c b/src/spicelib/devices/mos1/mos1sld.c index 2365f84cc..83390cfd9 100644 --- a/src/spicelib/devices/mos1/mos1sld.c +++ b/src/spicelib/devices/mos1/mos1sld.c @@ -97,7 +97,7 @@ MOS1sLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS1instances(model); here != NULL ; - here=here->MOS1nextInstance) { + here=MOS1nextInstance(here)) { #ifdef SENSDEBUG printf("senload instance name %s\n",here->MOS1name); diff --git a/src/spicelib/devices/mos1/mos1sprt.c b/src/spicelib/devices/mos1/mos1sprt.c index 808fd05f9..11dfc6a83 100644 --- a/src/spicelib/devices/mos1/mos1sprt.c +++ b/src/spicelib/devices/mos1/mos1sprt.c @@ -34,7 +34,7 @@ MOS1sPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS1instances(model); here != NULL ; - here=here->MOS1nextInstance) { + here=MOS1nextInstance(here)) { printf(" Instance name:%s\n",here->MOS1name); printf(" Drain, Gate , Source nodes: %s, %s ,%s\n", diff --git a/src/spicelib/devices/mos1/mos1sset.c b/src/spicelib/devices/mos1/mos1sset.c index 9c2e38e2c..b8f4f6cca 100644 --- a/src/spicelib/devices/mos1/mos1sset.c +++ b/src/spicelib/devices/mos1/mos1sset.c @@ -26,7 +26,7 @@ MOS1sSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = MOS1instances(model); here != NULL ; - here=here->MOS1nextInstance) { + here=MOS1nextInstance(here)) { if(here->MOS1senParmNo){ if((here->MOS1sens_l)&&(here->MOS1sens_w)){ diff --git a/src/spicelib/devices/mos1/mos1supd.c b/src/spicelib/devices/mos1/mos1supd.c index d565f0ba5..8ed0156d2 100644 --- a/src/spicelib/devices/mos1/mos1supd.c +++ b/src/spicelib/devices/mos1/mos1supd.c @@ -55,7 +55,7 @@ MOS1sUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS1instances(model); here != NULL ; - here=here->MOS1nextInstance) { + here=MOS1nextInstance(here)) { #ifdef SENSDEBUG printf("senupdate instance name %s\n",here->MOS1name); diff --git a/src/spicelib/devices/mos1/mos1temp.c b/src/spicelib/devices/mos1/mos1temp.c index e6b8e2b22..83bc15664 100644 --- a/src/spicelib/devices/mos1/mos1temp.c +++ b/src/spicelib/devices/mos1/mos1temp.c @@ -115,7 +115,7 @@ MOS1temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ for(here = MOS1instances(model); here!= NULL; - here = here->MOS1nextInstance) { + here = MOS1nextInstance(here)) { double czbd; /* zero voltage bulk-drain capacitance */ double czbdsw; /* zero voltage bulk-drain sidewall capacitance */ double czbs; /* zero voltage bulk-source capacitance */ diff --git a/src/spicelib/devices/mos1/mos1trun.c b/src/spicelib/devices/mos1/mos1trun.c index c4d6c965c..81e11fdf0 100644 --- a/src/spicelib/devices/mos1/mos1trun.c +++ b/src/spicelib/devices/mos1/mos1trun.c @@ -19,7 +19,7 @@ MOS1trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MOS1instance *here; for( ; model != NULL; model = MOS1nextModel(model)) { - for(here=MOS1instances(model);here!=NULL;here = here->MOS1nextInstance){ + for(here=MOS1instances(model);here!=NULL;here = MOS1nextInstance(here)){ CKTterr(here->MOS1qgs,ckt,timeStep); CKTterr(here->MOS1qgd,ckt,timeStep); diff --git a/src/spicelib/devices/mos2/mos2acld.c b/src/spicelib/devices/mos2/mos2acld.c index 1492d8735..7e4fea7b5 100644 --- a/src/spicelib/devices/mos2/mos2acld.c +++ b/src/spicelib/devices/mos2/mos2acld.c @@ -35,7 +35,7 @@ MOS2acLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS2nextModel(model)) { for(here = MOS2instances(model); here!= NULL; - here = here->MOS2nextInstance) { + here = MOS2nextInstance(here)) { if (here->MOS2mode < 0) { xnrm=0; diff --git a/src/spicelib/devices/mos2/mos2ask.c b/src/spicelib/devices/mos2/mos2ask.c index 36378479e..19243a040 100644 --- a/src/spicelib/devices/mos2/mos2ask.c +++ b/src/spicelib/devices/mos2/mos2ask.c @@ -182,7 +182,7 @@ MOS2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, case MOS2_CAPGS: value->rValue = 2* *(ckt->CKTstate0 + here->MOS2capgs); /* add overlap capacitance */ - value->rValue += (here->MOS2modPtr->MOS2gateSourceOverlapCapFactor) + value->rValue += (MOS2modPtr(here)->MOS2gateSourceOverlapCapFactor) * here->MOS2m * (here->MOS2w); return(OK); @@ -195,7 +195,7 @@ MOS2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, case MOS2_CAPGD: value->rValue = 2* *(ckt->CKTstate0 + here->MOS2capgd); /* add overlap capacitance */ - value->rValue += (here->MOS2modPtr->MOS2gateDrainOverlapCapFactor) + value->rValue += (MOS2modPtr(here)->MOS2gateDrainOverlapCapFactor) * here->MOS2m * (here->MOS2w); return(OK); @@ -208,10 +208,10 @@ MOS2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, case MOS2_CAPGB: value->rValue = 2* *(ckt->CKTstate0 + here->MOS2capgb); /* add overlap capacitance */ - value->rValue += (here->MOS2modPtr->MOS2gateBulkOverlapCapFactor) + value->rValue += (MOS2modPtr(here)->MOS2gateBulkOverlapCapFactor) * here->MOS2m * (here->MOS2l - -2*(here->MOS2modPtr->MOS2latDiff)); + -2*(MOS2modPtr(here)->MOS2latDiff)); return(OK); case MOS2_QGB: value->rValue = *(ckt->CKTstate0 + here->MOS2qgb); diff --git a/src/spicelib/devices/mos2/mos2conv.c b/src/spicelib/devices/mos2/mos2conv.c index 2ee444a45..3d035447c 100644 --- a/src/spicelib/devices/mos2/mos2conv.c +++ b/src/spicelib/devices/mos2/mos2conv.c @@ -31,7 +31,7 @@ MOS2convTest(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS2nextModel(model)) { for(here = MOS2instances(model); here!= NULL; - here = here->MOS2nextInstance) { + here = MOS2nextInstance(here)) { vbs = model->MOS2type * ( *(ckt->CKTrhs+here->MOS2bNode) - diff --git a/src/spicelib/devices/mos2/mos2defs.h b/src/spicelib/devices/mos2/mos2defs.h index 802981f94..68c254019 100644 --- a/src/spicelib/devices/mos2/mos2defs.h +++ b/src/spicelib/devices/mos2/mos2defs.h @@ -18,11 +18,13 @@ Modified: 2000 AlansFIxes /* information needed for each instance */ typedef struct sMOS2instance { - struct sMOS2model *MOS2modPtr; /* backpointer to model */ - struct sMOS2instance *MOS2nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS2name; /* pointer to character string naming this instance */ - int MOS2states; /* index into state table for this device */ + struct GENinstance gen; + +#define MOS2modPtr(inst) ((struct sMOS2model*)((inst)->gen.GENmodPtr)) +#define MOS2nextInstance(inst) ((struct sMOS2instance*)((inst)->gen.GENnextInstance)) +#define MOS2name gen.GENname +#define MOS2states gen.GENstate + const int MOS2dNode; /* number of the gate node of the mosfet */ const int MOS2gNode; /* number of the gate node of the mosfet */ const int MOS2sNode; /* number of the source node of the mosfet */ diff --git a/src/spicelib/devices/mos2/mos2dest.c b/src/spicelib/devices/mos2/mos2dest.c index 78c7b0004..18a991a51 100644 --- a/src/spicelib/devices/mos2/mos2dest.c +++ b/src/spicelib/devices/mos2/mos2dest.c @@ -17,7 +17,7 @@ MOS2destroy(GENmodel **inModel) MOS2model *next_mod = MOS2nextModel(mod); MOS2instance *inst = MOS2instances(mod); while (inst) { - MOS2instance *next_inst = inst->MOS2nextInstance; + MOS2instance *next_inst = MOS2nextInstance(inst); FREE(inst->MOS2sens); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/mos2/mos2dist.c b/src/spicelib/devices/mos2/mos2dist.c index 9eea4a9ac..18b8d3a1e 100644 --- a/src/spicelib/devices/mos2/mos2dist.c +++ b/src/spicelib/devices/mos2/mos2dist.c @@ -49,7 +49,7 @@ for( ; model != NULL; model = MOS2nextModel(model) ) { /* loop through all the instances of the model */ for (here = MOS2instances(model); here != NULL ; - here=here->MOS2nextInstance) { + here=MOS2nextInstance(here)) { /* loading starts here */ diff --git a/src/spicelib/devices/mos2/mos2dset.c b/src/spicelib/devices/mos2/mos2dset.c index ff9bb8683..93b513d7e 100644 --- a/src/spicelib/devices/mos2/mos2dset.c +++ b/src/spicelib/devices/mos2/mos2dset.c @@ -74,7 +74,7 @@ double gmbds; /* loop through all the instances of the model */ for (here = MOS2instances(model); here != NULL ; - here=here->MOS2nextInstance) { + here=MOS2nextInstance(here)) { vt = CONSTKoverQ * here->MOS2temp; diff --git a/src/spicelib/devices/mos2/mos2ic.c b/src/spicelib/devices/mos2/mos2ic.c index 36ecfe219..d0fbb74fa 100644 --- a/src/spicelib/devices/mos2/mos2ic.c +++ b/src/spicelib/devices/mos2/mos2ic.c @@ -23,7 +23,7 @@ MOS2getic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = MOS2nextModel(model)) { - for(here = MOS2instances(model); here ; here = here->MOS2nextInstance) { + for(here = MOS2instances(model); here ; here = MOS2nextInstance(here)) { if(!here->MOS2icVBSGiven) { here->MOS2icVBS = diff --git a/src/spicelib/devices/mos2/mos2load.c b/src/spicelib/devices/mos2/mos2load.c index 688199727..32441c057 100644 --- a/src/spicelib/devices/mos2/mos2load.c +++ b/src/spicelib/devices/mos2/mos2load.c @@ -107,7 +107,7 @@ MOS2load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS2instances(model); here != NULL ; - here=here->MOS2nextInstance) { + here=MOS2nextInstance(here)) { vt = CONSTKoverQ * here->MOS2temp; Check=1; diff --git a/src/spicelib/devices/mos2/mos2noi.c b/src/spicelib/devices/mos2/mos2noi.c index a4f5face9..4069c653c 100644 --- a/src/spicelib/devices/mos2/mos2noi.c +++ b/src/spicelib/devices/mos2/mos2noi.c @@ -47,7 +47,7 @@ MOS2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, }; for (model=firstModel; model != NULL; model=MOS2nextModel(model)) { - for (inst=MOS2instances(model); inst != NULL; inst=inst->MOS2nextInstance) { + for (inst=MOS2instances(model); inst != NULL; inst=MOS2nextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/mos2/mos2pzld.c b/src/spicelib/devices/mos2/mos2pzld.c index 8057a167b..c7c262937 100644 --- a/src/spicelib/devices/mos2/mos2pzld.c +++ b/src/spicelib/devices/mos2/mos2pzld.c @@ -36,7 +36,7 @@ MOS2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = MOS2nextModel(model)) { for(here = MOS2instances(model); here!= NULL; - here = here->MOS2nextInstance) { + here = MOS2nextInstance(here)) { if (here->MOS2mode < 0) { xnrm=0; diff --git a/src/spicelib/devices/mos2/mos2sacl.c b/src/spicelib/devices/mos2/mos2sacl.c index 324c91099..67f117721 100644 --- a/src/spicelib/devices/mos2/mos2sacl.c +++ b/src/spicelib/devices/mos2/mos2sacl.c @@ -130,7 +130,7 @@ MOS2sAcLoad(GENmodel *inModel, CKTcircuit *ckt) info->SENstatus = PERTURBATION; for( ; model != NULL; model = MOS2nextModel(model)) { for(here = MOS2instances(model); here!= NULL; - here = here->MOS2nextInstance) { + here = MOS2nextInstance(here)) { /* save the unperturbed values in the state vector */ for(i=0; i <= 16; i++) diff --git a/src/spicelib/devices/mos2/mos2set.c b/src/spicelib/devices/mos2/mos2set.c index 41748ca78..3e4994b52 100644 --- a/src/spicelib/devices/mos2/mos2set.c +++ b/src/spicelib/devices/mos2/mos2set.c @@ -119,7 +119,7 @@ MOS2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = MOS2instances(model); here != NULL ; - here=here->MOS2nextInstance) { + here=MOS2nextInstance(here)) { CKTnode *tmpNode; IFuid tmpName; @@ -244,7 +244,7 @@ MOS2unsetup(GENmodel *inModel, CKTcircuit *ckt) model = MOS2nextModel(model)) { for (here = MOS2instances(model); here != NULL; - here=here->MOS2nextInstance) + here=MOS2nextInstance(here)) { if (here->MOS2sNodePrime > 0 && here->MOS2sNodePrime != here->MOS2sNode) diff --git a/src/spicelib/devices/mos2/mos2sld.c b/src/spicelib/devices/mos2/mos2sld.c index 12105fa0d..b18b69f6f 100644 --- a/src/spicelib/devices/mos2/mos2sld.c +++ b/src/spicelib/devices/mos2/mos2sld.c @@ -97,7 +97,7 @@ MOS2sLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS2instances(model); here != NULL ; - here=here->MOS2nextInstance) { + here=MOS2nextInstance(here)) { #ifdef SENSDEBUG printf("senload instance name %s\n",here->MOS2name); diff --git a/src/spicelib/devices/mos2/mos2sprt.c b/src/spicelib/devices/mos2/mos2sprt.c index 6e7c39283..49f86fbbf 100644 --- a/src/spicelib/devices/mos2/mos2sprt.c +++ b/src/spicelib/devices/mos2/mos2sprt.c @@ -30,7 +30,7 @@ MOS2sPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS2instances(model); here != NULL ; - here=here->MOS2nextInstance) { + here=MOS2nextInstance(here)) { printf(" Instance name:%s\n",here->MOS2name); printf(" Drain, Gate , Source nodes: %s, %s ,%s\n", diff --git a/src/spicelib/devices/mos2/mos2sset.c b/src/spicelib/devices/mos2/mos2sset.c index 01ebf7981..d815142e2 100644 --- a/src/spicelib/devices/mos2/mos2sset.c +++ b/src/spicelib/devices/mos2/mos2sset.c @@ -26,7 +26,7 @@ MOS2sSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = MOS2instances(model); here != NULL ; - here=here->MOS2nextInstance) { + here=MOS2nextInstance(here)) { if(here->MOS2senParmNo){ if((here->MOS2sens_l)&&(here->MOS2sens_w)){ diff --git a/src/spicelib/devices/mos2/mos2supd.c b/src/spicelib/devices/mos2/mos2supd.c index 9930bf858..cb3193df3 100644 --- a/src/spicelib/devices/mos2/mos2supd.c +++ b/src/spicelib/devices/mos2/mos2supd.c @@ -55,7 +55,7 @@ MOS2sUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS2instances(model); here != NULL ; - here=here->MOS2nextInstance) { + here=MOS2nextInstance(here)) { #ifdef SENSDEBUG printf("senupdate instance name %s\n",here->MOS2name); diff --git a/src/spicelib/devices/mos2/mos2temp.c b/src/spicelib/devices/mos2/mos2temp.c index 7162604ee..f51deef98 100644 --- a/src/spicelib/devices/mos2/mos2temp.c +++ b/src/spicelib/devices/mos2/mos2temp.c @@ -122,7 +122,7 @@ MOS2temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ for(here = MOS2instances(model); here!= NULL; - here = here->MOS2nextInstance) { + here = MOS2nextInstance(here)) { double czbd; /* zero voltage bulk-drain capacitance */ double czbdsw; /* zero voltage bulk-drain sidewall capacitance */ double czbs; /* zero voltage bulk-source capacitance */ diff --git a/src/spicelib/devices/mos2/mos2trun.c b/src/spicelib/devices/mos2/mos2trun.c index ee849a2f7..20de2ef8b 100644 --- a/src/spicelib/devices/mos2/mos2trun.c +++ b/src/spicelib/devices/mos2/mos2trun.c @@ -19,7 +19,7 @@ MOS2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MOS2instance *here; for( ; model != NULL; model = MOS2nextModel(model)) { - for(here=MOS2instances(model);here!=NULL;here = here->MOS2nextInstance){ + for(here=MOS2instances(model);here!=NULL;here = MOS2nextInstance(here)){ CKTterr(here->MOS2qgs,ckt,timeStep); CKTterr(here->MOS2qgd,ckt,timeStep); diff --git a/src/spicelib/devices/mos3/mos3acld.c b/src/spicelib/devices/mos3/mos3acld.c index 84334ade6..49c014e4f 100644 --- a/src/spicelib/devices/mos3/mos3acld.c +++ b/src/spicelib/devices/mos3/mos3acld.c @@ -36,7 +36,7 @@ MOS3acLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS3nextModel(model)) { for(here = MOS3instances(model); here!= NULL; - here = here->MOS3nextInstance) { + here = MOS3nextInstance(here)) { if (here->MOS3mode < 0) { xnrm=0; diff --git a/src/spicelib/devices/mos3/mos3ask.c b/src/spicelib/devices/mos3/mos3ask.c index 5ac10f317..cadbbde3c 100644 --- a/src/spicelib/devices/mos3/mos3ask.c +++ b/src/spicelib/devices/mos3/mos3ask.c @@ -182,11 +182,11 @@ MOS3ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, case MOS3_CAPGS: value->rValue = 2* *(ckt->CKTstate0 + here->MOS3capgs); /* add overlap capacitance */ - value->rValue += (here->MOS3modPtr->MOS3gateSourceOverlapCapFactor) + value->rValue += (MOS3modPtr(here)->MOS3gateSourceOverlapCapFactor) * here->MOS3m * (here->MOS3w - +here->MOS3modPtr->MOS3widthAdjust - -2*(here->MOS3modPtr->MOS3widthNarrow)); + +MOS3modPtr(here)->MOS3widthAdjust + -2*(MOS3modPtr(here)->MOS3widthNarrow)); return(OK); case MOS3_QGS: value->rValue = *(ckt->CKTstate0 + here->MOS3qgs); @@ -197,11 +197,11 @@ MOS3ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, case MOS3_CAPGD: value->rValue = 2* *(ckt->CKTstate0 + here->MOS3capgd); /* add overlap capacitance */ - value->rValue += (here->MOS3modPtr->MOS3gateDrainOverlapCapFactor) + value->rValue += (MOS3modPtr(here)->MOS3gateDrainOverlapCapFactor) * here->MOS3m * (here->MOS3w - +here->MOS3modPtr->MOS3widthAdjust - -2*(here->MOS3modPtr->MOS3widthNarrow)); + +MOS3modPtr(here)->MOS3widthAdjust + -2*(MOS3modPtr(here)->MOS3widthNarrow)); return(OK); case MOS3_QGD: value->rValue = *(ckt->CKTstate0 + here->MOS3qgd); @@ -212,11 +212,11 @@ MOS3ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, case MOS3_CAPGB: value->rValue = 2* *(ckt->CKTstate0 + here->MOS3capgb); /* add overlap capacitance */ - value->rValue += (here->MOS3modPtr->MOS3gateBulkOverlapCapFactor) + value->rValue += (MOS3modPtr(here)->MOS3gateBulkOverlapCapFactor) * here->MOS3m * (here->MOS3l - +here->MOS3modPtr->MOS3lengthAdjust - -2*(here->MOS3modPtr->MOS3latDiff)); + +MOS3modPtr(here)->MOS3lengthAdjust + -2*(MOS3modPtr(here)->MOS3latDiff)); return(OK); case MOS3_QGB: value->rValue = *(ckt->CKTstate0 + here->MOS3qgb); diff --git a/src/spicelib/devices/mos3/mos3conv.c b/src/spicelib/devices/mos3/mos3conv.c index a6018103b..a746bb581 100644 --- a/src/spicelib/devices/mos3/mos3conv.c +++ b/src/spicelib/devices/mos3/mos3conv.c @@ -31,7 +31,7 @@ MOS3convTest(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS3nextModel(model)) { for(here = MOS3instances(model); here!= NULL; - here = here->MOS3nextInstance) { + here = MOS3nextInstance(here)) { vbs = model->MOS3type * ( *(ckt->CKTrhs+here->MOS3bNode) - diff --git a/src/spicelib/devices/mos3/mos3defs.h b/src/spicelib/devices/mos3/mos3defs.h index 161388338..57b2a0218 100644 --- a/src/spicelib/devices/mos3/mos3defs.h +++ b/src/spicelib/devices/mos3/mos3defs.h @@ -18,11 +18,13 @@ Modified: 2000 AlanFixes /* information needed for each instance */ typedef struct sMOS3instance { - struct sMOS3model *MOS3modPtr; /* backpointer to model */ - struct sMOS3instance *MOS3nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS3name; /* pointer to character string naming this instance */ - int MOS3states; /* index into state table for this device */ + struct GENinstance gen; + +#define MOS3modPtr(inst) ((struct sMOS3model*)((inst)->gen.GENmodPtr)) +#define MOS3nextInstance(inst) ((struct sMOS3instance*)((inst)->gen.GENnextInstance)) +#define MOS3name gen.GENname +#define MOS3states gen.GENstate + const int MOS3dNode; /* number of the gate node of the mosfet */ const int MOS3gNode; /* number of the gate node of the mosfet */ const int MOS3sNode; /* number of the source node of the mosfet */ diff --git a/src/spicelib/devices/mos3/mos3dest.c b/src/spicelib/devices/mos3/mos3dest.c index 5affd7a0f..dfdab0ff4 100644 --- a/src/spicelib/devices/mos3/mos3dest.c +++ b/src/spicelib/devices/mos3/mos3dest.c @@ -17,7 +17,7 @@ MOS3destroy(GENmodel **inModel) MOS3model *next_mod = MOS3nextModel(mod); MOS3instance *inst = MOS3instances(mod); while (inst) { - MOS3instance *next_inst = inst->MOS3nextInstance; + MOS3instance *next_inst = MOS3nextInstance(inst); FREE(inst->MOS3sens); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/mos3/mos3dist.c b/src/spicelib/devices/mos3/mos3dist.c index 8b278fe90..488f5ac0f 100644 --- a/src/spicelib/devices/mos3/mos3dist.c +++ b/src/spicelib/devices/mos3/mos3dist.c @@ -49,7 +49,7 @@ for( ; model != NULL; model = MOS3nextModel(model) ) { /* loop through all the instances of the model */ for (here = MOS3instances(model); here != NULL ; - here=here->MOS3nextInstance) { + here=MOS3nextInstance(here)) { /* loading starts here */ diff --git a/src/spicelib/devices/mos3/mos3dset.c b/src/spicelib/devices/mos3/mos3dset.c index 13aef2097..b373acb53 100644 --- a/src/spicelib/devices/mos3/mos3dset.c +++ b/src/spicelib/devices/mos3/mos3dset.c @@ -65,7 +65,7 @@ MOS3dSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS3instances(model); here != NULL ; - here=here->MOS3nextInstance) { + here=MOS3nextInstance(here)) { vt = CONSTKoverQ * here->MOS3temp; diff --git a/src/spicelib/devices/mos3/mos3ic.c b/src/spicelib/devices/mos3/mos3ic.c index fe576b0e1..76dcd58e2 100644 --- a/src/spicelib/devices/mos3/mos3ic.c +++ b/src/spicelib/devices/mos3/mos3ic.c @@ -23,7 +23,7 @@ MOS3getic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = MOS3nextModel(model)) { - for(here = MOS3instances(model); here ; here = here->MOS3nextInstance) { + for(here = MOS3instances(model); here ; here = MOS3nextInstance(here)) { if(!here->MOS3icVBSGiven) { here->MOS3icVBS = diff --git a/src/spicelib/devices/mos3/mos3load.c b/src/spicelib/devices/mos3/mos3load.c index 9e6f6519c..7c6f921e4 100644 --- a/src/spicelib/devices/mos3/mos3load.c +++ b/src/spicelib/devices/mos3/mos3load.c @@ -106,7 +106,7 @@ MOS3load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS3instances(model); here != NULL ; - here=here->MOS3nextInstance) { + here=MOS3nextInstance(here)) { vt = CONSTKoverQ * here->MOS3temp; Check=1; diff --git a/src/spicelib/devices/mos3/mos3noi.c b/src/spicelib/devices/mos3/mos3noi.c index feefee3d0..82008d9b5 100644 --- a/src/spicelib/devices/mos3/mos3noi.c +++ b/src/spicelib/devices/mos3/mos3noi.c @@ -47,7 +47,7 @@ MOS3noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, }; for (model=firstModel; model != NULL; model=MOS3nextModel(model)) { - for (inst=MOS3instances(model); inst != NULL; inst=inst->MOS3nextInstance) { + for (inst=MOS3instances(model); inst != NULL; inst=MOS3nextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/mos3/mos3pzld.c b/src/spicelib/devices/mos3/mos3pzld.c index 079dca693..7ac8d5891 100644 --- a/src/spicelib/devices/mos3/mos3pzld.c +++ b/src/spicelib/devices/mos3/mos3pzld.c @@ -37,7 +37,7 @@ MOS3pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = MOS3nextModel(model)) { for(here = MOS3instances(model); here!= NULL; - here = here->MOS3nextInstance) { + here = MOS3nextInstance(here)) { if (here->MOS3mode < 0) { xnrm=0; diff --git a/src/spicelib/devices/mos3/mos3sacl.c b/src/spicelib/devices/mos3/mos3sacl.c index 416796000..0e74295ed 100644 --- a/src/spicelib/devices/mos3/mos3sacl.c +++ b/src/spicelib/devices/mos3/mos3sacl.c @@ -130,7 +130,7 @@ MOS3sAcLoad(GENmodel *inModel, CKTcircuit *ckt) info->SENstatus = PERTURBATION; for( ; model != NULL; model = MOS3nextModel(model)) { for(here = MOS3instances(model); here!= NULL; - here = here->MOS3nextInstance) { + here = MOS3nextInstance(here)) { /* save the unperturbed values in the state vector */ for(i=0; i <= 16; i++) diff --git a/src/spicelib/devices/mos3/mos3set.c b/src/spicelib/devices/mos3/mos3set.c index ff487acd8..dd20fccb9 100644 --- a/src/spicelib/devices/mos3/mos3set.c +++ b/src/spicelib/devices/mos3/mos3set.c @@ -142,7 +142,7 @@ MOS3setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = MOS3instances(model); here != NULL ; - here=here->MOS3nextInstance) { + here=MOS3nextInstance(here)) { CKTnode *tmpNode; IFuid tmpName; @@ -269,7 +269,7 @@ MOS3unsetup(GENmodel *inModel, CKTcircuit *ckt) model = MOS3nextModel(model)) { for (here = MOS3instances(model); here != NULL; - here=here->MOS3nextInstance) + here=MOS3nextInstance(here)) { if (here->MOS3sNodePrime > 0 && here->MOS3sNodePrime != here->MOS3sNode) diff --git a/src/spicelib/devices/mos3/mos3sld.c b/src/spicelib/devices/mos3/mos3sld.c index 854b47d39..8b2893349 100644 --- a/src/spicelib/devices/mos3/mos3sld.c +++ b/src/spicelib/devices/mos3/mos3sld.c @@ -99,7 +99,7 @@ MOS3sLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS3instances(model); here != NULL ; - here=here->MOS3nextInstance) { + here=MOS3nextInstance(here)) { #ifdef SENSDEBUG printf("senload instance name %s\n",here->MOS3name); diff --git a/src/spicelib/devices/mos3/mos3sprt.c b/src/spicelib/devices/mos3/mos3sprt.c index f891e513d..1847d374f 100644 --- a/src/spicelib/devices/mos3/mos3sprt.c +++ b/src/spicelib/devices/mos3/mos3sprt.c @@ -31,7 +31,7 @@ MOS3sPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS3instances(model); here != NULL ; - here=here->MOS3nextInstance) { + here=MOS3nextInstance(here)) { printf(" Instance name:%s\n",here->MOS3name); printf(" Drain, Gate , Source nodes: %s, %s ,%s\n", diff --git a/src/spicelib/devices/mos3/mos3sset.c b/src/spicelib/devices/mos3/mos3sset.c index cda65b83a..ea8962c21 100644 --- a/src/spicelib/devices/mos3/mos3sset.c +++ b/src/spicelib/devices/mos3/mos3sset.c @@ -27,7 +27,7 @@ MOS3sSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = MOS3instances(model); here != NULL ; - here=here->MOS3nextInstance) { + here=MOS3nextInstance(here)) { if(here->MOS3senParmNo){ if((here->MOS3sens_l)&&(here->MOS3sens_w)){ diff --git a/src/spicelib/devices/mos3/mos3supd.c b/src/spicelib/devices/mos3/mos3supd.c index a25091d5b..e4d0e0b89 100644 --- a/src/spicelib/devices/mos3/mos3supd.c +++ b/src/spicelib/devices/mos3/mos3supd.c @@ -53,7 +53,7 @@ MOS3sUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS3instances(model); here != NULL ; - here=here->MOS3nextInstance) { + here=MOS3nextInstance(here)) { #ifdef SENSDEBUG printf("senupdate instance name %s\n",here->MOS3name); diff --git a/src/spicelib/devices/mos3/mos3temp.c b/src/spicelib/devices/mos3/mos3temp.c index e11c3d454..9dc912b70 100644 --- a/src/spicelib/devices/mos3/mos3temp.c +++ b/src/spicelib/devices/mos3/mos3temp.c @@ -116,7 +116,7 @@ MOS3temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ for(here = MOS3instances(model); here!= NULL; - here = here->MOS3nextInstance) { + here = MOS3nextInstance(here)) { double czbd; /* zero voltage bulk-drain capacitance */ double czbdsw; /* zero voltage bulk-drain sidewall capacitance */ diff --git a/src/spicelib/devices/mos3/mos3trun.c b/src/spicelib/devices/mos3/mos3trun.c index c51b6624d..e345617a5 100644 --- a/src/spicelib/devices/mos3/mos3trun.c +++ b/src/spicelib/devices/mos3/mos3trun.c @@ -16,7 +16,7 @@ MOS3trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MOS3instance *here; for( ; model != NULL; model = MOS3nextModel(model)) { - for(here=MOS3instances(model);here!=NULL;here = here->MOS3nextInstance){ + for(here=MOS3instances(model);here!=NULL;here = MOS3nextInstance(here)){ CKTterr(here->MOS3qgs,ckt,timeStep); CKTterr(here->MOS3qgd,ckt,timeStep); diff --git a/src/spicelib/devices/mos6/mos6ask.c b/src/spicelib/devices/mos6/mos6ask.c index 5740b2787..fc4aec4c1 100644 --- a/src/spicelib/devices/mos6/mos6ask.c +++ b/src/spicelib/devices/mos6/mos6ask.c @@ -209,7 +209,7 @@ MOS6ask(CKTcircuit *ckt, GENinstance *inst, int which, case MOS6_CAPGS: value->rValue = 2* *(ckt->CKTstate0 + here->MOS6capgs); /* add overlap capacitance */ - value->rValue += (here->MOS6modPtr->MOS6gateSourceOverlapCapFactor) + value->rValue += (MOS6modPtr(here)->MOS6gateSourceOverlapCapFactor) * (here->MOS6w); value->rValue *= here->MOS6m; return(OK); @@ -224,7 +224,7 @@ MOS6ask(CKTcircuit *ckt, GENinstance *inst, int which, case MOS6_CAPGD: value->rValue = 2* *(ckt->CKTstate0 + here->MOS6capgd); /* add overlap capacitance */ - value->rValue += (here->MOS6modPtr->MOS6gateSourceOverlapCapFactor) + value->rValue += (MOS6modPtr(here)->MOS6gateSourceOverlapCapFactor) * (here->MOS6w); value->rValue *= here->MOS6m; return(OK); @@ -239,9 +239,9 @@ MOS6ask(CKTcircuit *ckt, GENinstance *inst, int which, case MOS6_CAPGB: value->rValue = 2* *(ckt->CKTstate0 + here->MOS6capgb); /* add overlap capacitance */ - value->rValue += (here->MOS6modPtr->MOS6gateBulkOverlapCapFactor) + value->rValue += (MOS6modPtr(here)->MOS6gateBulkOverlapCapFactor) * (here->MOS6l - -2*(here->MOS6modPtr->MOS6latDiff)); + -2*(MOS6modPtr(here)->MOS6latDiff)); value->rValue *= here->MOS6m; return(OK); case MOS6_QGB: diff --git a/src/spicelib/devices/mos6/mos6conv.c b/src/spicelib/devices/mos6/mos6conv.c index 055ea7155..5b97b61d1 100644 --- a/src/spicelib/devices/mos6/mos6conv.c +++ b/src/spicelib/devices/mos6/mos6conv.c @@ -31,7 +31,7 @@ MOS6convTest(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS6nextModel(model)) { for(here = MOS6instances(model); here!= NULL; - here = here->MOS6nextInstance) { + here = MOS6nextInstance(here)) { vbs = model->MOS6type * ( *(ckt->CKTrhs+here->MOS6bNode) - diff --git a/src/spicelib/devices/mos6/mos6defs.h b/src/spicelib/devices/mos6/mos6defs.h index c4c58531a..c7088b497 100644 --- a/src/spicelib/devices/mos6/mos6defs.h +++ b/src/spicelib/devices/mos6/mos6defs.h @@ -16,11 +16,13 @@ Author: 1985 Thomas L. Quarles /* information needed for each instance */ typedef struct sMOS6instance { - struct sMOS6model *MOS6modPtr; /* backpointer to model */ - struct sMOS6instance *MOS6nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS6name; /* pointer to character string naming this instance */ - int MOS6states; /* index into state table for this device */ + struct GENinstance gen; + +#define MOS6modPtr(inst) ((struct sMOS6model*)((inst)->gen.GENmodPtr)) +#define MOS6nextInstance(inst) ((struct sMOS6instance*)((inst)->gen.GENnextInstance)) +#define MOS6name gen.GENname +#define MOS6states gen.GENstate + const int MOS6dNode; /* number of the gate node of the mosfet */ const int MOS6gNode; /* number of the gate node of the mosfet */ const int MOS6sNode; /* number of the source node of the mosfet */ diff --git a/src/spicelib/devices/mos6/mos6dest.c b/src/spicelib/devices/mos6/mos6dest.c index 4cc4cb7b7..f4f83945f 100644 --- a/src/spicelib/devices/mos6/mos6dest.c +++ b/src/spicelib/devices/mos6/mos6dest.c @@ -17,7 +17,7 @@ MOS6destroy(GENmodel **inModel) MOS6model *next_mod = MOS6nextModel(mod); MOS6instance *inst = MOS6instances(mod); while (inst) { - MOS6instance *next_inst = inst->MOS6nextInstance; + MOS6instance *next_inst = MOS6nextInstance(inst); FREE(inst->MOS6sens); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/mos6/mos6ic.c b/src/spicelib/devices/mos6/mos6ic.c index 908a54031..e2a290e8e 100644 --- a/src/spicelib/devices/mos6/mos6ic.c +++ b/src/spicelib/devices/mos6/mos6ic.c @@ -23,7 +23,7 @@ MOS6getic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = MOS6nextModel(model)) { - for(here = MOS6instances(model); here ; here = here->MOS6nextInstance) { + for(here = MOS6instances(model); here ; here = MOS6nextInstance(here)) { if(!here->MOS6icVBSGiven) { here->MOS6icVBS = diff --git a/src/spicelib/devices/mos6/mos6load.c b/src/spicelib/devices/mos6/mos6load.c index d0e1deb9a..caf18da91 100644 --- a/src/spicelib/devices/mos6/mos6load.c +++ b/src/spicelib/devices/mos6/mos6load.c @@ -99,7 +99,7 @@ MOS6load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS6instances(model); here != NULL ; - here=here->MOS6nextInstance) { + here=MOS6nextInstance(here)) { vt = CONSTKoverQ * here->MOS6temp; Check=1; diff --git a/src/spicelib/devices/mos6/mos6set.c b/src/spicelib/devices/mos6/mos6set.c index 3155acf08..da6a5f63e 100644 --- a/src/spicelib/devices/mos6/mos6set.c +++ b/src/spicelib/devices/mos6/mos6set.c @@ -111,7 +111,7 @@ MOS6setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, /* loop through all the instances of the model */ for (here = MOS6instances(model); here != NULL ; - here=here->MOS6nextInstance) { + here=MOS6nextInstance(here)) { CKTnode *tmpNode; IFuid tmpName; @@ -231,7 +231,7 @@ MOS6unsetup(GENmodel *inModel, CKTcircuit *ckt) model = MOS6nextModel(model)) { for (here = MOS6instances(model); here != NULL; - here=here->MOS6nextInstance) + here=MOS6nextInstance(here)) { if (here->MOS6sNodePrime > 0 && here->MOS6sNodePrime != here->MOS6sNode) diff --git a/src/spicelib/devices/mos6/mos6temp.c b/src/spicelib/devices/mos6/mos6temp.c index 4ef33b263..bb263a997 100644 --- a/src/spicelib/devices/mos6/mos6temp.c +++ b/src/spicelib/devices/mos6/mos6temp.c @@ -117,7 +117,7 @@ MOS6temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ for(here = MOS6instances(model); here!= NULL; - here = here->MOS6nextInstance) { + here = MOS6nextInstance(here)) { double czbd; /* zero voltage bulk-drain capacitance */ double czbdsw; /* zero voltage bulk-drain sidewall capacitance */ diff --git a/src/spicelib/devices/mos6/mos6trun.c b/src/spicelib/devices/mos6/mos6trun.c index a8b441297..b86c33cd4 100644 --- a/src/spicelib/devices/mos6/mos6trun.c +++ b/src/spicelib/devices/mos6/mos6trun.c @@ -19,7 +19,7 @@ MOS6trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MOS6instance *here; for( ; model != NULL; model = MOS6nextModel(model)) { - for(here=MOS6instances(model);here!=NULL;here = here->MOS6nextInstance){ + for(here=MOS6instances(model);here!=NULL;here = MOS6nextInstance(here)){ CKTterr(here->MOS6qgs,ckt,timeStep); CKTterr(here->MOS6qgd,ckt,timeStep); diff --git a/src/spicelib/devices/mos9/mos9acld.c b/src/spicelib/devices/mos9/mos9acld.c index e47e13781..ceefd8c32 100644 --- a/src/spicelib/devices/mos9/mos9acld.c +++ b/src/spicelib/devices/mos9/mos9acld.c @@ -36,7 +36,7 @@ MOS9acLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS9nextModel(model)) { for(here = MOS9instances(model); here!= NULL; - here = here->MOS9nextInstance) { + here = MOS9nextInstance(here)) { if (here->MOS9mode < 0) { xnrm=0; diff --git a/src/spicelib/devices/mos9/mos9ask.c b/src/spicelib/devices/mos9/mos9ask.c index d74b75c11..56533509a 100644 --- a/src/spicelib/devices/mos9/mos9ask.c +++ b/src/spicelib/devices/mos9/mos9ask.c @@ -179,11 +179,11 @@ MOS9ask(CKTcircuit *ckt, GENinstance *inst, int which, case MOS9_CAPGS: value->rValue = 2* *(ckt->CKTstate0 + here->MOS9capgs); /* add overlap capacitance */ - value->rValue += (here->MOS9modPtr->MOS9gateSourceOverlapCapFactor) + value->rValue += (MOS9modPtr(here)->MOS9gateSourceOverlapCapFactor) * here->MOS9m * (here->MOS9w - +here->MOS9modPtr->MOS9widthAdjust - -2*(here->MOS9modPtr->MOS9widthNarrow)); + +MOS9modPtr(here)->MOS9widthAdjust + -2*(MOS9modPtr(here)->MOS9widthNarrow)); return(OK); case MOS9_QGS: value->rValue = *(ckt->CKTstate0 + here->MOS9qgs); @@ -194,11 +194,11 @@ MOS9ask(CKTcircuit *ckt, GENinstance *inst, int which, case MOS9_CAPGD: value->rValue = 2* *(ckt->CKTstate0 + here->MOS9capgd); /* add overlap capacitance */ - value->rValue += (here->MOS9modPtr->MOS9gateDrainOverlapCapFactor) + value->rValue += (MOS9modPtr(here)->MOS9gateDrainOverlapCapFactor) * here->MOS9m * (here->MOS9w - +here->MOS9modPtr->MOS9widthAdjust - -2*(here->MOS9modPtr->MOS9widthNarrow)); + +MOS9modPtr(here)->MOS9widthAdjust + -2*(MOS9modPtr(here)->MOS9widthNarrow)); return(OK); case MOS9_QGD: value->rValue = *(ckt->CKTstate0 + here->MOS9qgd); @@ -209,11 +209,11 @@ MOS9ask(CKTcircuit *ckt, GENinstance *inst, int which, case MOS9_CAPGB: value->rValue = 2* *(ckt->CKTstate0 + here->MOS9capgb); /* add overlap capacitance */ - value->rValue += (here->MOS9modPtr->MOS9gateBulkOverlapCapFactor) + value->rValue += (MOS9modPtr(here)->MOS9gateBulkOverlapCapFactor) * here->MOS9m * (here->MOS9l - +here->MOS9modPtr->MOS9lengthAdjust - -2*(here->MOS9modPtr->MOS9latDiff)); + +MOS9modPtr(here)->MOS9lengthAdjust + -2*(MOS9modPtr(here)->MOS9latDiff)); return(OK); case MOS9_QGB: value->rValue = *(ckt->CKTstate0 + here->MOS9qgb); diff --git a/src/spicelib/devices/mos9/mos9conv.c b/src/spicelib/devices/mos9/mos9conv.c index 7b5e898ea..0667db025 100644 --- a/src/spicelib/devices/mos9/mos9conv.c +++ b/src/spicelib/devices/mos9/mos9conv.c @@ -33,7 +33,7 @@ MOS9convTest(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = MOS9nextModel(model)) { for(here = MOS9instances(model); here!= NULL; - here = here->MOS9nextInstance) { + here = MOS9nextInstance(here)) { vbs = model->MOS9type * ( *(ckt->CKTrhs+here->MOS9bNode) - diff --git a/src/spicelib/devices/mos9/mos9defs.h b/src/spicelib/devices/mos9/mos9defs.h index 85db7e508..4a0a2bdfd 100644 --- a/src/spicelib/devices/mos9/mos9defs.h +++ b/src/spicelib/devices/mos9/mos9defs.h @@ -18,11 +18,13 @@ Modified: Alan Gillespie /* information needed for each instance */ typedef struct sMOS9instance { - struct sMOS9model *MOS9modPtr; /* backpointer to model */ - struct sMOS9instance *MOS9nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS9name; /* pointer to character string naming this instance */ - int MOS9states; /* index into state table for this device */ + struct GENinstance gen; + +#define MOS9modPtr(inst) ((struct sMOS9model*)((inst)->gen.GENmodPtr)) +#define MOS9nextInstance(inst) ((struct sMOS9instance*)((inst)->gen.GENnextInstance)) +#define MOS9name gen.GENname +#define MOS9states gen.GENstate + const int MOS9dNode; /* number of the gate node of the mosfet */ const int MOS9gNode; /* number of the gate node of the mosfet */ const int MOS9sNode; /* number of the source node of the mosfet */ diff --git a/src/spicelib/devices/mos9/mos9dest.c b/src/spicelib/devices/mos9/mos9dest.c index 3cde63a41..ad30e8817 100644 --- a/src/spicelib/devices/mos9/mos9dest.c +++ b/src/spicelib/devices/mos9/mos9dest.c @@ -18,7 +18,7 @@ MOS9destroy(GENmodel **inModel) MOS9model *next_mod = MOS9nextModel(mod); MOS9instance *inst = MOS9instances(mod); while (inst) { - MOS9instance *next_inst = inst->MOS9nextInstance; + MOS9instance *next_inst = MOS9nextInstance(inst); FREE(inst->MOS9sens); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/mos9/mos9dist.c b/src/spicelib/devices/mos9/mos9dist.c index 7dfc05fc4..ab2c07495 100644 --- a/src/spicelib/devices/mos9/mos9dist.c +++ b/src/spicelib/devices/mos9/mos9dist.c @@ -54,7 +54,7 @@ for( ; model != NULL; model = MOS9nextModel(model) ) { /* loop through all the instances of the model */ for (here = MOS9instances(model); here != NULL ; - here=here->MOS9nextInstance) { + here=MOS9nextInstance(here)) { /* loading starts here */ diff --git a/src/spicelib/devices/mos9/mos9dset.c b/src/spicelib/devices/mos9/mos9dset.c index c2b4f6925..d317a398b 100644 --- a/src/spicelib/devices/mos9/mos9dset.c +++ b/src/spicelib/devices/mos9/mos9dset.c @@ -65,7 +65,7 @@ MOS9dSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS9instances(model); here != NULL ; - here=here->MOS9nextInstance) { + here=MOS9nextInstance(here)) { vt = CONSTKoverQ * here->MOS9temp; diff --git a/src/spicelib/devices/mos9/mos9ic.c b/src/spicelib/devices/mos9/mos9ic.c index b89802066..63cb3f635 100644 --- a/src/spicelib/devices/mos9/mos9ic.c +++ b/src/spicelib/devices/mos9/mos9ic.c @@ -24,7 +24,7 @@ MOS9getic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = MOS9nextModel(model)) { - for(here = MOS9instances(model); here ; here = here->MOS9nextInstance) { + for(here = MOS9instances(model); here ; here = MOS9nextInstance(here)) { if(!here->MOS9icVBSGiven) { here->MOS9icVBS = diff --git a/src/spicelib/devices/mos9/mos9load.c b/src/spicelib/devices/mos9/mos9load.c index a8919a5d1..6a34b7161 100644 --- a/src/spicelib/devices/mos9/mos9load.c +++ b/src/spicelib/devices/mos9/mos9load.c @@ -107,7 +107,7 @@ next: /* loop through all the instances of the model */ for (here = MOS9instances(model); here != NULL ; - here=here->MOS9nextInstance) { + here=MOS9nextInstance(here)) { vt = CONSTKoverQ * here->MOS9temp; Check=1; diff --git a/src/spicelib/devices/mos9/mos9noi.c b/src/spicelib/devices/mos9/mos9noi.c index 8f300df71..69f9bfd80 100644 --- a/src/spicelib/devices/mos9/mos9noi.c +++ b/src/spicelib/devices/mos9/mos9noi.c @@ -47,7 +47,7 @@ MOS9noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, }; for (model=firstModel; model != NULL; model=MOS9nextModel(model)) { - for (inst=MOS9instances(model); inst != NULL; inst=inst->MOS9nextInstance) { + for (inst=MOS9instances(model); inst != NULL; inst=MOS9nextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/mos9/mos9pzld.c b/src/spicelib/devices/mos9/mos9pzld.c index 991534f95..7c140a052 100644 --- a/src/spicelib/devices/mos9/mos9pzld.c +++ b/src/spicelib/devices/mos9/mos9pzld.c @@ -37,7 +37,7 @@ MOS9pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) for( ; model != NULL; model = MOS9nextModel(model)) { for(here = MOS9instances(model); here!= NULL; - here = here->MOS9nextInstance) { + here = MOS9nextInstance(here)) { if (here->MOS9mode < 0) { xnrm=0; diff --git a/src/spicelib/devices/mos9/mos9sacl.c b/src/spicelib/devices/mos9/mos9sacl.c index cf661de59..3c4fa2871 100644 --- a/src/spicelib/devices/mos9/mos9sacl.c +++ b/src/spicelib/devices/mos9/mos9sacl.c @@ -131,7 +131,7 @@ MOS9sAcLoad(GENmodel *inModel, CKTcircuit *ckt) info->SENstatus = PERTURBATION; for( ; model != NULL; model = MOS9nextModel(model)) { for(here = MOS9instances(model); here!= NULL; - here = here->MOS9nextInstance) { + here = MOS9nextInstance(here)) { /* 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 937ce7a80..286fa0e8c 100644 --- a/src/spicelib/devices/mos9/mos9set.c +++ b/src/spicelib/devices/mos9/mos9set.c @@ -142,7 +142,7 @@ MOS9setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = MOS9instances(model); here != NULL ; - here=here->MOS9nextInstance) { + here=MOS9nextInstance(here)) { CKTnode *tmpNode; IFuid tmpName; @@ -269,7 +269,7 @@ MOS9unsetup(GENmodel *inModel, CKTcircuit *ckt) model = MOS9nextModel(model)) { for (here = MOS9instances(model); here != NULL; - here=here->MOS9nextInstance) + here=MOS9nextInstance(here)) { if (here->MOS9sNodePrime > 0 && here->MOS9sNodePrime != here->MOS9sNode) diff --git a/src/spicelib/devices/mos9/mos9sld.c b/src/spicelib/devices/mos9/mos9sld.c index 6343dbfd9..fa028d4f8 100644 --- a/src/spicelib/devices/mos9/mos9sld.c +++ b/src/spicelib/devices/mos9/mos9sld.c @@ -99,7 +99,7 @@ MOS9sLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS9instances(model); here != NULL ; - here=here->MOS9nextInstance) { + here=MOS9nextInstance(here)) { #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 009f928a9..6c595ea60 100644 --- a/src/spicelib/devices/mos9/mos9sprt.c +++ b/src/spicelib/devices/mos9/mos9sprt.c @@ -31,7 +31,7 @@ MOS9sPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS9instances(model); here != NULL ; - here=here->MOS9nextInstance) { + here=MOS9nextInstance(here)) { 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 c71c2469b..7ea7e11c3 100644 --- a/src/spicelib/devices/mos9/mos9sset.c +++ b/src/spicelib/devices/mos9/mos9sset.c @@ -28,7 +28,7 @@ MOS9sSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = MOS9instances(model); here != NULL ; - here=here->MOS9nextInstance) { + here=MOS9nextInstance(here)) { if(here->MOS9senParmNo){ if((here->MOS9sens_l)&&(here->MOS9sens_w)){ diff --git a/src/spicelib/devices/mos9/mos9supd.c b/src/spicelib/devices/mos9/mos9supd.c index 28ccb20cb..8c782a4c4 100644 --- a/src/spicelib/devices/mos9/mos9supd.c +++ b/src/spicelib/devices/mos9/mos9supd.c @@ -54,7 +54,7 @@ MOS9sUpdate(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = MOS9instances(model); here != NULL ; - here=here->MOS9nextInstance) { + here=MOS9nextInstance(here)) { #ifdef SENSDEBUG printf("senupdate instance name %s\n",here->MOS9name); diff --git a/src/spicelib/devices/mos9/mos9temp.c b/src/spicelib/devices/mos9/mos9temp.c index 9a75e3f83..7f829ac2e 100644 --- a/src/spicelib/devices/mos9/mos9temp.c +++ b/src/spicelib/devices/mos9/mos9temp.c @@ -120,7 +120,7 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ for(here = MOS9instances(model); here!= NULL; - here = here->MOS9nextInstance) { + here = MOS9nextInstance(here)) { double czbd; /* zero voltage bulk-drain capacitance */ double czbdsw; /* zero voltage bulk-drain sidewall capacitance */ diff --git a/src/spicelib/devices/mos9/mos9trun.c b/src/spicelib/devices/mos9/mos9trun.c index bdc2e401b..f04f01f66 100644 --- a/src/spicelib/devices/mos9/mos9trun.c +++ b/src/spicelib/devices/mos9/mos9trun.c @@ -20,7 +20,7 @@ MOS9trunc( MOS9instance *here; for( ; model != NULL; model = MOS9nextModel(model)) { - for(here=MOS9instances(model);here!=NULL;here = here->MOS9nextInstance){ + for(here=MOS9instances(model);here!=NULL;here = MOS9nextInstance(here)){ CKTterr(here->MOS9qgs,ckt,timeStep); CKTterr(here->MOS9qgd,ckt,timeStep); diff --git a/src/spicelib/devices/nbjt/nbjtacld.c b/src/spicelib/devices/nbjt/nbjtacld.c index 4ad824177..9a66ef222 100644 --- a/src/spicelib/devices/nbjt/nbjtacld.c +++ b/src/spicelib/devices/nbjt/nbjtacld.c @@ -40,7 +40,7 @@ NBJTacLoad(GENmodel *inModel, CKTcircuit *ckt) ONEacDebug = model->NBJToutputs->OUTPacDebug; for (inst = NBJTinstances(model); inst != NULL; - inst = inst->NBJTnextInstance) { + inst = NBJTnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); /* Get Temp.-Dep. Global Parameters */ diff --git a/src/spicelib/devices/nbjt/nbjtdefs.h b/src/spicelib/devices/nbjt/nbjtdefs.h index 357c02d1b..5129e7dde 100644 --- a/src/spicelib/devices/nbjt/nbjtdefs.h +++ b/src/spicelib/devices/nbjt/nbjtdefs.h @@ -22,14 +22,13 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNBJTinstance { - struct sNBJTmodel *NBJTmodPtr;/* back pointer to model */ - struct sNBJTinstance *NBJTnextInstance; /* pointer to next instance - * of current model */ - IFuid NBJTname; /* pointer to character string naming this - * instance */ - int NBJTstate; /* pointer to start of state vector for bjt */ + struct GENinstance gen; + +#define NBJTmodPtr(inst) ((struct sNBJTmodel*)((inst)->gen.GENmodPtr)) +#define NBJTnextInstance(inst) ((struct sNBJTinstance*)((inst)->gen.GENnextInstance)) +#define NBJTname gen.GENname +#define NBJTstate gen.GENstate - /* entries in the state vector for bjt: */ #define NBJTvbe NBJTstate #define NBJTvce NBJTstate+1 #define NBJTic NBJTstate+2 diff --git a/src/spicelib/devices/nbjt/nbjtdest.c b/src/spicelib/devices/nbjt/nbjtdest.c index 2acea8f35..b3da2522c 100644 --- a/src/spicelib/devices/nbjt/nbjtdest.c +++ b/src/spicelib/devices/nbjt/nbjtdest.c @@ -24,7 +24,7 @@ NBJTdestroy(GENmodel **inModel) NBJTmodel *next_mod = NBJTnextModel(mod); NBJTinstance *inst = NBJTinstances(mod); while (inst) { - NBJTinstance *next_inst = inst->NBJTnextInstance; + NBJTinstance *next_inst = NBJTnextInstance(inst); ONEdestroy(inst->NBJTpDevice); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/nbjt/nbjtdump.c b/src/spicelib/devices/nbjt/nbjtdump.c index a09676ac0..8d95b6e98 100644 --- a/src/spicelib/devices/nbjt/nbjtdump.c +++ b/src/spicelib/devices/nbjt/nbjtdump.c @@ -58,7 +58,7 @@ NBJTdump(GENmodel *inModel, CKTcircuit *ckt) for (; model != NULL; model = NBJTnextModel(model)) { output = model->NBJToutputs; for (inst = NBJTinstances(model); inst != NULL; - inst = inst->NBJTnextInstance) { + inst = NBJTnextInstance(inst)) { if (inst->NBJTprintGiven) { if ((ckt->CKTmode & MODETRAN) && @@ -158,7 +158,7 @@ NBJTacct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) for (; model != NULL; model = NBJTnextModel(model)) { output = model->NBJToutputs; for (inst = NBJTinstances(model); inst != NULL; - inst = inst->NBJTnextInstance) { + inst = NBJTnextInstance(inst)) { if (output->OUTPstats) { ONEmemStats(file, inst->NBJTpDevice); diff --git a/src/spicelib/devices/nbjt/nbjtload.c b/src/spicelib/devices/nbjt/nbjtload.c index 1bd15f994..39ac5a484 100644 --- a/src/spicelib/devices/nbjt/nbjtload.c +++ b/src/spicelib/devices/nbjt/nbjtload.c @@ -92,7 +92,7 @@ NBJTload(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the instances of the model */ for (inst = NBJTinstances(model); inst != NULL; - inst = inst->NBJTnextInstance) { + inst = NBJTnextInstance(inst)) { pDevice = inst->NBJTpDevice; @@ -491,7 +491,7 @@ NBJTinitSmSig(NBJTinstance *inst) { SPcomplex yIeVce, yIeVbe; SPcomplex yIcVce, yIcVbe; - double omega = inst->NBJTmodPtr->NBJTmethods->METHomega; + double omega = NBJTmodPtr(inst)->NBJTmethods->METHomega; AcAnalysisMethod = SOR_ONLY; (void) NBJTadmittance(inst->NBJTpDevice, omega, diff --git a/src/spicelib/devices/nbjt/nbjtpzld.c b/src/spicelib/devices/nbjt/nbjtpzld.c index 3e379d6f6..af87f8e5c 100644 --- a/src/spicelib/devices/nbjt/nbjtpzld.c +++ b/src/spicelib/devices/nbjt/nbjtpzld.c @@ -41,7 +41,7 @@ NBJTpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) ONEacDebug = model->NBJToutputs->OUTPacDebug; for (inst = NBJTinstances(model); inst != NULL; - inst = inst->NBJTnextInstance) { + inst = NBJTnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); /* Get Temp.-Dep. Global Parameters */ diff --git a/src/spicelib/devices/nbjt/nbjtset.c b/src/spicelib/devices/nbjt/nbjtset.c index 491da88cc..65f57d81a 100644 --- a/src/spicelib/devices/nbjt/nbjtset.c +++ b/src/spicelib/devices/nbjt/nbjtset.c @@ -147,7 +147,7 @@ NBJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (inst = NBJTinstances(model); inst != NULL; - inst = inst->NBJTnextInstance) { + inst = NBJTnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt/nbjttemp.c b/src/spicelib/devices/nbjt/nbjttemp.c index 4848846e6..77c16652b 100644 --- a/src/spicelib/devices/nbjt/nbjttemp.c +++ b/src/spicelib/devices/nbjt/nbjttemp.c @@ -54,7 +54,7 @@ NBJTtemp(GENmodel *inModel, CKTcircuit *ckt) ConcDepMobility = models->MODLconcDepMobility; for (inst = NBJTinstances(model); inst != NULL; - inst = inst->NBJTnextInstance) { + inst = NBJTnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt/nbjttrun.c b/src/spicelib/devices/nbjt/nbjttrun.c index 8a5dee844..590177dc3 100644 --- a/src/spicelib/devices/nbjt/nbjttrun.c +++ b/src/spicelib/devices/nbjt/nbjttrun.c @@ -35,7 +35,7 @@ NBJTtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) model->NBJTpInfo->delta = deltaNorm; model->NBJTpInfo->lteCoeff = computeLTECoeff(model->NBJTpInfo); for (inst = NBJTinstances(model); inst != NULL; - inst = inst->NBJTnextInstance) { + inst = NBJTnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); deltaNew = ONEtrunc(inst->NBJTpDevice, model->NBJTpInfo, diff --git a/src/spicelib/devices/nbjt2/nbjt2def.h b/src/spicelib/devices/nbjt2/nbjt2def.h index b75e361ae..c645f0053 100644 --- a/src/spicelib/devices/nbjt2/nbjt2def.h +++ b/src/spicelib/devices/nbjt2/nbjt2def.h @@ -22,14 +22,13 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNBJT2instance { - struct sNBJT2model *NBJT2modPtr; /* back pointer to model */ - struct sNBJT2instance *NBJT2nextInstance; /* pointer to next instance - * of current model */ - IFuid NBJT2name; /* pointer to character string naming this - * instance */ - int NBJT2state; /* pointer to start of state vector for bjt */ + struct GENinstance gen; + +#define NBJT2modPtr(inst) ((struct sNBJT2model*)((inst)->gen.GENmodPtr)) +#define NBJT2nextInstance(inst) ((struct sNBJT2instance*)((inst)->gen.GENnextInstance)) +#define NBJT2name gen.GENname +#define NBJT2state gen.GENstate - /* entries in the state vector for bjt: */ #define NBJT2vbe NBJT2state #define NBJT2vce NBJT2state+1 #define NBJT2ic NBJT2state+2 diff --git a/src/spicelib/devices/nbjt2/nbt2acld.c b/src/spicelib/devices/nbjt2/nbt2acld.c index 9ae40ad44..9aa4016d9 100644 --- a/src/spicelib/devices/nbjt2/nbt2acld.c +++ b/src/spicelib/devices/nbjt2/nbt2acld.c @@ -41,7 +41,7 @@ NBJT2acLoad(GENmodel *inModel, CKTcircuit *ckt) TWOacDebug = model->NBJT2outputs->OUTPacDebug; for (inst = NBJT2instances(model); inst != NULL; - inst = inst->NBJT2nextInstance) { + inst = NBJT2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); /* Get Temp.-Dep. Global Parameters */ diff --git a/src/spicelib/devices/nbjt2/nbt2dest.c b/src/spicelib/devices/nbjt2/nbt2dest.c index edb5aac1e..2d3b3b5b0 100644 --- a/src/spicelib/devices/nbjt2/nbt2dest.c +++ b/src/spicelib/devices/nbjt2/nbt2dest.c @@ -24,7 +24,7 @@ NBJT2destroy(GENmodel **inModel) NBJT2model *next_mod = NBJT2nextModel(mod); NBJT2instance *inst = NBJT2instances(mod); while (inst) { - NBJT2instance *next_inst = inst->NBJT2nextInstance; + NBJT2instance *next_inst = NBJT2nextInstance(inst); TWOdestroy(inst->NBJT2pDevice); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/nbjt2/nbt2dump.c b/src/spicelib/devices/nbjt2/nbt2dump.c index 042da76ae..ac6e1a633 100644 --- a/src/spicelib/devices/nbjt2/nbt2dump.c +++ b/src/spicelib/devices/nbjt2/nbt2dump.c @@ -59,7 +59,7 @@ NBJT2dump(GENmodel *inModel, CKTcircuit *ckt) for (; model != NULL; model = NBJT2nextModel(model)) { output = model->NBJT2outputs; for (inst = NBJT2instances(model); inst != NULL; - inst = inst->NBJT2nextInstance) { + inst = NBJT2nextInstance(inst)) { if (inst->NBJT2printGiven) { if ((ckt->CKTmode & MODETRAN) && @@ -159,7 +159,7 @@ NBJT2acct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) for (; model != NULL; model = NBJT2nextModel(model)) { output = model->NBJT2outputs; for (inst = NBJT2instances(model); inst != NULL; - inst = inst->NBJT2nextInstance) { + inst = NBJT2nextInstance(inst)) { if (output->OUTPstats) { TWOmemStats(file, inst->NBJT2pDevice); diff --git a/src/spicelib/devices/nbjt2/nbt2load.c b/src/spicelib/devices/nbjt2/nbt2load.c index 2eecaceb3..3511660aa 100644 --- a/src/spicelib/devices/nbjt2/nbt2load.c +++ b/src/spicelib/devices/nbjt2/nbt2load.c @@ -95,7 +95,7 @@ NBJT2load(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the instances of the model */ for (inst = NBJT2instances(model); inst != NULL; - inst = inst->NBJT2nextInstance) { + inst = NBJT2nextInstance(inst)) { pDevice = inst->NBJT2pDevice; @@ -480,7 +480,7 @@ NBJT2initSmSig(NBJT2instance *inst) { SPcomplex yIeVce, yIeVbe; SPcomplex yIcVce, yIcVbe; - double omega = inst->NBJT2modPtr->NBJT2methods->METHomega; + double omega = NBJT2modPtr(inst)->NBJT2methods->METHomega; AcAnalysisMethod = SOR_ONLY; (void) NBJT2admittance(inst->NBJT2pDevice, omega, diff --git a/src/spicelib/devices/nbjt2/nbt2pzld.c b/src/spicelib/devices/nbjt2/nbt2pzld.c index d5d086048..e10eb627b 100644 --- a/src/spicelib/devices/nbjt2/nbt2pzld.c +++ b/src/spicelib/devices/nbjt2/nbt2pzld.c @@ -38,7 +38,7 @@ NBJT2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) TWOacDebug = model->NBJT2outputs->OUTPacDebug; for (inst = NBJT2instances(model); inst != NULL; - inst = inst->NBJT2nextInstance) { + inst = NBJT2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt2/nbt2set.c b/src/spicelib/devices/nbjt2/nbt2set.c index d0eba4e5d..f6b02c653 100644 --- a/src/spicelib/devices/nbjt2/nbt2set.c +++ b/src/spicelib/devices/nbjt2/nbt2set.c @@ -163,7 +163,7 @@ NBJT2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (inst = NBJT2instances(model); inst != NULL; - inst = inst->NBJT2nextInstance) { + inst = NBJT2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt2/nbt2temp.c b/src/spicelib/devices/nbjt2/nbt2temp.c index cac117208..f2696bcd6 100644 --- a/src/spicelib/devices/nbjt2/nbt2temp.c +++ b/src/spicelib/devices/nbjt2/nbt2temp.c @@ -56,7 +56,7 @@ NBJT2temp(GENmodel *inModel, CKTcircuit *ckt) OneCarrier = methods->METHoneCarrier; for (inst = NBJT2instances(model); inst != NULL; - inst = inst->NBJT2nextInstance) { + inst = NBJT2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt2/nbt2trun.c b/src/spicelib/devices/nbjt2/nbt2trun.c index a57887d28..d28ff71d4 100644 --- a/src/spicelib/devices/nbjt2/nbt2trun.c +++ b/src/spicelib/devices/nbjt2/nbt2trun.c @@ -38,7 +38,7 @@ NBJT2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) model->NBJT2pInfo->delta = deltaNorm; model->NBJT2pInfo->lteCoeff = computeLTECoeff(model->NBJT2pInfo); for (inst = NBJT2instances(model); inst != NULL; - inst = inst->NBJT2nextInstance) { + inst = NBJT2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); deltaNew = TWOtrunc(inst->NBJT2pDevice, model->NBJT2pInfo, diff --git a/src/spicelib/devices/ndev/ndevaccept.c b/src/spicelib/devices/ndev/ndevaccept.c index 43288c1a2..fdc52ccd2 100644 --- a/src/spicelib/devices/ndev/ndevaccept.c +++ b/src/spicelib/devices/ndev/ndevaccept.c @@ -23,7 +23,7 @@ int NDEVaccept(CKTcircuit *ckt, GENmodel *inModel) for( ; model != NULL; model = NDEVnextModel(model) ) { /* loop through all the instances of the model */ - for (here = NDEVinstances(model); here != NULL ; here=here->NDEVnextInstance) + for (here = NDEVinstances(model); here != NULL ; here=NDEVnextInstance(here)) { /* set ckt accept_flag */ here->CKTInfo.DEV_CALL = NDEV_ACCEPT; @@ -46,7 +46,7 @@ int NDEVconvTest(GENmodel *inModel, CKTcircuit *ckt) NDEVinstance *here; for( ; model != NULL; model = NDEVnextModel(model)) { - for(here=NDEVinstances(model);here!=NULL;here = here->NDEVnextInstance){ + for(here=NDEVinstances(model);here!=NULL;here = NDEVnextInstance(here)){ /* * get convergence information from ndev diff --git a/src/spicelib/devices/ndev/ndevdefs.h b/src/spicelib/devices/ndev/ndevdefs.h index 798c4986a..dab9ffb93 100644 --- a/src/spicelib/devices/ndev/ndevdefs.h +++ b/src/spicelib/devices/ndev/ndevdefs.h @@ -24,12 +24,12 @@ University of Science and Technology of China /* information needed per instance */ typedef struct sNDEVinstance { - struct sNDEVmodel *NDEVmodPtr;/* back pointer to model */ - struct sNDEVinstance *NDEVnextInstance; /* pointer to next instance - * of current model */ - IFuid NDEVname; /* pointer to character string naming this - * instance */ - int NDEVstate; /* pointer to start of state vector for diode */ + struct GENinstance gen; + +#define NDEVmodPtr(inst) ((struct sNDEVmodel*)((inst)->gen.GENmodPtr)) +#define NDEVnextInstance(inst) ((struct sNDEVinstance*)((inst)->gen.GENnextInstance)) +#define NDEVstate gen.GENstate + const int pin[7]; /* max 7 terminals are allowed */ int term; /* the real number of terminals */ CKTnode *node[7]; /* the array of CKT node's node pointer */ diff --git a/src/spicelib/devices/ndev/ndevdest.c b/src/spicelib/devices/ndev/ndevdest.c index b10f773bf..0c175ea42 100644 --- a/src/spicelib/devices/ndev/ndevdest.c +++ b/src/spicelib/devices/ndev/ndevdest.c @@ -18,7 +18,7 @@ NDEVdestroy(GENmodel **inModel) NDEVmodel *next_mod = NDEVnextModel(mod); NDEVinstance *inst = NDEVinstances(mod); while (inst) { - NDEVinstance *next_inst = inst->NDEVnextInstance; + NDEVinstance *next_inst = NDEVnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/ndev/ndevload.c b/src/spicelib/devices/ndev/ndevload.c index 1e69d9a77..5b8bd04e0 100644 --- a/src/spicelib/devices/ndev/ndevload.c +++ b/src/spicelib/devices/ndev/ndevload.c @@ -27,7 +27,7 @@ NDEVload(GENmodel * inModel, CKTcircuit * ckt) { /* loop through all the instances of the model */ - for (here = NDEVinstances(model); here != NULL ; here=here->NDEVnextInstance) + for (here = NDEVinstances(model); here != NULL ; here=NDEVnextInstance(here)) { /* sent ckt information to device simulator */ here->CKTInfo.DEV_CALL = NDEV_LOAD; @@ -54,7 +54,7 @@ NDEVload(GENmodel * inModel, CKTcircuit * ckt) { /* loop through all the instances of the model */ - for (here = NDEVinstances(model); here != NULL ; here=here->NDEVnextInstance) + for (here = NDEVinstances(model); here != NULL ; here=NDEVnextInstance(here)) { /* reveive terminal current and conductional matrix from device simulator */ for(i=0;iterm;i++) @@ -85,7 +85,7 @@ int NDEVgetic(GENmodel *inModel, CKTcircuit *ckt) printf("set ic\n"); for( ; model ; model = NDEVnextModel(model)) { - for(here = NDEVinstances(model); here ; here = here->NDEVnextInstance) { + for(here = NDEVinstances(model); here ; here = NDEVnextInstance(here)) { /* if(!here->DIOinitCondGiven) { here->DIOinitCond = diff --git a/src/spicelib/devices/ndev/ndevset.c b/src/spicelib/devices/ndev/ndevset.c index a2b3d194f..249b6cd18 100644 --- a/src/spicelib/devices/ndev/ndevset.c +++ b/src/spicelib/devices/ndev/ndevset.c @@ -43,10 +43,10 @@ int NDEVsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states /* loop through all the instances of the model */ for (here = NDEVinstances(model); here != NULL ; - here=here->NDEVnextInstance) { + here=NDEVnextInstance(here)) { here->Ndevinfo.term = here->term; - strncpy(here->Ndevinfo.NDEVname,here->NDEVname,32); + strncpy(here->Ndevinfo.NDEVname, here->gen.GENname, 32); send(model->sock,&(here->Ndevinfo),sizeof(here->Ndevinfo),0); /* macro to make elements with built in test for out of memory */ #define TSTALLOC(ptr,first,second) \ diff --git a/src/spicelib/devices/numd/numdacld.c b/src/spicelib/devices/numd/numdacld.c index c93991a5f..ca57dea38 100644 --- a/src/spicelib/devices/numd/numdacld.c +++ b/src/spicelib/devices/numd/numdacld.c @@ -40,7 +40,7 @@ NUMDacLoad(GENmodel *inModel, CKTcircuit *ckt) ONEacDebug = model->NUMDoutputs->OUTPacDebug; for (inst = NUMDinstances(model); inst != NULL; - inst = inst->NUMDnextInstance) { + inst = NUMDnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); /* Get Temp.-Dep. Global Parameters */ diff --git a/src/spicelib/devices/numd/numddefs.h b/src/spicelib/devices/numd/numddefs.h index 17bca5261..9d7d789bf 100644 --- a/src/spicelib/devices/numd/numddefs.h +++ b/src/spicelib/devices/numd/numddefs.h @@ -22,12 +22,12 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNUMDinstance { - struct sNUMDmodel *NUMDmodPtr;/* back pointer to model */ - struct sNUMDinstance *NUMDnextInstance; /* pointer to next instance - * of current model */ - IFuid NUMDname; /* pointer to character string naming this - * instance */ - int NUMDstate; /* pointer to start of state vector for diode */ + struct GENinstance gen; + +#define NUMDmodPtr(inst) ((struct sNUMDmodel*)((inst)->gen.GENmodPtr)) +#define NUMDnextInstance(inst) ((struct sNUMDinstance*)((inst)->gen.GENnextInstance)) +#define NUMDname gen.GENname +#define NUMDstate gen.GENstate #define NUMDvoltage NUMDstate #define NUMDid NUMDstate+1 diff --git a/src/spicelib/devices/numd/numddest.c b/src/spicelib/devices/numd/numddest.c index 437c33481..5ef34418d 100644 --- a/src/spicelib/devices/numd/numddest.c +++ b/src/spicelib/devices/numd/numddest.c @@ -24,7 +24,7 @@ NUMDdestroy(GENmodel **inModel) NUMDmodel *next_mod = NUMDnextModel(mod); NUMDinstance *inst = NUMDinstances(mod); while (inst) { - NUMDinstance *next_inst = inst->NUMDnextInstance; + NUMDinstance *next_inst = NUMDnextInstance(inst); ONEdestroy(inst->NUMDpDevice); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/numd/numddump.c b/src/spicelib/devices/numd/numddump.c index 4b53f08b8..6c3c1857a 100644 --- a/src/spicelib/devices/numd/numddump.c +++ b/src/spicelib/devices/numd/numddump.c @@ -58,7 +58,7 @@ NUMDdump(GENmodel *inModel, CKTcircuit *ckt) for (; model != NULL; model = NUMDnextModel(model)) { output = model->NUMDoutputs; for (inst = NUMDinstances(model); inst != NULL; - inst = inst->NUMDnextInstance) { + inst = NUMDnextInstance(inst)) { if (inst->NUMDprintGiven) { if ((ckt->CKTmode & MODETRAN) && @@ -145,7 +145,7 @@ NUMDacct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) for (; model != NULL; model = NUMDnextModel(model)) { output = model->NUMDoutputs; for (inst = NUMDinstances(model); inst != NULL; - inst = inst->NUMDnextInstance) { + inst = NUMDnextInstance(inst)) { if (output->OUTPstats) { ONEmemStats(file, inst->NUMDpDevice); diff --git a/src/spicelib/devices/numd/numdload.c b/src/spicelib/devices/numd/numdload.c index 7cde49811..cbffed583 100644 --- a/src/spicelib/devices/numd/numdload.c +++ b/src/spicelib/devices/numd/numdload.c @@ -90,7 +90,7 @@ NUMDload(GENmodel *inModel, CKTcircuit *ckt) } /* Now do instance things */ for (inst = NUMDinstances(model); inst != NULL; - inst = inst->NUMDnextInstance) { + inst = NUMDnextInstance(inst)) { pDevice = inst->NUMDpDevice; @@ -377,7 +377,7 @@ int NUMDinitSmSig(NUMDinstance *inst) { SPcomplex yd; - double omega = inst->NUMDmodPtr->NUMDmethods->METHomega; + double omega = NUMDmodPtr(inst)->NUMDmethods->METHomega; AcAnalysisMethod = SOR_ONLY; (void) NUMDadmittance(inst->NUMDpDevice, omega, &yd); diff --git a/src/spicelib/devices/numd/numdpzld.c b/src/spicelib/devices/numd/numdpzld.c index de3f238e6..a3c71892a 100644 --- a/src/spicelib/devices/numd/numdpzld.c +++ b/src/spicelib/devices/numd/numdpzld.c @@ -36,7 +36,7 @@ NUMDpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) ONEacDebug = model->NUMDoutputs->OUTPacDebug; for (inst = NUMDinstances(model); inst != NULL; - inst = inst->NUMDnextInstance) { + inst = NUMDnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); /* Get Temp.-Dep. Global Parameters */ diff --git a/src/spicelib/devices/numd/numdset.c b/src/spicelib/devices/numd/numdset.c index d441fc205..3fb686e87 100644 --- a/src/spicelib/devices/numd/numdset.c +++ b/src/spicelib/devices/numd/numdset.c @@ -142,7 +142,7 @@ NUMDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (inst = NUMDinstances(model); inst != NULL; - inst = inst->NUMDnextInstance) { + inst = NUMDnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd/numdtemp.c b/src/spicelib/devices/numd/numdtemp.c index b1b3fd9dd..21c97de11 100644 --- a/src/spicelib/devices/numd/numdtemp.c +++ b/src/spicelib/devices/numd/numdtemp.c @@ -51,7 +51,7 @@ NUMDtemp(GENmodel *inModel, CKTcircuit *ckt) ConcDepMobility = models->MODLconcDepMobility; for (inst = NUMDinstances(model); inst != NULL; - inst = inst->NUMDnextInstance) { + inst = NUMDnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd/numdtrun.c b/src/spicelib/devices/numd/numdtrun.c index cd4f4388b..e8eac8600 100644 --- a/src/spicelib/devices/numd/numdtrun.c +++ b/src/spicelib/devices/numd/numdtrun.c @@ -31,7 +31,7 @@ NUMDtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) model->NUMDpInfo->delta = deltaNorm; model->NUMDpInfo->lteCoeff = computeLTECoeff(model->NUMDpInfo); for (inst = NUMDinstances(model); inst != NULL; - inst = inst->NUMDnextInstance) { + inst = NUMDnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); deltaNew = ONEtrunc(inst->NUMDpDevice, model->NUMDpInfo, ckt->CKTdelta); diff --git a/src/spicelib/devices/numd2/nud2acld.c b/src/spicelib/devices/numd2/nud2acld.c index a3e51dca5..ba3801bf7 100644 --- a/src/spicelib/devices/numd2/nud2acld.c +++ b/src/spicelib/devices/numd2/nud2acld.c @@ -42,7 +42,7 @@ NUMD2acLoad(GENmodel *inModel, CKTcircuit *ckt) TWOacDebug = model->NUMD2outputs->OUTPacDebug; for (inst = NUMD2instances(model); inst != NULL; - inst = inst->NUMD2nextInstance) { + inst = NUMD2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); /* Get Temp.-Dep. Global Parameters */ diff --git a/src/spicelib/devices/numd2/nud2dest.c b/src/spicelib/devices/numd2/nud2dest.c index 83a3edb72..6f989a6f4 100644 --- a/src/spicelib/devices/numd2/nud2dest.c +++ b/src/spicelib/devices/numd2/nud2dest.c @@ -25,7 +25,7 @@ NUMD2destroy(GENmodel **inModel) NUMD2model *next_mod = NUMD2nextModel(mod); NUMD2instance *inst = NUMD2instances(mod); while (inst) { - NUMD2instance *next_inst = inst->NUMD2nextInstance; + NUMD2instance *next_inst = NUMD2nextInstance(inst); TWOdestroy(inst->NUMD2pDevice); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/numd2/nud2dump.c b/src/spicelib/devices/numd2/nud2dump.c index aecc1cc6a..823cfb062 100644 --- a/src/spicelib/devices/numd2/nud2dump.c +++ b/src/spicelib/devices/numd2/nud2dump.c @@ -59,7 +59,7 @@ NUMD2dump(GENmodel *inModel, CKTcircuit *ckt) for (; model != NULL; model = NUMD2nextModel(model)) { output = model->NUMD2outputs; for (inst = NUMD2instances(model); inst != NULL; - inst = inst->NUMD2nextInstance) { + inst = NUMD2nextInstance(inst)) { if (inst->NUMD2printGiven) { if ((ckt->CKTmode & MODETRAN) && @@ -146,7 +146,7 @@ NUMD2acct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) for (; model != NULL; model = NUMD2nextModel(model)) { output = model->NUMD2outputs; for (inst = NUMD2instances(model); inst != NULL; - inst = inst->NUMD2nextInstance) { + inst = NUMD2nextInstance(inst)) { if (output->OUTPstats) { TWOmemStats(file, inst->NUMD2pDevice); diff --git a/src/spicelib/devices/numd2/nud2load.c b/src/spicelib/devices/numd2/nud2load.c index 4681fb57b..abd43c721 100644 --- a/src/spicelib/devices/numd2/nud2load.c +++ b/src/spicelib/devices/numd2/nud2load.c @@ -91,7 +91,7 @@ NUMD2load(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the instances of the model */ for (inst = NUMD2instances(model); inst != NULL; - inst = inst->NUMD2nextInstance) { + inst = NUMD2nextInstance(inst)) { pDevice = inst->NUMD2pDevice; @@ -386,7 +386,7 @@ int NUMD2initSmSig(NUMD2instance *inst) { SPcomplex yd; - double omega = inst->NUMD2modPtr->NUMD2methods->METHomega; + double omega = NUMD2modPtr(inst)->NUMD2methods->METHomega; AcAnalysisMethod = SOR_ONLY; (void) NUMD2admittance(inst->NUMD2pDevice, omega, &yd); diff --git a/src/spicelib/devices/numd2/nud2pzld.c b/src/spicelib/devices/numd2/nud2pzld.c index 4e7c5b934..49933197b 100644 --- a/src/spicelib/devices/numd2/nud2pzld.c +++ b/src/spicelib/devices/numd2/nud2pzld.c @@ -38,7 +38,7 @@ NUMD2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) TWOacDebug = model->NUMD2outputs->OUTPacDebug; for (inst = NUMD2instances(model); inst != NULL; - inst = inst->NUMD2nextInstance) { + inst = NUMD2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); /* Get Temp.-Dep. Global Parameters */ diff --git a/src/spicelib/devices/numd2/nud2set.c b/src/spicelib/devices/numd2/nud2set.c index 35a362364..414cc9c27 100644 --- a/src/spicelib/devices/numd2/nud2set.c +++ b/src/spicelib/devices/numd2/nud2set.c @@ -162,7 +162,7 @@ NUMD2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (inst = NUMD2instances(model); inst != NULL; - inst = inst->NUMD2nextInstance) { + inst = NUMD2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd2/nud2temp.c b/src/spicelib/devices/numd2/nud2temp.c index c09edd109..a85247876 100644 --- a/src/spicelib/devices/numd2/nud2temp.c +++ b/src/spicelib/devices/numd2/nud2temp.c @@ -54,7 +54,7 @@ NUMD2temp(GENmodel *inModel, CKTcircuit *ckt) OneCarrier = methods->METHoneCarrier; for (inst = NUMD2instances(model); inst != NULL; - inst = inst->NUMD2nextInstance) { + inst = NUMD2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd2/nud2trun.c b/src/spicelib/devices/numd2/nud2trun.c index e52063070..fbf8cb1cb 100644 --- a/src/spicelib/devices/numd2/nud2trun.c +++ b/src/spicelib/devices/numd2/nud2trun.c @@ -32,7 +32,7 @@ NUMD2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) model->NUMD2pInfo->delta = deltaNorm; model->NUMD2pInfo->lteCoeff = computeLTECoeff(model->NUMD2pInfo); for (inst = NUMD2instances(model); inst != NULL; - inst = inst->NUMD2nextInstance) { + inst = NUMD2nextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); deltaNew = TWOtrunc(inst->NUMD2pDevice, model->NUMD2pInfo, diff --git a/src/spicelib/devices/numd2/numd2def.h b/src/spicelib/devices/numd2/numd2def.h index 169371a65..7d700a7be 100644 --- a/src/spicelib/devices/numd2/numd2def.h +++ b/src/spicelib/devices/numd2/numd2def.h @@ -22,12 +22,12 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNUMD2instance { - struct sNUMD2model *NUMD2modPtr; /* back pointer to model */ - struct sNUMD2instance *NUMD2nextInstance; /* pointer to next instance - * of current model */ - IFuid NUMD2name; /* pointer to character string naming this - * instance */ - int NUMD2state; /* pointer to start of state vector for diode */ + struct GENinstance gen; + +#define NUMD2modPtr(inst) ((struct sNUMD2model*)((inst)->gen.GENmodPtr)) +#define NUMD2nextInstance(inst) ((struct sNUMD2instance*)((inst)->gen.GENnextInstance)) +#define NUMD2name gen.GENname +#define NUMD2state gen.GENstate #define NUMD2voltage NUMD2state #define NUMD2id NUMD2state+1 diff --git a/src/spicelib/devices/numos/nummacld.c b/src/spicelib/devices/numos/nummacld.c index fa62cd174..ac5f7aff5 100644 --- a/src/spicelib/devices/numos/nummacld.c +++ b/src/spicelib/devices/numos/nummacld.c @@ -40,7 +40,7 @@ NUMOSacLoad(GENmodel *inModel, CKTcircuit *ckt) TWOacDebug = model->NUMOSoutputs->OUTPacDebug; for (inst = NUMOSinstances(model); inst != NULL; - inst = inst->NUMOSnextInstance) { + inst = NUMOSnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); /* Get Temp.-Dep. Global Parameters */ diff --git a/src/spicelib/devices/numos/nummdest.c b/src/spicelib/devices/numos/nummdest.c index 56124c19c..ce4dd4fff 100644 --- a/src/spicelib/devices/numos/nummdest.c +++ b/src/spicelib/devices/numos/nummdest.c @@ -24,7 +24,7 @@ NUMOSdestroy(GENmodel **inModel) NUMOSmodel *next_mod = NUMOSnextModel(mod); NUMOSinstance *inst = NUMOSinstances(mod); while (inst) { - NUMOSinstance *next_inst = inst->NUMOSnextInstance; + NUMOSinstance *next_inst = NUMOSnextInstance(inst); TWOdestroy(inst->NUMOSpDevice); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/numos/nummdump.c b/src/spicelib/devices/numos/nummdump.c index fabcccefb..9563cc5a6 100644 --- a/src/spicelib/devices/numos/nummdump.c +++ b/src/spicelib/devices/numos/nummdump.c @@ -59,7 +59,7 @@ NUMOSdump(GENmodel *inModel, CKTcircuit *ckt) for (; model != NULL; model = NUMOSnextModel(model)) { output = model->NUMOSoutputs; for (inst = NUMOSinstances(model); inst != NULL; - inst = inst->NUMOSnextInstance) { + inst = NUMOSnextInstance(inst)) { if (inst->NUMOSprintGiven) { if ((ckt->CKTmode & MODETRAN) && @@ -160,7 +160,7 @@ NUMOSacct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) for (; model != NULL; model = NUMOSnextModel(model)) { output = model->NUMOSoutputs; for (inst = NUMOSinstances(model); inst != NULL; - inst = inst->NUMOSnextInstance) { + inst = NUMOSnextInstance(inst)) { if (output->OUTPstats) { TWOmemStats(file, inst->NUMOSpDevice); diff --git a/src/spicelib/devices/numos/nummload.c b/src/spicelib/devices/numos/nummload.c index b04eb48d8..164b47dbb 100644 --- a/src/spicelib/devices/numos/nummload.c +++ b/src/spicelib/devices/numos/nummload.c @@ -92,7 +92,7 @@ NUMOSload(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the instances of the model */ for (inst = NUMOSinstances(model); inst != NULL; - inst = inst->NUMOSnextInstance) { + inst = NUMOSnextInstance(inst)) { pDevice = inst->NUMOSpDevice; @@ -594,7 +594,7 @@ int NUMOSinitSmSig(NUMOSinstance *inst) { struct mosAdmittances yAc; - double omega = inst->NUMOSmodPtr->NUMOSmethods->METHomega; + double omega = NUMOSmodPtr(inst)->NUMOSmethods->METHomega; AcAnalysisMethod = SOR_ONLY; (void) NUMOSadmittance(inst->NUMOSpDevice, omega, &yAc); diff --git a/src/spicelib/devices/numos/nummpzld.c b/src/spicelib/devices/numos/nummpzld.c index b02a90506..d403a2a75 100644 --- a/src/spicelib/devices/numos/nummpzld.c +++ b/src/spicelib/devices/numos/nummpzld.c @@ -37,7 +37,7 @@ NUMOSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) TWOacDebug = model->NUMOSoutputs->OUTPacDebug; for (inst = NUMOSinstances(model); inst != NULL; - inst = inst->NUMOSnextInstance) { + inst = NUMOSnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); /* Get Temp.-Dep. Global Parameters */ diff --git a/src/spicelib/devices/numos/nummset.c b/src/spicelib/devices/numos/nummset.c index 5ed80ce75..f5c55d8c5 100644 --- a/src/spicelib/devices/numos/nummset.c +++ b/src/spicelib/devices/numos/nummset.c @@ -161,7 +161,7 @@ NUMOSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (inst = NUMOSinstances(model); inst != NULL; - inst = inst->NUMOSnextInstance) { + inst = NUMOSnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numos/nummtemp.c b/src/spicelib/devices/numos/nummtemp.c index 84990f999..897aa58f8 100644 --- a/src/spicelib/devices/numos/nummtemp.c +++ b/src/spicelib/devices/numos/nummtemp.c @@ -55,7 +55,7 @@ NUMOStemp(GENmodel *inModel, CKTcircuit *ckt) OneCarrier = methods->METHoneCarrier; for (inst = NUMOSinstances(model); inst != NULL; - inst = inst->NUMOSnextInstance) { + inst = NUMOSnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numos/nummtrun.c b/src/spicelib/devices/numos/nummtrun.c index 87c1ddbe7..bdfb57ed0 100644 --- a/src/spicelib/devices/numos/nummtrun.c +++ b/src/spicelib/devices/numos/nummtrun.c @@ -38,7 +38,7 @@ NUMOStrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) model->NUMOSpInfo->delta = deltaNorm; model->NUMOSpInfo->lteCoeff = computeLTECoeff(model->NUMOSpInfo); for (inst = NUMOSinstances(model); inst != NULL; - inst = inst->NUMOSnextInstance) { + inst = NUMOSnextInstance(inst)) { startTime = SPfrontEnd->IFseconds(); deltaNew = TWOtrunc(inst->NUMOSpDevice, model->NUMOSpInfo, diff --git a/src/spicelib/devices/numos/numosdef.h b/src/spicelib/devices/numos/numosdef.h index fb24bdcc4..caa1c2817 100644 --- a/src/spicelib/devices/numos/numosdef.h +++ b/src/spicelib/devices/numos/numosdef.h @@ -22,15 +22,13 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNUMOSinstance { - struct sNUMOSmodel *NUMOSmodPtr; /* back pointer to model */ - struct sNUMOSinstance *NUMOSnextInstance; /* pointer to next instance - * of current model */ - IFuid NUMOSname; /* pointer to character string naming this - * instance */ - int NUMOSstate; /* pointer to start of state vector for - * mosfet */ + struct GENinstance gen; + +#define NUMOSmodPtr(inst) ((struct sNUMOSmodel*)((inst)->gen.GENmodPtr)) +#define NUMOSnextInstance(inst) ((struct sNUMOSinstance*)((inst)->gen.GENnextInstance)) +#define NUMOSname gen.GENname +#define NUMOSstate gen.GENstate - /* entries in the state vector for mosfet: */ #define NUMOSvdb NUMOSstate #define NUMOSvsb NUMOSstate+1 #define NUMOSvgb NUMOSstate+2 diff --git a/src/spicelib/devices/res/resdefs.h b/src/spicelib/devices/res/resdefs.h index fb92819f3..3ac5aead4 100644 --- a/src/spicelib/devices/res/resdefs.h +++ b/src/spicelib/devices/res/resdefs.h @@ -19,12 +19,13 @@ Modified: 2000 AlansFixes /* information used to describe a single instance */ typedef struct sRESinstance { - struct sRESmodel *RESmodPtr; /* backpointer to model */ - struct sRESinstance *RESnextInstance; /* pointer to next instance of - * current model*/ + struct GENinstance gen; + +#define RESmodPtr(inst) ((struct sRESmodel*)((inst)->gen.GENmodPtr)) +#define RESnextInstance(inst) ((struct sRESinstance*)((inst)->gen.GENnextInstance)) +#define RESname gen.GENname +#define RESstate gen.GENstate - IFuid RESname; /* pointer to character string naming this instance */ - int RESstate; /* not used but needed for sructure consistency */ const int RESposNode; /* number of positive node of resistor */ const int RESnegNode; /* number of negative node of resistor */ diff --git a/src/spicelib/devices/res/resdest.c b/src/spicelib/devices/res/resdest.c index 4f9bb9937..fb4ab33f8 100644 --- a/src/spicelib/devices/res/resdest.c +++ b/src/spicelib/devices/res/resdest.c @@ -17,7 +17,7 @@ RESdestroy(GENmodel **inModel) RESmodel *next_mod = RESnextModel(mod); RESinstance *inst = RESinstances(mod); while (inst) { - RESinstance *next_inst = inst->RESnextInstance; + RESinstance *next_inst = RESnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/res/resload.c b/src/spicelib/devices/res/resload.c index 600546415..b6bc3a6e2 100644 --- a/src/spicelib/devices/res/resload.c +++ b/src/spicelib/devices/res/resload.c @@ -23,7 +23,7 @@ RESload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = RESinstances(model); here != NULL ; - here = here->RESnextInstance) { + here = RESnextInstance(here)) { here->REScurrent = (*(ckt->CKTrhsOld+here->RESposNode) - *(ckt->CKTrhsOld+here->RESnegNode)) * here->RESconduct; @@ -54,7 +54,7 @@ RESacload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = RESinstances(model); here != NULL ; - here = here->RESnextInstance) { + here = RESnextInstance(here)) { if (here->RESacresGiven) g = here->RESacConduct; diff --git a/src/spicelib/devices/res/resnoise.c b/src/spicelib/devices/res/resnoise.c index 2e7aa5033..a27faf460 100644 --- a/src/spicelib/devices/res/resnoise.c +++ b/src/spicelib/devices/res/resnoise.c @@ -54,7 +54,7 @@ RESnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, for (model = firstModel; model != NULL; model = RESnextModel(model)) { for (inst = RESinstances(model); inst != NULL; - inst = inst->RESnextInstance) { + inst = RESnextInstance(inst)) { if(!inst->RESnoisy) continue; /* Quiet resistors are skipped */ diff --git a/src/spicelib/devices/res/respzld.c b/src/spicelib/devices/res/respzld.c index 7462c93a4..070b357fe 100644 --- a/src/spicelib/devices/res/respzld.c +++ b/src/spicelib/devices/res/respzld.c @@ -31,7 +31,7 @@ RESpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for (here = RESinstances(model); here != NULL ; - here=here->RESnextInstance) { + here=RESnextInstance(here)) { if (here->RESacresGiven) g = here->RESacConduct; diff --git a/src/spicelib/devices/res/ressacl.c b/src/spicelib/devices/res/ressacl.c index cb92d1790..995d57b69 100644 --- a/src/spicelib/devices/res/ressacl.c +++ b/src/spicelib/devices/res/ressacl.c @@ -29,7 +29,7 @@ RESsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = RESinstances(model); here != NULL ; - here=here->RESnextInstance) { + here=RESnextInstance(here)) { if(here->RESsenParmNo){ value = *(ckt->CKTrhsOld+here->RESposNode) - diff --git a/src/spicelib/devices/res/ressetup.c b/src/spicelib/devices/res/ressetup.c index 5b57acf70..73dc10410 100644 --- a/src/spicelib/devices/res/ressetup.c +++ b/src/spicelib/devices/res/ressetup.c @@ -46,7 +46,7 @@ RESsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit*ckt, int *state) /* loop through all the instances of the model */ for (here = RESinstances(model); here != NULL ; - here=here->RESnextInstance) { + here=RESnextInstance(here)) { if(!here->RESwidthGiven) here->RESwidth = model->RESdefWidth; if(!here->RESlengthGiven) here->RESlength = model->RESdefLength; diff --git a/src/spicelib/devices/res/ressload.c b/src/spicelib/devices/res/ressload.c index 2b90f43e7..ccfedfd60 100644 --- a/src/spicelib/devices/res/ressload.c +++ b/src/spicelib/devices/res/ressload.c @@ -27,7 +27,7 @@ RESsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = RESinstances(model); here != NULL ; - here=here->RESnextInstance) { + here=RESnextInstance(here)) { if(here->RESsenParmNo){ double value; diff --git a/src/spicelib/devices/res/ressoachk.c b/src/spicelib/devices/res/ressoachk.c index 46b425756..93db1f099 100644 --- a/src/spicelib/devices/res/ressoachk.c +++ b/src/spicelib/devices/res/ressoachk.c @@ -30,7 +30,7 @@ RESsoaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = RESnextModel(model)) { - for (here = RESinstances(model); here; here = here->RESnextInstance) { + for (here = RESinstances(model); here; here = RESnextInstance(here)) { vr = fabs(ckt->CKTrhsOld [here->RESposNode] - ckt->CKTrhsOld [here->RESnegNode]); diff --git a/src/spicelib/devices/res/ressprt.c b/src/spicelib/devices/res/ressprt.c index 77093d126..18ceb2d55 100644 --- a/src/spicelib/devices/res/ressprt.c +++ b/src/spicelib/devices/res/ressprt.c @@ -30,7 +30,7 @@ RESsPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = RESinstances(model); here != NULL ; - here=here->RESnextInstance) { + here=RESnextInstance(here)) { printf(" Instance name:%s\n",here->RESname); printf(" Positive, negative nodes: %s, %s\n", diff --git a/src/spicelib/devices/res/ressset.c b/src/spicelib/devices/res/ressset.c index b7c1946c6..9b3eca0cd 100644 --- a/src/spicelib/devices/res/ressset.c +++ b/src/spicelib/devices/res/ressset.c @@ -27,7 +27,7 @@ RESsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = RESinstances(model); here != NULL ; - here=here->RESnextInstance) { + here=RESnextInstance(here)) { if(here->RESsenParmNo){ here->RESsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/res/restemp.c b/src/spicelib/devices/res/restemp.c index 9b26d8fa8..0d9783b89 100644 --- a/src/spicelib/devices/res/restemp.c +++ b/src/spicelib/devices/res/restemp.c @@ -28,7 +28,7 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = RESinstances(model); here != NULL ; - here=here->RESnextInstance) { + here=RESnextInstance(here)) { /* Default Value Processing for Resistor Instance */ @@ -53,7 +53,7 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt) void RESupdate_conduct(RESinstance *here, bool spill_warnings) { - RESmodel *model = here->RESmodPtr; + RESmodel *model = RESmodPtr(here); double factor; double difference; double tc1, tc2, tce; diff --git a/src/spicelib/devices/soi3/soi3acld.c b/src/spicelib/devices/soi3/soi3acld.c index 633ab1570..b98e6b4f8 100644 --- a/src/spicelib/devices/soi3/soi3acld.c +++ b/src/spicelib/devices/soi3/soi3acld.c @@ -78,7 +78,7 @@ SOI3acLoad(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = SOI3nextModel(model)) { for(here = SOI3instances(model); here!= NULL; - here = here->SOI3nextInstance) + here = SOI3nextInstance(here)) { if (here->SOI3mode < 0) diff --git a/src/spicelib/devices/soi3/soi3conv.c b/src/spicelib/devices/soi3/soi3conv.c index bc455e68b..88fa9cbdc 100644 --- a/src/spicelib/devices/soi3/soi3conv.c +++ b/src/spicelib/devices/soi3/soi3conv.c @@ -59,7 +59,7 @@ SOI3convTest(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = SOI3nextModel(model)) { for(here = SOI3instances(model); here!= NULL; - here = here->SOI3nextInstance) { + here = SOI3nextInstance(here)) { vbs = model->SOI3type * ( *(ckt->CKTrhs+here->SOI3bNode) - diff --git a/src/spicelib/devices/soi3/soi3defs.h b/src/spicelib/devices/soi3/soi3defs.h index ac18d32c6..4ed1d60b5 100644 --- a/src/spicelib/devices/soi3/soi3defs.h +++ b/src/spicelib/devices/soi3/soi3defs.h @@ -37,12 +37,12 @@ ngspice integration typedef struct sSOI3instance { - struct sSOI3model *SOI3modPtr; /* backpointer to model */ - struct sSOI3instance *SOI3nextInstance; /* pointer to next instance of - *current model*/ - IFuid SOI3name; /* pointer to character string naming this instance */ - int SOI3states; /* index into state table for this device */ + struct GENinstance gen; +#define SOI3modPtr(inst) ((struct sSOI3model*)((inst)->gen.GENmodPtr)) +#define SOI3nextInstance(inst) ((struct sSOI3instance*)((inst)->gen.GENnextInstance)) +#define SOI3name gen.GENname +#define SOI3states gen.GENstate const int SOI3dNode; /* number of the drain node of the mosfet */ const int SOI3gfNode; /* number of the front gate node of the mosfet */ diff --git a/src/spicelib/devices/soi3/soi3dest.c b/src/spicelib/devices/soi3/soi3dest.c index fbda9eba5..0d120cad6 100644 --- a/src/spicelib/devices/soi3/soi3dest.c +++ b/src/spicelib/devices/soi3/soi3dest.c @@ -34,7 +34,7 @@ SOI3destroy(GENmodel **inModel) SOI3model *next_mod = SOI3nextModel(mod); SOI3instance *inst = SOI3instances(mod); while (inst) { - SOI3instance *next_inst = inst->SOI3nextInstance; + SOI3instance *next_inst = SOI3nextInstance(inst); /* FREE(inst->SOI3sens); */ FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/soi3/soi3ic.c b/src/spicelib/devices/soi3/soi3ic.c index 83e581e49..6013eba4c 100644 --- a/src/spicelib/devices/soi3/soi3ic.c +++ b/src/spicelib/devices/soi3/soi3ic.c @@ -38,7 +38,7 @@ SOI3getic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = SOI3nextModel(model)) { - for(here = SOI3instances(model); here ; here = here->SOI3nextInstance) { + for(here = SOI3instances(model); here ; here = SOI3nextInstance(here)) { if(!here->SOI3icVBSGiven) { here->SOI3icVBS = diff --git a/src/spicelib/devices/soi3/soi3load.c b/src/spicelib/devices/soi3/soi3load.c index 18aa28d0e..539eee887 100644 --- a/src/spicelib/devices/soi3/soi3load.c +++ b/src/spicelib/devices/soi3/soi3load.c @@ -161,7 +161,7 @@ SOI3load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = SOI3instances(model); here != NULL ; - here=here->SOI3nextInstance) { + here=SOI3nextInstance(here)) { vt = CONSTKoverQ * here->SOI3temp; Check=1; diff --git a/src/spicelib/devices/soi3/soi3nois.c b/src/spicelib/devices/soi3/soi3nois.c index 9d06d50fe..3e0817501 100644 --- a/src/spicelib/devices/soi3/soi3nois.c +++ b/src/spicelib/devices/soi3/soi3nois.c @@ -70,7 +70,7 @@ SOI3noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, }; for (model=firstModel; model != NULL; model=SOI3nextModel(model)) { - for (inst=SOI3instances(model); inst != NULL; inst=inst->SOI3nextInstance) { + for (inst=SOI3instances(model); inst != NULL; inst=SOI3nextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/soi3/soi3set.c b/src/spicelib/devices/soi3/soi3set.c index b20c40efd..43d2b2341 100644 --- a/src/spicelib/devices/soi3/soi3set.c +++ b/src/spicelib/devices/soi3/soi3set.c @@ -289,7 +289,7 @@ SOI3setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = SOI3instances(model); here != NULL ; - here=here->SOI3nextInstance) { + here=SOI3nextInstance(here)) { if(!here->SOI3icVBSGiven) { @@ -672,7 +672,7 @@ SOI3unsetup(GENmodel *inModel, CKTcircuit *ckt) model = SOI3nextModel(model)) { for (here = SOI3instances(model); here != NULL; - here=here->SOI3nextInstance) + here=SOI3nextInstance(here)) { if (here->SOI3tout4Node > 0) CKTdltNNum(ckt, here->SOI3tout4Node); diff --git a/src/spicelib/devices/soi3/soi3temp.c b/src/spicelib/devices/soi3/soi3temp.c index 7d1eb0218..be5837dfa 100644 --- a/src/spicelib/devices/soi3/soi3temp.c +++ b/src/spicelib/devices/soi3/soi3temp.c @@ -300,7 +300,7 @@ SOI3temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ for(here = SOI3instances(model); here!= NULL; - here = here->SOI3nextInstance) + here = SOI3nextInstance(here)) { double czbd; /* zero voltage bulk-drain capacitance */ diff --git a/src/spicelib/devices/soi3/soi3trun.c b/src/spicelib/devices/soi3/soi3trun.c index b1e4b8c58..22c3f0a2b 100644 --- a/src/spicelib/devices/soi3/soi3trun.c +++ b/src/spicelib/devices/soi3/soi3trun.c @@ -35,7 +35,7 @@ SOI3trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) for( ; model != NULL; model = SOI3nextModel(model)) { - for(here=SOI3instances(model);here!=NULL;here = here->SOI3nextInstance) + for(here=SOI3instances(model);here!=NULL;here = SOI3nextInstance(here)) { CKTterr(here->SOI3qgf,ckt,timeStep); CKTterr(here->SOI3qd,ckt,timeStep); diff --git a/src/spicelib/devices/sw/swacload.c b/src/spicelib/devices/sw/swacload.c index d1c50a6df..2621ba7e4 100644 --- a/src/spicelib/devices/sw/swacload.c +++ b/src/spicelib/devices/sw/swacload.c @@ -29,7 +29,7 @@ SWacLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = SWinstances(model); here != NULL ; - here=here->SWnextInstance) { + here=SWnextInstance(here)) { /* In AC analysis, just propogate the state... */ diff --git a/src/spicelib/devices/sw/swdefs.h b/src/spicelib/devices/sw/swdefs.h index 1116b9929..3e51f39ba 100644 --- a/src/spicelib/devices/sw/swdefs.h +++ b/src/spicelib/devices/sw/swdefs.h @@ -19,11 +19,12 @@ Modified: 2000 AlansFixes /* information to describe each instance */ typedef struct sSWinstance { - struct sSWmodel *SWmodPtr; /* backpointer to model */ - struct sSWinstance *SWnextInstance; /* pointer to next instance of - * current model*/ - IFuid SWname; /* pointer to character string naming this instance */ - int SWstate; /* pointer to start of switch's section of state vector */ + struct GENinstance gen; + +#define SWmodPtr(inst) ((struct sSWmodel*)((inst)->gen.GENmodPtr)) +#define SWnextInstance(inst) ((struct sSWinstance*)((inst)->gen.GENnextInstance)) +#define SWname gen.GENname +#define SWstate gen.GENstate const int SWposNode; /* number of positive node of switch */ const int SWnegNode; /* number of negative node of switch */ diff --git a/src/spicelib/devices/sw/swdest.c b/src/spicelib/devices/sw/swdest.c index a309dd041..2c23592b0 100644 --- a/src/spicelib/devices/sw/swdest.c +++ b/src/spicelib/devices/sw/swdest.c @@ -17,7 +17,7 @@ SWdestroy(GENmodel **inModel) SWmodel *next_mod = SWnextModel(mod); SWinstance *inst = SWinstances(mod); while (inst) { - SWinstance *next_inst = inst->SWnextInstance; + SWinstance *next_inst = SWnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/sw/swload.c b/src/spicelib/devices/sw/swload.c index b6ee38f01..2177345de 100644 --- a/src/spicelib/devices/sw/swload.c +++ b/src/spicelib/devices/sw/swload.c @@ -35,7 +35,7 @@ SWload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = SWinstances(model); here != NULL ; - here=here->SWnextInstance) { + here=SWnextInstance(here)) { old_current_state = *(ckt->CKTstates[0] + here->SWstate); previous_state = *(ckt->CKTstates[1] + here->SWstate); diff --git a/src/spicelib/devices/sw/swnoise.c b/src/spicelib/devices/sw/swnoise.c index 01ad53727..1e429a2e1 100644 --- a/src/spicelib/devices/sw/swnoise.c +++ b/src/spicelib/devices/sw/swnoise.c @@ -37,7 +37,7 @@ SWnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *da for (model=firstModel; model != NULL; model=SWnextModel(model)) { - for (inst=SWinstances(model); inst != NULL; inst=inst->SWnextInstance) { + for (inst=SWinstances(model); inst != NULL; inst=SWnextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/sw/swpzload.c b/src/spicelib/devices/sw/swpzload.c index 362d3be3e..6af94ecef 100644 --- a/src/spicelib/devices/sw/swpzload.c +++ b/src/spicelib/devices/sw/swpzload.c @@ -33,7 +33,7 @@ SWpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for (here = SWinstances(model); here != NULL ; - here=here->SWnextInstance) { + here=SWnextInstance(here)) { /* In AC analysis, just propogate the state... */ diff --git a/src/spicelib/devices/sw/swsetup.c b/src/spicelib/devices/sw/swsetup.c index 47619340e..a4fe7b133 100644 --- a/src/spicelib/devices/sw/swsetup.c +++ b/src/spicelib/devices/sw/swsetup.c @@ -42,7 +42,7 @@ SWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = SWinstances(model); here != NULL ; - here=here->SWnextInstance) { + here=SWnextInstance(here)) { here->SWstate = *states; *states += SW_NUM_STATES; diff --git a/src/spicelib/devices/sw/swtrunc.c b/src/spicelib/devices/sw/swtrunc.c index 68b1d3dd4..879ad59db 100644 --- a/src/spicelib/devices/sw/swtrunc.c +++ b/src/spicelib/devices/sw/swtrunc.c @@ -21,7 +21,7 @@ SWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) for( ; model!= NULL; model = SWnextModel(model)) { for(here = SWinstances(model) ; here != NULL ; - here = here->SWnextInstance) { + here = SWnextInstance(here)) { lastChange = *(ckt->CKTstate0+(here->SWstate+1)) - *(ckt->CKTstate1+(here->SWstate+1)); if (*(ckt->CKTstate0+(here->SWstate))==0) { diff --git a/src/spicelib/devices/tra/traacct.c b/src/spicelib/devices/tra/traacct.c index 71de15304..b83489a2a 100644 --- a/src/spicelib/devices/tra/traacct.c +++ b/src/spicelib/devices/tra/traacct.c @@ -29,7 +29,7 @@ TRAaccept(CKTcircuit *ckt, GENmodel *inModel) /* loop through all the instances of the model */ for (here = TRAinstances(model); here != NULL ; - here=here->TRAnextInstance) { + here=TRAnextInstance(here)) { if( (ckt->CKTtime - here->TRAtd) > *(here->TRAdelays+6)) { /* shift! */ diff --git a/src/spicelib/devices/tra/traacld.c b/src/spicelib/devices/tra/traacld.c index a40200cef..fd32971ec 100644 --- a/src/spicelib/devices/tra/traacld.c +++ b/src/spicelib/devices/tra/traacld.c @@ -25,7 +25,7 @@ TRAacLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = TRAinstances(model); here != NULL ; - here=here->TRAnextInstance) { + here=TRAnextInstance(here)) { real = cos(-ckt->CKTomega*here->TRAtd); imag = sin(-ckt->CKTomega*here->TRAtd); diff --git a/src/spicelib/devices/tra/tradefs.h b/src/spicelib/devices/tra/tradefs.h index d399d6a69..337e4ab98 100644 --- a/src/spicelib/devices/tra/tradefs.h +++ b/src/spicelib/devices/tra/tradefs.h @@ -18,11 +18,13 @@ Author: 1985 Thomas L. Quarles /* information used to describe a single instance */ typedef struct sTRAinstance { - struct sTRAmodel *TRAmodPtr; /* backpointer to model */ - struct sTRAinstance *TRAnextInstance; /* pointer to next instance of - * current model*/ - IFuid TRAname; /* pointer to character string naming this instance */ - int TRAstate; /* not used */ + struct GENinstance gen; + +#define TRAmodPtr(inst) ((struct sTRAmodel*)((inst)->gen.GENmodPtr)) +#define TRAnextInstance(inst) ((struct sTRAinstance*)((inst)->gen.GENnextInstance)) +#define TRAname gen.GENname +#define TRAstate gen.GENstate + const int TRAposNode1; /* number of positive node of end 1 of t. line */ const int TRAnegNode1; /* number of negative node of end 1 of t. line */ const int TRAposNode2; /* number of positive node of end 2 of t. line */ diff --git a/src/spicelib/devices/tra/tradest.c b/src/spicelib/devices/tra/tradest.c index 478ad04b0..913482322 100644 --- a/src/spicelib/devices/tra/tradest.c +++ b/src/spicelib/devices/tra/tradest.c @@ -17,7 +17,7 @@ TRAdestroy(GENmodel **inModel) TRAmodel *next_mod = TRAnextModel(mod); TRAinstance *inst = TRAinstances(mod); while (inst) { - TRAinstance *next_inst = inst->TRAnextInstance; + TRAinstance *next_inst = TRAnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/tra/traload.c b/src/spicelib/devices/tra/traload.c index 50e38098b..a5dd8571a 100644 --- a/src/spicelib/devices/tra/traload.c +++ b/src/spicelib/devices/tra/traload.c @@ -31,7 +31,7 @@ TRAload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = TRAinstances(model); here != NULL ; - here=here->TRAnextInstance) { + here=TRAnextInstance(here)) { *(here->TRApos1Pos1Ptr) += here->TRAconduct; *(here->TRApos1Int1Ptr) -= here->TRAconduct; diff --git a/src/spicelib/devices/tra/trasetup.c b/src/spicelib/devices/tra/trasetup.c index 450f3a444..a479c3333 100644 --- a/src/spicelib/devices/tra/trasetup.c +++ b/src/spicelib/devices/tra/trasetup.c @@ -32,7 +32,7 @@ TRAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) /* loop through all the instances of the model */ for (here = TRAinstances(model); here != NULL ; - here=here->TRAnextInstance) { + here=TRAnextInstance(here)) { if(here->TRAbrEq1==0) { error = CKTmkVolt(ckt,&tmp,here->TRAname,"i1"); @@ -124,7 +124,7 @@ TRAunsetup(GENmodel *inModel, CKTcircuit *ckt) model = TRAnextModel(model)) { for (here = TRAinstances(model); here != NULL; - here=here->TRAnextInstance) + here=TRAnextInstance(here)) { if (here->TRAintNode2 > 0) CKTdltNNum(ckt, here->TRAintNode2); diff --git a/src/spicelib/devices/tra/tratemp.c b/src/spicelib/devices/tra/tratemp.c index ad5cb2a35..79d481427 100644 --- a/src/spicelib/devices/tra/tratemp.c +++ b/src/spicelib/devices/tra/tratemp.c @@ -30,7 +30,7 @@ TRAtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = TRAinstances(model); here != NULL ; - here=here->TRAnextInstance) { + here=TRAnextInstance(here)) { if(!here->TRAtdGiven) { here->TRAtd = here->TRAnl/here->TRAf; diff --git a/src/spicelib/devices/tra/tratrunc.c b/src/spicelib/devices/tra/tratrunc.c index 41ee726a9..1b46acbac 100644 --- a/src/spicelib/devices/tra/tratrunc.c +++ b/src/spicelib/devices/tra/tratrunc.c @@ -27,7 +27,7 @@ TRAtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) /* loop through all the instances of the model */ for (here = TRAinstances(model); here != NULL ; - here=here->TRAnextInstance) { + here=TRAnextInstance(here)) { v1 = ( *(ckt->CKTrhsOld + here->TRAposNode2) - *(ckt->CKTrhsOld + here->TRAnegNode2)) diff --git a/src/spicelib/devices/txl/txlacct.c b/src/spicelib/devices/txl/txlacct.c index b32cf20e1..afe99d8fd 100644 --- a/src/spicelib/devices/txl/txlacct.c +++ b/src/spicelib/devices/txl/txlacct.c @@ -30,7 +30,7 @@ TXLaccept(CKTcircuit *ckt, GENmodel *inModel) /* loop through all the instances of the model */ for (here = TXLinstances(model); here != NULL ; - here=here->TXLnextInstance) { + here=TXLnextInstance(here)) { h = ckt->CKTdelta; hint = (int) (h * 1e12); @@ -61,7 +61,7 @@ TXLaccept(CKTcircuit *ckt, GENmodel *inModel) model = (TXLmodel *)inModel; for( ; model != NULL; model = TXLnextModel(model) ) { for (here = TXLinstances(model); here != NULL ; - here=here->TXLnextInstance) { + here=TXLnextInstance(here)) { nd = here->txline->in_node; nd->dvtag = 0; nd = here->txline->out_node; diff --git a/src/spicelib/devices/txl/txldefs.h b/src/spicelib/devices/txl/txldefs.h index 419988c73..3b4d2c3a1 100644 --- a/src/spicelib/devices/txl/txldefs.h +++ b/src/spicelib/devices/txl/txldefs.h @@ -11,13 +11,13 @@ /* information used to describe a single instance */ typedef struct sTXLinstance { - struct sTXLmodel *TXLmodPtr; /* backpointer to model */ - struct sTXLinstance *TXLnextInstance; /* pointer to next instance of - * current model*/ + struct GENinstance gen; + +#define TXLmodPtr(inst) ((struct sTXLmodel*)((inst)->gen.GENmodPtr)) +#define TXLnextInstance(inst) ((struct sTXLinstance*)((inst)->gen.GENnextInstance)) +#define TXLname gen.GENname +#define TXLstates gen.GENstate - IFuid TXLname; /* pointer to character string naming this instance */ - int TXLstates; /* state info, unused */ - int dimensions; /* may we not need this but ... */ int TXLposNode; int TXLnegNode; diff --git a/src/spicelib/devices/txl/txldest.c b/src/spicelib/devices/txl/txldest.c index b41d5f638..07ee634c1 100644 --- a/src/spicelib/devices/txl/txldest.c +++ b/src/spicelib/devices/txl/txldest.c @@ -18,7 +18,7 @@ TXLdestroy(GENmodel **inModel) TXLmodel *next_mod = TXLnextModel(mod); TXLinstance *inst = TXLinstances(mod); while (inst) { - TXLinstance *next_inst = inst->TXLnextInstance; + TXLinstance *next_inst = TXLnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/txl/txlfbr.c b/src/spicelib/devices/txl/txlfbr.c index 2ef905aa4..46503a403 100644 --- a/src/spicelib/devices/txl/txlfbr.c +++ b/src/spicelib/devices/txl/txlfbr.c @@ -22,7 +22,7 @@ TXLfindBr(CKTcircuit *ckt, GENmodel *inModel, IFuid name) for( ; model != NULL; model = TXLnextModel(model)) { for (here = TXLinstances(model); here != NULL; - here = here->TXLnextInstance) { + here = TXLnextInstance(here)) { if(here->TXLname == name) { if(here->TXLbranch == 0) { error = CKTmkCur(ckt,&tmp,here->TXLname,"branch"); diff --git a/src/spicelib/devices/txl/txlload.c b/src/spicelib/devices/txl/txlload.c index 2cd49abed..fb1d69a22 100644 --- a/src/spicelib/devices/txl/txlload.c +++ b/src/spicelib/devices/txl/txlload.c @@ -63,7 +63,7 @@ TXLload(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = TXLnextModel(model) ) { for (here = TXLinstances(model); here != NULL ; - here=here->TXLnextInstance) { + here=TXLnextInstance(here)) { tx = here->txline; @@ -110,7 +110,7 @@ TXLload(GENmodel *inModel, CKTcircuit *ckt) model = (TXLmodel *)inModel; for( ; model != NULL; model = TXLnextModel(model) ) { for (here = TXLinstances(model); here != NULL ; - here=here->TXLnextInstance) { + here=TXLnextInstance(here)) { tx = here->txline; tx2 = here->txline2; @@ -132,7 +132,7 @@ TXLload(GENmodel *inModel, CKTcircuit *ckt) if (cond1) { if (here->TXLlengthgiven) g = model->R * here->TXLlength; - else g = model->R * here->TXLmodPtr->length; + else g = model->R * TXLmodPtr(here)->length; *(here->TXLposIbr1Ptr) += 1.0; *(here->TXLnegIbr2Ptr) += 1.0; *(here->TXLibr1Ibr1Ptr) += 1.0; diff --git a/src/spicelib/devices/txl/txlsetup.c b/src/spicelib/devices/txl/txlsetup.c index 807ddb8d0..98483440a 100644 --- a/src/spicelib/devices/txl/txlsetup.c +++ b/src/spicelib/devices/txl/txlsetup.c @@ -115,7 +115,7 @@ TXLsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit*ckt, int *state) /* loop through all the instances of the model */ for (here = TXLinstances(model); here != NULL ; - here=here->TXLnextInstance) { + here=TXLnextInstance(here)) { /* macro to make elements with built in test for out of memory */ #define TSTALLOC(ptr,first,second) \ @@ -168,7 +168,7 @@ TXLunsetup(GENmodel *inModel, CKTcircuit *ckt) for (model = (TXLmodel *) inModel; model != NULL; model = TXLnextModel(model)) { for (here = TXLinstances(model); here != NULL; - here = here->TXLnextInstance) { + here = TXLnextInstance(here)) { if (here->TXLibr2) { CKTdltNNum(ckt, here->TXLibr2); @@ -257,14 +257,14 @@ ReadTxL(TXLinstance *tx, CKTcircuit *ckt) t2->lsl = 0; l = 0.0; - R = tx->TXLmodPtr->R; - L = tx->TXLmodPtr->L; + R = TXLmodPtr(tx)->R; + L = TXLmodPtr(tx)->L; L = MAX(L, LL); - C = tx->TXLmodPtr->C; - G = tx->TXLmodPtr->G; + C = TXLmodPtr(tx)->C; + G = TXLmodPtr(tx)->G; if (tx->TXLlengthgiven == TRUE) l = tx->TXLlength; - else l = tx->TXLmodPtr->length; + else l = TXLmodPtr(tx)->length; if (l == 0.0) { diff --git a/src/spicelib/devices/urc/urcdefs.h b/src/spicelib/devices/urc/urcdefs.h index 106d4b07f..d311acd26 100644 --- a/src/spicelib/devices/urc/urcdefs.h +++ b/src/spicelib/devices/urc/urcdefs.h @@ -19,11 +19,13 @@ Author: 1985 Thomas L. Quarles /* information needed for each instance */ typedef struct sURCinstance { - struct sURCmodel *URCmodPtr; /* backpointer to model */ - struct sURCinstance *URCnextInstance; /* pointer to next instance of - * current model*/ - IFuid URCname; /* pointer to character string naming this instance */ - int URCstate; /* not used */ + struct GENinstance gen; + +#define URCmodPtr(inst) ((struct sURCmodel*)((inst)->gen.GENmodPtr)) +#define URCnextInstance(inst) ((struct sURCinstance*)((inst)->gen.GENnextInstance)) +#define URCname gen.GENname +#define URCstate gen.GENstate + const int URCposNode; /* number of positive node of URC */ const int URCnegNode; /* number of negative node of URC */ const int URCgndNode; /* number of the "ground" node of the URC */ diff --git a/src/spicelib/devices/urc/urcdest.c b/src/spicelib/devices/urc/urcdest.c index 7061473ec..91f3d3093 100644 --- a/src/spicelib/devices/urc/urcdest.c +++ b/src/spicelib/devices/urc/urcdest.c @@ -17,7 +17,7 @@ URCdestroy(GENmodel **inModel) URCmodel *next_mod = URCnextModel(mod); URCinstance *inst = URCinstances(mod); while (inst) { - URCinstance *next_inst = inst->URCnextInstance; + URCinstance *next_inst = URCnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/urc/urcsetup.c b/src/spicelib/devices/urc/urcsetup.c index c0e408455..719bca3f4 100644 --- a/src/spicelib/devices/urc/urcsetup.c +++ b/src/spicelib/devices/urc/urcsetup.c @@ -75,7 +75,7 @@ URCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) /* loop through all the instances of the model */ for (here = URCinstances(model); here != NULL ; - here=here->URCnextInstance) + here=URCnextInstance(here)) { p = model->URCk; r0 = here->URClength * model->URCrPerL; @@ -277,7 +277,7 @@ URCunsetup(GENmodel *inModel, CKTcircuit *ckt) for ( ; model; model = URCnextModel(model)) { for (here = URCinstances(model); here; - here = here->URCnextInstance) + here = URCnextInstance(here)) { if(model->URCisPerLGiven) { /* Diodes */ diff --git a/src/spicelib/devices/vbic/vbicacld.c b/src/spicelib/devices/vbic/vbicacld.c index 64ccef745..e896777e0 100644 --- a/src/spicelib/devices/vbic/vbicacld.c +++ b/src/spicelib/devices/vbic/vbicacld.c @@ -37,7 +37,7 @@ VBICacLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for( here = VBICinstances(model); here!= NULL; - here = here->VBICnextInstance) { + here = VBICnextInstance(here)) { Ibe_Vbei = *(ckt->CKTstate0 + here->VBICibe_Vbei); Ibex_Vbex = *(ckt->CKTstate0 + here->VBICibex_Vbex); diff --git a/src/spicelib/devices/vbic/vbicconv.c b/src/spicelib/devices/vbic/vbicconv.c index f686aaff8..f1def73fa 100644 --- a/src/spicelib/devices/vbic/vbicconv.c +++ b/src/spicelib/devices/vbic/vbicconv.c @@ -46,7 +46,7 @@ VBICconvTest(GENmodel *inModel, CKTcircuit *ckt) double Ibe, Ibex, Itzf, Itzr, Ibc, Ibep, Irci, Irbi, Irbp, Ibcp, Iccp; for( ; model != NULL; model = VBICnextModel(model)) { - for(here=VBICinstances(model);here!=NULL;here = here->VBICnextInstance) { + for(here=VBICinstances(model);here!=NULL;here = VBICnextInstance(here)) { Vbei=model->VBICtype*( *(ckt->CKTrhsOld+here->VBICbaseBINode)- diff --git a/src/spicelib/devices/vbic/vbicdefs.h b/src/spicelib/devices/vbic/vbicdefs.h index 247757d9b..418615f5c 100644 --- a/src/spicelib/devices/vbic/vbicdefs.h +++ b/src/spicelib/devices/vbic/vbicdefs.h @@ -19,11 +19,12 @@ Spice3 Implementation: 2003 Dietmar Warning DAnalyse GmbH /* data needed to describe a single instance */ typedef struct sVBICinstance { - struct sVBICmodel *VBICmodPtr; /* backpointer to model */ - struct sVBICinstance *VBICnextInstance; /* pointer to next instance of - current model*/ - IFuid VBICname; /* pointer to character string naming this instance */ - int VBICstate; /* pointer to start of state vector for vbic */ + struct GENinstance gen; + +#define VBICmodPtr(inst) ((struct sVBICmodel*)((inst)->gen.GENmodPtr)) +#define VBICnextInstance(inst) ((struct sVBICinstance*)((inst)->gen.GENnextInstance)) +#define VBICname gen.GENname +#define VBICstate gen.GENstate const int VBICcollNode; /* number of collector node of vbic */ const int VBICbaseNode; /* number of base node of vbic */ diff --git a/src/spicelib/devices/vbic/vbicdest.c b/src/spicelib/devices/vbic/vbicdest.c index 3731ff1e0..c90b433e1 100644 --- a/src/spicelib/devices/vbic/vbicdest.c +++ b/src/spicelib/devices/vbic/vbicdest.c @@ -24,7 +24,7 @@ VBICdestroy(GENmodel **inModel) VBICmodel *next_mod = VBICnextModel(mod); VBICinstance *inst = VBICinstances(mod); while (inst) { - VBICinstance *next_inst = inst->VBICnextInstance; + VBICinstance *next_inst = VBICnextInstance(inst); FREE(inst->VBICsens); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/vbic/vbicgetic.c b/src/spicelib/devices/vbic/vbicgetic.c index 5659d159f..54598720b 100644 --- a/src/spicelib/devices/vbic/vbicgetic.c +++ b/src/spicelib/devices/vbic/vbicgetic.c @@ -29,7 +29,7 @@ VBICgetic(GENmodel *inModel, CKTcircuit *ckt) */ for( ; model ; model = VBICnextModel(model)) { - for(here = VBICinstances(model); here ; here = here->VBICnextInstance) { + for(here = VBICinstances(model); here ; here = VBICnextInstance(here)) { if(!here->VBICicVBEGiven) { here->VBICicVBE = diff --git a/src/spicelib/devices/vbic/vbicload.c b/src/spicelib/devices/vbic/vbicload.c index d1208a46e..44d1d90c7 100644 --- a/src/spicelib/devices/vbic/vbicload.c +++ b/src/spicelib/devices/vbic/vbicload.c @@ -89,7 +89,7 @@ VBICload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VBICinstances(model); here != NULL ; - here=here->VBICnextInstance) { + here=VBICnextInstance(here)) { vt = here->VBICtemp * CONSTKoverQ; diff --git a/src/spicelib/devices/vbic/vbicnoise.c b/src/spicelib/devices/vbic/vbicnoise.c index 4b9eb4bce..42516da59 100644 --- a/src/spicelib/devices/vbic/vbicnoise.c +++ b/src/spicelib/devices/vbic/vbicnoise.c @@ -60,7 +60,7 @@ VBICnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata * for (model=firstModel; model != NULL; model=VBICnextModel(model)) { for (inst=VBICinstances(model); inst != NULL; - inst=inst->VBICnextInstance) { + inst=VBICnextInstance(inst)) { switch (operation) { diff --git a/src/spicelib/devices/vbic/vbicpzld.c b/src/spicelib/devices/vbic/vbicpzld.c index 20de08419..18c59410a 100644 --- a/src/spicelib/devices/vbic/vbicpzld.c +++ b/src/spicelib/devices/vbic/vbicpzld.c @@ -37,7 +37,7 @@ VBICpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for( here = VBICinstances(model); here!= NULL; - here = here->VBICnextInstance) { + here = VBICnextInstance(here)) { Ibe_Vbei = *(ckt->CKTstate0 + here->VBICibe_Vbei); Ibex_Vbex = *(ckt->CKTstate0 + here->VBICibex_Vbex); diff --git a/src/spicelib/devices/vbic/vbicsetup.c b/src/spicelib/devices/vbic/vbicsetup.c index 6322bfbcc..d756d1652 100644 --- a/src/spicelib/devices/vbic/vbicsetup.c +++ b/src/spicelib/devices/vbic/vbicsetup.c @@ -381,7 +381,7 @@ VBICsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = VBICinstances(model); here != NULL ; - here=here->VBICnextInstance) { + here=VBICnextInstance(here)) { CKTnode *tmpNode; IFuid tmpName; @@ -556,7 +556,7 @@ VBICunsetup( model = VBICnextModel(model)) { for (here = VBICinstances(model); here != NULL; - here=here->VBICnextInstance) + here=VBICnextInstance(here)) { if (here->VBICbaseBINode > 0) CKTdltNNum(ckt, here->VBICbaseBINode); diff --git a/src/spicelib/devices/vbic/vbicsoachk.c b/src/spicelib/devices/vbic/vbicsoachk.c index 5fce97e9a..34d6755ac 100644 --- a/src/spicelib/devices/vbic/vbicsoachk.c +++ b/src/spicelib/devices/vbic/vbicsoachk.c @@ -32,7 +32,7 @@ VBICsoaCheck(CKTcircuit *ckt, GENmodel *inModel) for (; model; model = VBICnextModel(model)) { - for (here = VBICinstances(model); here; here=here->VBICnextInstance) { + for (here = VBICinstances(model); here; here=VBICnextInstance(here)) { vbe = fabs(ckt->CKTrhsOld [here->VBICbaseNode] - ckt->CKTrhsOld [here->VBICemitNode]); diff --git a/src/spicelib/devices/vbic/vbictemp.c b/src/spicelib/devices/vbic/vbictemp.c index 6af5b19f4..6a6fd57e4 100644 --- a/src/spicelib/devices/vbic/vbictemp.c +++ b/src/spicelib/devices/vbic/vbictemp.c @@ -70,7 +70,7 @@ VBICtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VBICinstances(model); here != NULL ; - here=here->VBICnextInstance) { + here=VBICnextInstance(here)) { if(!here->VBICtempGiven) here->VBICtemp = ckt->CKTtemp; diff --git a/src/spicelib/devices/vbic/vbictrunc.c b/src/spicelib/devices/vbic/vbictrunc.c index be9d1b553..eb8603edf 100644 --- a/src/spicelib/devices/vbic/vbictrunc.c +++ b/src/spicelib/devices/vbic/vbictrunc.c @@ -25,7 +25,7 @@ VBICtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) for( ; model != NULL; model = VBICnextModel(model)) { for(here=VBICinstances(model);here!=NULL; - here = here->VBICnextInstance){ + here = VBICnextInstance(here)){ CKTterr(here->VBICqbe,ckt,timeStep); CKTterr(here->VBICqbex,ckt,timeStep); diff --git a/src/spicelib/devices/vccs/vccsdefs.h b/src/spicelib/devices/vccs/vccsdefs.h index f39daa54f..3d29e8f9e 100644 --- a/src/spicelib/devices/vccs/vccsdefs.h +++ b/src/spicelib/devices/vccs/vccsdefs.h @@ -18,11 +18,12 @@ Author: 1985 Thomas L. Quarles /* information to describe a single instance */ typedef struct sVCCSinstance { - struct sVCCSmodel *VCCSmodPtr; /* backpointer to model */ - struct sVCCSinstance *VCCSnextInstance; /* pointer to next instance of - *current model*/ - IFuid VCCSname; /* pointer to character string naming this instance */ - int VCCSstates; /* state info */ + struct GENinstance gen; + +#define VCCSmodPtr(inst) ((struct sVCCSmodel*)((inst)->gen.GENmodPtr)) +#define VCCSnextInstance(inst) ((struct sVCCSinstance*)((inst)->gen.GENnextInstance)) +#define VCCSname gen.GENname +#define VCCSstates gen.GENstate const int VCCSposNode; /* number of positive node of source */ const int VCCSnegNode; /* number of negative node of source */ diff --git a/src/spicelib/devices/vccs/vccsdest.c b/src/spicelib/devices/vccs/vccsdest.c index 0ea257ee8..f306a97df 100644 --- a/src/spicelib/devices/vccs/vccsdest.c +++ b/src/spicelib/devices/vccs/vccsdest.c @@ -17,7 +17,7 @@ VCCSdestroy(GENmodel **inModel) VCCSmodel *next_mod = VCCSnextModel(mod); VCCSinstance *inst = VCCSinstances(mod); while (inst) { - VCCSinstance *next_inst = inst->VCCSnextInstance; + VCCSinstance *next_inst = VCCSnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/vccs/vccsload.c b/src/spicelib/devices/vccs/vccsload.c index a75e561b2..1eb9b40be 100644 --- a/src/spicelib/devices/vccs/vccsload.c +++ b/src/spicelib/devices/vccs/vccsload.c @@ -29,7 +29,7 @@ VCCSload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VCCSinstances(model); here != NULL ; - here=here->VCCSnextInstance) { + here=VCCSnextInstance(here)) { *(here->VCCSposContPosPtr) += here->VCCScoeff ; *(here->VCCSposContNegPtr) -= here->VCCScoeff ; diff --git a/src/spicelib/devices/vccs/vccspzld.c b/src/spicelib/devices/vccs/vccspzld.c index 9d2cede77..802df4bf4 100644 --- a/src/spicelib/devices/vccs/vccspzld.c +++ b/src/spicelib/devices/vccs/vccspzld.c @@ -31,7 +31,7 @@ VCCSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for (here = VCCSinstances(model); here != NULL ; - here=here->VCCSnextInstance) { + here=VCCSnextInstance(here)) { *(here->VCCSposContPosPtr) += here->VCCScoeff ; *(here->VCCSposContNegPtr) -= here->VCCScoeff ; diff --git a/src/spicelib/devices/vccs/vccssacl.c b/src/spicelib/devices/vccs/vccssacl.c index d6f26f6d0..f72d37b41 100644 --- a/src/spicelib/devices/vccs/vccssacl.c +++ b/src/spicelib/devices/vccs/vccssacl.c @@ -31,7 +31,7 @@ VCCSsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VCCSinstances(model); here != NULL ; - here=here->VCCSnextInstance) { + here=VCCSnextInstance(here)) { if (here->VCCSsenParmNo){ vc = *(ckt->CKTrhsOld + here->VCCScontPosNode) diff --git a/src/spicelib/devices/vccs/vccsset.c b/src/spicelib/devices/vccs/vccsset.c index 63b9ec6af..26d50f1bf 100644 --- a/src/spicelib/devices/vccs/vccsset.c +++ b/src/spicelib/devices/vccs/vccsset.c @@ -32,7 +32,7 @@ VCCSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = VCCSinstances(model); here != NULL ; - here=here->VCCSnextInstance) { + here=VCCSnextInstance(here)) { /* macro to make elements with built in test for out of memory */ #define TSTALLOC(ptr,first,second) \ diff --git a/src/spicelib/devices/vccs/vccssld.c b/src/spicelib/devices/vccs/vccssld.c index 5331c9158..a1f4a4443 100644 --- a/src/spicelib/devices/vccs/vccssld.c +++ b/src/spicelib/devices/vccs/vccssld.c @@ -29,7 +29,7 @@ VCCSsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VCCSinstances(model); here != NULL ; - here=here->VCCSnextInstance) { + here=VCCSnextInstance(here)) { if(here->VCCSsenParmNo){ vc = *(ckt->CKTrhsOld + here->VCCScontPosNode) diff --git a/src/spicelib/devices/vccs/vccssprt.c b/src/spicelib/devices/vccs/vccssprt.c index 387517a1a..19156cc50 100644 --- a/src/spicelib/devices/vccs/vccssprt.c +++ b/src/spicelib/devices/vccs/vccssprt.c @@ -31,7 +31,7 @@ VCCSsPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VCCSinstances(model); here != NULL ; - here=here->VCCSnextInstance) { + here=VCCSnextInstance(here)) { printf(" Instance name:%s\n",here->VCCSname); printf(" Positive, negative nodes: %s, %s\n", diff --git a/src/spicelib/devices/vccs/vccssset.c b/src/spicelib/devices/vccs/vccssset.c index 93772cd28..2aaa0700f 100644 --- a/src/spicelib/devices/vccs/vccssset.c +++ b/src/spicelib/devices/vccs/vccssset.c @@ -28,7 +28,7 @@ VCCSsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = VCCSinstances(model); here != NULL ; - here=here->VCCSnextInstance) { + here=VCCSnextInstance(here)) { if(here->VCCSsenParmNo){ here->VCCSsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/vcvs/vcvsdefs.h b/src/spicelib/devices/vcvs/vcvsdefs.h index 8e1462afe..e64159446 100644 --- a/src/spicelib/devices/vcvs/vcvsdefs.h +++ b/src/spicelib/devices/vcvs/vcvsdefs.h @@ -19,11 +19,12 @@ Author: 1985 Thomas L. Quarles /* information to describe a single instance */ typedef struct sVCVSinstance { - struct sVCVSmodel *VCVSmodPtr; /* backpointer to model */ - struct sVCVSinstance *VCVSnextInstance; /* pointer to next instance of - *current model*/ - IFuid VCVSname; /* pointer to character string naming this instance */ - int VCVSstates; /* state info */ + struct GENinstance gen; + +#define VCVSmodPtr(inst) ((struct sVCVSmodel*)((inst)->gen.GENmodPtr)) +#define VCVSnextInstance(inst) ((struct sVCVSinstance*)((inst)->gen.GENnextInstance)) +#define VCVSname gen.GENname +#define VCVSstates gen.GENstate const int VCVSposNode; /* number of positive node of source */ const int VCVSnegNode; /* number of negative node of source */ diff --git a/src/spicelib/devices/vcvs/vcvsdest.c b/src/spicelib/devices/vcvs/vcvsdest.c index 4997ae09b..00eb900a3 100644 --- a/src/spicelib/devices/vcvs/vcvsdest.c +++ b/src/spicelib/devices/vcvs/vcvsdest.c @@ -17,7 +17,7 @@ VCVSdestroy(GENmodel **inModel) VCVSmodel *next_mod = VCVSnextModel(mod); VCVSinstance *inst = VCVSinstances(mod); while (inst) { - VCVSinstance *next_inst = inst->VCVSnextInstance; + VCVSinstance *next_inst = VCVSnextInstance(inst); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/vcvs/vcvsfbr.c b/src/spicelib/devices/vcvs/vcvsfbr.c index ad4bbe54d..e2ebd588a 100644 --- a/src/spicelib/devices/vcvs/vcvsfbr.c +++ b/src/spicelib/devices/vcvs/vcvsfbr.c @@ -23,7 +23,7 @@ VCVSfindBr(CKTcircuit *ckt, GENmodel *inModel, IFuid name) for( ; model != NULL; model = VCVSnextModel(model)) { for (here = VCVSinstances(model); here != NULL; - here = here->VCVSnextInstance) { + here = VCVSnextInstance(here)) { if(here->VCVSname == name) { if(here->VCVSbranch == 0) { error = CKTmkCur(ckt,&tmp,here->VCVSname,"branch"); diff --git a/src/spicelib/devices/vcvs/vcvsload.c b/src/spicelib/devices/vcvs/vcvsload.c index 0598a915a..a3b8248cc 100644 --- a/src/spicelib/devices/vcvs/vcvsload.c +++ b/src/spicelib/devices/vcvs/vcvsload.c @@ -29,7 +29,7 @@ VCVSload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VCVSinstances(model); here != NULL ; - here=here->VCVSnextInstance) { + here=VCVSnextInstance(here)) { *(here->VCVSposIbrPtr) += 1.0 ; *(here->VCVSnegIbrPtr) -= 1.0 ; diff --git a/src/spicelib/devices/vcvs/vcvspzld.c b/src/spicelib/devices/vcvs/vcvspzld.c index d581f8914..a875108b5 100644 --- a/src/spicelib/devices/vcvs/vcvspzld.c +++ b/src/spicelib/devices/vcvs/vcvspzld.c @@ -31,7 +31,7 @@ VCVSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for (here = VCVSinstances(model); here != NULL ; - here=here->VCVSnextInstance) { + here=VCVSnextInstance(here)) { *(here->VCVSposIbrPtr) += 1.0 ; *(here->VCVSnegIbrPtr) -= 1.0 ; diff --git a/src/spicelib/devices/vcvs/vcvssacl.c b/src/spicelib/devices/vcvs/vcvssacl.c index 73542790b..acb56b88c 100644 --- a/src/spicelib/devices/vcvs/vcvssacl.c +++ b/src/spicelib/devices/vcvs/vcvssacl.c @@ -29,7 +29,7 @@ VCVSsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VCVSinstances(model); here != NULL ; - here=here->VCVSnextInstance) { + here=VCVSnextInstance(here)) { if(here->VCVSsenParmNo){ diff --git a/src/spicelib/devices/vcvs/vcvsset.c b/src/spicelib/devices/vcvs/vcvsset.c index 3dcebc587..dcaa7a7af 100644 --- a/src/spicelib/devices/vcvs/vcvsset.c +++ b/src/spicelib/devices/vcvs/vcvsset.c @@ -30,7 +30,7 @@ VCVSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ for (here = VCVSinstances(model); here != NULL ; - here=here->VCVSnextInstance) { + here=VCVSnextInstance(here)) { if(here->VCVSposNode == here->VCVSnegNode) { SPfrontEnd->IFerrorf (ERR_FATAL, @@ -71,7 +71,7 @@ VCVSunsetup(GENmodel *inModel, CKTcircuit *ckt) model = VCVSnextModel(model)) { for (here = VCVSinstances(model); here != NULL; - here=here->VCVSnextInstance) + here=VCVSnextInstance(here)) { if (here->VCVSbranch > 0) CKTdltNNum(ckt, here->VCVSbranch); diff --git a/src/spicelib/devices/vcvs/vcvssld.c b/src/spicelib/devices/vcvs/vcvssld.c index 51dd81b31..0c792a614 100644 --- a/src/spicelib/devices/vcvs/vcvssld.c +++ b/src/spicelib/devices/vcvs/vcvssld.c @@ -28,7 +28,7 @@ VCVSsLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VCVSinstances(model); here != NULL ; - here=here->VCVSnextInstance) { + here=VCVSnextInstance(here)) { if(here->VCVSsenParmNo){ diff --git a/src/spicelib/devices/vcvs/vcvssprt.c b/src/spicelib/devices/vcvs/vcvssprt.c index 01f68ce7b..fca5ce694 100644 --- a/src/spicelib/devices/vcvs/vcvssprt.c +++ b/src/spicelib/devices/vcvs/vcvssprt.c @@ -30,7 +30,7 @@ VCVSsPrint(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VCVSinstances(model); here != NULL ; - here=here->VCVSnextInstance) { + here=VCVSnextInstance(here)) { printf(" Instance name:%s\n",here->VCVSname); printf(" Positive, negative nodes: %s, %s\n", diff --git a/src/spicelib/devices/vcvs/vcvssset.c b/src/spicelib/devices/vcvs/vcvssset.c index 37ef88196..1ed6e339f 100644 --- a/src/spicelib/devices/vcvs/vcvssset.c +++ b/src/spicelib/devices/vcvs/vcvssset.c @@ -28,7 +28,7 @@ VCVSsSetup(SENstruct *info, GENmodel *inModel) /* loop through all the instances of the model */ for (here = VCVSinstances(model); here != NULL ; - here=here->VCVSnextInstance) { + here=VCVSnextInstance(here)) { if(here->VCVSsenParmNo){ here->VCVSsenParmNo = ++(info->SENparms); diff --git a/src/spicelib/devices/vsrc/vsrcacct.c b/src/spicelib/devices/vsrc/vsrcacct.c index c1af69bec..da86c15cc 100644 --- a/src/spicelib/devices/vsrc/vsrcacct.c +++ b/src/spicelib/devices/vsrc/vsrcacct.c @@ -34,7 +34,7 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) /* loop through all the instances of the model */ for (here = VSRCinstances(model); here != NULL ; - here=here->VSRCnextInstance) { + here=VSRCnextInstance(here)) { if(!(ckt->CKTmode & (MODETRAN | MODETRANOP))) { /* not transient, so shouldn't be here */ diff --git a/src/spicelib/devices/vsrc/vsrcacld.c b/src/spicelib/devices/vsrc/vsrcacld.c index 839030728..568f0770e 100644 --- a/src/spicelib/devices/vsrc/vsrcacld.c +++ b/src/spicelib/devices/vsrc/vsrcacld.c @@ -20,7 +20,7 @@ VSRCacLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VSRCinstances(model); here != NULL ; - here=here->VSRCnextInstance) { + here=VSRCnextInstance(here)) { double acReal, acImag; diff --git a/src/spicelib/devices/vsrc/vsrcdefs.h b/src/spicelib/devices/vsrc/vsrcdefs.h index 2b29365b3..0722c0ece 100644 --- a/src/spicelib/devices/vsrc/vsrcdefs.h +++ b/src/spicelib/devices/vsrc/vsrcdefs.h @@ -21,11 +21,12 @@ struct trnoise_state; /* information needed for each instance */ typedef struct sVSRCinstance { - struct sVSRCmodel *VSRCmodPtr; /* backpointer to model */ - struct sVSRCinstance *VSRCnextInstance; /* pointer to next instance of - *current model */ - IFuid VSRCname; /* pointer to character string naming this instance */ - int VSRCstate; /* not used */ + struct GENinstance gen; + +#define VSRCmodPtr(inst) ((struct sVSRCmodel*)((inst)->gen.GENmodPtr)) +#define VSRCnextInstance(inst) ((struct sVSRCinstance*)((inst)->gen.GENnextInstance)) +#define VSRCname gen.GENname +#define VSRCstate gen.GENstate const int VSRCposNode; /* number of positive node of source */ const int VSRCnegNode; /* number of negative node of source */ diff --git a/src/spicelib/devices/vsrc/vsrcdest.c b/src/spicelib/devices/vsrc/vsrcdest.c index 853eec9a6..3a3f94fcd 100644 --- a/src/spicelib/devices/vsrc/vsrcdest.c +++ b/src/spicelib/devices/vsrc/vsrcdest.c @@ -17,7 +17,7 @@ VSRCdestroy(GENmodel **inModel) VSRCmodel *next_mod = VSRCnextModel(mod); VSRCinstance *inst = VSRCinstances(mod); while (inst) { - VSRCinstance *next_inst = inst->VSRCnextInstance; + VSRCinstance *next_inst = VSRCnextInstance(inst); FREE(inst->VSRCcoeffs); FREE(inst); inst = next_inst; diff --git a/src/spicelib/devices/vsrc/vsrcfbr.c b/src/spicelib/devices/vsrc/vsrcfbr.c index ff8773977..fed1075e6 100644 --- a/src/spicelib/devices/vsrc/vsrcfbr.c +++ b/src/spicelib/devices/vsrc/vsrcfbr.c @@ -22,7 +22,7 @@ VSRCfindBr(CKTcircuit *ckt, GENmodel *inModel, IFuid name) for( ; model != NULL; model = VSRCnextModel(model)) { for (here = VSRCinstances(model); here != NULL; - here = here->VSRCnextInstance) { + here = VSRCnextInstance(here)) { if(here->VSRCname == name) { if(here->VSRCbranch == 0) { error = CKTmkCur(ckt,&tmp,here->VSRCname,"branch"); diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index d0786ea7b..58f5144a3 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -38,7 +38,7 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VSRCinstances(model); here != NULL ; - here=here->VSRCnextInstance) { + here=VSRCnextInstance(here)) { *(here->VSRCposIbrPtr) += 1.0 ; *(here->VSRCnegIbrPtr) -= 1.0 ; diff --git a/src/spicelib/devices/vsrc/vsrcpzld.c b/src/spicelib/devices/vsrc/vsrcpzld.c index 2349d9794..403b6e3de 100644 --- a/src/spicelib/devices/vsrc/vsrcpzld.c +++ b/src/spicelib/devices/vsrc/vsrcpzld.c @@ -24,7 +24,7 @@ VSRCpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) /* loop through all the instances of the model */ for (here = VSRCinstances(model); here != NULL ; - here=here->VSRCnextInstance) { + here=VSRCnextInstance(here)) { if (!(here->VSRCacGiven)) { /*a dc source*/ diff --git a/src/spicelib/devices/vsrc/vsrcpzs.c b/src/spicelib/devices/vsrc/vsrcpzs.c index df4848b9d..fdbc2e544 100644 --- a/src/spicelib/devices/vsrc/vsrcpzs.c +++ b/src/spicelib/devices/vsrc/vsrcpzs.c @@ -28,7 +28,7 @@ VSRCpzSetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, /* loop through all the instances of the model */ for (here = VSRCinstances(model); here != NULL ; - here = here->VSRCnextInstance) { + here = VSRCnextInstance(here)) { if (here->VSRCbranch == 0) { error = CKTmkCur(ckt,&tmp,here->VSRCname,"branch"); diff --git a/src/spicelib/devices/vsrc/vsrcset.c b/src/spicelib/devices/vsrc/vsrcset.c index 8a901a33d..3ddc2eae0 100644 --- a/src/spicelib/devices/vsrc/vsrcset.c +++ b/src/spicelib/devices/vsrc/vsrcset.c @@ -29,7 +29,7 @@ VSRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) /* loop through all the instances of the model */ for (here = VSRCinstances(model); here != NULL ; - here=here->VSRCnextInstance) { + here=VSRCnextInstance(here)) { if(here->VSRCposNode == here->VSRCnegNode) { SPfrontEnd->IFerrorf (ERR_FATAL, @@ -68,7 +68,7 @@ VSRCunsetup(GENmodel *inModel, CKTcircuit *ckt) model = VSRCnextModel(model)) { for (here = VSRCinstances(model); here != NULL; - here=here->VSRCnextInstance) + here=VSRCnextInstance(here)) { if (here->VSRCbranch > 0) CKTdltNNum(ckt, here->VSRCbranch); diff --git a/src/spicelib/devices/vsrc/vsrctemp.c b/src/spicelib/devices/vsrc/vsrctemp.c index 7cfb1e24f..6ef2c2908 100644 --- a/src/spicelib/devices/vsrc/vsrctemp.c +++ b/src/spicelib/devices/vsrc/vsrctemp.c @@ -27,7 +27,7 @@ VSRCtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the instances of the model */ for (here = VSRCinstances(model); here != NULL ; - here=here->VSRCnextInstance) { + here=VSRCnextInstance(here)) { if(here->VSRCacGiven && !here->VSRCacMGiven) { here->VSRCacMag = 1; diff --git a/src/xspice/cm/cmmeters.c b/src/xspice/cm/cmmeters.c index 6f05ed144..37e2f1372 100644 --- a/src/xspice/cm/cmmeters.c +++ b/src/xspice/cm/cmmeters.c @@ -112,7 +112,7 @@ double cm_netlist_get_c(void) for(cap_model = cap_head; cap_model; cap_model = CAPnextModel(cap_model)) { for(cap_inst = CAPinstances(cap_model); cap_inst; - cap_inst = cap_inst->CAPnextInstance) { + cap_inst = CAPnextInstance(cap_inst)) { if((cmeter_node == cap_inst->CAPposNode) || (cmeter_node == cap_inst->CAPnegNode)) { c += cap_inst->CAPcapac; @@ -139,7 +139,7 @@ double cm_netlist_get_c(void) for(vsrc_model = vsrc_head; vsrc_model; vsrc_model = VSRCnextModel(vsrc_model)) { for(vsrc_inst = VSRCinstances(vsrc_model); vsrc_inst; - vsrc_inst = vsrc_inst->VSRCnextInstance) { + vsrc_inst = VSRCnextInstance(vsrc_inst)) { /* Skip to next if not DC source with value = 0.0 */ if((vsrc_inst->VSRCfunctionType != 0) || @@ -163,7 +163,7 @@ double cm_netlist_get_c(void) for(cap_model = cap_head; cap_model; cap_model = CAPnextModel(cap_model)) { for(cap_inst = CAPinstances(cap_model); cap_inst; - cap_inst = cap_inst->CAPnextInstance) { + cap_inst = CAPnextInstance(cap_inst)) { if((vsrc_node == cap_inst->CAPposNode) || (vsrc_node == cap_inst->CAPnegNode)) { c += cap_inst->CAPcapac; @@ -243,7 +243,7 @@ double cm_netlist_get_l(void) for(ind_model = ind_head; ind_model; ind_model = INDnextModel(ind_model)) { for(ind_inst = INDinstances(ind_model); ind_inst; - ind_inst = ind_inst->INDnextInstance) { + ind_inst = INDnextInstance(ind_inst)) { if((lmeter_node == ind_inst->INDposNode) || (lmeter_node == ind_inst->INDnegNode)) { l = 1.0 / ( (1.0 / l) + (1.0 / ind_inst->INDinduct) ); @@ -270,7 +270,7 @@ double cm_netlist_get_l(void) for(vsrc_model = vsrc_head; vsrc_model; vsrc_model = VSRCnextModel(vsrc_model)) { for(vsrc_inst = VSRCinstances(vsrc_model); vsrc_inst; - vsrc_inst = vsrc_inst->VSRCnextInstance) { + vsrc_inst = VSRCnextInstance(vsrc_inst)) { /* Skip to next if not DC source with value = 0.0 */ if((vsrc_inst->VSRCfunctionType != 0) || @@ -294,7 +294,7 @@ double cm_netlist_get_l(void) for(ind_model = ind_head; ind_model; ind_model = INDnextModel(ind_model)) { for(ind_inst = INDinstances(ind_model); ind_inst; - ind_inst = ind_inst->INDnextInstance) { + ind_inst = INDnextInstance(ind_inst)) { if((vsrc_node == ind_inst->INDposNode) || (vsrc_node == ind_inst->INDnegNode)) { l = 1.0 / ( (1.0 / l) + (1.0 / ind_inst->INDinduct) ); diff --git a/src/xspice/evt/evtload.c b/src/xspice/evt/evtload.c index b48b229a9..64b7d85e6 100644 --- a/src/xspice/evt/evtload.c +++ b/src/xspice/evt/evtload.c @@ -232,7 +232,7 @@ int EVTload( /* Call the code model */ /* ******************* */ - mod_type = inst->MIFmodPtr->MIFmodType; + mod_type = MIFmodPtr(inst)->MIFmodType; DEVices[mod_type]->DEVpublic.cm_func (&cm_data); diff --git a/src/xspice/mif/mifask.c b/src/xspice/mif/mifask.c index 21dfb400b..f91c63b7b 100644 --- a/src/xspice/mif/mifask.c +++ b/src/xspice/mif/mifask.c @@ -92,7 +92,7 @@ int MIFask( inst = (MIFinstance *) inInst; /* Arrange for access to MIF specific data in the model */ - model = inst->MIFmodPtr; + model = MIFmodPtr(inst); /* Get model type */ diff --git a/src/xspice/mif/mifconvt.c b/src/xspice/mif/mifconvt.c index c07fb6031..2f9e02083 100644 --- a/src/xspice/mif/mifconvt.c +++ b/src/xspice/mif/mifconvt.c @@ -107,7 +107,7 @@ int MIFconvTest( for( ; model != NULL; model = MIFnextModel(model)) { /* Loop through all instances of this model */ - for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = MIFnextInstance(here)) { /* Loop through all items registered for convergence */ for(i = 0; i < here->num_conv; i++) { diff --git a/src/xspice/mif/mifdelete.c b/src/xspice/mif/mifdelete.c index a110784e9..567d8e61c 100644 --- a/src/xspice/mif/mifdelete.c +++ b/src/xspice/mif/mifdelete.c @@ -189,7 +189,7 @@ MIFdelete( FIXME Finally one has to free the memory in the same module where allocated. */ #if defined(_MSC_VER) || defined(__MINGW32__) - if(!DEVices[here->MIFmodPtr->MIFmodType]->DEVpublic.inst_var[i].is_array) + if(!DEVices[MIFmodPtr(here)->MIFmodType]->DEVpublic.inst_var[i].is_array) #endif FREE(here->inst_var[i]->element); } diff --git a/src/xspice/mif/mifload.c b/src/xspice/mif/mifload.c index 9080262e2..febc67342 100644 --- a/src/xspice/mif/mifload.c +++ b/src/xspice/mif/mifload.c @@ -228,7 +228,7 @@ MIFload( /* ***************************************************************** */ /* loop through all instances of this model */ /* ***************************************************************** */ - for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = MIFnextInstance(here)) { /* If not an analog or hybrid instance, continue to next */ if(! here->analog) continue; diff --git a/src/xspice/mif/mifsetup.c b/src/xspice/mif/mifsetup.c index 863a97763..d1be070f5 100644 --- a/src/xspice/mif/mifsetup.c +++ b/src/xspice/mif/mifsetup.c @@ -157,7 +157,7 @@ MIFsetup( /* Since several instances may share this model, we have to create an array */ /* big enough for the instance with the biggest connection array */ max_size = 0; - for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = MIFnextInstance(here)) { size = here->conn[param_info->conn_ref]->size; if(size > max_size) max_size = size; @@ -204,7 +204,7 @@ MIFsetup( /* For each instance, initialize stuff used by cm_... functions */ - for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = MIFnextInstance(here)) { here->num_state = 0; here->state = NULL; @@ -220,7 +220,7 @@ MIFsetup( /* For each instance, allocate runtime structs for output connections/ports */ /* and grab a place in the state vector for all input connections/ports */ - for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = MIFnextInstance(here)) { /* Skip these expensive allocations if the instance is not analog */ if(! here->analog) continue; @@ -267,7 +267,7 @@ MIFsetup( /* Loop through all instances of this model and for each port of each connection */ /* create current equations, matrix entries, and matrix pointers as necessary. */ - for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = MIFnextInstance(here)) { /* Skip these expensive allocations if the instance is not analog */ if(! here->analog) continue; @@ -457,7 +457,7 @@ MIFunsetup(GENmodel *inModel,CKTcircuit *ckt) for (model = (MIFmodel *)inModel; model != NULL; model = MIFnextModel(model)) { - for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = MIFnextInstance(here)) { /* Skip these expensive allocations if the instance is not analog */ if(! here->analog) continue; diff --git a/src/xspice/mif/miftrunc.c b/src/xspice/mif/miftrunc.c index 57cd6ab44..c843a35d6 100644 --- a/src/xspice/mif/miftrunc.c +++ b/src/xspice/mif/miftrunc.c @@ -95,7 +95,7 @@ MIFtrunc( for( ; model != NULL; model = MIFnextModel(model)) { /* Loop through all instances of this model */ - for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = MIFnextInstance(here)) { /* Loop through all integration states on the instance */ for(i = 0; i < here->num_intgr; i++) {