README.txt
----------

Spice3f5 for Linux is a version of the public domain spice3f5 code from
Berkeley, with a Qt gui bolted on, and many fixes to the code. 

Important: Edit the lib/scripts/spinit file and set the sourcepath variable to something suitable. 
It is of the form:
	set sourcepath = ( path1 path2 pathN)
Where path1..N are file paths, using '/' as the path separator.

Set the env var SPICE_HOME to the installation directory.
Set the env var SPICE_LIB_DIR to the lib directory $SPICEHOME/lib

Create a .spiceinit file with Spice3 cmds (e.g. set colorN="...") to suit.

If you get errors written to stdout of the form:
	qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
then add to your .bashrc:
	export QT_QPA_PLATFORM=xcb


Bugs fixed / enhancements:
--------------------------

Patchlevel 0.1:
---------------

0) many memory leaks fixed
1) cp_event did not seem to be getting updated, fix in cshpar.c
2) related to above - get history to work. Fix in cshpar.c
3) Help system is broke - use oldhelp for now
4) fixed some bugs with the alter command in device.c and spiceif.c
5) memory mangling problems dealing with @dev[param] fixed in vectors.c
6) let x = [ 1 2 3 ] did not work - implemented vector array assignment in postcoms.c/parse.c
	Also let x = [1,2,3] alternative syntax supported.
7) let x[2] = 3.0 did not work - fixed in postcoms.c
8) set temp = xxx did not work, fixed in CKTnewTask / spiceif.c
9) Buffer overflows due to e.g. long models fixed in output.c
10) .param statement now supported. Parameters can be simple values or expressions, in which
    case it is required to enclose them by single quotes. Fix in inp.c
    Example:
    	.param ccoflag=0
    	.param cfn = '1.29E-10+3.1E-11*ccoflag'
11) Device model parameters can be expressions, in which case the parameter value must be
    enclosed by single quotes. Fixed in inpgtok.c
    Example:
    	.MODEL nch.1 NMOS	(	LMIN     = '1.0000E-05-dxln'
12) hspice-compatible .lib statement supported.
    Example:
    	.lib D:\C++Stuff\spice3f5\examples\cln90lp_lk.l TT
13) The spice netlist in the main editor window can be edited, and '(Re)Load edits'
    loads the (potentially edited) netlist into spice again.
14) Bugfixes to the BSIM4 model to bring it up to 4.6.5 patch level
15) A simple syntax highlighter has been added.
16) Added File menu commands to:
	- open an existing spice netlist file
	- create (i.e. start entering) a new netlist
	- save the current netlist
	- save the current netlist to a new file
	- load or reload the current netlist after any edits have been made
	- close the current netlist
	- exit

Patchlevel 0.2:
---------------

17) Added Edit menu commands to cut/copy/paste/find/replace/goto line/undo/redo
    the netlist.
18) Fixed a bug in the set command that did not accept e.g.
		set fred = ("a" "b" "c")
    Fixed in variable.c
19) If file names in .include or .lib statements have relative or absolute
    paths, add the path to the 'sourcepath' variable so that nested .include/.lib
    statements can omit the full path name.
20) Fixed a bug in postcoms.c introduced by fixing (7).


Patchlevel 0.3:
---------------

21) History using up/down arrow keys now works intuitively.
22) Multiple circuits can be loaded, and a circuit is set current on activating
its window.
23) Window menu added for traversing open circuits
24) Recent Files entry for loading recently opened files
25) Window size and recent files  settings saved

Patchlevel 0.4 18/12/2016:
--------------------------

26) Fixed some bugs with pnodes that caused crashes.
27) Model binning implemented as in HSPICE. If you have MOS models with names
    of the form <basename>.<index> e.g. nch.1, nch.2, ...each with a lmin/lmax and 
    wmin/wmax, and your netlist has mos devices with modelname e.g. nch, then the 
    mos device model is picked from the available models from the first which has 
    l and w within the min/max values for the model. Note this only works for MOS 
    devices, and model names should not otherwise contain a '.' character .
28) Added .GLOBAL command. Sets global net names that can be referenced from
    inside subcircuits. For example:

	.GLOBAL vdd! gnd!

	.SUBCKT nand2 A B Z
	M3 vdd! B Z vdd! pch w=3.2u l=0.13u
	M2 vdd! A Z vdd! pch w=3.2u l=0.13u
	M1 Z A n0 gnd! nch w=1.6u l=0.13u
	M0 n0 B gnd! gnd! nch w=1.6u l=0.13u
	.ENDS

	VGND gnd! 0 DC 0
	VVDD vdd! 0 DC 1.2
	X1 IN1 IN2 OUT nand2

29) Added m factor support, initially just for mosfets. The syntax is:

	Mxx D G S B modeName L=nn W=NN m=NN

    If an m factor is found with value NN, then NN devices are added in parallel
    to the circuit. Device names are numbered Mxx.0, Mxx.1 etc.

Patchlevel 0.5 22/01/2018:
--------------------------

30) Windows build fixed for missing stdout to logfile.
31) Spice3 now accepts filename(s) as arguments, and loads them into the gui on
    startup. Multiple files are concatenated.
32) Plot windows are automatically closed when quitting the gui. Previously they
    had to be individually closed.
33) Added a 'Run' menu to run the common analysis modes from the gui.
34) Netlists are loaded and displayed maximised. In future there will be an
    option to configure whether they are shown maximised or in cascade mode.
35) Added a 'Plot' menu to simplify plotting from the gui.
36) Added support for parameterised subcircuits to be compatible with Glade
    netlisting. Given a subckt definition of the form:

	.SUBCKT nand2 A B Z wp=1.6u wn=0.8u lp=0.13u ln=0.13u
	M7 Z A vdd! vdd! pch w=wp l=lp m=1
	M8 Z B vdd! vdd! pch w=wp l=lp m=1
	M1 Z A n0 gnd! nch w=wn l=ln m=1
	M0 n0 B gnd! gnd! nch w=wn l=ln m=1
	.ENDS

    In the above, parameters are defined by name=value pairs. Default values MUST be
    given.

    Then the subckt can be called with parameters:

	X12 n2 QB Q nand2 wp=3.2u wn=1.6u lp=0.13u ln=0.13u

    In the invocation above, parameters are specified in name=value pairs.
    When replacing the actual subcicuit's parameter list, default values are used if
    the invocation does not specify a particular parameter.

Patchlevel 0.6 12/11/2019:
--------------------------

37) Various memory leaks fixed.
38) rusage now gives meaningful infor for total memory and used memory.
39) Added option of toggling background colour of plots from white to black.
40) Plot colours can be changed from the default using set colorN="rbg:RR/GG/BB"
    where N is a number in the range [0-20] and RR, GG, BB are two digit hex numbers.
    color0 is the background colour of the plot, and color1 is the grid/legend colour.
    e.g.
	set color0="rgb:00/00/00"
	set color1="rgb:ff/ff/ff"
	set color2="rgb:00/ff/00"
    will set the plot background to black, the grid to white and the first plot variable to green.

41) Added vector combination operator ';' so that you can create vectors, e.g.
	let j = (1; 2; 3; 4) 

    Currently only 1D vectors, either of all real or all complex types are
    supported.
42) Expressions with an index now work, e.g.
	let k = j[2]
43) New plotting routines. A far more elegant solution than the ancient spice3
    code, however it currently does not have all the functionalit of the old code
    such as smith charts. To use the old plotting routines, add the following
    to your .spiceinit file(s):

	set oldplot=1


Patchlevel 0.7 02/12/2019:
--------------------------

44) The .spiceinit file was not being read from ~ or . 
45) Added a new option 'multiplot' to the plot command. When used, plot
    expressions will use a separate chart for each expression. Currently
	common grid scaling is used for all charts based on the first expression.
46) Fixed various bugs in the alter command. Now things like:
	alter @v1[sin] = vec
	alter R1 resistance = 10k
	all work.
47) Fixed a bug in foreach that caused only the first variable in the list to be
	used in the loop.
48) Various improvements to the new plotting code.
49) Parser handles 'set <variablename> = $&<vectorname>' correctly.
50) Various memory leaks in the parser fixed.

Patchlevel 0.8 23/06/2025:
--------------------------

51) Fixed a crash in cpitf.c where a file pointer was close()'d twice.
52) Fixed a bug where callouts in plot window were not fixed by left-clicking.
53) Fixed a bug whereby rubber band zooming was not working in plot window.
54) A .lib statement was not setting sourcepath so that subsequent embedded 
    .lib statements did not need to specify the lib path. Fixed in inpcom.c
55) Fixed delcirc cmd so it actually deletes a circuit; add listcirc to list
    all circuits.

Patchlevel 0.9 20/10/2025:
--------------------------

56) Fixed an issue when running e.g. DC sweeps with negative voltages or
    currents, which would cause a crash or hanging plot window.
57) Allow resistors, capacitors, inductors to have form 'R0 1 2 r=1k'
	i.e. ignore the 'r='.
58) Allow selecting a node in the netlist window and right-mouse button 
	clicking to get a popup menu which includes 'plot' and 'print' to
	plot or print the current simulation results.

Patchlevel 0.10 09/12/2025:
---------------------------

59) Fixed plotting for vp() and ph() y scale to plot in degrees or radians,
	depending on the setting of 'units'.
60) Fixed 'unix' command mode for Windows. You need to do a 'set unixcom'
	in your .spiceinit for this to work.
61) Various memory leaks fixed, including keyword and command completion,
	globbing, and the stdin/stdout/stderr threads.
62) Fixed multiplot - previously size of each plot was not equal for all plots.
63) .GLOBAL if specified more than once ignored the first line of globals.


Patchlevel 0.11 17/09/2026:
---------------------------

64: Fixed a memory leak in subckt.c translate()
65: Fixed a memory leak in parse.c mknsnode ()
66: Fixed a memory leak in define.c trcopy()
67: Implemented SPICE2 POLY() syntax for E/F/G/H sources, handling n-dimensional
	poly expressions.
68: Fixed a trivial bug with B sources with no dependent variables 
	e.g. B 1 0 v=1.414
69: Fix a memory leak and a heap error in parse.c
70: Handle e.g ($j) - variables enclosed with brackets.
71: noise analysis was not running integrated noise, fixed in noisean.c
72: Distortion analysis plots were not scaling correctly; fixed plotting.
73: Poly/Zero analysis failing on simple testcase, due to unstable algorithm
	and issues with numerical code.
	Fixed in cktpzstr.c, pzan.c, nipzmeth.c, spsmp.c
74: Fix a memory leak with keywords.
75: Fix leaks for foreach/goto; wl_splice
76: Last history entry was dropped without freeing in cshpar.c
77: Redirects in docommand() were leaking, also some bugs fixed.
78: Leaks from ft_getpnames fixed.
79: Fix up/down arrow key history handling in main window.
80: Warning given for empty .subckt
81: Fixes for various bugs with diode, bjt and jfet models.
82: DC sweep can now sweep resistors and temperature.
83: Fixed MOS1 gmbs error and 2nd deriv wrong sign.
84: MOS2 incorrect gds/gm/gmbs in forward bias; disto setup broken.
85: MOS3 incorrect charge terms in mos3temp.c caused charge discontinuity;
various other bugs.
86: MOS1/2/3 gate cap disto coeffs wrong.
87: MOS6 had a bug (gmbs set from uninitialosed value) when forward biassed 
	beyond 2*phi. 
88: Fixed several bugs in compose.c, added missing options (log, unif, gauss
	etc)
89: Fix a memory leak in inp2m.c due to copying params.
90: subckt.c was gaily copying lines of input, which might not matter for simple
	circuits, but when you are using e.g. a TSMC CL013 spice model library at
	>8000 lines, it adds up to a lot.

Patchlevel 0.12 27/09/2026:
---------------------------

91: Added an 'optimise' (or 'optimize') command, which adjusts device and
	model parameters with the Nelder-Mead simplex method to minimise,
	maximise, or hit a target for any vector expression evaluated on the
	results of an analysis:

	optimise [options] vary <spec> [vary <spec> ...] <goal>

    Parameters to vary (as many as you like):

	vary <dev> [<param>] <min> <max> [<init>] [lin|log]
	vary @<dev>[<param>] <min> <max> [<init>] [lin|log]
	varymod <model> <param> <min> <max> [<init>] [lin|log]
	varymod @<model>[<param>] <min> <max> [<init>] [lin|log]

	If <param> is omitted, the device's principal parameter is used (e.g.
	resistance for a resistor).  If <init> is omitted, the current value
	is used.  A parameter is searched on a log scale if min > 0 and
	max >= 10*min, otherwise linearly; 'lin' or 'log' overrides this.

    Options:

	analysis <type> <args>  the analysis to run for each evaluation,
	                        e.g. 'analysis ac dec 10 1 1meg'.  Default is
	                        'run', i.e. the analyses in the deck.
	maxeval <n>             maximum number of simulations (500).
	tol <x>                 stop when the simplex is smaller than x, as a
	                        fraction of each parameter's range (1e-4).
	step <x>                initial simplex size, as a fraction of each
	                        parameter's range (0.1).
	restarts <n>            restart from the best point after convergence
	                        (1), to guard against premature collapse.
	quiet                   only print the final result.

    Goal (must come last - the rest of the line is the expression):

	minimise <expr>         (or minimize) expr must be a scalar; reduce a
	maximise <expr>         vector with e.g. mean() or [index].
	target <value> <expr>   minimise the mean square error between expr
	                        and value.  value may be a scalar, or a vector
	                        the same length as expr, e.g. (1;1) - so
	                        several goals can be combined, normalised to
	                        similar sizes.  Complex values are compared as
	                        complex numbers.

    Examples:

	* Set an RC corner at 1kHz
	optimise analysis ac lin 1 1k 1k vary r1 10 10k target 0.7071 mag(v(2))

	* Maximum power into rl
	optimise analysis op vary rl 1 10k maximise v(2)*vm#branch

	* Hit two targets at once with two parameters (all on one line)
	optimise analysis op vary ra 10 10k vary rb 10 10k target (1;1) (v(11)/0.5;-va#branch/1m)

	* Fit a diode model parameter
	optimise analysis op varymod dmod is 1e-16 1e-6 target 0.4 v(11)-v(12)

	A simulation that fails to converge is given a huge cost, so the search
	backs away from it.  Each evaluation's plot is deleted once it has been
	used.  At the end, the best parameter values are left set in the
	circuit and simulated once more, and that plot is kept as the current
	plot, so it can be plotted or printed directly.  If nothing works (or
	the expression can't be evaluated), the original values are restored.
	Parameters that end up at a bound are flagged.
	See examples/optimise_demo.cir.

92: Fixed a small leak in runcoms.c dosim() for every analysis command.

93: Added LTspice-style .meas (or .measure) cards, and a 'meas' (or
	'measure') command:

	.meas [op|dc|ac|tran|tf|noise] <name> <function> <expr> <modifiers>

    Point measurements:

	FIND <expr> AT <x>
	FIND <expr> WHEN <lhs>=<rhs> [TD=<x>] [RISE|FALL|CROSS=<n>|LAST]
	DERIV <expr> AT <x>              (or WHEN ...)
	WHEN <lhs>=<rhs> [TD=...] [RISE|FALL|CROSS=...]    result is x
	FIND <expr>                      single point analyses, e.g. op
	PARAM <expr>                     e.g. of earlier measurements

    Range measurements:

	AVG|MAX|MIN|PP|P2P|RMS|INTEG <expr> [FROM <x1>] [TO <x2>]
	AVG|MAX|MIN|PP|P2P|RMS|INTEG <expr> TRIG <cond> TARG <cond>
	TRIG <cond> TARG <cond>          result is x2 - x1, e.g. a delay

    where a TRIG/TARG condition is <lhs>=<rhs>, <lhs> VAL=<rhs>, or AT=<x>,
    optionally followed by TD=, RISE=, FALL= or CROSS=.

	x is the plot's scale: time, frequency or dc sweep value.  Values may
	be expressions, keywords are case insensitive, and the '=' after a
	keyword is optional.  WHEN, TRIG and TARG find the nth crossing
	(default: the first, of either direction), ignoring any before TD.
	Values between points are interpolated linearly, and range functions
	treat the waveform as piecewise linear, e.g. RMS is exact for it.
	For ac, conditions and range functions use the magnitude of complex
	values, and FIND/DERIV give complex results, printed as (dB,deg).
	Without an analysis type, a measurement is done on every analysis.

	.meas cards are run automatically on the results of each matching
	analysis, and print e.g.

	    risetime=2.19669e-06 FROM 1.10594e-06 TO 3.30263e-06
	    vmax: MAX(v(2))=1 AT 2e-05

	Each result is also stored as a vector of that name in the analysis
	plot, so it can be printed, plotted, used in expressions, in later
	PARAM measurements, or as an optimise goal, e.g.

	    .meas tran risetime TRIG v(2) VAL=0.1 RISE=1 TARG v(2) VAL=0.9 RISE=1
	    ...
	    optimise vary c1 0.1n 10n target 5u risetime

	A result name must not be the name of one of the plot's vectors,
	e.g. time, a node name such as out (or 2, i.e. v(2)), or a branch
	current such as vin#branch or i(vin): that is an error, rather than
	replacing the simulation data.  Nor can it be 'all'.

	During optimise, .meas results are only printed for the final run,
	and a measurement that fails at some point in the search counts as a
	failed simulation there.

	The meas command does a measurement on the current plot, and with
	no arguments, reruns the circuit's .meas cards on the current plot.
	See examples/meas_demo.cir.

94: Added .optimise (or .optimize) cards, which take the same arguments as
	the optimise command, e.g.

	.tran 0.05u 20u
	.meas tran risetime TRIG v(2) VAL=0.1 RISE=1 TARG v(2) VAL=0.9 RISE=1
	.optimise analysis tran 0.05u 20u vary c1 0.1n 10n target 5u risetime

	A run (the run command, the Run menu, or batch mode) first does each
	.optimise card in turn, leaving its parameters at their optimised
	values, then runs the circuit as usual with them, so the analyses and
	.meas results are for the optimised circuit.  If an optimisation
	fails or is interrupted, the run isn't done.  Each run repeats the
	optimisations, starting from the current (already optimised) values
	unless the card gives initial values.

	The optimise command with no arguments does the circuit's .optimise
	cards on their own, each leaving the results of a final simulation
	in the current plot.  See examples/optimise_card_demo.cir.

95: Cards starting .opt were all taken as .options cards, so e.g. a
	.optimise card was lost.  Now only .opt, .option and .options are.

96: Added LTspice-style .step cards, which make a run (the run command,
	the Run menu, or batch mode) run the circuit once for each value of
	a .param, a device or model parameter, or the temperature:

	.step [lin] <what> <start> <stop> <increment>
	.step dec|oct <what> <start> <stop> <points per decade|octave>
	.step <what> list <value> [<value> ...]

	where <what> is param <name>, temp, a device name (for its principal
	value, e.g. r1, c1 or v1), <type> <model>(<param>) as in LTspice
	(e.g. npn q2n2222(bf)), or @<name>[<param>] for any device or model
	parameter.  Several .step cards nest, the first varying fastest.
	Stepping a .param reparses the circuit with the new value, and
	evaluates the other .params again, so those defined in terms of it
	follow it.

	The .meas results of all the steps are printed as a table.  The
	plots each step makes are then merged into one plot per analysis,
	in which each vector has a dimension per .step card as well as its
	own, so e.g. 'plot v(out)' draws a curve for each step, labelled
	with the step's values (e.g. "out c1=1n rval=2k").  If the
	steps' scales differ (e.g. transient timesteps), the results are
	interpolated onto evenly spaced points.  Results with one value per
	step (an .op, or .meas results) are vectors over the steps, scaled
	by the first card's values, so 'plot risetime' draws the rise time
	against e.g. r1, with a curve for each value of any other cards.
	The stepped values are also vectors, named after what was stepped
	(e.g. r1, temp, or qmod_bf), and a plot against them has its x axis
	labelled with that name.  Resistances, capacitances, inductances,
	source values and temperatures are typed, so the axis shows Ohm,
	F, H, V, A or C.  The individual steps'
	plots are then deleted, unless the variable keepsteps is set.  With
	a rawfile (run <file>, or -r in batch mode), each step's plot is
	written to it.

	Afterwards the stepped values are put back.  .optimise cards are
	done before the steps.  The command step <spec> runs the circuit
	stepped by one spec, instead of by the .step cards.  (The
	debugger's old step command is now called iterate.)  See
	examples/step_demo.cir.

97: .param values are now always kept in the constant plot.  They were
	put in whichever plot was current when the deck was loaded (e.g. an
	earlier run's), where a later reset couldn't find them once another
	plot was current.

98: Added vector types cap-sweep (F) and ind-sweep (H).  The type table's
	count was 15 when it had 17 entries, so settype couldn't find
	temp-sweep or res-sweep, and a type it added replaced temp-sweep.

99: Plotting a complex vector of more than one dimension (e.g. an ac
	result from a .step run) crashed: splitting it into a family of
	curves allocated real data, then copied the complex data to a null
	pointer.

100:In batch mode, the Qt GUI is never started. Using plot (for example)
	in a circuit results in a crash. Now batch mode does not try to open
	dialogs, and gives a warning.

101:setscale with no args hung; there was a buffer overflow in INPfindLev,
	HSPCIE level 49 is now BSIM3 level 8. A real scale in a complex 
	rawfile was written with an imaginary part (now written as 0).

102:Fix POLY to B source conversion. Convert coeffs with spice scale 
	factors (1k, 1m etc) to numbers; avoid name collisions with existing
	B sources; handle continuation lines; take a single coeff as
	the gain P1 as per SPICE2.

103:Add HTML documentation and a new 'Help' menu item which displays
	it in the user's browser.

104:Fix Noise dialog to pass output as V(out) or V(out,ref).
	Include the AC keyword in SENS dialog in AC mode.
	TRAN dialog needed space seperated tstart/tmax, and pass tstart
	if tmax given.
	cktsens.c did a double free after a DC sens and on every AC freq point.

105:Don't rerun ckt in batch mode after .control has run it.

106:In a SENS analysis in AC mode, the DC op point was deleted at each
	frequency, hence the results were as if zero bias.
	SENS ... AC LIN didn't work, now fixed.

107:Vectors in square brackets, let a = [1 2 3] or [1,2,3], only got their
	first value (item 6). Each element is now parsed on its own and the
	values are concatenated; a complex element such as (2,3) is kept whole.
	A MOSFET LEVEL written as a floating point number (level = 4.00000e+000)
	was not recognised and BSIM4 was assumed; it is now read as a number.
	Function names in vector expressions are case insensitive: print I(V1)
	gave 'no such function as I'. User-defined functions too.
	Fix examples/bsim2tst.cir, which defined VGS twice and used 'options'.

108:The r=, c= and l= forms of a resistor, capacitor or inductor value
	crashed (or hung in a Debug build) when the value had no digit, as in
	r=rx with rx a .param: the parser skipped ahead to the first digit and
	ran off the end of the line.  It also mangled r=.5, r=-1 and r='rx'.
	The value may now be a number, a quoted expression, or the name of a
	.param (r=rx); a name that is not a .param is reported as an error.
	Fields before or after r=, c= or l= were silently dropped, so a model
	name, temp=, l=, w= or ic= was lost (R1 1 2 rm r=1k temp=127 ignored
	both rm and temp).  They are now read as in the positional form.
	A keyword after the value was taken as a model name: R1 1 2 1k
	temp=127 gave a model error and a resistance of 127.  Fixed in
	inp2r.c, inp2c.c, inp2l.c and inpgtok.c.

109:HSPICE-style expressions, as used by the TSMC model libraries:

	.param can define a function, e.g.

	.param bin3(bin,k0,k1,k2)='bin==0 ? k0: (bin==1 ? k1: (bin==2 ? k2:k0))'

	as the define command does.  A formal parameter hides any .param
	or vector of the same name.  Expressions have the conditional
	operator c ? a : b (nesting to the right, as in C), and ==, !=,
	&&, || and ! as well as spice3's =, <>, &, | and ~.  A : is only
	an operator after a ?, so subcircuit node names such as x1:n0 are
	still read as names.

110:New functions pwr(x,y) = sign(x)*|x|^y, sgn(x), int(x) (truncating
	towards zero) and tanh(x).  min(x,y) and max(x,y) were already
	defined.  With 'set hspicelog', log() and ln() are the natural log,
	log10() is base 10, and a negative argument gives -log(|x|), as in
	HSPICE; otherwise log() is base 10, as in spice3.  .params are
	evaluated as the deck is read, so for them hspicelog must be set in
	spinit or .spiceinit, not in a .control block.
	A define that failed (e.g. of a predefined function) freed the
	caller's word list, which was then freed again: a crash.

111:Loading a .lib section read the library file from the start, a line
	at a time, until it found the section.  The TSMC libraries are over
	20Mb and call sections of themselves many times.  Each library file
	is now indexed once, and each .lib seeks straight to its section.
	.endl must now name the section exactly: .endl tt_x used to end a
	section tt.

112:Reading .params was quadratic in their number: each name used was
	looked up along the list of all the vectors in the constant plot,
	and the intermediate results of every expression stayed on it until
	the end of the command.  The constant plot is now indexed, and the
	intermediate results of each .param (and each quoted model
	parameter) are freed at once.  A bad .param now shows just the start
	of its card, which may be thousands of characters long.  Loading
	the TSMC 40nm TOP_TT corner took over 7 minutes; it now takes 25s.

113:x ** y is HSPICE's form of x ^ y.  Added the HSPICE Monte Carlo
	functions:

	agauss(nom, abs, sigma [, m])   gaussian, sd abs/sigma
	gauss(nom, rel, sigma [, m])    gaussian, sd nom*rel/sigma
	aunif(nom, abs [, m])           uniform in nom +- abs
	unif(nom, rel [, m])            uniform in nom +- nom*rel

	As in HSPICE outside a Monte Carlo run, they give nom, unless the
	variable montecarlo is set: then each evaluation draws a new value
	(one for each element of nom).  The multiplier m is ignored.  For
	.params, set montecarlo in spinit or .spiceinit, as they are
	evaluated as the deck is read.

114:Subcircuit parameters are scoped as in HSPICE.  Each instance of a
	.subckt has its own parameters: those on the .subckt line (the
	instance's values, or the defaults), then any .param cards in the
	body, which may be in any order and use each other, e.g.

	.subckt rdiv a b rv=1k k=2
	.param rbot='rtop/2'
	.param rtop='rv*k'
	r1 a m r='rtop'
	r2 m b rbot
	.model dm d (is='1e-14*k')
	d1 m b dm
	.ends

	A name that isn't one of them is a global .param.  They are put into
	quoted expressions and name=value fields (name = value in a .model),
	and an R, C or L's value, anywhere in the body; an expression that can
	then be evaluated is replaced by its value.  A B source's expression
	gets the global .params too, as its own parser doesn't know them.
	The .param cards in a subckt were evaluated as global ones, where
	they failed.  Before, only a field whose whole value was the name of
	a subckt parameter (w=wp) was replaced.
	A device using a binned model defined in the subckt (nch_rf, for
	models nch_rf.1, nch_rf.2 ...) now gets that subckt's models.
	For the TSMC RF kits, instantiate the wrappers, e.g.
	X1 d g s b nmos_rf lr=40n wr=600n nr=1: the nch_rf models are local
	to them.

115:Global .params may now be in any order, as in HSPICE: each is
	evaluated once the .params it uses have been.  If a name is defined
	more than once, the last definition is the one used, also in those
	using it (.param p1=1 p2='p1+1' ... .param p1=5 gives p2 = 6; it
	used to be 2).  HSPICE's temper, the temperature in degrees C, is
	defined: 'set temp' if given, otherwise 27.
	A line of just ')' ends the .model card above it, as HSPICE allows
	(the TSMC libraries do this).

116:The diode takes HSPICE's (LEVEL 3) parameters, as used by the TSMC
	junction diodes:

	jsw     sidewall saturation current, A/m      (none)
	cjsw    sidewall junction capacitance, F/m    (none)
	php     sidewall junction potential (vjsw)    1
	mjsw    sidewall grading coefficient          0.33
	fcs     sidewall forward bias fit             fc
	area    default instance area                 1
	pj      default instance perimeter            0
	cj, pb, mj, tref    the same as cjo, vj, m, tnom
	tlevc   1: CJ, CJSW, PB and PHP vary linearly with temperature,
	        by cta, ctp, tpb and tphp per degree; 0 (the default):
	        spice3's equations, for both junctions
	tcv     BV falls by tcv per degree
	level, tlev, ik, ikr    accepted but not used

	and the instance parameter pj, the perimeter.  The saturation current
	is is*area + jsw*pj, and the depletion charge and capacitance are the
	sum of the bottom (cj, pb, mj, fc) and sidewall (cjsw, php, mjsw, fcs)
	junctions.  Other TLEVC values are taken as 1.  A model's default
	area and pj are not scaled by .option scale or geoshrink (117).
	The pole-zero load used the series resistance where the conductance
	belonged (diopzld.c).

117:HSPICE's .option scale and .option geoshrink (each 1 by default) scale
	element geometries, as used by the TSMC shrink libraries (geoshrink
	0.9: drawn 40n transistors are simulated as 36n).  With s = scale *
	geoshrink, MOSFET L, W, PD and PS are multiplied by s and AD and AS by
	s*s, and so are a LEVEL 3 diode's PJ and AREA; e.g. with .option
	scale=1u, l=2 is 2u.  Binned models (item 27) are chosen by the scaled
	L and W, with a little tolerance at the bin edges.  The factor, when
	it isn't 1, is noted as the deck is loaded.  (The .options are set
	after the devices are read, so they are read for this first.)

118:temper follows the temperature the devices are simulated at: the
	deck's .options temp if given, else 'set temp', else 27.  It used
	to ignore .options temp (item 115).  A .step temp sets temper too,
	and reparses the circuit if it uses temper.  (A 'set temp' in the
	.control section after the deck is loaded still doesn't change it.)
	A reparse (reset, or a .step of a .param or of temp) now expands
	the subcircuits again, so their parameters (item 114) follow the
	stepped values; since item 114 they were evaluated once, when the
	deck was loaded.

119:A LEVEL 3 diode's area given without area= (D1 a b dmod 2e-12) is
	scaled by .option scale and geoshrink too (item 117).  && works in
	interactive commands (the command lexer split it into "& &").  The
	HTML manual is brought up to date with items 109-119: .param,
	subcircuit parameters, temper, the HSPICE operators and functions,
	hspicelog, the diode's HSPICE parameters, and .options scale and
	geoshrink.

120:Batch mode (-b) reads .spiceinit too, before the circuit, as the GUI
	does (from the current directory, else the home directory; -n to
	not), so that e.g. 'set hspicelog' applies to batch runs.  There is
	no warning in batch mode if there isn't one.
	temper no longer uses 'set temp' (items 115, 118): a 'set temp'
	before a circuit is loaded doesn't reach its devices, so temper is
	the deck's .options temp, or 27.

121:The qmake project for the JFET level 2 device (jfet2.pro) listed the
	JFET level 1 sources, so qmake builds (Linux, macOS) had no jfet2
	library to link.  It now lists jfet2*.c and psmodel.c.

122:The constants plot's index (item 112) was never freed: its buckets
	were left allocated at exit.  vec_clear() now frees it.

123:Memory leaks reading input:
	- Comment and blank lines between a card and its + continuation
	  were unlinked from the deck and lost (inpcom.c).  With item 111,
	  .lib files are read in binary mode, so their blank lines (ending
	  \r\n) weren't skipped as before and were lost this way: they are
	  skipped again.
	- The comment lines of command files (spinit, .spiceinit, source)
	  were not freed.
	- The index of .lib files (item 111) was not freed at exit.
	- The first word of every dot card (INP2dot) and of every .model
	  card (INPdomodel), and a .model's type, were not freed.

124:More memory leaks reading input:
	- The names of the nodes, devices and models of a circuit were never
	  freed: the symbol table owns them, but INPtabEnd() freed only its
	  entries.  It now frees the names too, after the circuit.
	- A quoted value, e.g. a model's tox = 'toxp', left its expression
	  text allocated when it was evaluated (INPgetUTok()).

125:Every analysis leaked its list of node names (CKTnames()): the
	front end copies the names when it starts a plot, but the list
	itself was never freed.  One list leaked per run, so optimise and
	.step leaked one per iteration (101 on examples/optimise_demo.cir).

126:The sweep type of .ac, .disto, .noise and .sens ac (DEC, OCT or LIN),
	and the V/I and POL/ZER/PZ words of .pz, were not freed after they
	set the analysis parameter (INP2dot).  optimise and .step parse the
	analysis again each run, so this also leaked one per iteration.

127:Aliasing a command (cp_doalias()) copied the last history line and
	leaked the copy on an empty command (a blank line, or only ;) and
	on an alias loop, which also left the history line as aliased.

128:The BSIM4 model (level 14/54) is updated from 4.6.5 to BSIM4 4.8.3.
	VERSION is now a number: models with VERSION <= 4.80 use the
	backwards-compatible equations, and a string such as 4.6.5 is read
	as 4.6.  New in 4.7/4.8 are e.g. TNOIMOD=2/3, MTRLCOMPATMOD, GIDLMOD
	and the DVTP2-5 parameters.  The HSPICE instance parameter MULU0 is
	still not supported.  The correlated gate/drain noise for TNOIMOD=2 uses the new NevalSrc2()
	in ckt/nevalsrc2.c.  An uninitialised log file pointer written to
	when Phi or phieot is not positive (b4temp.c) is removed.

129:The show and showmod commands print their tables in neat columns.  The
	label column and the value columns are sized to the longest
	parameter keyword and the longest device or model name, instead of
	cutting them to 10 and 9 characters, and are the same for every
	device type in one command.  Values are left-aligned, the number of
	columns per row follows the 'width' variable, and a complex scalar
	parameter no longer has its real and imaginary parts swapped.
	The Message Window and the netlist editors on macOS now use Menlo
	instead of Helvetica Neue, a proportional font in which columns
	can't line up.

130:Smith, smithgrid and polar charts are implemented. Callouts are modified
	to show frequency, real and imaginary values.


----------------------------------------------------------------------------

Legal mumbo-jumbo:

   	This package is provided "as is" and without any express or implied
   	warranties, including, without limitation, the implied warranties oF
   	merchantability and fitness for a particular purpose.

   	Various portions of this package are copyright:

		Spice3f5 source code from Berkeley - please see the
		seperate 'COPYRIGHT' file for details.

		Qt: The Qt Company (http://www.qt.io)

----------------------------------------------------------------------------
