From d0a39bc5dd3f5b204cec2b865ee0d12d5a309a1d Mon Sep 17 00:00:00 2001 From: Francesco Lannutti Date: Mon, 1 Apr 2013 22:21:51 +0200 Subject: [PATCH] New Binding Method extended to BSIM3v1 device --- src/spicelib/devices/bsim3v1/b3v1bindCSC.c | 976 +++++++++------------ src/spicelib/devices/bsim3v1/bsim3v1def.h | 34 + 2 files changed, 456 insertions(+), 554 deletions(-) diff --git a/src/spicelib/devices/bsim3v1/b3v1bindCSC.c b/src/spicelib/devices/bsim3v1/b3v1bindCSC.c index dbec6f54a..4292a1ca9 100644 --- a/src/spicelib/devices/bsim3v1/b3v1bindCSC.c +++ b/src/spicelib/devices/bsim3v1/b3v1bindCSC.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 "bsim3v1def.h" #include "ngspice/sperror.h" +#include + +static int -BSIM3v1bindCSC(GENmodel *inModel, CKTcircuit *ckt) +BindCompare (const void *a, const void *b) { - BSIM3v1model *model = (BSIM3v1model *)inModel; - int i ; + BindElement *A, *B ; + A = (BindElement *)a ; + B = (BindElement *)b ; - /* loop through all the b3v1 models */ - for( ; model != NULL; model = model->BSIM3v1nextModel ) { - BSIM3v1instance *here; - - /* loop through all the instances of the model */ - for (here = model->BSIM3v1instances; here != NULL ; - here = here->BSIM3v1nextInstance) { - - i = 0 ; - if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNode != 0)) { - while (here->BSIM3v1DdPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1DdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1GgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1GgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNode != 0)) { - while (here->BSIM3v1SsPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1SsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1BbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1BbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1DPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1DPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1SPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1SPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1DdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1DdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1GbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1GbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1GdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1GdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1GspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1GspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1SspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1SspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1BdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1BdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1BspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1BspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1DPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1DPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNode != 0)) { - while (here->BSIM3v1DPdPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1DPdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1BgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1BgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1DPgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1DPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1SPgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1SPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNode != 0)) { - while (here->BSIM3v1SPsPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1SPsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1DPbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1DPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1SPbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1SPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1SPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1SPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1QqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1QqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1QdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1QdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1QspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1QspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1QgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1QgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1QbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1QbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1DPqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1DPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1SPqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1SPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1GqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1GqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1BqPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->BSIM3v1BqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - } - } - return(OK); + return ((int)(A->Sparse - B->Sparse)) ; } int -BSIM3v1bindCSCComplex(GENmodel *inModel, CKTcircuit *ckt) +BSIM3v1bindCSC (GENmodel *inModel, CKTcircuit *ckt) { - BSIM3v1model *model = (BSIM3v1model *)inModel; - int i ; + BSIM3v1model *model = (BSIM3v1model *)inModel ; + BSIM3v1instance *here ; + double *i ; + BindElement *matched, *BindStruct ; + size_t nz ; - /* loop through all the b3v1 models */ - for( ; model != NULL; model = model->BSIM3v1nextModel ) { - BSIM3v1instance *here; + BindStruct = ckt->CKTmatrix->CKTbindStruct ; + nz = (size_t)ckt->CKTmatrix->CKTklunz ; + /* loop through all the BSIM3v1 models */ + for ( ; model != NULL ; model = model->BSIM3v1nextModel) + { /* loop through all the instances of the model */ - for (here = model->BSIM3v1instances; here != NULL ; - here = here->BSIM3v1nextInstance) { + for (here = model->BSIM3v1instances ; here != NULL ; here = here->BSIM3v1nextInstance) + { + if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNode != 0)) + { + i = here->BSIM3v1DdPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1DdStructPtr = matched ; + here->BSIM3v1DdPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNode != 0)) { - while (here->BSIM3v1DdPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1DdPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1gNode != 0)) + { + i = here->BSIM3v1GgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1GgStructPtr = matched ; + here->BSIM3v1GgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1GgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1GgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNode != 0)) + { + i = here->BSIM3v1SsPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1SsStructPtr = matched ; + here->BSIM3v1SsPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNode != 0)) { - while (here->BSIM3v1SsPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1SsPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1bNode != 0)) + { + i = here->BSIM3v1BbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1BbStructPtr = matched ; + here->BSIM3v1BbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1BbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1BbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) + { + i = here->BSIM3v1DPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1DPdpStructPtr = matched ; + here->BSIM3v1DPdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1DPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1DPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) + { + i = here->BSIM3v1SPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1SPspStructPtr = matched ; + here->BSIM3v1SPspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1SPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1SPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + { + i = here->BSIM3v1DdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1DdpStructPtr = matched ; + here->BSIM3v1DdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1DdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1DdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1bNode != 0)) + { + i = here->BSIM3v1GbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1GbStructPtr = matched ; + here->BSIM3v1GbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1GbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1GbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + { + i = here->BSIM3v1GdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1GdpStructPtr = matched ; + here->BSIM3v1GdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1GdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1GdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + { + i = here->BSIM3v1GspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1GspStructPtr = matched ; + here->BSIM3v1GspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1GspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1GspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + { + i = here->BSIM3v1SspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1SspStructPtr = matched ; + here->BSIM3v1SspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1SspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1SspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + { + i = here->BSIM3v1BdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1BdpStructPtr = matched ; + here->BSIM3v1BdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1BdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1BdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + { + i = here->BSIM3v1BspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1BspStructPtr = matched ; + here->BSIM3v1BspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1BspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1BspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) + { + i = here->BSIM3v1DPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1DPspStructPtr = matched ; + here->BSIM3v1DPspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1DPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1DPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNode != 0)) + { + i = here->BSIM3v1DPdPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1DPdStructPtr = matched ; + here->BSIM3v1DPdPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNode != 0)) { - while (here->BSIM3v1DPdPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1DPdPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1gNode != 0)) + { + i = here->BSIM3v1BgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1BgStructPtr = matched ; + here->BSIM3v1BgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1BgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1BgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1gNode != 0)) + { + i = here->BSIM3v1DPgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1DPgStructPtr = matched ; + here->BSIM3v1DPgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1DPgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1DPgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1gNode != 0)) + { + i = here->BSIM3v1SPgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1SPgStructPtr = matched ; + here->BSIM3v1SPgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1SPgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1SPgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNode != 0)) + { + i = here->BSIM3v1SPsPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1SPsStructPtr = matched ; + here->BSIM3v1SPsPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNode != 0)) { - while (here->BSIM3v1SPsPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1SPsPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1bNode != 0)) + { + i = here->BSIM3v1DPbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1DPbStructPtr = matched ; + here->BSIM3v1DPbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1DPbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1DPbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1bNode != 0)) + { + i = here->BSIM3v1SPbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1SPbStructPtr = matched ; + here->BSIM3v1SPbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1SPbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1SPbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) + { + i = here->BSIM3v1SPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1SPdpStructPtr = matched ; + here->BSIM3v1SPdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1SPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1SPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1qNode != 0)) + { + i = here->BSIM3v1QqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1QqStructPtr = matched ; + here->BSIM3v1QqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1QqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1QqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + { + i = here->BSIM3v1QdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1QdpStructPtr = matched ; + here->BSIM3v1QdpPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1dNodePrime != 0)) { - while (here->BSIM3v1QdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1QdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + { + i = here->BSIM3v1QspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1QspStructPtr = matched ; + here->BSIM3v1QspPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1sNodePrime != 0)) { - while (here->BSIM3v1QspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1QspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1gNode != 0)) + { + i = here->BSIM3v1QgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1QgStructPtr = matched ; + here->BSIM3v1QgPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1gNode != 0)) { - while (here->BSIM3v1QgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1QgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1bNode != 0)) + { + i = here->BSIM3v1QbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1QbStructPtr = matched ; + here->BSIM3v1QbPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1bNode != 0)) { - while (here->BSIM3v1QbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1QbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1qNode != 0)) + { + i = here->BSIM3v1DPqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1DPqStructPtr = matched ; + here->BSIM3v1DPqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1DPqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1DPqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1qNode != 0)) + { + i = here->BSIM3v1SPqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1SPqStructPtr = matched ; + here->BSIM3v1SPqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1SPqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1SPqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1qNode != 0)) + { + i = here->BSIM3v1GqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1GqStructPtr = matched ; + here->BSIM3v1GqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1GqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1GqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1qNode != 0)) + { + i = here->BSIM3v1BqPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->BSIM3v1BqStructPtr = matched ; + here->BSIM3v1BqPtr = matched->CSC ; + } - i = 0 ; - if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1qNode != 0)) { - while (here->BSIM3v1BqPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->BSIM3v1BqPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - } + } } - return(OK); + + return (OK) ; +} + +int +BSIM3v1bindCSCComplex (GENmodel *inModel, CKTcircuit *ckt) +{ + BSIM3v1model *model = (BSIM3v1model *)inModel ; + BSIM3v1instance *here ; + + NG_IGNORE (ckt) ; + + /* loop through all the BSIM3v1 models */ + for ( ; model != NULL ; model = model->BSIM3v1nextModel) + { + /* loop through all the instances of the model */ + for (here = model->BSIM3v1instances ; here != NULL ; here = here->BSIM3v1nextInstance) + { + if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNode != 0)) + here->BSIM3v1DdPtr = here->BSIM3v1DdStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1GgPtr = here->BSIM3v1GgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNode != 0)) + here->BSIM3v1SsPtr = here->BSIM3v1SsStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1BbPtr = here->BSIM3v1BbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1DPdpPtr = here->BSIM3v1DPdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1SPspPtr = here->BSIM3v1SPspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1DdpPtr = here->BSIM3v1DdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1GbPtr = here->BSIM3v1GbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1GdpPtr = here->BSIM3v1GdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1GspPtr = here->BSIM3v1GspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1SspPtr = here->BSIM3v1SspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1BdpPtr = here->BSIM3v1BdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1BspPtr = here->BSIM3v1BspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1DPspPtr = here->BSIM3v1DPspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNode != 0)) + here->BSIM3v1DPdPtr = here->BSIM3v1DPdStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1BgPtr = here->BSIM3v1BgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1DPgPtr = here->BSIM3v1DPgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1SPgPtr = here->BSIM3v1SPgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNode != 0)) + here->BSIM3v1SPsPtr = here->BSIM3v1SPsStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1DPbPtr = here->BSIM3v1DPbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1SPbPtr = here->BSIM3v1SPbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1SPdpPtr = here->BSIM3v1SPdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1QqPtr = here->BSIM3v1QqStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1QdpPtr = here->BSIM3v1QdpStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1QspPtr = here->BSIM3v1QspStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1QgPtr = here->BSIM3v1QgStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1QbPtr = here->BSIM3v1QbStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1DPqPtr = here->BSIM3v1DPqStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1SPqPtr = here->BSIM3v1SPqStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1GqPtr = here->BSIM3v1GqStructPtr->CSC_Complex ; + + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1BqPtr = here->BSIM3v1BqStructPtr->CSC_Complex ; + + } + } + + return (OK) ; } int @@ -420,232 +410,110 @@ BSIM3v1bindCSCComplexToReal (GENmodel *inModel, CKTcircuit *ckt) { BSIM3v1model *model = (BSIM3v1model *)inModel ; BSIM3v1instance *here ; - int i ; - /* loop through all the bsim3v1 models */ + NG_IGNORE (ckt) ; + + /* loop through all the BSIM3v1 models */ for ( ; model != NULL ; model = model->BSIM3v1nextModel) { /* loop through all the instances of the model */ for (here = model->BSIM3v1instances ; here != NULL ; here = here->BSIM3v1nextInstance) { - i = 0 ; - if ((here->BSIM3v1dNode != 0) && (here->BSIM3v1dNode != 0)) - { - while (here->BSIM3v1DdPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1DdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNode != 0)) + here->BSIM3v1DdPtr = here->BSIM3v1DdStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1gNode != 0) && (here->BSIM3v1gNode != 0)) - { - while (here->BSIM3v1GgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1GgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1GgPtr = here->BSIM3v1GgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1sNode != 0) && (here->BSIM3v1sNode != 0)) - { - while (here->BSIM3v1SsPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1SsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNode != 0)) + here->BSIM3v1SsPtr = here->BSIM3v1SsStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1bNode != 0) && (here->BSIM3v1bNode != 0)) - { - while (here->BSIM3v1BbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1BbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1BbPtr = here->BSIM3v1BbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1dNodePrime != 0) && (here->BSIM3v1dNodePrime != 0)) - { - while (here->BSIM3v1DPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1DPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1DPdpPtr = here->BSIM3v1DPdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1sNodePrime != 0) && (here->BSIM3v1sNodePrime != 0)) - { - while (here->BSIM3v1SPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1SPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1SPspPtr = here->BSIM3v1SPspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1dNode != 0) && (here->BSIM3v1dNodePrime != 0)) - { - while (here->BSIM3v1DdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1DdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1dNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1DdpPtr = here->BSIM3v1DdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1gNode != 0) && (here->BSIM3v1bNode != 0)) - { - while (here->BSIM3v1GbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1GbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1GbPtr = here->BSIM3v1GbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1gNode != 0) && (here->BSIM3v1dNodePrime != 0)) - { - while (here->BSIM3v1GdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1GdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1GdpPtr = here->BSIM3v1GdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1gNode != 0) && (here->BSIM3v1sNodePrime != 0)) - { - while (here->BSIM3v1GspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1GspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1GspPtr = here->BSIM3v1GspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1sNode != 0) && (here->BSIM3v1sNodePrime != 0)) - { - while (here->BSIM3v1SspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1SspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1sNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1SspPtr = here->BSIM3v1SspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1bNode != 0) && (here->BSIM3v1dNodePrime != 0)) - { - while (here->BSIM3v1BdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1BdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1BdpPtr = here->BSIM3v1BdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1bNode != 0) && (here->BSIM3v1sNodePrime != 0)) - { - while (here->BSIM3v1BspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1BspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1BspPtr = here->BSIM3v1BspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1dNodePrime != 0) && (here->BSIM3v1sNodePrime != 0)) - { - while (here->BSIM3v1DPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1DPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1DPspPtr = here->BSIM3v1DPspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1dNodePrime != 0) && (here->BSIM3v1dNode != 0)) - { - while (here->BSIM3v1DPdPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1DPdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1dNode != 0)) + here->BSIM3v1DPdPtr = here->BSIM3v1DPdStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1bNode != 0) && (here->BSIM3v1gNode != 0)) - { - while (here->BSIM3v1BgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1BgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1BgPtr = here->BSIM3v1BgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1dNodePrime != 0) && (here->BSIM3v1gNode != 0)) - { - while (here->BSIM3v1DPgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1DPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1DPgPtr = here->BSIM3v1DPgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1sNodePrime != 0) && (here->BSIM3v1gNode != 0)) - { - while (here->BSIM3v1SPgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1SPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1SPgPtr = here->BSIM3v1SPgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1sNodePrime != 0) && (here->BSIM3v1sNode != 0)) - { - while (here->BSIM3v1SPsPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1SPsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1sNode != 0)) + here->BSIM3v1SPsPtr = here->BSIM3v1SPsStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1dNodePrime != 0) && (here->BSIM3v1bNode != 0)) - { - while (here->BSIM3v1DPbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1DPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1DPbPtr = here->BSIM3v1DPbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1sNodePrime != 0) && (here->BSIM3v1bNode != 0)) - { - while (here->BSIM3v1SPbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1SPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1SPbPtr = here->BSIM3v1SPbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1sNodePrime != 0) && (here->BSIM3v1dNodePrime != 0)) - { - while (here->BSIM3v1SPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1SPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1SPdpPtr = here->BSIM3v1SPdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1qNode != 0) && (here->BSIM3v1qNode != 0)) - { - while (here->BSIM3v1QqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1QqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1QqPtr = here->BSIM3v1QqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1qNode != 0) && (here->BSIM3v1dNodePrime != 0)) - { - while (here->BSIM3v1QdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1QdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1dNodePrime != 0)) + here->BSIM3v1QdpPtr = here->BSIM3v1QdpStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1qNode != 0) && (here->BSIM3v1sNodePrime != 0)) - { - while (here->BSIM3v1QspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1QspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1sNodePrime != 0)) + here->BSIM3v1QspPtr = here->BSIM3v1QspStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1qNode != 0) && (here->BSIM3v1gNode != 0)) - { - while (here->BSIM3v1QgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1QgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1gNode != 0)) + here->BSIM3v1QgPtr = here->BSIM3v1QgStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1qNode != 0) && (here->BSIM3v1bNode != 0)) - { - while (here->BSIM3v1QbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1QbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1qNode != 0) && (here-> BSIM3v1bNode != 0)) + here->BSIM3v1QbPtr = here->BSIM3v1QbStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1dNodePrime != 0) && (here->BSIM3v1qNode != 0)) - { - while (here->BSIM3v1DPqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1DPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1dNodePrime != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1DPqPtr = here->BSIM3v1DPqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1sNodePrime != 0) && (here->BSIM3v1qNode != 0)) - { - while (here->BSIM3v1SPqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1SPqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1sNodePrime != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1SPqPtr = here->BSIM3v1SPqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1gNode != 0) && (here->BSIM3v1qNode != 0)) - { - while (here->BSIM3v1GqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1GqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + if ((here-> BSIM3v1gNode != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1GqPtr = here->BSIM3v1GqStructPtr->CSC ; + + if ((here-> BSIM3v1bNode != 0) && (here-> BSIM3v1qNode != 0)) + here->BSIM3v1BqPtr = here->BSIM3v1BqStructPtr->CSC ; - i = 0 ; - if ((here->BSIM3v1bNode != 0) && (here->BSIM3v1qNode != 0)) - { - while (here->BSIM3v1BqPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->BSIM3v1BqPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } } } return (OK) ; -} \ No newline at end of file +} diff --git a/src/spicelib/devices/bsim3v1/bsim3v1def.h b/src/spicelib/devices/bsim3v1/bsim3v1def.h index 8b1e3d53b..5cf7f90de 100644 --- a/src/spicelib/devices/bsim3v1/bsim3v1def.h +++ b/src/spicelib/devices/bsim3v1/bsim3v1def.h @@ -189,6 +189,40 @@ typedef struct sBSIM3v1instance double **BSIM3v1nVar; #endif /* NONOISE */ +#ifdef KLU + BindElement *BSIM3v1DdStructPtr ; + BindElement *BSIM3v1GgStructPtr ; + BindElement *BSIM3v1SsStructPtr ; + BindElement *BSIM3v1BbStructPtr ; + BindElement *BSIM3v1DPdpStructPtr ; + BindElement *BSIM3v1SPspStructPtr ; + BindElement *BSIM3v1DdpStructPtr ; + BindElement *BSIM3v1GbStructPtr ; + BindElement *BSIM3v1GdpStructPtr ; + BindElement *BSIM3v1GspStructPtr ; + BindElement *BSIM3v1SspStructPtr ; + BindElement *BSIM3v1BdpStructPtr ; + BindElement *BSIM3v1BspStructPtr ; + BindElement *BSIM3v1DPspStructPtr ; + BindElement *BSIM3v1DPdStructPtr ; + BindElement *BSIM3v1BgStructPtr ; + BindElement *BSIM3v1DPgStructPtr ; + BindElement *BSIM3v1SPgStructPtr ; + BindElement *BSIM3v1SPsStructPtr ; + BindElement *BSIM3v1DPbStructPtr ; + BindElement *BSIM3v1SPbStructPtr ; + BindElement *BSIM3v1SPdpStructPtr ; + BindElement *BSIM3v1QqStructPtr ; + BindElement *BSIM3v1QdpStructPtr ; + BindElement *BSIM3v1QspStructPtr ; + BindElement *BSIM3v1QgStructPtr ; + BindElement *BSIM3v1QbStructPtr ; + BindElement *BSIM3v1DPqStructPtr ; + BindElement *BSIM3v1SPqStructPtr ; + BindElement *BSIM3v1GqStructPtr ; + BindElement *BSIM3v1BqStructPtr ; +#endif + } BSIM3v1instance ; struct bsim3v1SizeDependParam