The latest version of this document may be found at: http://www.geda-project.org/wiki/geda:gschem_symbol_creation
This document is released under the GNU Free Documentation License (GFDL).
This document describes the creation of component symbols, including style conventions, and hints/tips and things to look out for when drawing symbols for the gEDA/gaf system.
Component symbols (from here on known as “symbols”) are drawn using gschem. You can start with a blank page or a known-to-be good symbol that is similar to the one you want to create.
Before you open gschem to create your symbol, there are a few questions you should ask yourself, that will effect how you create your symbol:
Once you've answered those questions, the following guide will be more useful to you.
To start building your symbol:
Use the 'line', 'box', 'circle', and 'arc' tools (in the Add menu) to create a simplified visual representation of your device. Make sure that the only colour you use is 'Graphic' (green). Do not place any pins on the device until the next step.
To check what colour you are using to draw, go to Edit→Color… (or hit E O).
If you have decided your symbol is graphical in nature (e.g., does not connect to anything, is just artwork), you can skip this step.
Add your first pin.
In the Edit dialog for a pin, you should see four attributes (name=value
pairs) already associated with your new pin. These attributes can be edited by clicking on the attribute in the list at the top of the edit window, then clicking on the field you want to edit. Note that when selected, the Add Attribute section of this dialog does not reflect what has been selected, as it is only meant for addition, not for editing.
Let's look at each attribute already associated with your pin, and edit some of the values. I recommend expanding the size of the edit window until all attributes are visible.
pinseq
attribute. This number dictates the order pins are looked at on this symbol in spice, gnetlist, and other tools. For our first pin, start this sequence number at '1', incrementing it on each new pin, as we add them.pinnumber
attribute. This is the number of the pin, on the package of the item you are drawing a symbol for. pinnumber
values can be alphanumeric (i.e. like E or C).pinlabel
attribute. This attribute is the name or label of the pin (not the pin number).pintype
attribute. This attribute describes the kind of a pin.pinseq
and pinnumber
attributes of several pins can be automatically numbered by Attributes→Autonumber Text….
Possible pintype
values are: in
, out
, io
, oc
, oe
, pas
, tp
, tri
, clk
, pwr
. Please see the Master
Attribute Document for more info.
Every symbol needs some attributes (name=value pairs) in order to be useful in gschem, and in other tools.
First we're going to add all of the attributes we want, then make the ones that need to be invisible invisible.
device=DEVICENAME
attribute should be placed somewhere in the symbol. The devicename
should consist of nothing but capital letters, dashes, numbers, and underscores. If the object is a graphic then device=
should be set to none
(device=none
).graphical=1
attribute should exist somewhere in a symbol which is purely graphical (such as a title block or decon symbol). Symbols which have this attribute have no electrical or circuit significance. Don't forget to set device=none
per the previous step.description=TEXT
attribute should exist somewhere in the symbol. The TEXT
value should provide a one line description of the symbol.footprint=PACKAGENAME
attribute should exist somewhere in the symbol which might be used with a pcb netlister. PACKAGENAME
is a pcb footprint or package type like DIP14 or DIP40. Please see the footprint naming conventions page for further detail. If you are using gEDA / PCB, also see the PCB documentation and gnetlist/docs/README.pcb for more info on this attribute and how it is used.refdes=
attribute should be placed inside all non-graphical symbols. This attribute should default to U?
for integrated circuits, and 'T?' for transistors. Make only the value visible and it will be promoted (attached to the outside of the symbol (so it can be edited)) when the symbol is placed in a schematic.numslots=
attribute should be placed inside of all symbols, to prevent a warning when you will check your symbol by gsymcheck. numslots=1
works fine.
Now that those have been added, make the numslots
, footprint
, description
, graphical
and device
attributes invisible. Leave only the value of the refdes
attribute visible, and place it somewhere at the top of your symbol.
component-library
keyword in the system-gafrc file. Once this is done, the symbol should be visible immediately and can be selected and placed with the Add→Select Component… menu item. On Debian, placing files in /usr/share/gEDA/sym/local/ works, but require permissions setup.Translating the symbol to the origin is a required step. To translate a symbol elsewhere, enter a offset (in mils) which is a even multiple of 100. Make sure all pins are snapped to a 100 mil grid point.
symbolname-#.sym
.sym
extension.-#
where #
is a number. Typically #
is 1 but if there are multiple symbols for a device then this number simply increments.This section describes the various requirements which must be met in order to create a valid symbol which will display and netlist in the gEDA/gaf system.
pinseq
attribute. This number dictates the order pins are looked at on this symbol in spice, gnetlist, and other tools. This is just a sequence number, and should increment sequentially starting at 1.pinnumber
attribute attached to them. This is the number of the pin, on the package of the item you are drawing a symbol for. The pin number can be alphanumeric (i.e. like E or C).pinlabel
attribute attached to them. This attribute is the name or label of the pin (not the pin number). This attribute is also used when a symbol is used in a hierarchical schematic.pintype
attribute attached to them. This attribute describes the kind of a pin. Possible values are: in
, out
, io
, oc
, oe
, pas
, tp
, tri
, clk
, pwr
. Please see the Master Attribute Document for more info.For more information on the attributes presented here, please see the Master Attribute Document.
device=DEVICENAME
attribute should be placed somewhere in the symbol and made invisible. Typically the devicename
is in all caps (capital letters). This attribute should not be used as a label. Use a separate text object for the label. If the object is a graphic then device=
should be set to none (device=none
).graphical=1
attribute should exist somewhere in a symbol which is purely graphical (such as a title block or decon symbol). Symbols which have this attribute have no electrical or circuit significance. Don't forget to set device=none
per the previous requirement.description=TEXT
attribute should exist somewhere in the symbol. The TEXT
value should provide a one line description of the symbol.footprint=PACKAGENAME
attribute should exist somewhere in the symbol which might be used with a pcb netlister. PACKAGENAME
is a pcb footprint or package type like DIP14 or DIP40. Please see the footprint naming conventions page for further detail. If you are using gEDA / PCB, also see the PCB documentation and gnetlist/docs/README.pcb for more info on this attribute and how it is used.refdes=U?
attribute should be placed inside all non-graphical symbols. Make only the value visible and it will be promoted (attached to the outside of the symbol, so it can be edited) when the symbol is placed in a schematic.label=
and name=
attributes should not exist anywhere in the symbol. They are obsolete.netname=
attribute should not be attached anywhere in the symbol. It is only used in schematics.numslots=#
attribute. The #
is the number of slots the device has. numslots=
should be exist somewhere in the symbol and made invisible. Additional slot related required attributes are described below.slotdef=#:#,#,#…
for every slot. The first #
corresponds to the slot number. If a device has 4 slots then there should be slotdef=1:…
, slotdef=2:…
, slotdef=3:…
, and slotdef=4:…
, attributes existing somewhere in the symbol and made invisible. The subsequent #
have a one-to-one correspondence to pinseq=#
attributes and specify what corresponding pinnumber=#
should be when that slot is set. See the attached 7400-1.sym as an example of how this should all work.slot=1
attribute inside the symbol.Running gsymcheck will check that all of these requirements are met. gsymcheck will output fatal errors which are quite serious and must be corrected. gsymcheck will also output warnings on things which should be fixed but are not fatal.
This section describes the style which is used in the standard gEDA/gaf symbol library.
pinlabel=\_Reset\_
) to express inverse logic levels.pinnumber
attributes should be displayed as pin numbers for pins (not pinseq
) and should be 8 pt in size.pinlabel=
attributes, those should be color number 9 (text | green). If every text item within a symbol is yellow, the symbol looks too yellow.device=
or net=
attributes) used to be required to be attached to something to be attributes, but now they just have to exist in the symbol file as name=value
.name=value
, it is considered an attribute. Attributes inside a symbol do not have to be attached to anything. In order to see hidden attributes in gschem select Edit→Show/Hide Inv Text.symversion=
attribute. Please see the Master Attribute Document for more information on using this versioning scheme.This section describes some hints and tips which will make your symbol creation experience easier.
pinnumber
should be the visible attribute for pins, along with pinlabel
if any.This section provides a simple example which tries to follow all of the above rules. This symbol is of a 7400 (NAND gate).
v 20031231 1 L 300 200 300 800 3 0 0 0 -1 -1 T 300 0 9 8 1 0 0 0 1 7400 L 300 800 700 800 3 0 0 0 -1 -1 T 500 900 5 10 0 0 0 0 1 device=7400 T 500 1100 5 10 0 0 0 0 1 slot=1 T 500 1300 5 10 0 0 0 0 1 numslots=4 T 500 1500 5 10 0 0 0 0 1 slotdef=1:1,2,3 T 500 1700 5 10 0 0 0 0 1 slotdef=2:4,5,6 T 500 1900 5 10 0 0 0 0 1 slotdef=3:9,10,8 T 500 2100 5 10 0 0 0 0 1 slotdef=4:12,13,11 L 300 200 700 200 3 0 0 0 -1 -1 A 700 500 300 270 180 3 0 0 0 -1 -1 V 1050 500 50 6 0 0 0 -1 -1 0 -1 -1 -1 -1 -1 P 1100 500 1300 500 1 0 1 { T 1100 550 5 8 1 1 0 0 1 pinnumber=3 T 1100 450 5 8 0 1 0 2 1 pinseq=3 T 950 500 9 8 0 1 0 6 1 pinlabel=Y T 950 500 5 8 0 1 0 8 1 pintype=out } P 300 300 0 300 1 0 1 { T 200 350 5 8 1 1 0 6 1 pinnumber=2 T 200 250 5 8 0 1 0 8 1 pinseq=2 T 350 300 9 8 0 1 0 0 1 pinlabel=B T 350 300 5 8 0 1 0 2 1 pintype=in } P 300 700 0 700 1 0 1 { T 200 750 5 8 1 1 0 6 1 pinnumber=1 T 200 650 5 8 0 1 0 8 1 pinseq=1 T 350 700 9 8 0 1 0 0 1 pinlabel=A T 350 700 5 8 0 1 0 2 1 pintype=in } T 300 900 8 10 1 1 0 0 1 refdes=U? T 500 2250 5 10 0 0 0 0 1 footprint=DIP14 T 500 2450 5 10 0 0 0 0 1 description=4 NAND gates with 2 inputs T 500 2850 5 10 0 0 0 0 1 net=Vcc:14 T 500 3050 5 10 0 0 0 0 1 net=GND:7 T 500 2650 5 10 0 0 0 0 1 documentation=http://www-s.ti.com/sc/ds/sn74hc00.pdf
This example produces the following (using gschem):
This is the same symbol with all the hidden text visible (via Edit→Show/Hide Inv Text):