Skip to content
Improved SPICE netlister for gEDA
Scheme Shell
Find file
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.

See the INSTALL file for installation instructions. Usage is "gnetlist -g spice-noqsi ...". There is a simple sample project in the BBamp directory. "cd BBamp; make" should result in a plot of the frequency response of the amplifier circuit there (you must have ngspice installed). See BBamp/README for more details.

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
%io	all nets attached to spice-IO symbols in numerical refdes order
%up	all nets attached to hierarchical IO symbols in lexical refdes order
%down	all nets attached to current object in lexical pinlabel 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".

The toplevel attribute "spice-prolog", if present, will be expanded as if if was a spice-prototype attached to an attribute-free symbol. This occurs before regular symbol processing. Similarly, a toplevel "spice-epilog" attribute will be expanded after all symbol processing.
Something went wrong with that request. Please try again.