Home
XSpice To Spice3 Converter
Copyright 2000 by John Sheahan <john@reptechnic.com.au>
This program is free software; you may redistribute and/or modify it under
the terms of the GNU General Public License Version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY, without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for complete
details.
copyright John Sheahan, taudelta@integritynet.com.au
spicepp README
WHAT
spicepp is a preprocessor for berkeley spice3f5. It adds support
for some structures commercial spices provide. Useful additions include .meas,
.param, .lib, .globals, inline comments and equations Check out spicrprm also as
a complementary package. Written under linux with perl 5.005_03, but any version
will probably work.
WHY
These are good features that make spice easier to use. And I had
some decks to run.
WHERE
Install .spicepp and measure_spice in a directory in your search
path. I keep them in ~/bin. You will need perl. If you don't have perl (or a
link to it) in /usr/local/bin , then edit the first line of these two scripts to
point to your perl. Remember to make both these executable.
HOW
spicepp preprocesses a spice deck for spice version 3. It translates
commands that hspice recognises into spice3f5 syntax. Use spicepp to translate
your input spicedeck into a intermediate file, then process that intermediate
file to spice3. for example: spicepp -i file.cir > file.ckt
spice3 file.ckt
spicepp (v1.3)
preprocesses the spice deck.
measure_spice
(v1.2) is invoked by spice to perform measurements on a data fils
[meas.data] written by spice using control information written to meas.ctl.
measure_spice logs results to the file spice.log.
You need to grab both. You can check the version number of each of these with
the -h commandline flag.
Commands
The following commands may be used in the input spice deck.
.lib | 'libfile' model |
The library libfile is read. The content
between the .lib and the .endl lines is included in the output spicedeck.
This is often used for subckts, but may be any valid spice input. libfile should
include path. There can be multiple .lib entries in library. Single quotes are
required around the file name. Syntax within the library is: .LIB model
<stuff>
.ENDL
libraries can use parameters and equations - these have global
scope. Global signals are also enforced through library code and subckts.
.param name=value [name2=value2 ....];
adds the ability to parametrize
spice data. This may include component values, voltages, currents, etc.
Equations are supported. Nodes are not. A value (data) used several times in the
deck can be entered once (dataval) in the deck in the .param card.
.global nodel [node2 [node3 ... ]]
You may include the .globals card to
allow global nodes in subckts This permits you to (typically) not worry about
power supplies for subckts. global signals are automatically added to the
instantiate line for subckts that use them.
.temp temperature
You may define temprature using the .temp card instead
of the .options card.
$
As usual '*' in the first column is permitted for comments. Also - you
can use '$' to comment to end of line.
.meas
You can have spice calculate the delay from one point to another.
This may be useful for measuring the propogation delay for a circuit element, or
ramptime for example Syntax is: .MEAS TRAN IO_LH_DELAY TRIG ADATA VAL=1.2 RISE=1
+ TARG PIN VAL=1.7 TD=20n FALL=2
TRAN implies transient analysis (which is the only analysis currently
supported) IO_LH_DELAY is the reported name of the measurement performed.
Measurements are performed from the TRIGger time to the TARGet time. In the
above example the trigger point is calculated as when the ADATA vector gets to a
VALue of 1.2 volts RISEing for the first time. The Target value point is
calculated when the PIN vector FALLs past a VALue of 1.7 volts for the second
time (fall=2). Counting of target transitions starts at the TD time of 20 nS.
The value reported is the difference the target time minus the trigger time.
Measurements are recorded into the file spice.log. Spice records time and
linearized waveforms into a temporary file, then invokes measure.spice to make
the measurement. The measurement, the current time, and the analysis heading
line are recorded in the 'spice.log' logfile.
Following are features rather than keywords.
-h
help flag may be given to spicepp to get version information.
-i
interactive flag may be given to spicepp. This just means spice does
not exit automatically. You can use nutmeg to see whats happening and draw
plots. Be aware that vectors are linearized prior to measurements being made, so
if you have .meas lines you may need to repeat the tran analysis to be able to
plot.
tran tstep tend will achieve your goal.
m=nn
Including the term m=5 in a component instantiation line includes 5
(for example) components in parallel in the final deck.
level
For a bsim3v3 mosfet model model, the level=49 statement is
changed to the Berkeley level=8. Not all model parameters are recognised.
equations
Equations are supported. Surround equations with single
quotes. For example val='vdd*0.50' In the above vdd is a parameter - which will
be substituted before evaluation. Equations are not supported in .lib cards,
they are ok in the library contents. Only one pass of equation expansion is
performed, nested parameter equations probably won't work.
This is beta code - but I use it. Released under GPL. Please tell me about
any bugs, or improvements.you make. john@reptechnic.com.au
John Sheahan Last
modified: Sat Jan 22 21:03:39 EST 2000