From 10f4eeed4a17ea5904b64080670940638066b474 Mon Sep 17 00:00:00 2001 From: dwarning Date: Mon, 28 Jul 2025 00:07:07 +0200 Subject: [PATCH] diode needs both current components (bottom and sidewall) for Vcrit and breakdown voltage calculation --- src/spicelib/devices/dio/diotemp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/spicelib/devices/dio/diotemp.c b/src/spicelib/devices/dio/diotemp.c index c49d77cc9..30a47405b 100644 --- a/src/spicelib/devices/dio/diotemp.c +++ b/src/spicelib/devices/dio/diotemp.c @@ -196,7 +196,8 @@ void DIOtempUpdate(DIOmodel *inModel, DIOinstance *here, double Temp, CKTcircuit here->DIOtDepSWCap=model->DIOdepletionSWcapCoeff* here->DIOtJctSWPot; /* and Vcrit */ - here->DIOtVcrit = vte * log(vte/(CONSTroot2*here->DIOtSatCur)); + double totalSatCur = here->DIOtSatCur + here->DIOtSatSWCur; + here->DIOtVcrit = vte * log(vte/(CONSTroot2*totalSatCur)); /* and now to compute the breakdown voltage, again, using * temperature adjusted basic parameters */ @@ -211,9 +212,9 @@ void DIOtempUpdate(DIOmodel *inModel, DIOinstance *here, double Temp, CKTcircuit } else { /* level=3 */ cbv = model->DIObreakdownCurrent * here->DIOarea * here->DIOm; } - if (cbv < here->DIOtSatCur * tBreakdownVoltage/vt) { + if (cbv < totalSatCur * tBreakdownVoltage/vt) { #ifdef TRACE - cbv=here->DIOtSatCur * tBreakdownVoltage/vt; + cbv=totalSatCur * tBreakdownVoltage/vt; SPfrontEnd->IFerrorf (ERR_WARNING, "%s: breakdown current increased to %g to resolve", here->DIOname, cbv); SPfrontEnd->IFerrorf (ERR_WARNING, "incompatibility with specified saturation current"); @@ -222,11 +223,11 @@ void DIOtempUpdate(DIOmodel *inModel, DIOinstance *here, double Temp, CKTcircuit } else { tol=ckt->CKTreltol*cbv; xbv=tBreakdownVoltage-model->DIObrkdEmissionCoeff*vt*log(1+cbv/ - (here->DIOtSatCur)); + totalSatCur); for(iter=0 ; iter < 25 ; iter++) { xbv=tBreakdownVoltage-model->DIObrkdEmissionCoeff*vt*log(cbv/ - (here->DIOtSatCur)+1-xbv/vt); - xcbv=here->DIOtSatCur * + totalSatCur+1-xbv/vt); + xcbv=totalSatCur * (exp((tBreakdownVoltage-xbv)/(model->DIObrkdEmissionCoeff*vt))-1+xbv/vt); if (fabs(xcbv-cbv) <= tol) goto matched; }