Re: [ng-spice-devel] Patches


To <ng-spice-devel@ieee.ing.uniroma1.it>
From "Alan Gillespie" <alan.gillespie@analog.com>
Date Fri, 13 Oct 2000 10:55:08 +0100
Delivered-To mailing list ng-spice-devel@ieee.ing.uniroma1.it
Mailing-List contact ng-spice-devel-help@ieee.ing.uniroma1.it; run by ezmlm
Reply-To ng-spice-devel@ieee.ing.uniroma1.it

>The diodes were correct in 3f4.  

Not in the version I'm looking at :-) When the diode voltage crosses
zero the current jumps from -satcur to zero. I think that this is the main
cause of convergance failures due to the MOS diode model.
If you have a tri-stated output, there are basically two reversed
diodes "fighting" each other. In the original code, each diode can
only run at it's specific reverse "satcur". Therefore there is no solution
to the final voltage level of the tri-stated node, even though the
artificially low gbx tells the program to try again at a slightly different
voltage.

>The current is incorrect at line 450 and vicinity, but corrected
>later when it is loaded (near line 1275).

>Spaghetti code strikes again.
>
>This means if you changed it, it is now incorrect.

You may be right, but I've done it the obvious way.

>Actually, the trick of not making the current and derivative match is
>often used as a convergence enhancer.  You can get sort of a
>pseudo-transient effect.

I did wonder if this was the reasoning behind it, i.e. lowering the
"impedance" on those nodes, but my reasoning was that if you
do that, it's only going to slow down convergance, 'cos each
iteration is only going to change the node voltage by a much smaller
amount than it really needs to, in order to get to the right answer.
That is, the error current at that node will be applied to an artificially
high conductance, thus the next "guess" will not be much better
than the last one.

But the other reason to get it right is that the gbx value in the
original code becomes very low as the reverse diode voltage
approaches zero. The spice AC analysis uses this artificial
gbx, so if you've got an unbiased node with a mosfet diode at
a miniscule reverse voltage, any capacitive feedthrough is
blocked by the low conductance. So the simulation is wrong.

>1,2,3,6 all have the same diode models.

I think I "fixed" them all ;-) They now all work just like the spice
diode model, which it seemed reasonable to take as the "reference"
model for a diode. (Unless I made a mistake in my implementation)

>Regarding the gds, etc.  changes ......    I don't know whether it is
>correct as is or not, but believe that it may not be.  If you change
>it, it is no longer MOS3.  This is a legacy model, and should be
>preserved, bugs and all.

gds, gm, and gbs were all incorrect. HSPICE fixed this by using
numerical differentiation to get the correct values. There's an
option to use the original calculated g's, but I don't know why
you'd want to do that. PSPICE have also attempted to improve
their computation of gm/gds/gmb, but, as far as I could make
out, they're not exactly correct, but within 5-10%, which is certainly
close enough for gain calculations. (within 1dB)

But you're right about the legacy model bit, to the extent that I have
created a MOS9 model to take more changes that I've added.
Unfortunately, as you may have read on the newsgroup, I gave
Paolo the wrong version of my code. We'll get round to fixing
that soon.

But I stand by my "corrections" to the MOS3 model. The MOS9
model, when we get it in, should contain the "improvements",
for instance, the fix for the gds discontinuity.

I had the same consideration in the fix for a discontinuity in the
MOS2 model. There's a condition which is highlighted by the
body effect if the vbs is positive. This causes a discontinuity of
the drain current as vgs crosses a threshold voltage. Tracking
down the cause of this shows that the code calculates an
elaborate Vt, but doesn't actually use it in the calculation of
Vgs-Vt. It does, however, use it when it decides whether the
device is off, i.e. it doesn't need to calculate Id. It looks to me
(though I'm no expert) that the body effect, or at least part of
it, is missing from the MOS2 model. I could have fixed it, but
that would have actually changed the DC curves in the normal
operating region. So I just fixed the discontinuity, which only
changes the DC curves of the model in an obscure region
where the body effect is reducing Vt (i.e. the bulk is higher
than the source).

However, this also highlights the fact that we should maybe
have some kind of "approval" mechanism for significant
changes like this. My lack of documentation didn't help
things, so I'll try to get round to providing some.

What do people think ?

Alan


Partial thread listing: