diff --git a/src/maths/ni/niiter.c b/src/maths/ni/niiter.c index 9520e0c34..a4938d3c8 100644 --- a/src/maths/ni/niiter.c +++ b/src/maths/ni/niiter.c @@ -66,7 +66,9 @@ NIiter(CKTcircuit *ckt, int maxIter) #ifdef KLU /* Francesco Lannutti */ /* Loading the Linear Dynamic Part */ - error = CKTloadLinearDynamic (ckt) ; + if (ckt->CKTkluMODE) { + error = CKTloadLinearDynamic (ckt) ; + } #endif for (;;) { @@ -94,7 +96,9 @@ NIiter(CKTcircuit *ckt, int maxIter) #ifdef KLU /* Francesco Lannutti */ /* Assembling the Linear and Non-Linear Part */ - error = CKTloadAssemble (ckt) ; + if (ckt->CKTkluMODE) { + error = CKTloadAssemble (ckt) ; + } #endif /* printf("after loading, before solving\n"); */ diff --git a/src/spicelib/analysis/cktop.c b/src/spicelib/analysis/cktop.c index 7f5ce0973..885c8ded9 100644 --- a/src/spicelib/analysis/cktop.c +++ b/src/spicelib/analysis/cktop.c @@ -43,8 +43,10 @@ CKTop (CKTcircuit *ckt, long int firstmode, long int continuemode, #ifdef KLU /* Francesco Lannutti */ /* Loading the Linear Static Part */ - int error ; - error = CKTloadLinearStatic (ckt) ; + if (ckt->CKTkluMODE) { + int error ; + error = CKTloadLinearStatic (ckt) ; + } #endif converged = NIiter (ckt, iterlim); @@ -55,8 +57,10 @@ CKTop (CKTcircuit *ckt, long int firstmode, long int continuemode, #ifdef KLU /* Francesco Lannutti */ /* Loading the Linear Static Part */ - int error ; - error = CKTloadLinearStatic (ckt) ; + if (ckt->CKTkluMODE) { + int error ; + error = CKTloadLinearStatic (ckt) ; + } #endif converged = 1; /* the 'go directly to gmin stepping' option */ diff --git a/src/spicelib/devices/bsim4/b4ld.c b/src/spicelib/devices/bsim4/b4ld.c index ea1321033..9037a029e 100644 --- a/src/spicelib/devices/bsim4/b4ld.c +++ b/src/spicelib/devices/bsim4/b4ld.c @@ -287,7 +287,13 @@ ChargeComputationNeeded = #ifndef USE_OMP for (; model != NULL; model = BSIM4nextModel(model)) -{ for (here = BSIM4instances(model); here != NULL; +{ + +#ifdef KLU + if (!ckt->CKTkluMODE || (ckt->CKTkluMODE && (model->BSIM4isLinear == ckt->CKTlinearModelsRequested) && (model->BSIM4isLinearStatic == ckt->CKTlinearStaticModelsRequested))) { +#endif + + for (here = BSIM4instances(model); here != NULL; here = BSIM4nextInstance(here)) { #endif @@ -5403,6 +5409,11 @@ line1000: ; #ifndef USE_OMP } /* End of MOSFET Instance */ + +#ifdef KLU + } +#endif + } /* End of Model Instance */ #endif diff --git a/src/spicelib/devices/bsim4/b4set.c b/src/spicelib/devices/bsim4/b4set.c index 01d16d8a4..632866c61 100644 --- a/src/spicelib/devices/bsim4/b4set.c +++ b/src/spicelib/devices/bsim4/b4set.c @@ -110,7 +110,14 @@ BSIM4instance **InstArray; /* loop through all the BSIM4 device models */ for( ; model != NULL; model = BSIM4nextModel(model)) - { /* process defaults of model parameters */ + { + +#ifdef KLU + model->BSIM4isLinear = 0 ; + model->BSIM4isLinearStatic = 0 ; +#endif + + /* process defaults of model parameters */ if (!model->BSIM4typeGiven) model->BSIM4type = NMOS; diff --git a/src/spicelib/devices/bsim4/bsim4def.h b/src/spicelib/devices/bsim4/bsim4def.h index 76e22ea5c..86495ecac 100644 --- a/src/spicelib/devices/bsim4/bsim4def.h +++ b/src/spicelib/devices/bsim4/bsim4def.h @@ -2835,6 +2835,10 @@ typedef struct sBSIM4model unsigned BSIM4pk2weGiven :1; unsigned BSIM4pku0weGiven :1; +#ifdef KLU + unsigned int BSIM4isLinear : 1 ; + unsigned int BSIM4isLinearStatic : 1 ; +#endif } BSIM4model; diff --git a/src/spicelib/devices/bsim4v7/b4v7ld.c b/src/spicelib/devices/bsim4v7/b4v7ld.c index 9c3efb14a..f95d517fa 100644 --- a/src/spicelib/devices/bsim4v7/b4v7ld.c +++ b/src/spicelib/devices/bsim4v7/b4v7ld.c @@ -252,7 +252,7 @@ for (; model != NULL; model = BSIM4v7nextModel(model)) { #ifdef KLU - if ((model->BSIM4v7isLinear == ckt->CKTlinearModelsRequested) && (model->BSIM4v7isLinearStatic == ckt->CKTlinearStaticModelsRequested)) { + if (!ckt->CKTkluMODE || (ckt->CKTkluMODE && (model->BSIM4v7isLinear == ckt->CKTlinearModelsRequested) && (model->BSIM4v7isLinearStatic == ckt->CKTlinearStaticModelsRequested))) { #endif for (here = BSIM4v7instances(model); here != NULL; diff --git a/src/spicelib/devices/cap/capload.c b/src/spicelib/devices/cap/capload.c index ed90adf98..4136b35be 100644 --- a/src/spicelib/devices/cap/capload.c +++ b/src/spicelib/devices/cap/capload.c @@ -38,7 +38,7 @@ CAPload(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = CAPnextModel(model)) { #ifdef KLU - if ((model->CAPisLinear == ckt->CKTlinearModelsRequested) && (model->CAPisLinearStatic == ckt->CKTlinearStaticModelsRequested)) { + if (!ckt->CKTkluMODE || (ckt->CKTkluMODE && (model->CAPisLinear == ckt->CKTlinearModelsRequested) && (model->CAPisLinearStatic == ckt->CKTlinearStaticModelsRequested))) { #endif /* loop through all the instances of the model */ diff --git a/src/spicelib/devices/ind/inddefs.h b/src/spicelib/devices/ind/inddefs.h index 2ae4c0b23..146025629 100644 --- a/src/spicelib/devices/ind/inddefs.h +++ b/src/spicelib/devices/ind/inddefs.h @@ -122,6 +122,12 @@ struct sINDmodel { /* model structure for an inductor */ unsigned INDmIndGiven : 1; /* flag to indicate model inductance given */ double INDspecInd; /* Specific (one turn) inductance */ + +#ifdef KLU + unsigned int INDisLinear : 1 ; + unsigned int INDisLinearStatic : 1 ; +#endif + }; @@ -174,6 +180,11 @@ struct sMUTmodel { /* model structure for a mutual inductor */ #define MUTinstances(inst) ((MUTinstance *)((inst)->gen.GENinstances)) #define MUTmodName gen.GENmodName +#ifdef KLU + unsigned int MUTisLinear : 1 ; + unsigned int MUTisLinearStatic : 1 ; +#endif + }; diff --git a/src/spicelib/devices/ind/indload.c b/src/spicelib/devices/ind/indload.c index ad3929492..08dd50590 100644 --- a/src/spicelib/devices/ind/indload.c +++ b/src/spicelib/devices/ind/indload.c @@ -34,6 +34,10 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the inductor models */ for( ; model != NULL; model = INDnextModel(model)) { +#ifdef KLU + if (!ckt->CKTkluMODE || (ckt->CKTkluMODE && (model->INDisLinear == ckt->CKTlinearModelsRequested) && (model->INDisLinearStatic == ckt->CKTlinearStaticModelsRequested))) { +#endif + /* loop through all the instances of the model */ for (here = INDinstances(model); here != NULL ; here=INDnextInstance(here)) { @@ -57,6 +61,10 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the mutual inductor models */ for( ; mutmodel != NULL; mutmodel = MUTnextModel(mutmodel)) { +#ifdef KLU + if (!ckt->CKTkluMODE || (ckt->CKTkluMODE && (mutmodel->MUTisLinear == ckt->CKTlinearModelsRequested) && (mutmodel->MUTisLinearStatic == ckt->CKTlinearStaticModelsRequested))) { +#endif + /* loop through all the instances of the model */ for (muthere = MUTinstances(mutmodel); muthere != NULL ; muthere=MUTnextInstance(muthere)) { @@ -74,6 +82,11 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) *(muthere->MUTbr1br2Ptr) -= muthere->MUTfactor*ckt->CKTag[0]; *(muthere->MUTbr2br1Ptr) -= muthere->MUTfactor*ckt->CKTag[0]; } + +#ifdef KLU + } +#endif + } itype = CKTtypelook("Inductor"); model = (INDmodel *)(ckt->CKThead[itype]); @@ -122,6 +135,11 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) *(here->INDibrNegPtr) -= 1; *(here->INDibrIbrPtr) -= req; } + +#ifdef KLU + } +#endif + } return(OK); } diff --git a/src/spicelib/devices/ind/indsetup.c b/src/spicelib/devices/ind/indsetup.c index 51bd0d924..43292d3c6 100644 --- a/src/spicelib/devices/ind/indsetup.c +++ b/src/spicelib/devices/ind/indsetup.c @@ -24,7 +24,12 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the inductor models */ for( ; model != NULL; model = INDnextModel(model)) { - /* Default Value Processing for Model Parameters */ +#ifdef KLU + model->INDisLinear = 1 ; + model->INDisLinearStatic = 0 ; +#endif + + /* Default Value Processing for Model Parameters */ if (!model->INDmIndGiven) { model->INDmInd = 0.0; } diff --git a/src/spicelib/devices/ind/mutsetup.c b/src/spicelib/devices/ind/mutsetup.c index 23ea9ebb7..43530feae 100644 --- a/src/spicelib/devices/ind/mutsetup.c +++ b/src/spicelib/devices/ind/mutsetup.c @@ -34,7 +34,13 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) NG_IGNORE(states); - for (; model; model = MUTnextModel(model)) + for (; model; model = MUTnextModel(model)) { + +#ifdef KLU + model->MUTisLinear = 1 ; + model->MUTisLinearStatic = 0 ; +#endif + for (here = MUTinstances(model); here; here = MUTnextInstance(here)) { int ktype = CKTtypelook("Inductor"); @@ -63,6 +69,7 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) TSTALLOC(MUTbr1br2Ptr, MUTind1->INDbrEq, MUTind2->INDbrEq); TSTALLOC(MUTbr2br1Ptr, MUTind2->INDbrEq, MUTind1->INDbrEq); } + } return(OK); } diff --git a/src/spicelib/devices/res/resload.c b/src/spicelib/devices/res/resload.c index 58f788a3e..6a07b415f 100644 --- a/src/spicelib/devices/res/resload.c +++ b/src/spicelib/devices/res/resload.c @@ -21,7 +21,7 @@ RESload(GENmodel *inModel, CKTcircuit *ckt) for( ; model != NULL; model = RESnextModel(model)) { #ifdef KLU - if ((model->RESisLinear == ckt->CKTlinearModelsRequested) && (model->RESisLinearStatic == ckt->CKTlinearStaticModelsRequested)) { + if (!ckt->CKTkluMODE || (ckt->CKTkluMODE && (model->RESisLinear == ckt->CKTlinearModelsRequested) && (model->RESisLinearStatic == ckt->CKTlinearStaticModelsRequested))) { #endif RESinstance *here; diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index f063a3633..12c4bdd07 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -41,7 +41,7 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) here=VSRCnextInstance(here)) { #ifdef KLU - if ((here->VSRCisLinear == ckt->CKTlinearModelsRequested) && (here->VSRCisLinearStatic == ckt->CKTlinearStaticModelsRequested)) { + if (!ckt->CKTkluMODE || (ckt->CKTkluMODE && (here->VSRCisLinear == ckt->CKTlinearModelsRequested) && (here->VSRCisLinearStatic == ckt->CKTlinearStaticModelsRequested))) { #endif *(here->VSRCposIbrPtr) += 1.0 ;