diff --git a/src/spicelib/devices/bsim3v0/b3v0bindCSC.c b/src/spicelib/devices/bsim3v0/b3v0bindCSC.c index 7c9bcfe65..e422e3648 100644 --- a/src/spicelib/devices/bsim3v0/b3v0bindCSC.c +++ b/src/spicelib/devices/bsim3v0/b3v0bindCSC.c @@ -1,5 +1,5 @@ /********** -Author: 2012 Francesco Lannutti +Author: 2013 Francesco Lannutti **********/ #include "ngspice/ngspice.h" @@ -7,412 +7,402 @@ Author: 2012 Francesco Lannutti #include "bsim3v0def.h" #include "ngspice/sperror.h" +#include + +static int -BSIM3v0bindCSC(GENmodel *inModel, CKTcircuit *ckt) +BindCompare (const void *a, const void *b) { - BSIM3v0model *model = (BSIM3v0model *)inModel; - int i ; + BindElement *A, *B ; + A = (BindElement *)a ; + B = (BindElement *)b ; - /* loop through all the b3v0 models */ - for( ; model != NULL; model = model->BSIM3v0nextModel ) { - BSIM3v0instance *here; - - /* loop through all the instances of the model */ - for (here = model->BSIM3v0instances; here != NULL ; - here = here->BSIM3v0nextInstance) { - - i = 0 ; - if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNode != 0)) { - while (here->BSIM3v0DdPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0DdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0GgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0GgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNode != 0)) { - while (here->BSIM3v0SsPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0SsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0BbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0BbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0DPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0DPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0SPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0SPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0DdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0DdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0GbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0GbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0GdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0GdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0GspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0GspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0SspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0SspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0BdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0BdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0BspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0BspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0DPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0DPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNode != 0)) { - while (here->BSIM3v0DPdPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0DPdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0BgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0BgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0DPgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0DPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0SPgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0SPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNode != 0)) { - while (here->BSIM3v0SPsPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0SPsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0DPbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0DPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0SPbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0SPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0SPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0SPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0QqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0QqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0QdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0QdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0QspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0QspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0QgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0QgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0QbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0QbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0DPqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0DPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0SPqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0SPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0GqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0GqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0BqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v0BqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - } - } - return(OK); + return ((int)(A->Sparse - B->Sparse)) ; } int -BSIM3v0bindCSCComplex(GENmodel *inModel, CKTcircuit *ckt) +BSIM3v0bindCSC (GENmodel *inModel, CKTcircuit *ckt) { - BSIM3v0model *model = (BSIM3v0model *)inModel; - int i ; + BSIM3v0model *model = (BSIM3v0model *)inModel ; + BSIM3v0instance *here ; + double *i ; + BindElement *matched, *BindStruct ; + size_t nz ; - /* loop through all the b3v0 models */ - for( ; model != NULL; model = model->BSIM3v0nextModel ) { - BSIM3v0instance *here; + BindStruct = ckt->CKTmatrix->CKTbindStruct ; + nz = (size_t)ckt->CKTmatrix->CKTklunz ; + /* loop through all the BSIM3v0 models */ + for ( ; model != NULL ; model = model->BSIM3v0nextModel) + { /* loop through all the instances of the model */ - for (here = model->BSIM3v0instances; here != NULL ; - here = here->BSIM3v0nextInstance) { + for (here = model->BSIM3v0instances ; here != NULL ; here = here->BSIM3v0nextInstance) + { + if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNode != 0)) + { + i = here->BSIM3v0DdPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0DdStructPtr = matched ; + here->BSIM3v0DdPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNode != 0)) { - while (here->BSIM3v0DdPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0DdPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0gNode != 0)) + { + i = here->BSIM3v0GgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0GgStructPtr = matched ; + here->BSIM3v0GgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0GgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0GgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNode != 0)) + { + i = here->BSIM3v0SsPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0SsStructPtr = matched ; + here->BSIM3v0SsPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNode != 0)) { - while (here->BSIM3v0SsPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0SsPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0bNode != 0)) + { + i = here->BSIM3v0BbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0BbStructPtr = matched ; + here->BSIM3v0BbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0BbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0BbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) + { + i = here->BSIM3v0DPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0DPdpStructPtr = matched ; + here->BSIM3v0DPdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0DPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0DPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) + { + i = here->BSIM3v0SPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0SPspStructPtr = matched ; + here->BSIM3v0SPspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0SPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0SPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + { + i = here->BSIM3v0DdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0DdpStructPtr = matched ; + here->BSIM3v0DdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0DdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0DdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0bNode != 0)) + { + i = here->BSIM3v0GbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0GbStructPtr = matched ; + here->BSIM3v0GbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0GbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0GbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + { + i = here->BSIM3v0GdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0GdpStructPtr = matched ; + here->BSIM3v0GdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0GdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0GdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + { + i = here->BSIM3v0GspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0GspStructPtr = matched ; + here->BSIM3v0GspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0GspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0GspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + { + i = here->BSIM3v0SspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0SspStructPtr = matched ; + here->BSIM3v0SspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0SspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0SspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + { + i = here->BSIM3v0BdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0BdpStructPtr = matched ; + here->BSIM3v0BdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0BdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0BdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + { + i = here->BSIM3v0BspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0BspStructPtr = matched ; + here->BSIM3v0BspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0BspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0BspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) + { + i = here->BSIM3v0DPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0DPspStructPtr = matched ; + here->BSIM3v0DPspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0DPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0DPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNode != 0)) + { + i = here->BSIM3v0DPdPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0DPdStructPtr = matched ; + here->BSIM3v0DPdPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNode != 0)) { - while (here->BSIM3v0DPdPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0DPdPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0gNode != 0)) + { + i = here->BSIM3v0BgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0BgStructPtr = matched ; + here->BSIM3v0BgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0BgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0BgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0gNode != 0)) + { + i = here->BSIM3v0DPgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0DPgStructPtr = matched ; + here->BSIM3v0DPgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0DPgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0DPgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0gNode != 0)) + { + i = here->BSIM3v0SPgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0SPgStructPtr = matched ; + here->BSIM3v0SPgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0SPgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0SPgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNode != 0)) + { + i = here->BSIM3v0SPsPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0SPsStructPtr = matched ; + here->BSIM3v0SPsPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNode != 0)) { - while (here->BSIM3v0SPsPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0SPsPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0bNode != 0)) + { + i = here->BSIM3v0DPbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0DPbStructPtr = matched ; + here->BSIM3v0DPbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0DPbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0DPbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0bNode != 0)) + { + i = here->BSIM3v0SPbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0SPbStructPtr = matched ; + here->BSIM3v0SPbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0SPbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0SPbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) + { + i = here->BSIM3v0SPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0SPdpStructPtr = matched ; + here->BSIM3v0SPdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0SPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0SPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0qNode != 0)) + { + i = here->BSIM3v0QqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0QqStructPtr = matched ; + here->BSIM3v0QqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0QqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0QqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + { + i = here->BSIM3v0QdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0QdpStructPtr = matched ; + here->BSIM3v0QdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0dNodePrime != 0)) { - while (here->BSIM3v0QdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0QdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + { + i = here->BSIM3v0QspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0QspStructPtr = matched ; + here->BSIM3v0QspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0sNodePrime != 0)) { - while (here->BSIM3v0QspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0QspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0gNode != 0)) + { + i = here->BSIM3v0QgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0QgStructPtr = matched ; + here->BSIM3v0QgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0gNode != 0)) { - while (here->BSIM3v0QgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0QgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0bNode != 0)) + { + i = here->BSIM3v0QbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0QbStructPtr = matched ; + here->BSIM3v0QbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0bNode != 0)) { - while (here->BSIM3v0QbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0QbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0qNode != 0)) + { + i = here->BSIM3v0DPqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0DPqStructPtr = matched ; + here->BSIM3v0DPqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0DPqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0DPqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0qNode != 0)) + { + i = here->BSIM3v0SPqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0SPqStructPtr = matched ; + here->BSIM3v0SPqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0SPqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0SPqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0qNode != 0)) + { + i = here->BSIM3v0GqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0GqStructPtr = matched ; + here->BSIM3v0GqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0GqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0GqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0qNode != 0)) + { + i = here->BSIM3v0BqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v0BqStructPtr = matched ; + here->BSIM3v0BqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0qNode != 0)) { - while (here->BSIM3v0BqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v0BqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - } + } } - return(OK); + + return (OK) ; +} + +int +BSIM3v0bindCSCComplex (GENmodel *inModel, CKTcircuit *ckt) +{ + BSIM3v0model *model = (BSIM3v0model *)inModel ; + BSIM3v0instance *here ; + + NG_IGNORE (ckt) ; + + /* loop through all the BSIM3v0 models */ + for ( ; model != NULL ; model = model->BSIM3v0nextModel) + { + /* loop through all the instances of the model */ + for (here = model->BSIM3v0instances ; here != NULL ; here = here->BSIM3v0nextInstance) + { + if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNode != 0)) + here->BSIM3v0DdPtr = here->BSIM3v0DdStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0GgPtr = here->BSIM3v0GgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNode != 0)) + here->BSIM3v0SsPtr = here->BSIM3v0SsStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0BbPtr = here->BSIM3v0BbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0DPdpPtr = here->BSIM3v0DPdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0SPspPtr = here->BSIM3v0SPspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0DdpPtr = here->BSIM3v0DdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0GbPtr = here->BSIM3v0GbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0GdpPtr = here->BSIM3v0GdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0GspPtr = here->BSIM3v0GspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0SspPtr = here->BSIM3v0SspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0BdpPtr = here->BSIM3v0BdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0BspPtr = here->BSIM3v0BspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0DPspPtr = here->BSIM3v0DPspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNode != 0)) + here->BSIM3v0DPdPtr = here->BSIM3v0DPdStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0BgPtr = here->BSIM3v0BgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0DPgPtr = here->BSIM3v0DPgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0SPgPtr = here->BSIM3v0SPgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNode != 0)) + here->BSIM3v0SPsPtr = here->BSIM3v0SPsStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0DPbPtr = here->BSIM3v0DPbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0SPbPtr = here->BSIM3v0SPbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0SPdpPtr = here->BSIM3v0SPdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0QqPtr = here->BSIM3v0QqStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0QdpPtr = here->BSIM3v0QdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0QspPtr = here->BSIM3v0QspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0QgPtr = here->BSIM3v0QgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0QbPtr = here->BSIM3v0QbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0DPqPtr = here->BSIM3v0DPqStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0SPqPtr = here->BSIM3v0SPqStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0GqPtr = here->BSIM3v0GqStructPtr->CSC_Complex ; + + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0BqPtr = here->BSIM3v0BqStructPtr->CSC_Complex ; + + } + } + + return (OK) ; } int @@ -420,232 +410,110 @@ BSIM3v0bindCSCComplexToReal (GENmodel *inModel, CKTcircuit *ckt) { BSIM3v0model *model = (BSIM3v0model *)inModel ; BSIM3v0instance *here ; - int i ; - /* loop through all the bsim3v0 models */ + NG_IGNORE (ckt) ; + + /* loop through all the BSIM3v0 models */ for ( ; model != NULL ; model = model->BSIM3v0nextModel) { /* loop through all the instances of the model */ for (here = model->BSIM3v0instances ; here != NULL ; here = here->BSIM3v0nextInstance) { - i = 0 ; - if ((here->BSIM3v0dNode != 0) && (here->BSIM3v0dNode != 0)) - { - while (here->BSIM3v0DdPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0DdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNode != 0)) + here->BSIM3v0DdPtr = here->BSIM3v0DdStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0gNode != 0) && (here->BSIM3v0gNode != 0)) - { - while (here->BSIM3v0GgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0GgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0GgPtr = here->BSIM3v0GgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0sNode != 0) && (here->BSIM3v0sNode != 0)) - { - while (here->BSIM3v0SsPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0SsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNode != 0)) + here->BSIM3v0SsPtr = here->BSIM3v0SsStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0bNode != 0) && (here->BSIM3v0bNode != 0)) - { - while (here->BSIM3v0BbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0BbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0BbPtr = here->BSIM3v0BbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0dNodePrime != 0) && (here->BSIM3v0dNodePrime != 0)) - { - while (here->BSIM3v0DPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0DPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0DPdpPtr = here->BSIM3v0DPdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0sNodePrime != 0) && (here->BSIM3v0sNodePrime != 0)) - { - while (here->BSIM3v0SPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0SPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0SPspPtr = here->BSIM3v0SPspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0dNode != 0) && (here->BSIM3v0dNodePrime != 0)) - { - while (here->BSIM3v0DdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0DdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0dNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0DdpPtr = here->BSIM3v0DdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0gNode != 0) && (here->BSIM3v0bNode != 0)) - { - while (here->BSIM3v0GbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0GbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0GbPtr = here->BSIM3v0GbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0gNode != 0) && (here->BSIM3v0dNodePrime != 0)) - { - while (here->BSIM3v0GdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0GdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0GdpPtr = here->BSIM3v0GdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0gNode != 0) && (here->BSIM3v0sNodePrime != 0)) - { - while (here->BSIM3v0GspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0GspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0GspPtr = here->BSIM3v0GspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0sNode != 0) && (here->BSIM3v0sNodePrime != 0)) - { - while (here->BSIM3v0SspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0SspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0sNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0SspPtr = here->BSIM3v0SspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0bNode != 0) && (here->BSIM3v0dNodePrime != 0)) - { - while (here->BSIM3v0BdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0BdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0BdpPtr = here->BSIM3v0BdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0bNode != 0) && (here->BSIM3v0sNodePrime != 0)) - { - while (here->BSIM3v0BspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0BspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0BspPtr = here->BSIM3v0BspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0dNodePrime != 0) && (here->BSIM3v0sNodePrime != 0)) - { - while (here->BSIM3v0DPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0DPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0DPspPtr = here->BSIM3v0DPspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0dNodePrime != 0) && (here->BSIM3v0dNode != 0)) - { - while (here->BSIM3v0DPdPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0DPdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0dNode != 0)) + here->BSIM3v0DPdPtr = here->BSIM3v0DPdStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0bNode != 0) && (here->BSIM3v0gNode != 0)) - { - while (here->BSIM3v0BgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0BgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0BgPtr = here->BSIM3v0BgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0dNodePrime != 0) && (here->BSIM3v0gNode != 0)) - { - while (here->BSIM3v0DPgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0DPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0DPgPtr = here->BSIM3v0DPgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0sNodePrime != 0) && (here->BSIM3v0gNode != 0)) - { - while (here->BSIM3v0SPgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0SPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0SPgPtr = here->BSIM3v0SPgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0sNodePrime != 0) && (here->BSIM3v0sNode != 0)) - { - while (here->BSIM3v0SPsPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0SPsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0sNode != 0)) + here->BSIM3v0SPsPtr = here->BSIM3v0SPsStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0dNodePrime != 0) && (here->BSIM3v0bNode != 0)) - { - while (here->BSIM3v0DPbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0DPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0DPbPtr = here->BSIM3v0DPbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0sNodePrime != 0) && (here->BSIM3v0bNode != 0)) - { - while (here->BSIM3v0SPbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0SPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0SPbPtr = here->BSIM3v0SPbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0sNodePrime != 0) && (here->BSIM3v0dNodePrime != 0)) - { - while (here->BSIM3v0SPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0SPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0SPdpPtr = here->BSIM3v0SPdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0qNode != 0) && (here->BSIM3v0qNode != 0)) - { - while (here->BSIM3v0QqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0QqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0QqPtr = here->BSIM3v0QqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0qNode != 0) && (here->BSIM3v0dNodePrime != 0)) - { - while (here->BSIM3v0QdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0QdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0dNodePrime != 0)) + here->BSIM3v0QdpPtr = here->BSIM3v0QdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0qNode != 0) && (here->BSIM3v0sNodePrime != 0)) - { - while (here->BSIM3v0QspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0QspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0sNodePrime != 0)) + here->BSIM3v0QspPtr = here->BSIM3v0QspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0qNode != 0) && (here->BSIM3v0gNode != 0)) - { - while (here->BSIM3v0QgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0QgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0gNode != 0)) + here->BSIM3v0QgPtr = here->BSIM3v0QgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0qNode != 0) && (here->BSIM3v0bNode != 0)) - { - while (here->BSIM3v0QbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0QbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0qNode != 0) && (here-> BSIM3v0bNode != 0)) + here->BSIM3v0QbPtr = here->BSIM3v0QbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0dNodePrime != 0) && (here->BSIM3v0qNode != 0)) - { - while (here->BSIM3v0DPqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0DPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0dNodePrime != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0DPqPtr = here->BSIM3v0DPqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0sNodePrime != 0) && (here->BSIM3v0qNode != 0)) - { - while (here->BSIM3v0SPqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0SPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0sNodePrime != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0SPqPtr = here->BSIM3v0SPqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0gNode != 0) && (here->BSIM3v0qNode != 0)) - { - while (here->BSIM3v0GqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0GqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v0gNode != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0GqPtr = here->BSIM3v0GqStructPtr->CSC ; + + if ((here-> BSIM3v0bNode != 0) && (here-> BSIM3v0qNode != 0)) + here->BSIM3v0BqPtr = here->BSIM3v0BqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v0bNode != 0) && (here->BSIM3v0qNode != 0)) - { - while (here->BSIM3v0BqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v0BqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } } } return (OK) ; -} \ No newline at end of file +} diff --git a/src/spicelib/devices/bsim3v0/bsim3v0def.h b/src/spicelib/devices/bsim3v0/bsim3v0def.h index 06eac1a98..4f22f92e3 100644 --- a/src/spicelib/devices/bsim3v0/bsim3v0def.h +++ b/src/spicelib/devices/bsim3v0/bsim3v0def.h @@ -188,6 +188,40 @@ typedef struct sBSIM3v0instance double **BSIM3v0nVar; #endif /* NONOISE */ +#ifdef KLU + BindElement *BSIM3v0DdStructPtr ; + BindElement *BSIM3v0GgStructPtr ; + BindElement *BSIM3v0SsStructPtr ; + BindElement *BSIM3v0BbStructPtr ; + BindElement *BSIM3v0DPdpStructPtr ; + BindElement *BSIM3v0SPspStructPtr ; + BindElement *BSIM3v0DdpStructPtr ; + BindElement *BSIM3v0GbStructPtr ; + BindElement *BSIM3v0GdpStructPtr ; + BindElement *BSIM3v0GspStructPtr ; + BindElement *BSIM3v0SspStructPtr ; + BindElement *BSIM3v0BdpStructPtr ; + BindElement *BSIM3v0BspStructPtr ; + BindElement *BSIM3v0DPspStructPtr ; + BindElement *BSIM3v0DPdStructPtr ; + BindElement *BSIM3v0BgStructPtr ; + BindElement *BSIM3v0DPgStructPtr ; + BindElement *BSIM3v0SPgStructPtr ; + BindElement *BSIM3v0SPsStructPtr ; + BindElement *BSIM3v0DPbStructPtr ; + BindElement *BSIM3v0SPbStructPtr ; + BindElement *BSIM3v0SPdpStructPtr ; + BindElement *BSIM3v0QqStructPtr ; + BindElement *BSIM3v0QdpStructPtr ; + BindElement *BSIM3v0QspStructPtr ; + BindElement *BSIM3v0QgStructPtr ; + BindElement *BSIM3v0QbStructPtr ; + BindElement *BSIM3v0DPqStructPtr ; + BindElement *BSIM3v0SPqStructPtr ; + BindElement *BSIM3v0GqStructPtr ; + BindElement *BSIM3v0BqStructPtr ; +#endif + } BSIM3v0instance ; struct bsim3v0SizeDependParam