Fixed a divide-by-zero bug in the MOS level=2 device model. The fix was supplied by Hitoshi Tanaka.

This commit is contained in:
sjborley 2005-05-23 20:30:43 +00:00
parent 11e978a77e
commit 3c0fab2bfb
2 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,7 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1988 Jaijeet S Roychowdhury
Modified: 2000 AlansFixes
$Id$
**********/
#include "ngspice.h"
@ -367,6 +368,8 @@ d_p.d3_pqr = 0.0;
InvDeriv(&d_dbrgdb,&d_barg);
TimesDeriv(&d_dbrgdb,&d_dbrgdb,-0.5);
} else {
sphi = sqrt(here->MOS2tPhi); /* added by HT 050523 */
sphi3 = here->MOS2tPhi*sphi; /* added by HT 050523 */
barg = sphi/(1.0+0.5*(lvbs-lvds)/here->MOS2tPhi);
EqualDeriv(&d_barg,&d_q); d_barg.value = lvbs - lvds;
d_barg.d1_r -= 1.0;

View File

@ -2,6 +2,7 @@
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles
Modified: 2000 alansFixes
$Id$
**********/
#include "ngspice.h"
@ -584,6 +585,8 @@ next1: if(vbs <= -3*vt) {
dbrgdb = -0.5/barg;
d2bdb2 = 0.5*dbrgdb/(phiMinVbs+lvds);
} else {
sphi = sqrt(here->MOS2tPhi);/* added by HT 050523 */
sphi3 = here->MOS2tPhi*sphi;/* added by HT 050523 */
barg = sphi/(1.0+0.5*(lvbs-lvds)/here->MOS2tPhi);
tmp = barg/sphi3;
dbrgdb = -0.5*barg*tmp;
@ -829,6 +832,8 @@ line500:
bsarg = sqrt(vdsat+phiMinVbs);
dbsrdb = -0.5/bsarg;
} else {
sphi = sqrt(here->MOS2tPhi);/* added by HT 050523 */
sphi3 = here->MOS2tPhi*sphi;/* added by HT 050523 */
bsarg = sphi/(1.0+0.5*(lvbs-vdsat)/here->MOS2tPhi);
dbsrdb = -0.5*bsarg*bsarg/sphi3;
}