missing NULL terminator in set_config_x
[geda-gaf.git] / docs / wiki / geda-na_howto.html
blob0922b107f99b66d7bb8c0ea91eb57fdb6df7caf6
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 <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
6 <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
7 <link rel="stylesheet" media="print" type="text/css" href="./print.css" />
9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10 </head>
11 <body>
13 <p>
14 <em>Translations of this page are also available in the following languages:</em> <a href="geda-na_howto.ru.html" class="wikilink1" title="geda-na_howto.ru.html">Русский</a>.
15 </p>
17 <h1 class="sectionedit1" id="net_attribute_mini-howto">net= attribute mini-HOWTO</h1>
18 <div class="level1">
20 <p>
21 by: Ales Hvezda
22 </p>
24 <p>
25 This document is released under <a href="http://www.gnu.org/copyleft/fdl.html" class="urlextern" title="http://www.gnu.org/copyleft/fdl.html" rel="nofollow">GFDL</a>
26 </p>
28 <p>
29 October 2nd, 2003
30 </p>
32 <p>
33 The information in this document is current as of 19991011.
34 </p>
36 </div>
37 <!-- EDIT1 SECTION "net= attribute mini-HOWTO" [111-326] -->
38 <h2 class="sectionedit2" id="what_is_the_net_attribute_used_for">What is the net= attribute used for?</h2>
39 <div class="level2">
41 <p>
42 The <strong><code>net=</code></strong> attribute is used to specify power, ground, and/or arbitrary nets in the gEDA system.<br/>
44 The <strong><code>net=</code></strong> attribute is used instead some of the other systems of specifying power/ground (such as having power/ground pins on symbols or power boxes). Some devices have lots of power/ground pins and having all of these pins on the symbol would increase its size and make it unmanageable. The <strong><code>net=</code></strong> attribute is the power/ground specification of choice in the gEDA system because of its simplicity and versatility.
45 Now having said all this, you can have power/ground pins on a symbol, but gnetlist will probably not recognize these nets connected to these pins as separate power/ground nets. Please keep this in mind as you draw symbols.
46 </p>
48 </div>
49 <!-- EDIT2 SECTION "What is the net= attribute used for?" [327-1132] -->
50 <h2 class="sectionedit3" id="what_is_the_format_of_the_net_attribute">What is the format of the net= attribute?</h2>
51 <div class="level2">
53 <p>
54 Attributes in gEDA are simple text items which are in the form <code>name=value</code>. All proper attributes follow this form. Attribute names are always lower case, but the value can be upper or lower case. gnetlist and friends are case sensitive. Typically net/signal names by default are upper case.<br/>
56 Attribute can be attached to an object or in certain cases (like the <strong><code>net=</code></strong> attribute) can be free floating (not attached to anything). The free floating attributes
57 are also called toplevel attributes.<br/>
59 The <strong><code>net=</code></strong> attribute is a text item which takes on the following form:
60 </p>
61 <pre class="code">net=signalname:pinname,pinname,pinname,...</pre>
63 <p>
64 where:
65 </p>
66 <div class="table sectionedit4"><table class="inline">
67 <tr class="row0">
68 <td class="col0"> <strong><code>net=</code></strong> </td><td class="col1"> The attribute name (always the same, lowercase) </td>
69 </tr>
70 <tr class="row1">
71 <td class="col0"> signalname </td><td class="col1"> The signal or net being defines (like +5V, GND, etc…) </td>
72 </tr>
73 <tr class="row2">
74 <td class="col0"> pinname </td><td class="col1"> The pin name (or number) which is assigned to this signal/net (or pin names/numbers) </td>
75 </tr>
76 </table></div>
77 <!-- EDIT4 TABLE [1835-2073] -->
78 <p>
79 The signalname cannot contain the “:” character (since it is a delimiter). The pinname is the pin name (A1, P2, D1, etc…) or pin number (1, 2, 5, 13, etc…). The pinname cannot contain the “,” character (since it is also a delimiter). pinnames are typically the same sort of numbers/names like the <code>pin#=#</code> attribute (if you are familiar with that attribute).<br/>
81 You can only have ONE signalname per <strong><code>net=</code></strong> attribute, but you can have as many pinnames/numbers as you want.
82 </p>
84 </div>
85 <!-- EDIT3 SECTION "What is the format of the net= attribute?" [1133-2558] -->
86 <h2 class="sectionedit5" id="how_do_you_actually_use_the_net_attribute">How do you actually use the net= attribute?</h2>
87 <div class="level2">
89 <p>
90 You can place the <strong><code>net=</code></strong> attribute in several places. Here&#039;s the list so far:
91 </p>
92 <ul>
93 <li class="level1"><div class="li"> Inside a symbol either as an attached attribute or an unattached attribute (toplevel attribute). Example which creates power/gnd nets: <strong><code>net=GND:7</code></strong> or <strong><code>net=+5V:14</code></strong></div>
94 </li>
95 <li class="level1"><div class="li"> Outside a symbol (which is instantiated on a schematic) attached as an attribute to override an existing <strong><code>net=</code></strong> created net/signal. Suppose a symbol has a <strong><code>net=GND:7</code></strong> inside it already; attaching this to the symbol: <strong><code>net=AGND:7</code></strong> overrides the GND net (on pin 7) calling it AGND and connects/associates it to pin 7.</div>
96 </li>
97 <li class="level1"><div class="li"> Outside or inside a symbol to connect a net to a visible pin automatically. This is still untested and still might have some undesirable (negative) side effects. Use with caution.</div>
98 </li>
99 <li class="level1"><div class="li"> Attached to one of those special power/gnd symbol (like vcc/gnd/vdd) and you can change what that symbol represents. You could change the ground symbol to create a net called DIGITAL GND without editing the symbol (<strong><code>net=DIGITAL_GND:1</code></strong>).<br/>
100 In the current symbol (19991011) library there are symbols named <strong>vdd-1.sym</strong>, <strong>vcc-1.sym</strong>, <strong>vee-1.sym</strong>, etc… which do not have a <strong><code>net=</code></strong> attribute inside, so you must attach the <strong><code>net=</code></strong> attribute yourself (in the schematic).<br/>
101 There also symbols named 5V-minus-1.sym, 12V-plus-1.sym, 9V-plus-1.sym, etc… which have the appropriate <strong><code>net=</code></strong> attribute in them already (can be overridden though). You can use these symbol as examples of how to use the <strong><code>net=</code></strong> attribute.<br/>
102 </div>
103 </li>
104 </ul>
107 You can have as many <strong><code>net=</code></strong> attributes as you want. Just remember that <strong><code>net=</code></strong> attributes attached to the outside of a symbol override any equivalent internal (inside the symbol) <strong><code>net=</code></strong> attributes. If you run into a case where this doesn&#039;t work, please <a href="geda-howto_report_bugs.html" class="wikilink1" title="geda-howto_report_bugs.html">report a bug</a>.
108 </p>
110 </div>
111 <!-- EDIT5 SECTION "How do you actually use the net= attribute?" [2559-4453] -->
112 <h2 class="sectionedit6" id="caveats_bugs">Caveats / Bugs</h2>
113 <div class="level2">
116 The <strong><code>net=</code></strong> attribute/mechanism is fairly new, so there are bound to be bugs (many bugs). Here are some of the identified issues:
117 </p>
118 <ul>
119 <li class="level1"><div class="li"> As of 19991011 almost all of the symbols in the standard library do not have the <strong><code>net=</code></strong> attribute or any other power/ground specifiers. Hopefully this will be updated sometime (any volunteers?).</div>
120 </li>
121 <li class="level1"><div class="li"> Attach a special power symbol (vcc/gnd) to a already named net will alias (rename) that net to the signalname specified in the <strong><code>net=</code></strong> attribute (in/attached to the vcc/gnd symbol). You can override this (so the reverse is true) by playing with the “net-naming-priority”. Be careful with this. There might be other “aliasing” issues which have not been identified yet.</div>
122 </li>
123 <li class="level1"><div class="li"> Creating a <strong><code>net=</code></strong> attribute which associates a signal name with a pin which is already visible on the symbol, is probably a bad idea. This does work, but all the ramifications have not been explored yet.</div>
124 </li>
125 <li class="level1"><div class="li"> It is probably a bad idea to have the same <strong><code>net=</code></strong> attribute attached several times. Ales has not formalized what happens in this case. Just remember that the <strong><code>net=</code></strong> attribute on the outside of a symbol should override the internal one.</div>
126 </li>
127 </ul>
129 </div>
130 <!-- EDIT6 SECTION "Caveats / Bugs" [4454-5665] -->
131 <h2 class="sectionedit7" id="example">Example</h2>
132 <div class="level2">
135 Here&#039;s a schematic which uses standard symbols (note: the 7400 does not have the <strong><code>net=</code></strong> attribute inside yet). This schematic consists of a 7400 with the <strong><code>net=</code></strong> attributes attached for power and ground, One of the input pins grounded using a gnd symbol and the other at a logic one using the vcc symbol (with an attached <strong><code>net=</code></strong> attribute). One of the input net is named, but as you will see, the netname is replaced by the <strong><code>net=</code></strong> signal name (see above for more info on this). The output is pulled up with a pull up resistor which has power specified using the +5V symbol.<br/>
137 </p>
138 <div class="table sectionedit8"><table class="inline">
139 <tr class="row0">
140 <td class="col0"> <a href="media/geda/net.jpg" class="media" target="_blank" title="geda:net.jpg"><img src="media/geda/net.jpg" class="media" alt="" /></a> </td>
141 </tr>
142 </table></div>
143 <!-- EDIT8 TABLE [6286-6307] --><pre class="code">v 19991011
144 C 38700 58100 1 0 0 7400-1.sym
146 T 39000 59000 5 10 1 1 0
147 uref=U100
148 T 38900 59500 5 10 1 1 0
149 net=GND:7
150 T 38900 59300 5 10 1 1 0
151 net=+5V:14
153 N 38700 58800 37400 58800 4
155 T 37600 58900 5 10 1 1 0
156 netname=NETLABEL
158 N 37400 58800 37400 59200 4
159 N 38700 58400 37400 58400 4
160 N 37400 58000 37400 58400 4
161 C 37300 57700 1 0 0 gnd-1.sym
162 C 37200 59200 1 0 0 vcc-1.sym
164 T 36800 59200 5 10 1 1 0
165 net=+5V:1
167 N 40000 58600 41600 58600 4
169 T 41200 58700 5 10 1 1 0
170 netname=OUTPUT
172 C 40700 58800 1 90 0 resistor-1.sym
174 T 40800 59200 5 10 1 1 0
175 uref=R1
177 N 40600 58800 40600 58600 4
178 N 40600 59900 40600 59700 4
179 C 40400 59900 1 0 0 5V-plus-1.sym</pre>
182 <strong>gnetlist</strong> (using the geda netlist format) run using this sample schematic outputs this:
183 </p>
184 <pre class="code">START header
186 gEDA&#039;s netlist format
187 Created specifically for testing of gnetlist
189 END header
191 START components
193 R1 device=RESISTOR
194 U100 device=7400
196 END components
198 START renamed-nets
200 NETLABEL -&gt; +5V
202 END renamed-nets
204 START nets
206 +5V : R1 2, U100 14, U100 1
207 GND : U100 7, U100 2
208 OUTPUT : R1 1, U100 3
210 END nets</pre>
213 Notice how NETLABEL was renamed (aliased to the +5V net).
214 </p>
216 </div>
217 <!-- EDIT7 SECTION "Example" [5666-7443] -->
218 <h2 class="sectionedit9" id="final_notes">Final notes</h2>
219 <div class="level2">
222 If you found a bug, please <a href="geda-howto_report_bugs.html" class="wikilink1" title="geda-howto_report_bugs.html">let us know</a>.
223 </p>
225 </div>
226 <!-- EDIT9 SECTION "Final notes" [7444-] --></body>
227 </html>