Improved SPICE netlister for gEDA
Switch branches/tags
Nothing to show
Pull request Compare This branch is 40 commits behind noqsi:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


The code here is a "back end" for the gnetlist program, which is part of gEDA. See for details on gEDA and gnetlist.

This back end produces output in SPICE format. It is intended to allow the designer to produce schematics that can be used as input for both SPICE simulation and printed circuit layout. It supports this by providing flexible methods for mapping schematic symbol attributes into the parameters of SPICE declarations and commands.

To manually install, copy the file gnet-spice-noqsi.scm to ${prefix}/share/gEDA/scheme/. Usage is "gnetlist -g spice-noqsi ...".

The process of creating a SPICE file is driven by attributes attached to symbols. In the text below, CAPITAL LETTERS represent variable text you supply, lower case and symbols are literal. Quick reference for these attributes:


F is a file name to be included by .include. This attribute is allowed on any symbol.


D is used to look up a default "prototype" for the device, if no spice-prototype attribute is present.


P is a series of fields separated by white space. If the field does not contain one of the "magic" characters in the set "?#=@%", it is copied literally. Otherwise, the leftmost magic character controls translation of the field. The translation patterns are:

?	refdes
T?	refdes with T prepended if needed
#n	net attached to pinnumber of current object
R#n	net attached to pinnumber of refdes R
A=	attribute name=value if it exists, blank if not
A=D	attribute name=value, defaulting to value D
A@	attribute value if it exists, blank if not
A@D	attribute value with default
%pinseq	all nets attached to current object in pinseq order

The prototype, for when no spice-prototype= attribute is given, and the device= attribute is unrecognised, is:

? %pinseq value@ model-name@ spice-args@

This yields the literal refdes followed by the list of connected nets in pinseq order, similar to previous SPICE netlisters for gEDA. It thus works for many already-existing symbols. It follows this with the values of the value=, model-name=, and spice-args= attributes.

Whitespace in the spice-prototype attribute is copied literally, so multiline values turn into multiple SPICE "cards". Here's the default prototype for the DUAL_OPAMP device:

X1? #3 #2 #8 #4 #1 model-name@
X2? #5 #6 #8 #4 #7 model-name@

This maps the defacto industry standard pinout for a dual opamp onto the defacto industry standard pin order for an opamp SPICE model. It creates two instances, one with prefix "X1" and one with prefix "X2".

See the end of gnet-spice-noqsi.scm for more prototype examples.

If one of the translations creates a ".subckt" card, it will be the first non-comment card in the output, and the last card will be ".ends".