From 5c26919de17b77eb0468784171128a423abf83cc Mon Sep 17 00:00:00 2001 From: pnenzi Date: Mon, 8 Dec 2003 18:28:00 +0000 Subject: [PATCH] Re-added some defines. --- src/spicelib/devices/mos6/mos6load.c | 37 ++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/spicelib/devices/mos6/mos6load.c b/src/spicelib/devices/mos6/mos6load.c index 5a7a5a3c5..8e738e416 100644 --- a/src/spicelib/devices/mos6/mos6load.c +++ b/src/spicelib/devices/mos6/mos6load.c @@ -73,12 +73,24 @@ MOS6load(GENmodel *inModel, CKTcircuit *ckt) double capgd; /* total gate-drain capacitance */ double capgb; /* total gate-bulk capacitance */ int Check; +#ifndef NOBYPASS double tempv; +#endif /*NOBYPASS*/ int error; +#ifdef CAPBYPASS + int senflag; +#endif /* CAPBYPASS */ int SenCond; int m; +#ifdef CAPBYPASS + senflag = 0; + if(ckt->CKTsenInfo && ckt->CKTsenInfo->SENstatus == PERTURBATION && + (ckt->CKTsenInfo->SENmode & (ACSEN | TRANSEN))) { + senflag = 1; + } +#endif /* CAPBYPASS */ /* loop through all the MOS6 device models */ for( ; model != NULL; model = model->MOS6nextModel ) { @@ -260,7 +272,7 @@ MOS6load(GENmodel *inModel, CKTcircuit *ckt) /* */ - +#ifndef NOBYPASS /* now lets see if we can bypass (ugh) */ /* the following mess should be one if statement, but * many compilers can't handle it all at once, so it @@ -288,7 +300,7 @@ MOS6load(GENmodel *inModel, CKTcircuit *ckt) if( (fabs(cdhat- here->MOS6cd) < ckt->CKTreltol * MAX(fabs(cdhat),fabs( here->MOS6cd)) + ckt->CKTabstol) ) { - /* bypass code */ + /* bypass code * /* nothing interesting has changed since last * iteration on this device, so we just * copy all the values computed last iteration out @@ -320,6 +332,7 @@ MOS6load(GENmodel *inModel, CKTcircuit *ckt) } goto bypass; } +#endif /*NOBYPASS*/ /* */ @@ -556,9 +569,17 @@ next1: if(vbs <= -3*vt) { * *.. bulk-drain and bulk-source depletion capacitances */ +#ifdef CAPBYPASS + if(((ckt->CKTmode & (MODEINITPRED | MODEINITTRAN) ) || + FABS(delvbs) >= ckt->CKTreltol * MAX(FABS(vbs), + FABS(*(ckt->CKTstate0+here->MOS6vbs)))+ + ckt->CKTvoltTol)|| senflag) +#endif /*CAPBYPASS*/ { /* can't bypass the diode capacitance calculations */ +#ifdef CAPZEROBYPASS if(here->MOS6Cbs != 0 || here->MOS6Cbssw != 0 ) { +#endif /*CAPZEROBYPASS*/ if (vbs < here->MOS6tDepCap){ arg=1-vbs/here->MOS6tBulkPot; /* @@ -610,14 +631,24 @@ next1: if(vbs <= -3*vt) { vbs*(here->MOS6f2s+vbs*(here->MOS6f3s/2)); here->MOS6capbs=here->MOS6f2s+here->MOS6f3s*vbs; } +#ifdef CAPZEROBYPASS } else { *(ckt->CKTstate0 + here->MOS6qbs) = 0; here->MOS6capbs=0; } +#endif /*CAPZEROBYPASS*/ } +#ifdef CAPBYPASS + if(((ckt->CKTmode & (MODEINITPRED | MODEINITTRAN) ) || + FABS(delvbd) >= ckt->CKTreltol * MAX(FABS(vbd), + FABS(*(ckt->CKTstate0+here->MOS6vbd)))+ + ckt->CKTvoltTol)|| senflag) +#endif /*CAPBYPASS*/ /* can't bypass the diode capacitance calculations */ { +#ifdef CAPZEROBYPASS if(here->MOS6Cbd != 0 || here->MOS6Cbdsw != 0 ) { +#endif /*CAPZEROBYPASS*/ if (vbd < here->MOS6tDepCap) { arg=1-vbd/here->MOS6tBulkPot; /* @@ -664,10 +695,12 @@ next1: if(vbs <= -3*vt) { vbd * (here->MOS6f2d + vbd * here->MOS6f3d/2); here->MOS6capbd=here->MOS6f2d + vbd * here->MOS6f3d; } +#ifdef CAPZEROBYPASS } else { *(ckt->CKTstate0 + here->MOS6qbd) = 0; here->MOS6capbd = 0; } +#endif /*CAPZEROBYPASS*/ } /*