Circuit Design on Your Linux Box Using gEDA
A good way to understand how gEDA is used is to examine its individual pieces in the context of the overall design flow. The first design step involves schematic capture—that is, using a specialized drawing program to draw a schematic representation of your circuit. The gEDA Suite's schematic capture program is called gschem.
gschem is usually invoked from the command line; once started, it opens up a GUI composed of a drawing window surrounded by all the menus and buttons necessary to draw a schematic. gschem, like any schematic capture program, has a number of built-in graphical primitives corresponding to wires, component pins, resistors, capacitors, transistors and other items you need to connect when creating a circuit design. A screenshot of a typical session with gschem is shown in Figure 1.
As for electronic devices, gschem maintains a library of component symbols, which are drawings of individual circuit elements such as resistors, ICs, connectors and anything else you might want to place on your schematic. Each symbol is stored as an ASCII file; when you place a component symbol into your schematic, the corresponding symbol file is opened up and the information contained in it is used to draw the symbol on your screen.
Currently, gschem's symbol library holds more than 2,000 component symbols, including symbols for most common electronic parts. However, engineers commonly need to create new symbols for their designs, because it is likely that not all the parts they want to use are present in the symbol library. Therefore, gschem—like all schematic capture programs—incorporates a symbol editor, which allows users to create and save their own symbols, which they can then use in any design.
gschem understands electrical connectivity, an important property for any schematic capture program. That is, wires (called nets in EDA parlance) know that they can connect only to component pins and other nets. When two nets are connected together, gschem knows to draw a large dot at the connection point, indicating to the user that a connection exists at that point.
gschem enables engineers to attach attributes to each component, which is an important part of creating a design. For example, if you have a 499-ohm resistor in your schematic, gschem lets you place a resistor symbol from the library, double-click on the resistor and then attach a value=499 to the resistor itself. Later, when the design is netlisted, the component's attributes are written into the netlist file and made available for other programs.
Finally, gschem saves your design in a well-documented ASCII format. There are many advantages to ASCII file formats; readers of Linux Journal will appreciate that ASCII files can be parsed and manipulated using scripting languages, including Perl and Python. Scripts facilitate labor-saving design tasks like automated symbol generation and schematic merging. Many proprietary EDA programs do not use ASCII file formats because they are interested in locking in customers. Open-source EDA advocates believe that open file formats are a key superiority of toolsets like gEDA.
After you have captured your schematic, the next step in the design flow is to create a netlist. gnetlist is the gEDA/gaf program used to generate netlists from your schematic files. gnetlist is a command-line utility; when you run it, it generates output netlist files and also displays diagnostic information in your terminal window.
So what's a netlist? A netlist is a file holding your design's connectivity information in a structured format suitable for machine processing. Many different types of netlist exist; each represents a file format optimized for a particular type of subsequent processing. For example, SPICE analog simulators read files written in the SPICE netlist format, which calls out connections between analog components, as well as specifies the values of each component's parameters, such as a resistor's resistance. As another example, netlists used as the input to lay out programs typically hold information about each component's PCB footprint, which is the metalization pattern on the circuit board to which the component is soldered, as well as connectivity information between all component pins.
gnetlist is designed in a unique way. It incorporates a front end written in C that reads and parses your schematic files. Once the read-in is complete, gnetlist invokes a back-end netlist generator written in Scheme. The back end is specific to the desired output netlist. The back end to use is specified via a command-line flag when you invoke gnetlist. gnetlist was designed this way to facilitate easy extensibility. Users who want to create new netlisters simply need to write a Scheme program implementing their desired netlister; they don't need to learn C or fool around with the internals of reading or parsing schematic files.
At the time of this writing, gnetlist can output more than 20 netlist formats. Among the important netlist types output by gnetlist is SPICE. The powerful gEDA SPICE netlister spice-sdb supports the inclusion of vendor SPICE models into your spice netlist. It has proven very popular with EE students worldwide, perhaps because it is well documented in a HOWTO available on the Web. Also, netlisters for several different layout tools exist. Finally, gnetlist is also used for BOM (bill of materials) generation and DRC (design rule checking) using any of several back ends crafted to achieve these goals.
Important to PCB design is the question of how to translate a gschem schematic into a format suitable for layout using the open-source layout program pcb. Although this can be done using gnetlist alone, the procedure is complicated. Therefore, Bill Wilson made a recent contribution to the gEDA Project by writing gsch2pcb, a C utility that wraps gnetlist and outputs the correct files to read into pcb for layout. gsch2pcb is a key addition to the gEDA Suite because it makes the transition from a gschem schematic to a pcb layout easy, and it also illustrates the vibrancy of the gEDA on-line community.