refdes_renum: warn of possible number clash with non-conforming values
[geda-gaf/whiteaudio.git] / docs / wiki / geda-gschem_symbol_creation.html
blobe9947f9be9b65d52641db3645fb47389c1f486da
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html>
4 <head>
5 <title></title>
6 <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
7 <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
8 <link rel="stylesheet" media="print" type="text/css" href="./print.css" />
10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11 </head>
12 <body>
15 <h1 class="sectionedit847"><a name="geda_gaf_symbol_creation_document" id="geda_gaf_symbol_creation_document">gEDA/gaf Symbol Creation Document</a></h1>
16 <div class="level1">
18 <p>
19 by: Ales V. Hvezda / July 6th, 2004<br/>
21 The latest version of this document may be found at: <a href="http://geda.seul.org/wiki/geda:gschem_symbol_creation" class="urlextern" title="http://geda.seul.org/wiki/geda:gschem_symbol_creation" rel="nofollow">http://geda.seul.org/wiki/geda:gschem_symbol_creation</a><br/>
23 This document is released under the <a href="geda-gfdl.html" class="wikilink1" title="geda-gfdl.html">GNU Free Documentation License (GFDL)</a>.<br/>
25 </p>
27 </div>
28 <!-- EDIT847 SECTION "gEDA/gaf Symbol Creation Document" [1-291] -->
29 <h2 class="sectionedit848"><a name="overview" id="overview">Overview</a></h2>
30 <div class="level2">
32 <p>
33 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.
34 </p>
36 </div>
37 <!-- EDIT848 SECTION "Overview" [292-490] -->
38 <h2 class="sectionedit849"><a name="component_symbol_creation" id="component_symbol_creation">Component symbol creation</a></h2>
39 <div class="level2">
41 <p>
42 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.
43 </p>
45 <p>
46 1. Run gschem and find a blank page or run: gschem filename-1.sym<br/>
48 2. Draw the symbol (see the style guide below for some conventions).<br/>
50 3. Translate the symbol to the origin using Edit/Symbol Translate…<br/>
52 </p>
53 <ul>
54 <li class="level1"><div class="li"> Zoom in at least one step.</div>
55 </li>
56 <li class="level1"><div class="li"> Make sure the snap is ON (this is critical).</div>
57 </li>
58 <li class="level1"><div class="li"> Make sure grid snap size is set to 100 (this is critical).</div>
59 </li>
60 <li class="level1"><div class="li"> Select “Symbol Translate…” or the press equivalent hotkey.</div>
61 </li>
62 <li class="level1"><div class="li"> Enter 0 into the entry field and press OK.<br/>
63 </div>
64 </li>
65 </ul>
67 <p>
68 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.
69 </p>
71 <p>
72 4. Save the symbol using Save or SaveAs… Here are some symbol naming
73 conventions:<br/>
75 </p>
76 <ul>
77 <li class="level1"><div class="li"> Symbols are named: symbolname-#.sym</div>
78 </li>
79 <li class="level1"><div class="li"> Symbols end with a .sym extension.</div>
80 </li>
81 <li class="level1"><div class="li"> Symbols have a -# where # is a number. Typically # is 1 but if there are multiple symbols for a device then this number simply increments.</div>
82 </li>
83 <li class="level1"><div class="li"> Symbol names are typically lowercase but letters which are part of a part number are uppercase.</div>
84 </li>
85 <li class="level1"><div class="li"> The above case rule can be broken if the filename looks incorrect or wrong.</div>
86 </li>
87 </ul>
89 <p>
91 5. Place the symbol in one of the directories specified by the componentlibrary 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.
92 </p>
94 </div>
95 <!-- EDIT849 SECTION "Component symbol creation" [491-2128] -->
96 <h2 class="sectionedit850"><a name="requirements" id="requirements">Requirements</a></h2>
97 <div class="level2">
99 <p>
100 This section describes the various requirements which must be met in order to
101 create a valid symbol which will display and netlist in the gEDA/gaf system.
102 Most of the requirements center around having certain attributes attached or
103 inside the symbol.<br/>
105 Running gsymcheck will check that all of these requirements are met. gsymcheck
106 will output fatal errors which are quite serious and must be corrected. gsymcheck
107 will also output warnings on things which should be fixed but are not fatal.<br/>
109 For more information on the attributes presented here, please see the <a href="geda-master_attributes_list.html" class="wikilink1" title="geda-master_attributes_list.html">Master
110 Attribute Document</a>.
111 </p>
112 <ul>
113 <li class="level1"><div class="li"> device=DEVICENAME should be placed somewhere in the symbol and made invisible. device= is the device name and is required. 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). It is no longer required to attach this attribute anything; just having it exist as device=DEVICENAME is good enough.</div>
114 </li>
115 <li class="level1"><div class="li"> graphical=1 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&#039;t forget to set device=none.</div>
116 </li>
117 <li class="level1"><div class="li"> description=text should exist somewhere in the symbol. This attribute provides an one line description of the symbol.</div>
118 </li>
119 <li class="level1"><div class="li"> All pins should have a pair of attributes attached to them: pinseq=# and pinnumber=#. The first attribute, pinseq=# is just a sequence number and increments sequentially starting at 1. The second attribute pinnumber=# is the number of the pin. When a symbol is netlisted, the pin numbers are output in order of pin sequence. The pin number can be alphanumeric (i.e. like E or C).</div>
120 </li>
121 <li class="level1"><div class="li"> All pins should also have pinlabel=value attached to them. This attribute is the name or label of the pin (vs the pin number). This attribute is also used when a symbol is used in a hierarchical schematic. Please make this attribute green (instead of the default attribute yellow).</div>
122 </li>
123 <li class="level1"><div class="li"> All pins should also have pintype=value 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 <a href="geda-master_attributes_list.html" class="wikilink1" title="geda-master_attributes_list.html">Master Attribute Document</a> for more info.</div>
124 </li>
125 <li class="level1"><div class="li"> If a component has multiple slots in a package (such as a 7400 (NAND) which has 4 NANDs per package) then you need a 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.</div>
126 </li>
127 <li class="level1"><div class="li"> If a component has multiple slots in a physical package then you also need to include a 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.</div>
128 </li>
129 <li class="level1"><div class="li"> It is recommended that all symbols which have slots have a slot=1 attribute inside the symbol.</div>
130 </li>
131 <li class="level1"><div class="li"> footprint=PACKAGENAME 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 <a href="geda-pcb_footprint_naming_conventions.html" class="wikilink1" title="geda-pcb_footprint_naming_conventions.html"> footprint naming conventions</a> 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.</div>
132 </li>
133 <li class="level1"><div class="li"> You should put a refdes=U? attribute inside the symbol. 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.</div>
134 </li>
135 <li class="level1"><div class="li"> The label= attribute should not be attached anywhere in the symbol. It is obsolete.</div>
136 </li>
137 <li class="level1"><div class="li"> The name= attribute should not be attached anywhere in the symbol.</div>
138 </li>
139 <li class="level1"><div class="li"> The netname= attribute should not be attached anywhere in the symbol. It is only used in schematics.</div>
140 </li>
141 </ul>
143 </div>
144 <!-- EDIT850 SECTION "Requirements" [2129-6404] -->
145 <h2 class="sectionedit851"><a name="style" id="style">Style</a></h2>
146 <div class="level2">
149 This section describes the style which is used in the standard gEDA/gaf symbol library.
150 </p>
152 </div>
153 <!-- EDIT851 SECTION "Style" [6405-6512] -->
154 <h3 class="sectionedit852"><a name="text" id="text">Text</a></h3>
155 <div class="level3">
156 <ul>
157 <li class="level1"><div class="li"> All Text labels should all be 10 pt in size.</div>
158 </li>
159 <li class="level1"><div class="li"> Text (labels not attributes) should be color number 9 (text | green).</div>
160 </li>
161 <li class="level1"><div class="li"> Use the special overbar encoding (e.g. “pinlabel=\_Reset\_”) to express inverse logic levels</div>
162 </li>
163 </ul>
165 </div>
166 <!-- EDIT852 SECTION "Text" [6513-6749] -->
167 <h3 class="sectionedit853"><a name="attributes" id="attributes">Attributes</a></h3>
168 <div class="level3">
169 <ul>
170 <li class="level1"><div class="li"> Pin numbers (which are attributes) should all be 8 pt in size.</div>
171 </li>
172 <li class="level1"><div class="li"> pinnumber (the attribute) should be displayed for pins (not pinseq).</div>
173 </li>
174 <li class="level1"><div class="li"> Attached attributes should be yellow. The color is set automatically to yellow if the text item is attached.</div>
175 </li>
176 <li class="level1"><div class="li"> The only exception to this is pinlabel= attributes, those should be color number 9 (text | green). If every text item within a symbol is yellow, the symbol looks too yellow.</div>
177 </li>
178 <li class="level1"><div class="li"> Attributes can be attached to some part of the symbol. Toplevel attributes (like the 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.</div>
179 </li>
180 <li class="level1"><div class="li"> Expanding a bit on the last sentence, as long as the text item has the format 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.</div>
181 </li>
182 <li class="level1"><div class="li"> There is a symbol content versioning system in libgeda which is based on the symversion= attribute. Please see the Master Attribute Document for more information on using this versioning scheme.</div>
183 </li>
184 </ul>
186 </div>
187 <!-- EDIT853 SECTION "Attributes" [6750-7919] -->
188 <h3 class="sectionedit854"><a name="graphics" id="graphics">Graphics</a></h3>
189 <div class="level3">
190 <ul>
191 <li class="level1"><div class="li"> Lines, boxes, arcs, and any other graphics should be color number 3 (graphic | green).</div>
192 </li>
193 <li class="level1"><div class="li"> Polarity bubbles should be color number 6 (logic bubble | cyan)</div>
194 </li>
195 <li class="level1"><div class="li"> If you are unsure on how to make a new symbol look or how big to make a new symbol, look at the existing symbols to get a feel for the appropriate appearance and size.</div>
196 </li>
197 </ul>
199 </div>
200 <!-- EDIT854 SECTION "Graphics" [7920-8270] -->
201 <h3 class="sectionedit855"><a name="pins" id="pins">Pins</a></h3>
202 <div class="level3">
203 <ul>
204 <li class="level1"><div class="li"> Pins should all be 300 mils (3 grid spaces) long.</div>
205 </li>
206 <li class="level1"><div class="li"> For pins which are next to a logic bubble, make the pins 200 mils (2 grid spaces) long and then make the logic bubble 100 mils in diameter. In order to draw a 100 mil diameter circle, you will need to change the snap spacing to 50.</div>
207 </li>
208 <li class="level1"><div class="li"> A pin has two ends: one end has a red endpoint and one end that does not. The red endpoint is where nets can be connected. You can either rotate the pin so that this active end is in the right place or manually edit the symbol file changing the “whichend” parameter on the pin object. See the File Format document for more info.</div>
209 </li>
210 <li class="level1"><div class="li"> Be that all endpoints of pins which are meant to be connected to are on the 100 mil grid. The endpoint which is not active can be off the grid if necessary.</div>
211 </li>
212 <li class="level1"><div class="li"> Pins should be color number 1 (pins | white).</div>
213 </li>
214 <li class="level1"><div class="li"> Leave 400 mils (4 grid spaces) between (vertically) pins, unless you are drawing a special symbol, then just try to make it look good.</div>
215 </li>
216 <li class="level1"><div class="li"> Pin number attributes should be 50 mils above (or below; which ever makes the most sense) the pin which they are attached to.</div>
217 </li>
218 <li class="level1"><div class="li"> Input pins belong on the left and output pins belong on the right of the symbol.</div>
219 </li>
220 <li class="level1"><div class="li"> Please do not mix inputs and outputs on the same side of the symbol, unless absolutely necessary.</div>
221 </li>
222 <li class="level1"><div class="li"> You can have pins on the top or bottom of a symbol.</div>
223 </li>
224 <li class="level1"><div class="li"> The order for rows of pins (buses) should be LSB (least significant bit) to MSB (most significant bit). When drawing pins which are part of a bus, make sure the LSB of the bus is at the top (or for pins on top/bottom of a symbol, left of the rest of the other pins). Look at 74/74181-1.sym for a correct example of this order (A0 on top through A3 and B0 on top through B3). Violating this rule will make connecting buses much more diffcult.</div>
225 </li>
226 <li class="level1"><div class="li"> When placing pins on logic gates, be sure to place the smallest pin numbers toward the top (or left) and then increment going down (or across).</div>
227 </li>
228 </ul>
230 </div>
231 <!-- EDIT855 SECTION "Pins" [8271-10226] -->
232 <h3 class="sectionedit856"><a name="electrical" id="electrical">Electrical</a></h3>
233 <div class="level3">
234 <ul>
235 <li class="level1"><div class="li"> Do not draw power and ground pins. That information will be conveyed using attributes (see the netattrib document).</div>
236 </li>
237 <li class="level1"><div class="li"> The above rule can be broken if necessary, but keep in mind most of the standard library does not have power pins showing.</div>
238 </li>
239 <li class="level1"><div class="li"> Keep in mind, symbols are supposed to be symbolic, they do not represent the physical package that the device comes in.</div>
240 </li>
241 <li class="level1"><div class="li"> There is some disagreement on above, so this is okay too: Arrange the pins on a symbol logically so that they promote an uncluttered schematic. Note that this is frequently not the same pin arrangement as the physical device.</div>
242 </li>
243 </ul>
245 </div>
246 <!-- EDIT856 SECTION "Electrical" [10227-10851] -->
247 <h2 class="sectionedit857"><a name="hints_and_tips" id="hints_and_tips">Hints and Tips</a></h2>
248 <div class="level2">
251 This section describes some hints and tips which will make your symbol creation
252 experience easier.<br/>
254 </p>
255 <ul>
256 <li class="level1"><div class="li"> Pins MUST be snapped on the 100-spaced grid.</div>
257 </li>
258 <li class="level1"><div class="li"> Avoid drawing things off of the grid. If you do, you cannot move the object(s) using the move command (if the grid is on) since the object will be snapped to the grid. [This was an old bug, which I think has been fixed, but avoid doing this anyway]. Use the symbol translate command instead (or move the object with grid snap off)</div>
259 </li>
260 <li class="level1"><div class="li"> It is okay to set the grid finer than 100 (say 10 or 25) when creating symbols, just remember to set this back to 100 once you are ready to translate the symbol to the origin.</div>
261 </li>
262 <li class="level1"><div class="li"> If you want to translate a symbol from the origin to elsewhere, then use the “Symbol translate” command and enter a non zero number. Make sure this number is a multiple of 100 (ie 1000, or 1100).</div>
263 </li>
264 <li class="level1"><div class="li"> Remember that pins are special objects; if you want to add a pin, make sure it is a pin and not a line or net. Use the Add/Pin command to place a pin.</div>
265 </li>
266 <li class="level1"><div class="li"> Don&#039;t include nets or buses inside symbols. That is not supported and doesn&#039;t make much sense anyway.</div>
267 </li>
268 <li class="level1"><div class="li"> Pinnumber should be the visible attribute for pins, along with pinlabel if any.</div>
269 </li>
270 </ul>
272 </div>
273 <!-- EDIT857 SECTION "Hints and Tips" [10852-12089] -->
274 <h2 class="sectionedit858"><a name="example" id="example">Example</a></h2>
275 <div class="level2">
278 This section provides a simple example which tries to follow all of the above rules. This symbol is of a 7400 (NAND gate).<br/>
280 </p>
283 <pre STYLE="background : LightGreen;
284 margin-left : 2em"><font size="+0">v 20031231 1
285 L 300 200 300 800 3 0 0 0 -1 -1
286 T 300 0 9 8 1 0 0 0 1
287 7400
288 L 300 800 700 800 3 0 0 0 -1 -1
289 T 500 900 5 10 0 0 0 0 1
290 device=7400
291 T 500 1100 5 10 0 0 0 0 1
292 slot=1
293 T 500 1300 5 10 0 0 0 0 1
294 numslots=4
295 T 500 1500 5 10 0 0 0 0 1
296 slotdef=1:1,2,3
297 T 500 1700 5 10 0 0 0 0 1
298 slotdef=2:4,5,6
299 T 500 1900 5 10 0 0 0 0 1
300 slotdef=3:9,10,8
301 T 500 2100 5 10 0 0 0 0 1
302 slotdef=4:12,13,11
303 L 300 200 700 200 3 0 0 0 -1 -1
304 A 700 500 300 270 180 3 0 0 0 -1 -1
305 V 1050 500 50 6 0 0 0 -1 -1 0 -1 -1 -1 -1 -1
306 P 1100 500 1300 500 1 0 1
308 T 1100 550 5 8 1 1 0 0 1
309 pinnumber=3
310 T 1100 450 5 8 0 1 0 2 1
311 pinseq=3
312 T 950 500 9 8 0 1 0 6 1
313 pinlabel=Y
314 T 950 500 5 8 0 1 0 8 1
315 pintype=out
317 P 300 300 0 300 1 0 1
319 T 200 350 5 8 1 1 0 6 1
320 pinnumber=2
321 T 200 250 5 8 0 1 0 8 1
322 pinseq=2
323 T 350 300 9 8 0 1 0 0 1
324 pinlabel=B
325 T 350 300 5 8 0 1 0 2 1
326 pintype=in
328 P 300 700 0 700 1 0 1
330 T 200 750 5 8 1 1 0 6 1
331 pinnumber=1
332 T 200 650 5 8 0 1 0 8 1
333 pinseq=1
334 T 350 700 9 8 0 1 0 0 1
335 pinlabel=A
336 T 350 700 5 8 0 1 0 2 1
337 pintype=in
339 T 300 900 8 10 1 1 0 0 1
340 refdes=U?
341 T 500 2250 5 10 0 0 0 0 1
342 footprint=DIP14
343 T 500 2450 5 10 0 0 0 0 1
344 description=4 NAND gates with 2 inputs
345 T 500 2850 5 10 0 0 0 0 1
346 net=Vcc:14
347 T 500 3050 5 10 0 0 0 0 1
348 net=GND:7
349 T 500 2650 5 10 0 0 0 0 1
350 documentation=http:<em>www-s.ti.com/sc/ds/sn74hc00.pdf
351 &lt;/xterm&gt;
353 This example produces the following (using gschem):
355 <a href="media/geda/symbol_7400-1_hidden.png" class="media" target="_blank" title="geda:symbol_7400-1_hidden.png"><img src="media/geda/symbol_7400-1_hidden.png" class="media" title=":geda:symbol_7400-1_hidden.png" alt=":geda:symbol_7400-1_hidden.png" /></a>
357 This is the same symbol with all the hidden text visible (via Edit/Show/Hide Inv Text):
359 <a href="media/geda/symbol_7400-1.png" class="media" target="_blank" title="geda:symbol_7400-1.png"><img src="media/geda/symbol_7400-1.png" class="media" title=":geda:symbol_7400-1.png" alt=":geda:symbol_7400-1.png" /></a>
361 ===== Document Revision History =====
362 | September 14th, 2002|Created symbol.tex from symbols.html |
363 | October 31st, 2002|Fixed bad example symbol |
364 | February 11th, 2003|Footprint naming conventions added |
365 | September 27th, 2003|Applied Dan McMahill&#039;s QFP and QFN patch |
366 | July 6th, 2004|Added a bunch more details/hints to the pin section |
368 </p>
370 </div>
371 <!-- EDIT858 SECTION "Example" [12090-] --></body>
372 </html>