diff --git a/src/spicelib/devices/bsim4v4/b4v4bindCSC.c b/src/spicelib/devices/bsim4v4/b4v4bindCSC.c index 8d7fb036d..7240fca4f 100644 --- a/src/spicelib/devices/bsim4v4/b4v4bindCSC.c +++ b/src/spicelib/devices/bsim4v4/b4v4bindCSC.c @@ -1,5 +1,5 @@ /********** -Author: 2012 Francesco Lannutti +Author: 2013 Francesco Lannutti **********/ #include "ngspice/ngspice.h" @@ -7,898 +7,849 @@ Author: 2012 Francesco Lannutti #include "bsim4v4def.h" #include "ngspice/sperror.h" +#include + +static int -BSIM4v4bindCSC(GENmodel *inModel, CKTcircuit *ckt) +BindCompare (const void *a, const void *b) { - BSIM4v4model *model = (BSIM4v4model *)inModel; - int i ; + BindElement *A, *B ; + A = (BindElement *)a ; + B = (BindElement *)b ; - /* loop through all the b4v4 models */ - for( ; model != NULL; model = model->BSIM4v4nextModel ) { - BSIM4v4instance *here; - - /* loop through all the instances of the model */ - for (here = model->BSIM4v4instances; here != NULL ; - here = here->BSIM4v4nextInstance) { - - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4DPbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DPbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4GPbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GPbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4SPbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SPbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4BPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4BPgpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BPgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4BPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4BPbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BPbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNode != 0)) { - while (here->BSIM4v4DdPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4GPgpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GPgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNode != 0)) { - while (here->BSIM4v4SsPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4DPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4SPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4DdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4GPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4GPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4SspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4DPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNode != 0)) { - while (here->BSIM4v4DPdPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DPdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4DPgpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DPgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4SPgpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SPgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNode != 0)) { - while (here->BSIM4v4SPsPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SPsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4SPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4qNode != 0)) { - while (here->BSIM4v4QqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4QqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4QbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4QbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4QdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4QdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4QspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4QspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4QgpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4QgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4qNode != 0)) { - while (here->BSIM4v4DPqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4qNode != 0)) { - while (here->BSIM4v4SPqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4qNode != 0)) { - while (here->BSIM4v4GPqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - if (here->BSIM4v4rgateMod != 0) { - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeExt != 0)) { - while (here->BSIM4v4GEgePtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GEgePtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4GEgpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GEgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeExt != 0)) { - while (here->BSIM4v4GPgePtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GPgePtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4GEdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GEdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4GEspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GEspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4GEbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GEbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4GMdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GMdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4GMgpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GMgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4GMgmPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GMgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeExt != 0)) { - while (here->BSIM4v4GMgePtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GMgePtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4GMspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GMspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4GMbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GMbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4DPgmPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DPgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4GPgmPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GPgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4GEgmPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4GEgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4SPgmPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SPgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4BPgmPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BPgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - } /* IF */ - - if (here->BSIM4v4rbodyMod) { - - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) { - while (here->BSIM4v4DPdbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DPdbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) { - while (here->BSIM4v4SPsbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SPsbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4DBdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DBdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dbNode != 0)) { - while (here->BSIM4v4DBdbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DBdbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4DBbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DBbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNode != 0)) { - while (here->BSIM4v4DBbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DBbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) { - while (here->BSIM4v4BPdbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BPdbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNode != 0)) { - while (here->BSIM4v4BPbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) { - while (here->BSIM4v4BPsbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BPsbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4SBspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SBspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4SBbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SBbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNode != 0)) { - while (here->BSIM4v4SBbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SBbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sbNode != 0)) { - while (here->BSIM4v4SBsbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SBsbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4dbNode != 0)) { - while (here->BSIM4v4BdbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BdbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4BbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4sbNode != 0)) { - while (here->BSIM4v4BsbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BsbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNode != 0)) { - while (here->BSIM4v4BbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4BbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - } /* IF */ - - if (model->BSIM4v4rdsMod) { - - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4DgpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4DspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4DbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4DbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4SdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4SgpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4SbpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM4v4SbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - } /* IF */ - } - } - return(OK); + return ((int)(A->Sparse - B->Sparse)) ; } int -BSIM4v4bindCSCComplex(GENmodel *inModel, CKTcircuit *ckt) +BSIM4v4bindCSC (GENmodel *inModel, CKTcircuit *ckt) { - BSIM4v4model *model = (BSIM4v4model *)inModel; - int i ; + BSIM4v4model *model = (BSIM4v4model *)inModel ; + BSIM4v4instance *here ; + double *i ; + BindElement *matched, *BindStruct ; + size_t nz ; - /* loop through all the b4v4 models */ - for( ; model != NULL; model = model->BSIM4v4nextModel ) { - BSIM4v4instance *here; + BindStruct = ckt->CKTmatrix->CKTbindStruct ; + nz = (size_t)ckt->CKTmatrix->CKTklunz ; + /* loop through all the BSIM4v4 models */ + for ( ; model != NULL ; model = model->BSIM4v4nextModel) + { /* loop through all the instances of the model */ - for (here = model->BSIM4v4instances; here != NULL ; - here = here->BSIM4v4nextInstance) { + for (here = model->BSIM4v4instances ; here != NULL ; here = here->BSIM4v4nextInstance) + { + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4DPbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DPbpStructPtr = matched ; + here->BSIM4v4DPbpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4DPbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DPbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4GPbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GPbpStructPtr = matched ; + here->BSIM4v4GPbpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4GPbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GPbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4SPbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SPbpStructPtr = matched ; + here->BSIM4v4SPbpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4SPbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SPbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4BPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BPdpStructPtr = matched ; + here->BSIM4v4BPdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4BPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + { + i = here->BSIM4v4BPgpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BPgpStructPtr = matched ; + here->BSIM4v4BPgpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4BPgpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BPgpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4BPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BPspStructPtr = matched ; + here->BSIM4v4BPspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4BPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4BPbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BPbpStructPtr = matched ; + here->BSIM4v4BPbpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4BPbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BPbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNode != 0)) + { + i = here->BSIM4v4DdPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DdStructPtr = matched ; + here->BSIM4v4DdPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNode != 0)) { - while (here->BSIM4v4DdPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DdPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + { + i = here->BSIM4v4GPgpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GPgpStructPtr = matched ; + here->BSIM4v4GPgpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4GPgpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GPgpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNode != 0)) + { + i = here->BSIM4v4SsPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SsStructPtr = matched ; + here->BSIM4v4SsPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNode != 0)) { - while (here->BSIM4v4SsPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SsPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4DPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DPdpStructPtr = matched ; + here->BSIM4v4DPdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4DPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4SPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SPspStructPtr = matched ; + here->BSIM4v4SPspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4SPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4DdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DdpStructPtr = matched ; + here->BSIM4v4DdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4DdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4GPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GPdpStructPtr = matched ; + here->BSIM4v4GPdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4GPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4GPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GPspStructPtr = matched ; + here->BSIM4v4GPspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4GPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4SspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SspStructPtr = matched ; + here->BSIM4v4SspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4SspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4DPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DPspStructPtr = matched ; + here->BSIM4v4DPspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4DPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNode != 0)) + { + i = here->BSIM4v4DPdPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DPdStructPtr = matched ; + here->BSIM4v4DPdPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNode != 0)) { - while (here->BSIM4v4DPdPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DPdPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + { + i = here->BSIM4v4DPgpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DPgpStructPtr = matched ; + here->BSIM4v4DPgpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4DPgpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DPgpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + { + i = here->BSIM4v4SPgpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SPgpStructPtr = matched ; + here->BSIM4v4SPgpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4SPgpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SPgpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNode != 0)) + { + i = here->BSIM4v4SPsPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SPsStructPtr = matched ; + here->BSIM4v4SPsPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNode != 0)) { - while (here->BSIM4v4SPsPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SPsPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4SPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SPdpStructPtr = matched ; + here->BSIM4v4SPdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4SPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4qNode != 0)) + { + i = here->BSIM4v4QqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4QqStructPtr = matched ; + here->BSIM4v4QqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4qNode != 0)) { - while (here->BSIM4v4QqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4QqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4QbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4QbpStructPtr = matched ; + here->BSIM4v4QbpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4QbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4QbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4QdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4QdpStructPtr = matched ; + here->BSIM4v4QdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4QdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4QdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4QspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4QspStructPtr = matched ; + here->BSIM4v4QspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4QspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4QspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4gNodePrime != 0)) + { + i = here->BSIM4v4QgpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4QgpStructPtr = matched ; + here->BSIM4v4QgpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4QgpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4QgpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4qNode != 0)) + { + i = here->BSIM4v4DPqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DPqStructPtr = matched ; + here->BSIM4v4DPqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4qNode != 0)) { - while (here->BSIM4v4DPqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DPqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4qNode != 0)) + { + i = here->BSIM4v4SPqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SPqStructPtr = matched ; + here->BSIM4v4SPqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4qNode != 0)) { - while (here->BSIM4v4SPqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SPqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4qNode != 0)) + { + i = here->BSIM4v4GPqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GPqStructPtr = matched ; + here->BSIM4v4GPqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4qNode != 0)) { - while (here->BSIM4v4GPqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GPqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - if (here->BSIM4v4rgateMod != 0) { - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeExt != 0)) { - while (here->BSIM4v4GEgePtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GEgePtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4GEgpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GEgpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeExt != 0)) { - while (here->BSIM4v4GPgePtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GPgePtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4GEdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GEdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4GEspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GEspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4GEbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GEbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4GMdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GMdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4GMgpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GMgpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4GMgmPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GMgmPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeExt != 0)) { - while (here->BSIM4v4GMgePtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GMgePtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4GMspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GMspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4GMbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GMbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4DPgmPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DPgmPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4GPgmPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GPgmPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4GEgmPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4GEgmPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4SPgmPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SPgmPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) { - while (here->BSIM4v4BPgmPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BPgmPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if (here->BSIM4v4rgateMod != 0) + { + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeExt != 0)) + { + i = here->BSIM4v4GEgePtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GEgeStructPtr = matched ; + here->BSIM4v4GEgePtr = matched->CSC ; } - if (here->BSIM4v4rbodyMod) { + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodePrime != 0)) + { + i = here->BSIM4v4GEgpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GEgpStructPtr = matched ; + here->BSIM4v4GEgpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) { - while (here->BSIM4v4DPdbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DPdbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeExt != 0)) + { + i = here->BSIM4v4GPgePtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GPgeStructPtr = matched ; + here->BSIM4v4GPgePtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) { - while (here->BSIM4v4SPsbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SPsbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4GEdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GEdpStructPtr = matched ; + here->BSIM4v4GEdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4DBdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DBdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4GEspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GEspStructPtr = matched ; + here->BSIM4v4GEspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dbNode != 0)) { - while (here->BSIM4v4DBdbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DBdbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4GEbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GEbpStructPtr = matched ; + here->BSIM4v4GEbpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4DBbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DBbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4GMdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GMdpStructPtr = matched ; + here->BSIM4v4GMdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNode != 0)) { - while (here->BSIM4v4DBbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DBbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodePrime != 0)) + { + i = here->BSIM4v4GMgpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GMgpStructPtr = matched ; + here->BSIM4v4GMgpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) { - while (here->BSIM4v4BPdbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BPdbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeMid != 0)) + { + i = here->BSIM4v4GMgmPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GMgmStructPtr = matched ; + here->BSIM4v4GMgmPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNode != 0)) { - while (here->BSIM4v4BPbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BPbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeExt != 0)) + { + i = here->BSIM4v4GMgePtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GMgeStructPtr = matched ; + here->BSIM4v4GMgePtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) { - while (here->BSIM4v4BPsbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BPsbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4GMspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GMspStructPtr = matched ; + here->BSIM4v4GMspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4SBspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SBspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4GMbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GMbpStructPtr = matched ; + here->BSIM4v4GMbpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4SBbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SBbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + { + i = here->BSIM4v4DPgmPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DPgmStructPtr = matched ; + here->BSIM4v4DPgmPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNode != 0)) { - while (here->BSIM4v4SBbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SBbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + { + i = here->BSIM4v4GPgmPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GPgmStructPtr = matched ; + here->BSIM4v4GPgmPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sbNode != 0)) { - while (here->BSIM4v4SBsbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SBsbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeMid != 0)) + { + i = here->BSIM4v4GEgmPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4GEgmStructPtr = matched ; + here->BSIM4v4GEgmPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4dbNode != 0)) { - while (here->BSIM4v4BdbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BdbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + { + i = here->BSIM4v4SPgmPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SPgmStructPtr = matched ; + here->BSIM4v4SPgmPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4BbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + { + i = here->BSIM4v4BPgmPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BPgmStructPtr = matched ; + here->BSIM4v4BPgmPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4sbNode != 0)) { - while (here->BSIM4v4BsbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BsbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + } + if (here->BSIM4v4rbodyMod) + { + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) + { + i = here->BSIM4v4DPdbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DPdbStructPtr = matched ; + here->BSIM4v4DPdbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNode != 0)) { - while (here->BSIM4v4BbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4BbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - } /* IF */ + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) + { + i = here->BSIM4v4SPsbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SPsbStructPtr = matched ; + here->BSIM4v4SPsbPtr = matched->CSC ; + } - if (model->BSIM4v4rdsMod) { + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4DBdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DBdpStructPtr = matched ; + here->BSIM4v4DBdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4DgpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DgpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dbNode != 0)) + { + i = here->BSIM4v4DBdbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DBdbStructPtr = matched ; + here->BSIM4v4DBdbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4sNodePrime != 0)) { - while (here->BSIM4v4DspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4DBbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DBbpStructPtr = matched ; + here->BSIM4v4DBbpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4DbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4DbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNode != 0)) + { + i = here->BSIM4v4DBbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DBbStructPtr = matched ; + here->BSIM4v4DBbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4dNodePrime != 0)) { - while (here->BSIM4v4SdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) + { + i = here->BSIM4v4BPdbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BPdbStructPtr = matched ; + here->BSIM4v4BPdbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4gNodePrime != 0)) { - while (here->BSIM4v4SgpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SgpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNode != 0)) + { + i = here->BSIM4v4BPbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BPbStructPtr = matched ; + here->BSIM4v4BPbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4bNodePrime != 0)) { - while (here->BSIM4v4SbpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM4v4SbpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - } /* IF */ - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) + { + i = here->BSIM4v4BPsbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BPsbStructPtr = matched ; + here->BSIM4v4BPsbPtr = matched->CSC ; + } + + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4SBspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SBspStructPtr = matched ; + here->BSIM4v4SBspPtr = matched->CSC ; + } + + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4SBbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SBbpStructPtr = matched ; + here->BSIM4v4SBbpPtr = matched->CSC ; + } + + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNode != 0)) + { + i = here->BSIM4v4SBbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SBbStructPtr = matched ; + here->BSIM4v4SBbPtr = matched->CSC ; + } + + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sbNode != 0)) + { + i = here->BSIM4v4SBsbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SBsbStructPtr = matched ; + here->BSIM4v4SBsbPtr = matched->CSC ; + } + + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4dbNode != 0)) + { + i = here->BSIM4v4BdbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BdbStructPtr = matched ; + here->BSIM4v4BdbPtr = matched->CSC ; + } + + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4BbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BbpStructPtr = matched ; + here->BSIM4v4BbpPtr = matched->CSC ; + } + + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4sbNode != 0)) + { + i = here->BSIM4v4BsbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BsbStructPtr = matched ; + here->BSIM4v4BsbPtr = matched->CSC ; + } + + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNode != 0)) + { + i = here->BSIM4v4BbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4BbStructPtr = matched ; + here->BSIM4v4BbPtr = matched->CSC ; + } + + } + if (model->BSIM4v4rdsMod) + { + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4gNodePrime != 0)) + { + i = here->BSIM4v4DgpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DgpStructPtr = matched ; + here->BSIM4v4DgpPtr = matched->CSC ; + } + + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + { + i = here->BSIM4v4DspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DspStructPtr = matched ; + here->BSIM4v4DspPtr = matched->CSC ; + } + + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4DbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4DbpStructPtr = matched ; + here->BSIM4v4DbpPtr = matched->CSC ; + } + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + { + i = here->BSIM4v4SdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SdpStructPtr = matched ; + here->BSIM4v4SdpPtr = matched->CSC ; + } + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4gNodePrime != 0)) + { + i = here->BSIM4v4SgpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SgpStructPtr = matched ; + here->BSIM4v4SgpPtr = matched->CSC ; + } + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + { + i = here->BSIM4v4SbpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM4v4SbpStructPtr = matched ; + here->BSIM4v4SbpPtr = matched->CSC ; + } + + } + } } - return(OK); + + return (OK) ; +} + +int +BSIM4v4bindCSCComplex (GENmodel *inModel, CKTcircuit *ckt) +{ + BSIM4v4model *model = (BSIM4v4model *)inModel ; + BSIM4v4instance *here ; + + NG_IGNORE (ckt) ; + + /* loop through all the BSIM4v4 models */ + for ( ; model != NULL ; model = model->BSIM4v4nextModel) + { + /* loop through all the instances of the model */ + for (here = model->BSIM4v4instances ; here != NULL ; here = here->BSIM4v4nextInstance) + { + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4DPbpPtr = here->BSIM4v4DPbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4GPbpPtr = here->BSIM4v4GPbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4SPbpPtr = here->BSIM4v4SPbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4BPdpPtr = here->BSIM4v4BPdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4BPgpPtr = here->BSIM4v4BPgpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4BPspPtr = here->BSIM4v4BPspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4BPbpPtr = here->BSIM4v4BPbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNode != 0)) + here->BSIM4v4DdPtr = here->BSIM4v4DdStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4GPgpPtr = here->BSIM4v4GPgpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNode != 0)) + here->BSIM4v4SsPtr = here->BSIM4v4SsStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4DPdpPtr = here->BSIM4v4DPdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4SPspPtr = here->BSIM4v4SPspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4DdpPtr = here->BSIM4v4DdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4GPdpPtr = here->BSIM4v4GPdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4GPspPtr = here->BSIM4v4GPspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4SspPtr = here->BSIM4v4SspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4DPspPtr = here->BSIM4v4DPspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNode != 0)) + here->BSIM4v4DPdPtr = here->BSIM4v4DPdStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4DPgpPtr = here->BSIM4v4DPgpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4SPgpPtr = here->BSIM4v4SPgpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNode != 0)) + here->BSIM4v4SPsPtr = here->BSIM4v4SPsStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4SPdpPtr = here->BSIM4v4SPdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4qNode != 0)) + here->BSIM4v4QqPtr = here->BSIM4v4QqStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4QbpPtr = here->BSIM4v4QbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4QdpPtr = here->BSIM4v4QdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4QspPtr = here->BSIM4v4QspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4QgpPtr = here->BSIM4v4QgpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4qNode != 0)) + here->BSIM4v4DPqPtr = here->BSIM4v4DPqStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4qNode != 0)) + here->BSIM4v4SPqPtr = here->BSIM4v4SPqStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4qNode != 0)) + here->BSIM4v4GPqPtr = here->BSIM4v4GPqStructPtr->CSC_Complex ; + + if (here->BSIM4v4rgateMod != 0) + { + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeExt != 0)) + here->BSIM4v4GEgePtr = here->BSIM4v4GEgeStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4GEgpPtr = here->BSIM4v4GEgpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeExt != 0)) + here->BSIM4v4GPgePtr = here->BSIM4v4GPgeStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4GEdpPtr = here->BSIM4v4GEdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4GEspPtr = here->BSIM4v4GEspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4GEbpPtr = here->BSIM4v4GEbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4GMdpPtr = here->BSIM4v4GMdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4GMgpPtr = here->BSIM4v4GMgpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4GMgmPtr = here->BSIM4v4GMgmStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeExt != 0)) + here->BSIM4v4GMgePtr = here->BSIM4v4GMgeStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4GMspPtr = here->BSIM4v4GMspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4GMbpPtr = here->BSIM4v4GMbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4DPgmPtr = here->BSIM4v4DPgmStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4GPgmPtr = here->BSIM4v4GPgmStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4GEgmPtr = here->BSIM4v4GEgmStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4SPgmPtr = here->BSIM4v4SPgmStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4BPgmPtr = here->BSIM4v4BPgmStructPtr->CSC_Complex ; + + } + if (here->BSIM4v4rbodyMod) + { + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) + here->BSIM4v4DPdbPtr = here->BSIM4v4DPdbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) + here->BSIM4v4SPsbPtr = here->BSIM4v4SPsbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4DBdpPtr = here->BSIM4v4DBdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dbNode != 0)) + here->BSIM4v4DBdbPtr = here->BSIM4v4DBdbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4DBbpPtr = here->BSIM4v4DBbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNode != 0)) + here->BSIM4v4DBbPtr = here->BSIM4v4DBbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) + here->BSIM4v4BPdbPtr = here->BSIM4v4BPdbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNode != 0)) + here->BSIM4v4BPbPtr = here->BSIM4v4BPbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) + here->BSIM4v4BPsbPtr = here->BSIM4v4BPsbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4SBspPtr = here->BSIM4v4SBspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4SBbpPtr = here->BSIM4v4SBbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNode != 0)) + here->BSIM4v4SBbPtr = here->BSIM4v4SBbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sbNode != 0)) + here->BSIM4v4SBsbPtr = here->BSIM4v4SBsbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4dbNode != 0)) + here->BSIM4v4BdbPtr = here->BSIM4v4BdbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4BbpPtr = here->BSIM4v4BbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4sbNode != 0)) + here->BSIM4v4BsbPtr = here->BSIM4v4BsbStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNode != 0)) + here->BSIM4v4BbPtr = here->BSIM4v4BbStructPtr->CSC_Complex ; + + } + if (model->BSIM4v4rdsMod) + { + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4DgpPtr = here->BSIM4v4DgpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4DspPtr = here->BSIM4v4DspStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4DbpPtr = here->BSIM4v4DbpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4SdpPtr = here->BSIM4v4SdpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4SgpPtr = here->BSIM4v4SgpStructPtr->CSC_Complex ; + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4SbpPtr = here->BSIM4v4SbpStructPtr->CSC_Complex ; + + } + } + } + + return (OK) ; } int @@ -906,505 +857,236 @@ BSIM4v4bindCSCComplexToReal (GENmodel *inModel, CKTcircuit *ckt) { BSIM4v4model *model = (BSIM4v4model *)inModel ; BSIM4v4instance *here ; - int i ; - /* loop through all the bsim4v4 models */ + NG_IGNORE (ckt) ; + + /* loop through all the BSIM4v4 models */ for ( ; model != NULL ; model = model->BSIM4v4nextModel) { /* loop through all the instances of the model */ for (here = model->BSIM4v4instances ; here != NULL ; here = here->BSIM4v4nextInstance) { - i = 0 ; - if ((here->BSIM4v4dNodePrime != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4DPbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DPbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4DPbpPtr = here->BSIM4v4DPbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodePrime != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4GPbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GPbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4GPbpPtr = here->BSIM4v4GPbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNodePrime != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4SPbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SPbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4SPbpPtr = here->BSIM4v4SPbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNodePrime != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4BPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4BPdpPtr = here->BSIM4v4BPdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNodePrime != 0) && (here->BSIM4v4gNodePrime != 0)) - { - while (here->BSIM4v4BPgpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BPgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4BPgpPtr = here->BSIM4v4BPgpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNodePrime != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4BPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4BPspPtr = here->BSIM4v4BPspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNodePrime != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4BPbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BPbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4BPbpPtr = here->BSIM4v4BPbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNode != 0) && (here->BSIM4v4dNode != 0)) - { - while (here->BSIM4v4DdPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNode != 0)) + here->BSIM4v4DdPtr = here->BSIM4v4DdStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodePrime != 0) && (here->BSIM4v4gNodePrime != 0)) - { - while (here->BSIM4v4GPgpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GPgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4GPgpPtr = here->BSIM4v4GPgpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNode != 0) && (here->BSIM4v4sNode != 0)) - { - while (here->BSIM4v4SsPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNode != 0)) + here->BSIM4v4SsPtr = here->BSIM4v4SsStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNodePrime != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4DPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4DPdpPtr = here->BSIM4v4DPdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNodePrime != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4SPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4SPspPtr = here->BSIM4v4SPspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNode != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4DdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4DdpPtr = here->BSIM4v4DdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodePrime != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4GPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4GPdpPtr = here->BSIM4v4GPdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodePrime != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4GPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4GPspPtr = here->BSIM4v4GPspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNode != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4SspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4SspPtr = here->BSIM4v4SspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNodePrime != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4DPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4DPspPtr = here->BSIM4v4DPspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNodePrime != 0) && (here->BSIM4v4dNode != 0)) - { - while (here->BSIM4v4DPdPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DPdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dNode != 0)) + here->BSIM4v4DPdPtr = here->BSIM4v4DPdStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNodePrime != 0) && (here->BSIM4v4gNodePrime != 0)) - { - while (here->BSIM4v4DPgpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DPgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4DPgpPtr = here->BSIM4v4DPgpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNodePrime != 0) && (here->BSIM4v4gNodePrime != 0)) - { - while (here->BSIM4v4SPgpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SPgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4SPgpPtr = here->BSIM4v4SPgpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNodePrime != 0) && (here->BSIM4v4sNode != 0)) - { - while (here->BSIM4v4SPsPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SPsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sNode != 0)) + here->BSIM4v4SPsPtr = here->BSIM4v4SPsStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNodePrime != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4SPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4SPdpPtr = here->BSIM4v4SPdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4qNode != 0) && (here->BSIM4v4qNode != 0)) - { - while (here->BSIM4v4QqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4QqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4qNode != 0)) + here->BSIM4v4QqPtr = here->BSIM4v4QqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4qNode != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4QbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4QbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4QbpPtr = here->BSIM4v4QbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4qNode != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4QdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4QdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4QdpPtr = here->BSIM4v4QdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4qNode != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4QspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4QspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4QspPtr = here->BSIM4v4QspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4qNode != 0) && (here->BSIM4v4gNodePrime != 0)) - { - while (here->BSIM4v4QgpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4QgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4qNode != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4QgpPtr = here->BSIM4v4QgpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNodePrime != 0) && (here->BSIM4v4qNode != 0)) - { - while (here->BSIM4v4DPqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4qNode != 0)) + here->BSIM4v4DPqPtr = here->BSIM4v4DPqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNodePrime != 0) && (here->BSIM4v4qNode != 0)) - { - while (here->BSIM4v4SPqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4qNode != 0)) + here->BSIM4v4SPqPtr = here->BSIM4v4SPqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodePrime != 0) && (here->BSIM4v4qNode != 0)) - { - while (here->BSIM4v4GPqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4qNode != 0)) + here->BSIM4v4GPqPtr = here->BSIM4v4GPqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeExt != 0) && (here->BSIM4v4gNodeExt != 0)) + if (here->BSIM4v4rgateMod != 0) { - while (here->BSIM4v4GEgePtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GEgePtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeExt != 0)) + here->BSIM4v4GEgePtr = here->BSIM4v4GEgeStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeExt != 0) && (here->BSIM4v4gNodePrime != 0)) - { - while (here->BSIM4v4GEgpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GEgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4GEgpPtr = here->BSIM4v4GEgpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodePrime != 0) && (here->BSIM4v4gNodeExt != 0)) - { - while (here->BSIM4v4GPgePtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GPgePtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeExt != 0)) + here->BSIM4v4GPgePtr = here->BSIM4v4GPgeStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeExt != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4GEdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GEdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4GEdpPtr = here->BSIM4v4GEdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeExt != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4GEspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GEspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4GEspPtr = here->BSIM4v4GEspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeExt != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4GEbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GEbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4GEbpPtr = here->BSIM4v4GEbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeMid != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4GMdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GMdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4GMdpPtr = here->BSIM4v4GMdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeMid != 0) && (here->BSIM4v4gNodePrime != 0)) - { - while (here->BSIM4v4GMgpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GMgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4GMgpPtr = here->BSIM4v4GMgpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeMid != 0) && (here->BSIM4v4gNodeMid != 0)) - { - while (here->BSIM4v4GMgmPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GMgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4GMgmPtr = here->BSIM4v4GMgmStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeMid != 0) && (here->BSIM4v4gNodeExt != 0)) - { - while (here->BSIM4v4GMgePtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GMgePtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4gNodeExt != 0)) + here->BSIM4v4GMgePtr = here->BSIM4v4GMgeStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeMid != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4GMspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GMspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4GMspPtr = here->BSIM4v4GMspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeMid != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4GMbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GMbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeMid != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4GMbpPtr = here->BSIM4v4GMbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNodePrime != 0) && (here->BSIM4v4gNodeMid != 0)) - { - while (here->BSIM4v4DPgmPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DPgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4DPgmPtr = here->BSIM4v4DPgmStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodePrime != 0) && (here->BSIM4v4gNodeMid != 0)) - { - while (here->BSIM4v4GPgmPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GPgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4GPgmPtr = here->BSIM4v4GPgmStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4gNodeExt != 0) && (here->BSIM4v4gNodeMid != 0)) - { - while (here->BSIM4v4GEgmPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4GEgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4gNodeExt != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4GEgmPtr = here->BSIM4v4GEgmStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNodePrime != 0) && (here->BSIM4v4gNodeMid != 0)) - { - while (here->BSIM4v4SPgmPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SPgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4SPgmPtr = here->BSIM4v4SPgmStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNodePrime != 0) && (here->BSIM4v4gNodeMid != 0)) - { - while (here->BSIM4v4BPgmPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BPgmPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4gNodeMid != 0)) + here->BSIM4v4BPgmPtr = here->BSIM4v4BPgmStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNodePrime != 0) && (here->BSIM4v4dbNode != 0)) - { - while (here->BSIM4v4DPdbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DPdbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; } - - i = 0 ; - if ((here->BSIM4v4sNodePrime != 0) && (here->BSIM4v4sbNode != 0)) + if (here->BSIM4v4rbodyMod) { - while (here->BSIM4v4SPsbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SPsbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) + here->BSIM4v4DPdbPtr = here->BSIM4v4DPdbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dbNode != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4DBdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DBdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) + here->BSIM4v4SPsbPtr = here->BSIM4v4SPsbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dbNode != 0) && (here->BSIM4v4dbNode != 0)) - { - while (here->BSIM4v4DBdbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DBdbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4DBdpPtr = here->BSIM4v4DBdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dbNode != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4DBbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DBbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4dbNode != 0)) + here->BSIM4v4DBdbPtr = here->BSIM4v4DBdbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dbNode != 0) && (here->BSIM4v4bNode != 0)) - { - while (here->BSIM4v4DBbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DBbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4DBbpPtr = here->BSIM4v4DBbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNodePrime != 0) && (here->BSIM4v4dbNode != 0)) - { - while (here->BSIM4v4BPdbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BPdbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dbNode != 0) && (here-> BSIM4v4bNode != 0)) + here->BSIM4v4DBbPtr = here->BSIM4v4DBbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNodePrime != 0) && (here->BSIM4v4bNode != 0)) - { - while (here->BSIM4v4BPbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4dbNode != 0)) + here->BSIM4v4BPdbPtr = here->BSIM4v4BPdbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNodePrime != 0) && (here->BSIM4v4sbNode != 0)) - { - while (here->BSIM4v4BPsbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BPsbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4bNode != 0)) + here->BSIM4v4BPbPtr = here->BSIM4v4BPbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sbNode != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4SBspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SBspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNodePrime != 0) && (here-> BSIM4v4sbNode != 0)) + here->BSIM4v4BPsbPtr = here->BSIM4v4BPsbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sbNode != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4SBbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SBbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4SBspPtr = here->BSIM4v4SBspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sbNode != 0) && (here->BSIM4v4bNode != 0)) - { - while (here->BSIM4v4SBbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SBbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4SBbpPtr = here->BSIM4v4SBbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sbNode != 0) && (here->BSIM4v4sbNode != 0)) - { - while (here->BSIM4v4SBsbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SBsbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4bNode != 0)) + here->BSIM4v4SBbPtr = here->BSIM4v4SBbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNode != 0) && (here->BSIM4v4dbNode != 0)) - { - while (here->BSIM4v4BdbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BdbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4sbNode != 0) && (here-> BSIM4v4sbNode != 0)) + here->BSIM4v4SBsbPtr = here->BSIM4v4SBsbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNode != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4BbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4dbNode != 0)) + here->BSIM4v4BdbPtr = here->BSIM4v4BdbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNode != 0) && (here->BSIM4v4sbNode != 0)) - { - while (here->BSIM4v4BsbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BsbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4BbpPtr = here->BSIM4v4BbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4bNode != 0) && (here->BSIM4v4bNode != 0)) - { - while (here->BSIM4v4BbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4BbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4sbNode != 0)) + here->BSIM4v4BsbPtr = here->BSIM4v4BsbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNode != 0) && (here->BSIM4v4gNodePrime != 0)) - { - while (here->BSIM4v4DgpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4bNode != 0) && (here-> BSIM4v4bNode != 0)) + here->BSIM4v4BbPtr = here->BSIM4v4BbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4dNode != 0) && (here->BSIM4v4sNodePrime != 0)) - { - while (here->BSIM4v4DspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; } - - i = 0 ; - if ((here->BSIM4v4dNode != 0) && (here->BSIM4v4bNodePrime != 0)) + if (model->BSIM4v4rdsMod) { - while (here->BSIM4v4DbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4DbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4DgpPtr = here->BSIM4v4DgpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNode != 0) && (here->BSIM4v4dNodePrime != 0)) - { - while (here->BSIM4v4SdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4sNodePrime != 0)) + here->BSIM4v4DspPtr = here->BSIM4v4DspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNode != 0) && (here->BSIM4v4gNodePrime != 0)) - { - while (here->BSIM4v4SgpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SgpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM4v4dNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4DbpPtr = here->BSIM4v4DbpStructPtr->CSC ; + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4dNodePrime != 0)) + here->BSIM4v4SdpPtr = here->BSIM4v4SdpStructPtr->CSC ; + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4gNodePrime != 0)) + here->BSIM4v4SgpPtr = here->BSIM4v4SgpStructPtr->CSC ; + + if ((here-> BSIM4v4sNode != 0) && (here-> BSIM4v4bNodePrime != 0)) + here->BSIM4v4SbpPtr = here->BSIM4v4SbpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM4v4sNode != 0) && (here->BSIM4v4bNodePrime != 0)) - { - while (here->BSIM4v4SbpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM4v4SbpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; } } } return (OK) ; -} \ No newline at end of file +} diff --git a/src/spicelib/devices/bsim4v4/bsim4v4def.h b/src/spicelib/devices/bsim4v4/bsim4v4def.h index 8e37d2d6e..f08bcff89 100644 --- a/src/spicelib/devices/bsim4v4/bsim4v4def.h +++ b/src/spicelib/devices/bsim4v4/bsim4v4def.h @@ -421,6 +421,79 @@ typedef struct sBSIM4v4instance double **BSIM4v4nVar; #endif /* NONOISE */ +#ifdef KLU + BindElement *BSIM4v4DPbpStructPtr ; + BindElement *BSIM4v4GPbpStructPtr ; + BindElement *BSIM4v4SPbpStructPtr ; + BindElement *BSIM4v4BPdpStructPtr ; + BindElement *BSIM4v4BPgpStructPtr ; + BindElement *BSIM4v4BPspStructPtr ; + BindElement *BSIM4v4BPbpStructPtr ; + BindElement *BSIM4v4DdStructPtr ; + BindElement *BSIM4v4GPgpStructPtr ; + BindElement *BSIM4v4SsStructPtr ; + BindElement *BSIM4v4DPdpStructPtr ; + BindElement *BSIM4v4SPspStructPtr ; + BindElement *BSIM4v4DdpStructPtr ; + BindElement *BSIM4v4GPdpStructPtr ; + BindElement *BSIM4v4GPspStructPtr ; + BindElement *BSIM4v4SspStructPtr ; + BindElement *BSIM4v4DPspStructPtr ; + BindElement *BSIM4v4DPdStructPtr ; + BindElement *BSIM4v4DPgpStructPtr ; + BindElement *BSIM4v4SPgpStructPtr ; + BindElement *BSIM4v4SPsStructPtr ; + BindElement *BSIM4v4SPdpStructPtr ; + BindElement *BSIM4v4QqStructPtr ; + BindElement *BSIM4v4QbpStructPtr ; + BindElement *BSIM4v4QdpStructPtr ; + BindElement *BSIM4v4QspStructPtr ; + BindElement *BSIM4v4QgpStructPtr ; + BindElement *BSIM4v4DPqStructPtr ; + BindElement *BSIM4v4SPqStructPtr ; + BindElement *BSIM4v4GPqStructPtr ; + BindElement *BSIM4v4GEgeStructPtr ; + BindElement *BSIM4v4GEgpStructPtr ; + BindElement *BSIM4v4GPgeStructPtr ; + BindElement *BSIM4v4GEdpStructPtr ; + BindElement *BSIM4v4GEspStructPtr ; + BindElement *BSIM4v4GEbpStructPtr ; + BindElement *BSIM4v4GMdpStructPtr ; + BindElement *BSIM4v4GMgpStructPtr ; + BindElement *BSIM4v4GMgmStructPtr ; + BindElement *BSIM4v4GMgeStructPtr ; + BindElement *BSIM4v4GMspStructPtr ; + BindElement *BSIM4v4GMbpStructPtr ; + BindElement *BSIM4v4DPgmStructPtr ; + BindElement *BSIM4v4GPgmStructPtr ; + BindElement *BSIM4v4GEgmStructPtr ; + BindElement *BSIM4v4SPgmStructPtr ; + BindElement *BSIM4v4BPgmStructPtr ; + BindElement *BSIM4v4DPdbStructPtr ; + BindElement *BSIM4v4SPsbStructPtr ; + BindElement *BSIM4v4DBdpStructPtr ; + BindElement *BSIM4v4DBdbStructPtr ; + BindElement *BSIM4v4DBbpStructPtr ; + BindElement *BSIM4v4DBbStructPtr ; + BindElement *BSIM4v4BPdbStructPtr ; + BindElement *BSIM4v4BPbStructPtr ; + BindElement *BSIM4v4BPsbStructPtr ; + BindElement *BSIM4v4SBspStructPtr ; + BindElement *BSIM4v4SBbpStructPtr ; + BindElement *BSIM4v4SBbStructPtr ; + BindElement *BSIM4v4SBsbStructPtr ; + BindElement *BSIM4v4BdbStructPtr ; + BindElement *BSIM4v4BbpStructPtr ; + BindElement *BSIM4v4BsbStructPtr ; + BindElement *BSIM4v4BbStructPtr ; + BindElement *BSIM4v4DgpStructPtr ; + BindElement *BSIM4v4DspStructPtr ; + BindElement *BSIM4v4DbpStructPtr ; + BindElement *BSIM4v4SdpStructPtr ; + BindElement *BSIM4v4SgpStructPtr ; + BindElement *BSIM4v4SbpStructPtr ; +#endif + } BSIM4v4instance ; struct bsim4SizeDependParam