[net.lsi] SPICE BUG

gbn@mcnc.UUCP (Gary Nifong) (08/01/86)

	* SPICE USERS *

	I have discovered a serious bug in Spice2G6 that has
plagued us for several years. The problem occurs when specifying
the model parameter "level". The three levels of SPICE model
equations used to calculate current can be set with this model
parameter. If you set "level=2.0", SPICE does NOT use level "2"
model equations, the SPICE parser incorrectly reads the number 2.0
and defaults to level "1". You must change it to integer "level=2"
for the correct model selection. SPICE prints that it is using level
"2.0", but in actuality level "1" equations are generating the
current.
	This means all of those models from MOSIS and elsewhere
have been fooling us for years. Half of all SPICE models that we
have received from various sites have been set to "level=2.0". 
	This bug is likely to be found in various versions of SPICE
since it has been in the code forever.  Also, break the news lightly
to the circuit designers (ours couldn't stop swearing for several
minutes).

gbn@mcnc.UUCP (Gary Nifong) (08/08/86)

*
* This is a clarification of the SPICE 2G6 "bug" reported last week and
* a reply to mark@mips.UUCP.
*

*****************************************************************************

>From: mark@mips.UUCP (Mark G. Johnson)

Summary:
	Tests were performed with UNIX Spice 2G6 to see whether
	the specification of "level=2.0" caused Spice to use the
	MOS model for level 1.  The results were that "level=2.0"
	causes Spice to use MOS model level 2.  No bug was found.


	Perhaps the failure to replicate gbn@mcnc's results arises from
	somebody at Berkeley doing "minor revisions" to the major release
	called Spice 2G6.  My tests were performed on virgin Berkeley source
	code (to the best of my knowledge anyway), using a VAX 11/780 running
	UNIX 4.2 BSD.  This copy of Spice 2G6 prints "spice 2g.6   3/15/83" on
	the top line of every output page.
 

******************************************************************************


	I tested Mark's results on a VAX 11/780 running UNIX 4.2 and
found that his tests are correct. I used version "SPICE 2g.6  3/15/83".
The "level=2.0" bug was not valid! So the bug has not been around
forever, I got excited. 


	HOWEVER, the we are running SPICE on a DEC 8600, and the "bug"
is very real. The "bug" appears on two types of machines used here.

	DEC 8600	4.2BSD UNIX   &   4.3BSD UNIX	
	CONVEX C1	4.2BSD Compatible UNIX


	The problem occurs in SPICE in file "mosfet.f" line 114. Where
integer "LEV" is assign the floating point value "VALUE(LOCM +1)".

(line 114)	LEV = VALUE(LOCM +1)

	On the 11/780 the value of "VALUE(LOCM +1)" equals "2.0000000000000000"
and the value of "LEV" equals "2". On the DEC 8600 and the Convex C1
the value of "VALUE(LOCM +1)" equals "1.9999999999999999111" and is truncated
to "1" when assigned to "LEV". So, the problem does exist and designers
should beware. I also remember having bugs similar to this when porting
MCNC's simulator to various 68000 based workstations.

	Gary Nifong, MCNC