gEDA+SPICE Discrete Circuit Simulation HOWTO

This is a HOWTO detailing my experiences with setting up and using the opensource gEDA suite and associated packages to perform analogue simulation of discrete electronic circuits. This application is useful for evaluation of circuit designs and in teaching of electronics. The instructions here were written when I was using Fedora 6 but they may work for later versions. They are applicable also for Ubuntu 8.04. Simulation for integrated circuit design is not covered. The resources section at the bottom of this page contains a lot of very useful information. It is best to read these and in particular the HOWTO by Stuart Brorson (reference 1). I found that none of these was sufficient to deal with all aspects of the task of tracking down necessary packages and getting the suite installed and running. The tools available at this time for this particular task are not yet up to the capabilities of freely available commercial tools, mainly because of a lack of a flexible waveform display utility.

The gEDA suite is the OpenSource Electronics Design Suite that "aims to be the best electronics design suite available". It allows development of a schematic circuit, netlisting and PCB layout, simulation and waveform display. Because design tools such as these are not available for serious work without significant capital outlay, this is a development well worth supporting and a credit to its authors. Many users have contributed significantly to its development through provision of schematic symbols and PCB footprints. Development has slowed with the latest packages being over three years old.

A first impression of gEDA is that it was designed primarily for PCB layout. The gEDA project has not really integrated EDA tools into an easily accessible suite, and users rely mainly on the command-line.This has a some advantage in that the command-line provides much greater flexibility than can be provided with a GUI, and is well suited to PCB development. For simulation work, where the designer or student may wish to make rapid changes to a circuit to try out different alternatives or to track down a problem, ease of access to simulation and waveform display commands with the click of a button is highly desirable. The situation here is a little better with some useful GUI integration tools available.

  1. Software
  2. Installation
  3. Spice Models
  4. Schematic Capture
  5. Netlisting
  6. Simulation
  7. Plotting
  8. EasySpice
  9. Resources
  10. Spice Model Sources


Quite a number of other sites give lists of software that can be assembled into a suitable EDA suite, but it is valuable to have a commentary on the advantages and disadvantages of that which is available. The following I consider essential in order to have a toolset that approaches the quality and flexibility of commercial offerings. These packages are discussed further below.
  1. Schematic capture gschem. This appears to be a quite mature and easy to use application.
  2. Netlist gnetlist. This appears to work quite well albeit reportedly a bit slow. It is used in PCB work as well as simulation.
  3. Models geda-spice. This package has some useful SPICE models for LTSpice, but is not part of the geda suite.
  4. Simulator ngspice. This is based on the long lived SPICE3f simulator and has compatible file formats.
  5. Simulator gnucap. This is a relatively new mixed-mode simulator but is not based on SPICE. Models are under development.
  6. EasySpice is an integrating GUI package for which development seems to have stopped. It manages schematic capture, netlisting and simulation by calling the gEDA packages.
  7. gSpiceUI is another integrating GUI package. It starts with SPICE circuit or gschem schematic files and manages the simulation process. Development has stopped but binaries are available for Fedora and Ubuntu. It doesn't seem to be as comprehensive as EasySpice.
  8. Waveform plotter GWave. This works with SPICE output but development has stopped and compilation presents difficulties but binaries are available for Ubuntu.



Most of the gEDA suite is provided as part of Fedora Extras. If not done already, it would be helpful to install the GNOME libraries as gEDA was written for the GNOME development platform. Using yum as follows should resolve dependencies and install the necessary packages. The packages will install symbols to the /usr/share/gEDA/sym/ directory, and binaries to the /usr/bin/ directory.

yum -y install geda-*
yum -y install pcb
yum -y install gerbv
yum -y install gtkwave


Most of the needed packages are available from the Ubuntu repositories, notably easyspice, the various geda packages, pcb, gerbv, gwave, gtkwave, gspiceui, gnucap. The simulator ngspice is unfortunately not present.

Simulation Software

A number of packages for circuit simulation are available. A quite mature and commonly used version is ngspice that is a port of SPICE3f5 and makes use of standard SPICE models. Another promising alternative is gnucap that offers fast simulation turnaround and mixed digital-analogue analysis. It includes a model compiler to allow creation of custom models. Both these simulators are under active development.

Fedora has the latest versions:

yum -y install ngspice
yum -y install gnucap

For Ubuntu, ngspice is not provided in the repositories. It can be obtained as a Debian package (to version 17) or source for compilation (versions 18, 19). Install the Debian package for version 17 as follows: download xspice_17.0.0-1_i386.deb and ngspice_17.0.0-1_i386.deb from Sourceforge. They must be installed together as they are interdependent:

sudo dpkg -i xspice_17.0.0-1_i386.deb ngspice_17.0.0-1_i386.deb

It is far preferable to compile the most recent version. Compile with readline or editline support, otherwise history and command editing will not be available. Compiling with xspice will give access to extended SPICE features. There will probably be some dev packages to be installed to provide header information about dependencies (I needed libxaw-dev and libreadline-dev). These will become apparent during the configuration stage. The INSTALL file has instructions to build and install ngspice. I found that the configure binary had to be explicitly made executable. The following is the set of commands used (in the top directory of the ngspice source tree).

$ aptitude install libreadline5-dev
$ aptitude install libxaw7-dev
$ chmod +x configure
$ ./configure --enable-xspice --enable-xgraph --with-readline=yes --prefix=/usr
$ make
$ sudo make install

There is no make uninstall so removal requires manual work. There is a minor bug in versions up to 19 that can cause compile failure with some C compilers when using --with-readline=yes or --with-editline=yes. Find line 85 "char history_file[512];"  in src/main.c and change it to:

char history_file[] = {'\0'};


An alternative to the above is to grab the gEDA CD iso file from the gEDA download pages and burn a CD for installation of all the tools from source. This will allow easier customization of the installation.

Spice Models

A significant issue to be faced is that SPICE models for active devices are not provided with the above packages because of licencing concerns. The various howtos and tutorials do not seem to bring this out clearly. To obtain an initial collection of SPICE models, it has been suggested to download the rpm for geda-spice and install it. To install this in Ubuntu you will first need to install alien:

sudo aptitude install alien
alien geda-spice-20030321-1.noarch.rpm
dpkg -i geda-spice-20030321-1.all.deb

The package will install to the /usr/share/gEDA/models/ directory and provides over 1200 LTSpice models. However note that LTSpice is not completely compatible with SPICE or ngspice. The mos subdirectory for example contains a collection of models for VDMOS devices. These are apparently designed for RF work, and ngspice does not recognise VDMOS as a native model. Most models have attributes not recognized by ngspice and require editing to remove textual parameters (not acceptable to ngspice) before ngspice will work smoothly with them. While ngspice will ignore unrecognized parameters, it is not clear if the resulting model will still be a faithful representation of the device in simulation.

Users generally need to dig out the necessary models for their simulation from various manufacturers' sites as needed (if they are available), or to create them separately. Most manufacturers now provide models for many of their products. Some references are given below. Note that these models may also contain attributes that are not supported by ngspice as they are often oriented towards some SPICE variation supported or sold by the manufacturer.

Schematic Capture

The schematic editor is called gschem. This provides excellent circuit layout tools and is quite easy to use, although most of the shortcut keys differ from the modern use <<control key>> plus a character, and familiarisation is needed.

The best way to illustrate the process of simulation is to work through a simple circuit simulation example. Open gschem and create a new schematic. "Save As" a file test.sch. When opening and saving files, gschem works in the current directory in which it was called and does not remember any changes of directory. Reference 2 provides a basic set of examples which can be tried.

There is a catch with using the symbols in gschem for simulation. Many symbols, particularly those in the basic symbol collections, have a device attribute giving the type of device being represented. gnetlist appears to use this to force the refdes attribute in the SPICE netlist (whose first letter must identify the device type) to match the device attribute of the gschem symbol. Therefore if you want to use a subckt to model the device rather then the usual model statement, you will need to delete the device attribute from the symbol.



Once the schematic has been entered correctly and saved, run gnetlist to check for errors.

$ gnetlist -g drc2 test.sch

If errors are shown you can pinpoint them by using verbose mode:

$ gnetlist -v -g drc2 test.sch

When no errors are shown use the spice backend with the -o switch to create a netlist file other than the default

$ gnetlist -g spice-sdb test.sch -o

The backends specified by the -g switch are written in Guile (an implementation of Scheme) and are procedures mainly intended for extracting various forms of netlist. The spice and spice-sdb backends produce netlists for SPICE compatible simulators.



This is based on SPICE3 and has been under development for quite some time, giving it a significant degree of maturity. The tutorials and manuals available as given in the references below provide a raft of information about using ngspice, so there will only be a brief reference summary of the most commonly useful commands here. More can be found in reference 2 Appendix B.
  1. source netlist will load a netlist file (this is normally loaded when invoking ngspice).
  2. listing will give a printout of the netlist, useful for finding node names.
  3. display will show all vectors of simulation results for plotting.
  4. plot VECTOR1 ...  will plot the specified vectors (separated by spaces).
  5. dc VSOURCENAME START STOP INCR performs a dc analysis by incrementing the named voltage source.
  6. tran STEP STOP transient analysis.
  7. ac scale N START STOP where scale is the type of scale (lin, dec, oct) and N is the total number of points.
As an aside, I haven't been able to get the latest ngspice to run circuits that were working three years ago. There seems to be difficulties with convergence and with recognising models.



GWave is a flexible display package for analogue waveforms, that is able to interpret a number of file formats, including the rawfile format from SPICE and ngspice.

GWave development appears to have slowed and compilation presents difficulties because of a raft of dependencies on packages that are now obsolete. However GWave is available in the Ubuntu repositories. The most recent version is 20060606.


ngspice provides its own plotting facilities as described above which are somewhat limited.


EasySpice is useful GUI integration of the EDA tools for discrete circuit simulation. It is best to become fully familiar with simulation using the command-line ngspice first as a number of difficulties can arise particularly with SPICE models as described above. EasySpice doesn't always provide adequate information for debugging. You will probably want to change the gnetlist command (in EasySpice Options) to use spice-sdb (see gnetlist below). I was only able to achieve success by specifying model library files directly in the gschem device attributes since EasySpice did not appear to use the libraries specified in the Options menu.

EasySpice development hasn't progressed since 2006 and could do with a bit of GUI polish. However it is quite useable. It has project support and will open gschem for editing, create the netlist and perform most common simulations followed by display or plotting of results. One very valuable feature is that it displays a gschem instance of the circuit with operating point voltages and currents printed on labelled nets.


I found documentation on gEDA to be a little sparse, scattered and lacking integration. The best place to start chasing down any questions is to go to the gEDA Wiki. Other resources are:
  1. A good HOWTO available on Stuart Brorson's website (it is included with gEDA documents).
  2. A smaller tutorial style document called Starting with gEDA is very useful, but is oriented to a different installation to that used by the standard gEDA suite, and may be a little outdated.
  3. Another small tutorial with examples.
  4. A Linux Focus article on Using gEDA.
  5. gEDA homepage.
  6. ngspice homepage. Check the resources page particularly for available models.
  7. EasySpice homepage (rather sparse).
  8. Gnucap homepage.

Spice Model Sources

  1. International Rectifier provides a zip file of over 100 models, mainly MOSFETS.
  2. Texas Instruments provides a zip file.
  3. National provides individual files.
  4. Fairchild provides models through email requiring registration.

First created
31 July 2007
Last Modified 11 October 2009
Ken Sarkies 2007