Restored SPARSE behavior (no LnNL is possible) and fixed some things

This commit is contained in:
Francesco Lannutti 2020-06-28 22:14:01 +02:00
parent 2af49ca9f0
commit 81ae905ba9
13 changed files with 85 additions and 14 deletions

View File

@ -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"); */

View File

@ -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 */

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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
};

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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 ;