diff --git a/src/spicelib/devices/hicum2/hicum2acld.c b/src/spicelib/devices/hicum2/hicum2acld.c index f738f9755..65aaa7faf 100644 --- a/src/spicelib/devices/hicum2/hicum2acld.c +++ b/src/spicelib/devices/hicum2/hicum2acld.c @@ -50,7 +50,7 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) double Ibpbi_Vbiei; double Ibpbi_Vrth; - double Isis_Vsis, Isis_Vrth; + double Isis_Vsis; double Icic_Vcic, Icic_Vrth; double Ieie_Veie, Ieie_Vrth; double Ibbp_Vbbp, Ibbp_Vrth; @@ -128,15 +128,32 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) here = HICUMnextInstance(here)) { // get all derivatives of branch DC currents - Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; - Icic_Vcic = 1/here->HICUMrcx_t.rpart; - Ieie_Veie = 1/here->HICUMre_t.rpart; - Isis_Vsis = 1/model->HICUMrsu; - - Ibbp_Vrth = -*(ckt->CKTstate0 + here->HICUMvbbp)/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart*here->HICUMrbx_t.dpart; - Icic_Vrth = -*(ckt->CKTstate0 + here->HICUMvcic)/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart*here->HICUMrcx_t.dpart; - Ieie_Vrth = -*(ckt->CKTstate0 + here->HICUMveie)/here->HICUMre_t.rpart/here->HICUMre_t.rpart*here->HICUMre_t.dpart; - Isis_Vrth = 0.0; + if(model->HICUMrcxGiven && model->HICUMrcx != 0) { + Icic_Vcic = 1/here->HICUMrcx_t.rpart; + Icic_Vrth = -*(ckt->CKTstate0 + here->HICUMvcic)/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart*here->HICUMrcx_t.dpart; + } else { + Icic_Vcic = 0.0; + Icic_Vrth = 0.0; + } + if(model->HICUMrbxGiven && model->HICUMrbx != 0) { + Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; + Ibbp_Vrth = -*(ckt->CKTstate0 + here->HICUMvbbp)/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart*here->HICUMrbx_t.dpart; + } else { + Ibbp_Vbbp = 0.0; + Ibbp_Vrth = 0.0; + } + if(model->HICUMreGiven && model->HICUMre != 0) { + Ieie_Veie = 1/here->HICUMre_t.rpart; + Ieie_Vrth = -*(ckt->CKTstate0 + here->HICUMveie)/here->HICUMre_t.rpart/here->HICUMre_t.rpart*here->HICUMre_t.dpart; + } else { + Ieie_Veie = 0.0; + Ieie_Vrth = 0.0; + } + if(model->HICUMrsuGiven && model->HICUMrsu != 0) { + Isis_Vsis = 1/model->HICUMrsu; + } else { + Isis_Vsis = 0.0; + } Ibiei_Vbiei = *(ckt->CKTstate0 + here->HICUMibiei_Vbiei); Ibiei_Vbici = *(ckt->CKTstate0 + here->HICUMibiei_Vbici); diff --git a/src/spicelib/devices/hicum2/hicum2mpar.c b/src/spicelib/devices/hicum2/hicum2mpar.c index 9bcb0643b..2b02a463c 100644 --- a/src/spicelib/devices/hicum2/hicum2mpar.c +++ b/src/spicelib/devices/hicum2/hicum2mpar.c @@ -201,7 +201,6 @@ HICUMmParam(int param, IFvalue *value, GENmodel *inModel) break; case HICUM_MOD_RBX: model->HICUMrbx = value->rValue; - if (model->HICUMrbx < MIN_R) model->HICUMrbx = MIN_R; model->HICUMrbxGiven = TRUE; break; case HICUM_MOD_FGEO: @@ -222,12 +221,10 @@ HICUMmParam(int param, IFvalue *value, GENmodel *inModel) break; case HICUM_MOD_RE: model->HICUMre = value->rValue; - if (model->HICUMre < MIN_R) model->HICUMre = MIN_R; model->HICUMreGiven = TRUE; break; case HICUM_MOD_RCX: model->HICUMrcx = value->rValue; - if (model->HICUMrcx < MIN_R) model->HICUMrcx = MIN_R; model->HICUMrcxGiven = TRUE; break; @@ -256,7 +253,6 @@ HICUMmParam(int param, IFvalue *value, GENmodel *inModel) //Intra-device substrate coupling case HICUM_MOD_RSU: model->HICUMrsu = value->rValue; - if (model->HICUMrsu < MIN_R) model->HICUMrsu = MIN_R; model->HICUMrsuGiven = TRUE; break; case HICUM_MOD_CSU: diff --git a/src/spicelib/devices/hicum2/hicum2noise.c b/src/spicelib/devices/hicum2/hicum2noise.c index f01c74ddd..37c0521ff 100644 --- a/src/spicelib/devices/hicum2/hicum2noise.c +++ b/src/spicelib/devices/hicum2/hicum2noise.c @@ -69,11 +69,28 @@ HICUMnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata for (inst=HICUMinstances(model); inst != NULL; inst=HICUMnextInstance(inst)) { - Icic_Vcic = 1/inst->HICUMrcx_t.rpart; - Ibbp_Vbbp = 1/inst->HICUMrbx_t.rpart; + // get all derivatives of branch DC currents + if(model->HICUMrcxGiven && model->HICUMrcx != 0) { + Icic_Vcic = 1/inst->HICUMrcx_t.rpart; + } else { + Icic_Vcic = 0.0; + } + if(model->HICUMrbxGiven && model->HICUMrbx != 0) { + Ibbp_Vbbp = 1/inst->HICUMrbx_t.rpart; + } else { + Ibbp_Vbbp = 0.0; + } + if(model->HICUMreGiven && model->HICUMre != 0) { + Ieie_Veie = 1/inst->HICUMre_t.rpart; + } else { + Ieie_Veie = 0.0; + } + if(model->HICUMrsuGiven && model->HICUMrsu != 0) { + Isis_Vsis = 1/model->HICUMrsu; + } else { + Isis_Vsis = 0.0; + } Ibpbi_Vbpbi = 1/inst->HICUMrbi; - Ieie_Veie = 1/inst->HICUMre_t.rpart; - Isis_Vsis = 1/model->HICUMrsu; switch (operation) { diff --git a/src/spicelib/devices/hicum2/hicum2pzld.c b/src/spicelib/devices/hicum2/hicum2pzld.c index 7d395c584..34c344624 100644 --- a/src/spicelib/devices/hicum2/hicum2pzld.c +++ b/src/spicelib/devices/hicum2/hicum2pzld.c @@ -50,7 +50,7 @@ HICUMpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double Ibpbi_Vbiei; double Ibpbi_Vrth; - double Isis_Vsis, Isis_Vrth; + double Isis_Vsis; double Icic_Vcic, Icic_Vrth; double Ieie_Veie, Ieie_Vrth; double Ibbp_Vbbp, Ibbp_Vrth; @@ -117,8 +117,6 @@ HICUMpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double Ith_Vrth, Ith_Vbiei, Ith_Vbici, Ith_Vbpbi, Ith_Vbpci, Ith_Vbpei, Ith_Vciei, Ith_Vsici, Ith_Vcic, Ith_Vbbp, Ith_Veie; - - /* loop through all the models */ for( ; model != NULL; model = HICUMnextModel(model)) { @@ -130,15 +128,32 @@ HICUMpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) here = HICUMnextInstance(here)) { // get all derivatives of branch DC currents - Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; - Icic_Vcic = 1/here->HICUMrcx_t.rpart; - Ieie_Veie = 1/here->HICUMre_t.rpart; - Isis_Vsis = 1/model->HICUMrsu; - - Ibbp_Vrth = -*(ckt->CKTstate0 + here->HICUMvbbp)/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart*here->HICUMrbx_t.dpart; - Icic_Vrth = -*(ckt->CKTstate0 + here->HICUMvcic)/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart*here->HICUMrcx_t.dpart; - Ieie_Vrth = -*(ckt->CKTstate0 + here->HICUMveie)/here->HICUMre_t.rpart/here->HICUMre_t.rpart*here->HICUMre_t.dpart; - Isis_Vrth = 0.0; + if(model->HICUMrcxGiven && model->HICUMrcx != 0) { + Icic_Vcic = 1/here->HICUMrcx_t.rpart; + Icic_Vrth = -*(ckt->CKTstate0 + here->HICUMvcic)/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart*here->HICUMrcx_t.dpart; + } else { + Icic_Vcic = 0.0; + Icic_Vrth = 0.0; + } + if(model->HICUMrbxGiven && model->HICUMrbx != 0) { + Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; + Ibbp_Vrth = -*(ckt->CKTstate0 + here->HICUMvbbp)/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart*here->HICUMrbx_t.dpart; + } else { + Ibbp_Vbbp = 0.0; + Ibbp_Vrth = 0.0; + } + if(model->HICUMreGiven && model->HICUMre != 0) { + Ieie_Veie = 1/here->HICUMre_t.rpart; + Ieie_Vrth = -*(ckt->CKTstate0 + here->HICUMveie)/here->HICUMre_t.rpart/here->HICUMre_t.rpart*here->HICUMre_t.dpart; + } else { + Ieie_Veie = 0.0; + Ieie_Vrth = 0.0; + } + if(model->HICUMrsuGiven && model->HICUMrsu != 0) { + Isis_Vsis = 1/model->HICUMrsu; + } else { + Isis_Vsis = 0.0; + } Ibiei_Vbiei = *(ckt->CKTstate0 + here->HICUMibiei_Vbiei); Ibiei_Vbici = *(ckt->CKTstate0 + here->HICUMibiei_Vbici); diff --git a/src/spicelib/devices/hicum2/hicumL2.cpp b/src/spicelib/devices/hicum2/hicumL2.cpp index e31f0e251..59adf238e 100644 --- a/src/spicelib/devices/hicum2/hicumL2.cpp +++ b/src/spicelib/devices/hicum2/hicumL2.cpp @@ -2443,7 +2443,11 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) } else { here->HICUMbetadc=0.0; } - Ieie = Veie/here->HICUMre_t.rpart; // only needed for re flicker noise + if (here->HICUMre_t.rpart >= MIN_R) { + Ieie = Veie/here->HICUMre_t.rpart; // only needed for re flicker noise + } else { + Ieie = 0.0; + } //Diode current for s-c junction (si,ci) hicum_diode(Temp,here->HICUMiscs_t,model->HICUMmsc, Vsici, &ijsc, &ijsc_Vsici, &ijsc_Vrth); @@ -2578,14 +2582,33 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) // Load_sources //resistors - Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; - Icic_Vcic = 1/here->HICUMrcx_t.rpart; - Ieie_Veie = 1/here->HICUMre_t.rpart; - Isis_Vsis = 1/model->HICUMrsu; + if(model->HICUMrcxGiven && model->HICUMrcx != 0) { + Icic_Vcic = 1/here->HICUMrcx_t.rpart; + Icic_Vrth = -Vcic*here->HICUMrcx_t.dpart/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart; + } else { + Icic_Vcic = 0.0; + Icic_Vrth = 0.0; + } + if(model->HICUMrbxGiven && model->HICUMrbx != 0) { + Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; + Ibbp_Vrth = -Vbbp*here->HICUMrbx_t.dpart/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart; + } else { + Ibbp_Vbbp = 0.0; + Ibbp_Vrth = 0.0; + } + if(model->HICUMreGiven && model->HICUMre != 0) { + Ieie_Veie = 1/here->HICUMre_t.rpart; + Ieie_Vrth = -Veie*here->HICUMre_t.dpart /here->HICUMre_t.rpart/here->HICUMre_t.rpart; + } else { + Ieie_Veie = 0.0; + Ieie_Vrth = 0.0; + } + if(model->HICUMrsuGiven && model->HICUMrsu != 0) { + Isis_Vsis = 1/model->HICUMrsu; + } else { + Isis_Vsis = 0.0; + } - Ibbp_Vrth = -Vbbp*here->HICUMrbx_t.dpart/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart; - Ieie_Vrth = -Veie*here->HICUMre_t.dpart /here->HICUMre_t.rpart/here->HICUMre_t.rpart; - Icic_Vrth = -Vcic*here->HICUMrcx_t.dpart/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart; Ibpei = model->HICUMtype*ibep; Ibpei += model->HICUMtype*irep;