diff --git a/src/spicelib/devices/mos6/mos6bindCSC.c b/src/spicelib/devices/mos6/mos6bindCSC.c index f53004eaf..942ecbad5 100644 --- a/src/spicelib/devices/mos6/mos6bindCSC.c +++ b/src/spicelib/devices/mos6/mos6bindCSC.c @@ -7,304 +7,301 @@ Author: 2012 Francesco Lannutti #include "mos6defs.h" #include "ngspice/sperror.h" +#include + +static int -MOS6bindCSC(GENmodel *inModel, CKTcircuit *ckt) +BindCompare (const void *a, const void *b) { - MOS6model *model = (MOS6model *)inModel; - int i ; + BindElement *A, *B ; + A = (BindElement *)a ; + B = (BindElement *)b ; - /* loop through all the mos6 models */ - for( ; model != NULL; model = model->MOS6nextModel ) { - MOS6instance *here; - - /* loop through all the instances of the model */ - for (here = model->MOS6instances; here != NULL ; - here = here->MOS6nextInstance) { - - i = 0 ; - if ((here->MOS6dNode != 0) && (here->MOS6dNode != 0)) { - while (here->MOS6DdPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6DdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6gNode != 0) && (here->MOS6gNode != 0)) { - while (here->MOS6GgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6GgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6sNode != 0) && (here->MOS6sNode != 0)) { - while (here->MOS6SsPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6SsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6bNode != 0) && (here->MOS6bNode != 0)) { - while (here->MOS6BbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6BbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6DPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6DPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6SPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6SPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6dNode != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6DdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6DdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6gNode != 0) && (here->MOS6bNode != 0)) { - while (here->MOS6GbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6GbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6gNode != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6GdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6GdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6gNode != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6GspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6GspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6sNode != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6SspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6SspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6bNode != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6BdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6BdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6bNode != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6BspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6BspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6DPspPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6DPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6dNode != 0)) { - while (here->MOS6DPdPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6DPdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6bNode != 0) && (here->MOS6gNode != 0)) { - while (here->MOS6BgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6BgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6gNode != 0)) { - while (here->MOS6DPgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6DPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6gNode != 0)) { - while (here->MOS6SPgPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6SPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6sNode != 0)) { - while (here->MOS6SPsPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6SPsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6bNode != 0)) { - while (here->MOS6DPbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6DPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6bNode != 0)) { - while (here->MOS6SPbPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6SPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6SPdpPtr != ckt->CKTmatrix->CKTbind_Sparse [i]) i ++ ; - here->MOS6SPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } - } - } - return(OK); + return ((int)(A->Sparse - B->Sparse)) ; } int -MOS6bindCSCComplex(GENmodel *inModel, CKTcircuit *ckt) +MOS6bindCSC (GENmodel *inModel, CKTcircuit *ckt) { - MOS6model *model = (MOS6model *)inModel; - int i ; + MOS6model *model = (MOS6model *)inModel ; + MOS6instance *here ; + double *i ; + BindElement *matched, *BindStruct ; + size_t nz ; - /* loop through all the mos6 models */ - for( ; model != NULL; model = model->MOS6nextModel ) { - MOS6instance *here; + BindStruct = ckt->CKTmatrix->CKTbindStruct ; + nz = (size_t)ckt->CKTmatrix->CKTklunz ; + /* loop through all the MOS6 models */ + for ( ; model != NULL ; model = model->MOS6nextModel) + { /* loop through all the instances of the model */ - for (here = model->MOS6instances; here != NULL ; - here = here->MOS6nextInstance) { + for (here = model->MOS6instances ; here != NULL ; here = here->MOS6nextInstance) + { + if ((here->MOS6dNode != 0) && (here->MOS6dNode != 0)) + { + i = here->MOS6DdPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6DdStructPtr = matched ; + here->MOS6DdPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6dNode != 0) && (here->MOS6dNode != 0)) { - while (here->MOS6DdPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6DdPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6gNode != 0) && (here->MOS6gNode != 0)) + { + i = here->MOS6GgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6GgStructPtr = matched ; + here->MOS6GgPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6gNode != 0) && (here->MOS6gNode != 0)) { - while (here->MOS6GgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6GgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6sNode != 0) && (here->MOS6sNode != 0)) + { + i = here->MOS6SsPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6SsStructPtr = matched ; + here->MOS6SsPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6sNode != 0) && (here->MOS6sNode != 0)) { - while (here->MOS6SsPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6SsPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6bNode != 0) && (here->MOS6bNode != 0)) + { + i = here->MOS6BbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6BbStructPtr = matched ; + here->MOS6BbPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6bNode != 0) && (here->MOS6bNode != 0)) { - while (here->MOS6BbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6BbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6dNodePrime != 0) && (here->MOS6dNodePrime != 0)) + { + i = here->MOS6DPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6DPdpStructPtr = matched ; + here->MOS6DPdpPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6DPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6DPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6sNodePrime != 0) && (here->MOS6sNodePrime != 0)) + { + i = here->MOS6SPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6SPspStructPtr = matched ; + here->MOS6SPspPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6SPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6SPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6dNode != 0) && (here->MOS6dNodePrime != 0)) + { + i = here->MOS6DdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6DdpStructPtr = matched ; + here->MOS6DdpPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6dNode != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6DdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6DdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6gNode != 0) && (here->MOS6bNode != 0)) + { + i = here->MOS6GbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6GbStructPtr = matched ; + here->MOS6GbPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6gNode != 0) && (here->MOS6bNode != 0)) { - while (here->MOS6GbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6GbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6gNode != 0) && (here->MOS6dNodePrime != 0)) + { + i = here->MOS6GdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6GdpStructPtr = matched ; + here->MOS6GdpPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6gNode != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6GdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6GdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6gNode != 0) && (here->MOS6sNodePrime != 0)) + { + i = here->MOS6GspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6GspStructPtr = matched ; + here->MOS6GspPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6gNode != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6GspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6GspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6sNode != 0) && (here->MOS6sNodePrime != 0)) + { + i = here->MOS6SspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6SspStructPtr = matched ; + here->MOS6SspPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6sNode != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6SspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6SspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6bNode != 0) && (here->MOS6dNodePrime != 0)) + { + i = here->MOS6BdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6BdpStructPtr = matched ; + here->MOS6BdpPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6bNode != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6BdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6BdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6bNode != 0) && (here->MOS6sNodePrime != 0)) + { + i = here->MOS6BspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6BspStructPtr = matched ; + here->MOS6BspPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6bNode != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6BspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6BspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6dNodePrime != 0) && (here->MOS6sNodePrime != 0)) + { + i = here->MOS6DPspPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6DPspStructPtr = matched ; + here->MOS6DPspPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6sNodePrime != 0)) { - while (here->MOS6DPspPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6DPspPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6dNodePrime != 0) && (here->MOS6dNode != 0)) + { + i = here->MOS6DPdPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6DPdStructPtr = matched ; + here->MOS6DPdPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6dNode != 0)) { - while (here->MOS6DPdPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6DPdPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6bNode != 0) && (here->MOS6gNode != 0)) + { + i = here->MOS6BgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6BgStructPtr = matched ; + here->MOS6BgPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6bNode != 0) && (here->MOS6gNode != 0)) { - while (here->MOS6BgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6BgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6dNodePrime != 0) && (here->MOS6gNode != 0)) + { + i = here->MOS6DPgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6DPgStructPtr = matched ; + here->MOS6DPgPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6gNode != 0)) { - while (here->MOS6DPgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6DPgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6sNodePrime != 0) && (here->MOS6gNode != 0)) + { + i = here->MOS6SPgPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6SPgStructPtr = matched ; + here->MOS6SPgPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6gNode != 0)) { - while (here->MOS6SPgPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6SPgPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6sNodePrime != 0) && (here->MOS6sNode != 0)) + { + i = here->MOS6SPsPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6SPsStructPtr = matched ; + here->MOS6SPsPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6sNode != 0)) { - while (here->MOS6SPsPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6SPsPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6dNodePrime != 0) && (here->MOS6bNode != 0)) + { + i = here->MOS6DPbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6DPbStructPtr = matched ; + here->MOS6DPbPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6dNodePrime != 0) && (here->MOS6bNode != 0)) { - while (here->MOS6DPbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6DPbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } + if ((here->MOS6sNodePrime != 0) && (here->MOS6bNode != 0)) + { + i = here->MOS6SPbPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6SPbStructPtr = matched ; + here->MOS6SPbPtr = matched->CSC ; + } - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6bNode != 0)) { - while (here->MOS6SPbPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6SPbPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - - i = 0 ; - if ((here->MOS6sNodePrime != 0) && (here->MOS6dNodePrime != 0)) { - while (here->MOS6SPdpPtr != ckt->CKTmatrix->CKTbind_CSC [i]) i ++ ; - here->MOS6SPdpPtr = ckt->CKTmatrix->CKTbind_CSC_Complex [i] ; - } - } + if ((here->MOS6sNodePrime != 0) && (here->MOS6dNodePrime != 0)) + { + i = here->MOS6SPdpPtr ; + matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; + here->MOS6SPdpStructPtr = matched ; + here->MOS6SPdpPtr = matched->CSC ; + } + } } - return(OK); + + return (OK) ; +} + +int +MOS6bindCSCComplex (GENmodel *inModel, CKTcircuit *ckt) +{ + MOS6model *model = (MOS6model *)inModel ; + MOS6instance *here ; + + NG_IGNORE (ckt) ; + + /* loop through all the MOS6 models */ + for ( ; model != NULL ; model = model->MOS6nextModel) + { + /* loop through all the instances of the model */ + for (here = model->MOS6instances ; here != NULL ; here = here->MOS6nextInstance) + { + if ((here->MOS6dNode != 0) && (here->MOS6dNode != 0)) + here->MOS6DdPtr = here->MOS6DdStructPtr->CSC_Complex ; + + if ((here->MOS6gNode != 0) && (here->MOS6gNode != 0)) + here->MOS6GgPtr = here->MOS6GgStructPtr->CSC_Complex ; + + if ((here->MOS6sNode != 0) && (here->MOS6sNode != 0)) + here->MOS6SsPtr = here->MOS6SsStructPtr->CSC_Complex ; + + if ((here->MOS6bNode != 0) && (here->MOS6bNode != 0)) + here->MOS6BbPtr = here->MOS6BbStructPtr->CSC_Complex ; + + if ((here->MOS6dNodePrime != 0) && (here->MOS6dNodePrime != 0)) + here->MOS6DPdpPtr = here->MOS6DPdpStructPtr->CSC_Complex ; + + if ((here->MOS6sNodePrime != 0) && (here->MOS6sNodePrime != 0)) + here->MOS6SPspPtr = here->MOS6SPspStructPtr->CSC_Complex ; + + if ((here->MOS6dNode != 0) && (here->MOS6dNodePrime != 0)) + here->MOS6DdpPtr = here->MOS6DdpStructPtr->CSC_Complex ; + + if ((here->MOS6gNode != 0) && (here->MOS6bNode != 0)) + here->MOS6GbPtr = here->MOS6GbStructPtr->CSC_Complex ; + + if ((here->MOS6gNode != 0) && (here->MOS6dNodePrime != 0)) + here->MOS6GdpPtr = here->MOS6GdpStructPtr->CSC_Complex ; + + if ((here->MOS6gNode != 0) && (here->MOS6sNodePrime != 0)) + here->MOS6GspPtr = here->MOS6GspStructPtr->CSC_Complex ; + + if ((here->MOS6sNode != 0) && (here->MOS6sNodePrime != 0)) + here->MOS6SspPtr = here->MOS6SspStructPtr->CSC_Complex ; + + if ((here->MOS6bNode != 0) && (here->MOS6dNodePrime != 0)) + here->MOS6BdpPtr = here->MOS6BdpStructPtr->CSC_Complex ; + + if ((here->MOS6bNode != 0) && (here->MOS6sNodePrime != 0)) + here->MOS6BspPtr = here->MOS6BspStructPtr->CSC_Complex ; + + if ((here->MOS6dNodePrime != 0) && (here->MOS6sNodePrime != 0)) + here->MOS6DPspPtr = here->MOS6DPspStructPtr->CSC_Complex ; + + if ((here->MOS6dNodePrime != 0) && (here->MOS6dNode != 0)) + here->MOS6DPdPtr = here->MOS6DPdStructPtr->CSC_Complex ; + + if ((here->MOS6bNode != 0) && (here->MOS6gNode != 0)) + here->MOS6BgPtr = here->MOS6BgStructPtr->CSC_Complex ; + + if ((here->MOS6dNodePrime != 0) && (here->MOS6gNode != 0)) + here->MOS6DPgPtr = here->MOS6DPgStructPtr->CSC_Complex ; + + if ((here->MOS6sNodePrime != 0) && (here->MOS6gNode != 0)) + here->MOS6SPgPtr = here->MOS6SPgStructPtr->CSC_Complex ; + + if ((here->MOS6sNodePrime != 0) && (here->MOS6sNode != 0)) + here->MOS6SPsPtr = here->MOS6SPsStructPtr->CSC_Complex ; + + if ((here->MOS6dNodePrime != 0) && (here->MOS6bNode != 0)) + here->MOS6DPbPtr = here->MOS6DPbStructPtr->CSC_Complex ; + + if ((here->MOS6sNodePrime != 0) && (here->MOS6bNode != 0)) + here->MOS6SPbPtr = here->MOS6SPbStructPtr->CSC_Complex ; + + if ((here->MOS6sNodePrime != 0) && (here->MOS6dNodePrime != 0)) + here->MOS6SPdpPtr = here->MOS6SPdpStructPtr->CSC_Complex ; + } + } + + return (OK) ; } int @@ -312,169 +309,82 @@ MOS6bindCSCComplexToReal (GENmodel *inModel, CKTcircuit *ckt) { MOS6model *model = (MOS6model *)inModel ; MOS6instance *here ; - int i ; - /* loop through all the mos6 models */ + NG_IGNORE (ckt) ; + + /* loop through all the MOS6 models */ for ( ; model != NULL ; model = model->MOS6nextModel) { /* loop through all the instances of the model */ for (here = model->MOS6instances ; here != NULL ; here = here->MOS6nextInstance) { - i = 0 ; if ((here->MOS6dNode != 0) && (here->MOS6dNode != 0)) - { - while (here->MOS6DdPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6DdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6DdPtr = here->MOS6DdStructPtr->CSC ; - i = 0 ; if ((here->MOS6gNode != 0) && (here->MOS6gNode != 0)) - { - while (here->MOS6GgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6GgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6GgPtr = here->MOS6GgStructPtr->CSC ; - i = 0 ; if ((here->MOS6sNode != 0) && (here->MOS6sNode != 0)) - { - while (here->MOS6SsPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6SsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6SsPtr = here->MOS6SsStructPtr->CSC ; - i = 0 ; if ((here->MOS6bNode != 0) && (here->MOS6bNode != 0)) - { - while (here->MOS6BbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6BbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6BbPtr = here->MOS6BbStructPtr->CSC ; - i = 0 ; if ((here->MOS6dNodePrime != 0) && (here->MOS6dNodePrime != 0)) - { - while (here->MOS6DPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6DPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6DPdpPtr = here->MOS6DPdpStructPtr->CSC ; - i = 0 ; if ((here->MOS6sNodePrime != 0) && (here->MOS6sNodePrime != 0)) - { - while (here->MOS6SPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6SPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6SPspPtr = here->MOS6SPspStructPtr->CSC ; - i = 0 ; if ((here->MOS6dNode != 0) && (here->MOS6dNodePrime != 0)) - { - while (here->MOS6DdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6DdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6DdpPtr = here->MOS6DdpStructPtr->CSC ; - i = 0 ; if ((here->MOS6gNode != 0) && (here->MOS6bNode != 0)) - { - while (here->MOS6GbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6GbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6GbPtr = here->MOS6GbStructPtr->CSC ; - i = 0 ; if ((here->MOS6gNode != 0) && (here->MOS6dNodePrime != 0)) - { - while (here->MOS6GdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6GdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6GdpPtr = here->MOS6GdpStructPtr->CSC ; - i = 0 ; if ((here->MOS6gNode != 0) && (here->MOS6sNodePrime != 0)) - { - while (here->MOS6GspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6GspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6GspPtr = here->MOS6GspStructPtr->CSC ; - i = 0 ; if ((here->MOS6sNode != 0) && (here->MOS6sNodePrime != 0)) - { - while (here->MOS6SspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6SspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6SspPtr = here->MOS6SspStructPtr->CSC ; - i = 0 ; if ((here->MOS6bNode != 0) && (here->MOS6dNodePrime != 0)) - { - while (here->MOS6BdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6BdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6BdpPtr = here->MOS6BdpStructPtr->CSC ; - i = 0 ; if ((here->MOS6bNode != 0) && (here->MOS6sNodePrime != 0)) - { - while (here->MOS6BspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6BspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6BspPtr = here->MOS6BspStructPtr->CSC ; - i = 0 ; if ((here->MOS6dNodePrime != 0) && (here->MOS6sNodePrime != 0)) - { - while (here->MOS6DPspPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6DPspPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6DPspPtr = here->MOS6DPspStructPtr->CSC ; - i = 0 ; if ((here->MOS6dNodePrime != 0) && (here->MOS6dNode != 0)) - { - while (here->MOS6DPdPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6DPdPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6DPdPtr = here->MOS6DPdStructPtr->CSC ; - i = 0 ; if ((here->MOS6bNode != 0) && (here->MOS6gNode != 0)) - { - while (here->MOS6BgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6BgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6BgPtr = here->MOS6BgStructPtr->CSC ; - i = 0 ; if ((here->MOS6dNodePrime != 0) && (here->MOS6gNode != 0)) - { - while (here->MOS6DPgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6DPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6DPgPtr = here->MOS6DPgStructPtr->CSC ; - i = 0 ; if ((here->MOS6sNodePrime != 0) && (here->MOS6gNode != 0)) - { - while (here->MOS6SPgPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6SPgPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6SPgPtr = here->MOS6SPgStructPtr->CSC ; - i = 0 ; if ((here->MOS6sNodePrime != 0) && (here->MOS6sNode != 0)) - { - while (here->MOS6SPsPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6SPsPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6SPsPtr = here->MOS6SPsStructPtr->CSC ; - i = 0 ; if ((here->MOS6dNodePrime != 0) && (here->MOS6bNode != 0)) - { - while (here->MOS6DPbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6DPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6DPbPtr = here->MOS6DPbStructPtr->CSC ; - i = 0 ; if ((here->MOS6sNodePrime != 0) && (here->MOS6bNode != 0)) - { - while (here->MOS6SPbPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6SPbPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6SPbPtr = here->MOS6SPbStructPtr->CSC ; - i = 0 ; if ((here->MOS6sNodePrime != 0) && (here->MOS6dNodePrime != 0)) - { - while (here->MOS6SPdpPtr != ckt->CKTmatrix->CKTbind_CSC_Complex [i]) i ++ ; - here->MOS6SPdpPtr = ckt->CKTmatrix->CKTbind_CSC [i] ; - } + here->MOS6SPdpPtr = here->MOS6SPdpStructPtr->CSC ; } } return (OK) ; -} \ No newline at end of file +} diff --git a/src/spicelib/devices/mos6/mos6defs.h b/src/spicelib/devices/mos6/mos6defs.h index d03070a81..3dedc89df 100644 --- a/src/spicelib/devices/mos6/mos6defs.h +++ b/src/spicelib/devices/mos6/mos6defs.h @@ -195,6 +195,31 @@ typedef struct sMOS6instance { #define MOS6dphibs_dw MOS6sens + 68 #define MOS6dphibd_dw MOS6sens + 69 +#ifdef KLU + BindElement *MOS6DdStructPtr ; + BindElement *MOS6GgStructPtr ; + BindElement *MOS6SsStructPtr ; + BindElement *MOS6BbStructPtr ; + BindElement *MOS6DPdpStructPtr ; + BindElement *MOS6SPspStructPtr ; + BindElement *MOS6DdpStructPtr ; + BindElement *MOS6GbStructPtr ; + BindElement *MOS6GdpStructPtr ; + BindElement *MOS6GspStructPtr ; + BindElement *MOS6SspStructPtr ; + BindElement *MOS6BdpStructPtr ; + BindElement *MOS6BspStructPtr ; + BindElement *MOS6DPspStructPtr ; + BindElement *MOS6DPdStructPtr ; + BindElement *MOS6BgStructPtr ; + BindElement *MOS6DPgStructPtr ; + BindElement *MOS6SPgStructPtr ; + BindElement *MOS6SPsStructPtr ; + BindElement *MOS6DPbStructPtr ; + BindElement *MOS6SPbStructPtr ; + BindElement *MOS6SPdpStructPtr ; +#endif + } MOS6instance ; #define MOS6vbd MOS6states+ 0 /* bulk-drain voltage */