|Physics and Astronomy||
|Physics Home||Study here||Our Teaching||Our Research||Our Centres||News||Work here||EMPS|
Back to top
SPICE 3 User's Manual - Appendix D
This appendix is based, with his kind permission, on Ned Forrester's collection of bugs and patches to Spice 3f4. Please email me further contributions and corrections for inclusion.
Demonstration filesCredit: Berkeley and Paolo Nenzi
There is a useful collection of spice source files which demonstrate known bugs in Spice3f5. They are based on the contents of ftp://ic.eecs.berkeley.edu/pub/Spice3/qxdir.tar.z
The evolution of Spice from 3f4 to 3f5Credit: Beorn Johnson
The last official version of Spice is 3f5 but for a while it was distributed under the name of 3f4. The last few patches (one of which is actually rather important for initial conditions to work right) were not done in the same way previous sets of patches were done. In particular, the version file (which is in an obscure location) wasn't updated. This causes lots of confusion, since you can't tell if you have an updated version of 3f4 or not -- so when you apply the patches, BE CAREFUL.
The patches from 3f4 to 3f5 are available and from Berkeley, but they move around a bit so there is a copy here [patches1.txt]. Each patch should be applied separately. To update the 'version' to 3f5, change the file 'util/skeleton/make_def.bd'; edit the line with "VERSION = 3f4".
Arbitrary Source state bugCredit: Beorn Johnson, Eckhard Brass
2 bugs in the arbitrary source code are illustrated by
Eckhard Brass noted:
Beorn Johnson provided some fixes for the asrc code [patches3.txt]. However, even after these are applied, the branch currents reported by show are unreliable -- this has to do with the fact that the current (amps) output of a current source isn't a state variable.
Bug: plot foo vs -bar is interpreted as plot foo (vs-bar) which is incorrect unless someone has unwisely defined a vector named
Fix: Workround: plot foo vs (-bar)
Bug: where causes crashes if there is no unconverged node to report.
Fix: Provide appropriate tests in where.c [patches10.txt].
Recognition of scale factors in arbitrary sourceCredit: Ned Forrester, Beorn Johnson, CDHW
Bug: Scale factors (e.g. m, k, meg, etc.) for constants in arbitrary sources (b devices) are not recognized.
Fix: Changes to inpgtok.c and inpptree.c, as supplied by Berkeley as patch for 3e2. [patches5.txt]
B.J. vaguely recalled that there was some problem/conflict with this patch, possibly occuring when you try to expand a subcircuit containing a nonlinear source that has scale factors in it.
CDHW: The root cause of several problems is the fact that the parser doesn't correctly interpret 'v(44bb)' which is the value of node 44bb, and '44bb*v(3)' which is either a syntax error or 44 times the value of node 3 depending on your philosophy. The patch5.txt version doesn't deal with v(foo,bar) correctly either. A more radical overhaul is needed to sort things out properly.
Current Controlled Switch in subckt, parsing errorCredit: Ned Forrester
Bug: Current controlled switch inside subcircuit does not expand the controlling source correctly: vsrc expands to name:vsrc, not to v:name:src.
Fix: Change src/lib/fte/subckt.c to indicate that w device has only 2 not 3 nodes and 1 not zero controlling sources. [patches4.txt]
Noise analysis bugCredit: Richard McRoberts
Bug: The ac noise analysis in Spice3f4 has a serious bug. In interactive mode, it fails to reproduce frequency dependence known to exist. In batch (Spice2) mode, it works only if a corresponding ac analysis has been run first.
Fix: Providing a call to CKTload() in noisean.c as shown by the source code patch [patches6.txt].
Save segmentation faultsCredit: Richard McRoberts
To fix various "save"-related segmentation faults, make this
one-line patch to outitf.c: line 356, change
Single point AC analysis crashCredit: Richard McRoberts
A bug that most users probably wouldn't encounter occurs in an ac analysis using a linear sweep with only one point. (A rather pathological case.) The original code in acan.c uses a frequency increment of "HUGE" (infinity) which causes a crash when stepping to the second point. Fixed by making the increment zero, which is tested for in the sweep, causing it to terminate correctly after the first point.
AC analysis of LTRA device wrong for LC only modelCredit: CDHW
An AC analysis of the LTRA transmission returns incorrect results unless LEN=1.0 . E.g. the two stub models below should be the same
Fix: Correct calculation of lambda_r in LTRAacld.c [patches11.txt]
BSIM1 model xpart parameter randomCredit: Al Davis
Bug: the BSIM1 model, the parameter "xpart" behaves randomly.
Fix: In the file "b1mpar.c" line 290, change "iValue" to "rValue".
BSIM3v3.1 model noteCredit: Peter Hunt
The bsim3 code available from Berkeley was written for spice 3e2. In the node setup code the BSIM3instance is cast as a GENinstance so the first part of both structures have to line up. This means the fourth member needs to be the "states". Apparently, the GENinstance changed between 3e2 and 3f4. [patches7.txt]
BSIM3v3.2 model TNOM parameterCredit: Mike Smith
BSIM3v3.2 gives wrong results unless TNOM parameter is omitted. [patches8.txt]
Diode model breakdown behaviourCredit: Various
When a breakdown region is specified for a diode by setting the IBV and BV parameters any value of emission coefficient othe than 1.0 (the default) leads to a characteristic that doesn't pass through I=-ibv when V=-bv.
MOSFET initialisationCredit: Thomas Leitner (ECS 97 paper)
Most standard MOSFET models have a bbug in the initialisation code for the drain bulk junction. The initial current at t=0 during a transient run has a spike that gets smaller as the initial timestep is increased.
Tran analysis default TSTEPCredit: CDHW
Bug: Spice 3 by default seems to set TMAX to TSTOP/50.0, instead of the smaller of either TSTEP or (TSTOP-TSTART)/50.0 as stated in the manual.
Fix: Specify TMAX explicitly. [patches9.txt]
MOS6 model noteCredit: Stephen Gilardi
This is some code from the Spice 3f5 source file mos6load.c:
The value of expression is not used. It looks like there's an unintended
extra semicolon after
Macquarie University PatchesCredit: Anthony Parker
The Macquarie University Patches include:
MOS3 Bulk-Source CapacitanceCredit: Thomas Leitner (ECS 97 paper)
The bulk-source junction capacacitance has some nasty discontinuities due to an error in the thermal dependence calculation, illustrated by the following comparison with the MOS1 model.
Front-end command processorCredit: CDHW
Bug: There are several problems with the code for this. e.g repeat loops only work once and breaks and continues are problematic.
Fix: Still work in progress, but I have a version of front.c that is much better than the original. It will be posted here after a bit more checking. The command processor is of limited use until the memory leaks that plague 3f5 are fixed.
Truncation error calculationCredit: Steve Hamm
The trtol value is a fudge factor, originally introduced by Nagel as a estimate of how much the local truncation error is overestimated by the divided difference formulas. But, after looking at this in detail some years ago, it is just a bug. The formula for estimating derivatives by divided differences includes, for the third divided difference, 3!. Nagel dropped the 3! somewhere along the way; the factor of 7 is a fairly close replacement -- but only for second order integration, which uses the third divided difference.
Note that the spice code has a number of other problems:
Back to trtol: After the above bugs are fixed, a fudge factor is still useful, but a value of 1.5 or 2.0 is more typical.
Interactive command: letCredit: CDHW
Bug: The let command doesn't handle references to subranges reliably.
Fix: Various a couple of tweaks to com_let() in postcoms.c
Interactive command: setCredit: CDHW
In the original 3f4/5 release, simulator variables specified with the set command are ignored by interactive simulations. This behaviour is because interactive commands have their own 'special' set of options that only exist while the the command is being executed and are distinct from the 'current' options for the circuit. 'Set' only affects the 'current' options because the 'special' ones don't exist at the time it is invoked and are created using the application defaults.
The original code also defines a 'default' set of options for a circuit which seem to serve no useful purpose. The cleanest fix would be to make 'set foo' change both the current and default values and to create new tasks using the circuit defaults, not the application defaults.