Re: [ng-spice-devel] Patches


To <ng-spice-devel@ieee.ing.uniroma1.it>
From Al Davis <aldavis@ieee.org>
Date Fri, 13 Oct 2000 13:14:33 -0700
Delivered-To mailing list ng-spice-devel@ieee.ing.uniroma1.it
In-Reply-To <006001c03501$91077b80$69754789@edin_alans.analog.com >
Mailing-List contact ng-spice-devel-help@ieee.ing.uniroma1.it; run by ezmlm
References <006001c03501$91077b80$69754789@edin_alans.analog.com >
Reply-To ng-spice-devel@ieee.ing.uniroma1.it

On Fri, 13 Oct 2000, Alan Gillespie wrote:
> >Not in the version I'm looking at :-) When the diode voltage crosses
> >zero the current jumps from -satcur to zero.
> 
> Oops, I think I'm talking rubbish. That wasn't the original code. It's
> all so long ago I can't remember. Looking at what I now think is the
> original code -
> 
> next1:      if(vbs <= 0) {
>                 here->MOS9gbs = SourceSatCur/vt;
>                 here->MOS9cbs = here->MOS9gbs*vbs;
>                 here->MOS9gbs += ckt->CKTgmin;
>             } else {
>                 evbs = exp(MIN(MAX_EXP_ARG,vbs/vt));
>                 here->MOS9gbs = SourceSatCur*evbs/vt + ckt->CKTgmin;
>                 here->MOS9cbs = SourceSatCur * (evbs-1);
>             }
> 
> sets the reverse gbs so that the reverse current will be -
> 
> SourceSatCur * Vbs/vt
> 
> Am I reading that correctly ? That's not how a diode is supposed
> to behave, is it ?

That says it is like a resistor in the reverse region, with R =
vt/SourceSatCur ..   This is reasonable.

The parasitic diode has other purposes in addition to acting like a
diode.  It provides a form of limiting and tweeks the parameters for
hopefully better convergence.  This one is the equivalent of some
parallel resistance, to help convergence in the case where mosfets
are connected in series such as on the series side of a gate.  When
both are off, the result is an open circuit.  By putting some
shunt conductance in the diode, it provides some way to compute a
voltage at this node.

What I was referring to is that gmin is included in the derivative,
but not in the current.  This is fixed later.  Spaghetti code.

            /*
             *  load current vector
             */
            ceqbs = model->MOS3type * 
                    (here->MOS3cbs-(here->MOS3gbs-ckt->CKTgmin)*vbs);
            ceqbd = model->MOS3type * 
                    (here->MOS3cbd-(here->MOS3gbd-ckt->CKTgmin)*vbd);


> All my rambling about fixed reverse currents was actually about
> my first simple attempt to fix the above. So just ignore that :-)

The rambling about fixed reverse currents makes some sense.  That is
one reason that the model must have some shunt conductance, and what
you get from gmin is not enough.

> Anyway, as I said, the diodes in the mosfets should now work
> in the same way as the actual diode model. That's reasonable,
> isn't it ?

Maybe.  Maybe not.

In ACS, there is another parameter in the MOS model: "diode".  By
default, diode == level, but you can change it.  For example, for a
MOS3 model (level=3) setting diode=7 uses the diode that ordinarily
goes with MOS level 7 (BSIM3).  Setting diode=0 uses a "proper"
diode, as in the diode device.  The charge effects are partly this
way, too (Cmodel) but incomplete.

The ACS diode code is a mess.  I have not changed it to use the model
compiler yet.

There is too much in that Spice "load" function.  Even Spice 2 was
better in this area.

al.


Partial thread listing: