refdes_renum: warn of possible number clash with non-conforming values
[geda-gaf/whiteaudio.git] / docs / wiki / geda-data_structure_design_discussion.html
blobf79b679fe3c8f245c74662c223a3b6c215a15626
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="sectionedit105"><a name="data_structure_design_discussion" id="data_structure_design_discussion">Data structure design discussion</a></h1>
16 <div class="level1">
18 </div>
19 <!-- EDIT105 SECTION "Data structure design discussion" [1-48] -->
20 <h1 class="sectionedit106"><a name="concept_diagram" id="concept_diagram">Concept diagram</a></h1>
21 <div class="level1">
23 <p>
25 (Inspired by gnetman, by Bill Cox)
26 </p>
28 <p>
29 <a href="/./lib/exe/fetch.php?hash=d4505f&amp;media=http%3A%2F%2Fwww2.eng.cam.ac.uk%2F%7Epcjc2%2Fgeda%2Fdatastructures.png" class="media" title="http://www2.eng.cam.ac.uk/~pcjc2/geda/datastructures.png"><img src="media/http///www2.eng.cam.ac.uk/~pcjc2/geda/datastructures.png" class="media" alt="" /></a>
30 </p>
32 </div>
33 <!-- EDIT106 SECTION "Concept diagram" [49-178] -->
34 <h2 class="sectionedit107"><a name="concepts_behind_the_structures" id="concepts_behind_the_structures">Concepts behind the structures</a></h2>
35 <div class="level2">
37 </div>
38 <!-- EDIT107 SECTION "Concepts behind the structures" [179-222] -->
39 <h3 class="sectionedit108"><a name="design" id="design">Design</a></h3>
40 <div class="level3">
42 <p>
44 This is might not exist as a “file”, as such, but exists as a data structure entity to be the owner of the circuits required in a particular design. The “root circuit” is the uppermost level of hierarchy.
45 </p>
47 </div>
48 <!-- EDIT108 SECTION "Design" [223-446] -->
49 <h3 class="sectionedit109"><a name="circuit" id="circuit">Circuit</a></h3>
50 <div class="level3">
52 <p>
54 A <strong>circuit</strong> entity is the key concept in this model. It defines an electrical block by a its external connections (<strong>MPort</strong>s). A schematic is one way of representing a circuit, hence a circuit object may own or more <strong>page</strong> of schematics.
55 </p>
57 <p>
58 We may also define a <strong>symbolic</strong> (graphic) representation of a circuit - this is like a schematic <strong>page</strong>, however its representation should fit within a single sheet. The minimum a symbolic representation must contain is the <strong>pins</strong> which connect it to higher levels of circuit hierarchy.
59 </p>
61 </div>
62 <!-- EDIT109 SECTION "Circuit" [447-1004] -->
63 <h3 class="sectionedit110"><a name="mport" id="mport">MPort</a></h3>
64 <div class="level3">
66 <p>
68 If it is to be useful as a re-usable block, a sub-<strong>circuit</strong> must expose electrical connectivity for a parent <strong>circuit</strong> to connect with. Each such connection is represented by an <strong>Mport</strong> (Master port). This term (re-used from gnetman) represents the fact that once a circuit is instantiated, we need to differentiate between the connections of each specific instance. This is done with instance specific <strong>Port</strong> structures. The <strong>port</strong>s point back at the <strong>Mport</strong>s (master ports) of the circuit representation.
69 </p>
71 </div>
72 <!-- EDIT110 SECTION "MPort" [1005-1541] -->
73 <h3 class="sectionedit111"><a name="instance" id="instance">Instance</a></h3>
74 <div class="level3">
76 <p>
78 A <strong>circuit</strong> represents a re-usable electrical entity which we may replicate at various points in our design hierarchy. This is done by instantiating the sub-<strong>circuit </strong> in a higher level of hierarchy. Each instance is associated with an <strong>Instance</strong> structure, which is a placeholder for instance specific attributes such as the sub-circuit&#039;s hierarchical refdes.
79 </p>
81 </div>
82 <!-- EDIT111 SECTION "Instance" [1542-1929] -->
83 <h3 class="sectionedit112"><a name="attrib" id="attrib">Attrib</a></h3>
84 <div class="level3">
86 <p>
88 An <strong>Attrib</strong> defines meta-data attached which might be attached to a <strong>circuit</strong>, a <strong>circuit</strong>&#039;s <strong>Mport</strong>, a specific <strong>circuit</strong> <strong>instance</strong>, or a <strong>Net</strong>.
89 </p>
91 <p>
92 In a break from gEDA&#039;s current <strong>attrib</strong> model, it makes sense to associate the meta-data directly with the particular entity it pertains to, rather than the graphic representation. This is because some forms of sub-<strong>circuit</strong> entity may be defined without a schematic, and could still require this meta-data. It will be possible to reference any <strong>attrib</strong> within the realm of a <strong>circuit</strong> for display on its schematic <strong>page</strong>(s) where that is desired.
93 </p>
95 </div>
96 <!-- EDIT112 SECTION "Attrib" [1930-2569] -->
97 <h3 class="sectionedit113"><a name="netlist" id="netlist">Netlist</a></h3>
98 <div class="level3">
102 A <strong>Netlist</strong> defines the electrical connectivity of a <strong>circuit</strong>. It owns a number of <strong>Net</strong>s, which individually represent a single connection between <strong>Mport</strong>s belonging to this <strong>circuit</strong>, and <strong>ports</strong> of instantiated sub-<strong>circuits</strong>.
103 </p>
106 Initially, it is likely there will only be one netlist for a <strong>circuit</strong> - the one constructed from processing the electrically relevant objects on <strong>page</strong>(s) of the <strong>circuit</strong>&#039;s schematic.
107 </p>
110 Future developments may see multiple netlists for a circuit, possibly some generated / written in an HDL language, and critically, re-exported from a layout package (e.g. PCB). It will be possible to identify and flag up differences in connectivity throughout a design flow, be that from HDL to schematic, or schematic to layout.
111 </p>
114 This has real applications in back-annotation and in design verification.
115 </p>
117 </div>
118 <!-- EDIT113 SECTION "Netlist" [2570-3435] -->
119 <h3 class="sectionedit114"><a name="net" id="net">Net</a></h3>
120 <div class="level3">
124 A <strong>net</strong> associates with structures forming a given electrical connection within this <strong>circuit</strong>.
125 </p>
128 As we also have a graphical representation of the wires (<strong>ConnSegment</strong>s) which make up this connection, each <strong>Net</strong> can be associated with multiple <strong>ConnSegment</strong>s. The association to <strong>Pins</strong> representing <strong>Mport</strong>s of this <strong>circuit</strong> and to the <strong>Pins</strong> of any instantiated sub-<strong>circuits</strong> is made via a <strong>net</strong>&#039;s association to the appropriate <strong>Mport</strong> and <strong>port</strong> structures.
129 </p>
131 </div>
132 <!-- EDIT114 SECTION "Net" [3436-3940] -->
133 <h3 class="sectionedit115"><a name="page" id="page">Page</a></h3>
134 <div class="level3">
138 A <strong>page</strong> is a canvas for placing graphical objects representing a circuit. A <strong>page</strong> can be used to draw an electrically meaningful schematic, or it can be used to draw a symbolic representation of the circuit entity.
139 </p>
142 Whilst most objects on a <strong>page</strong> are graphic primitives, there are some which have a relation to the <strong>circuit</strong>&#039;s electrical specification.
144 </p>
145 <ul>
146 <li class="level1"><div class="li"> <strong>ConnSegments</strong> (or <strong>net</strong>s) represent connected electrical signals within the circuit represented.</div>
147 <ul>
148 <li class="level2"><div class="li"> A connectivity representation (<strong>netlist</strong>) can be built by considering the end-point positioning of these objects.</div>
149 </li>
150 <li class="level2"><div class="li"> <strong>ConnSegment</strong> is intended to be a generalisation of <strong>net</strong>s and <strong>bus</strong>es for the purpose of this diagram.</div>
151 </li>
152 </ul>
153 </li>
154 </ul>
155 <ul>
156 <li class="level1"><div class="li"> <strong>Pins</strong> represent a connection outside this circuit.</div>
157 <ul>
158 <li class="level2"><div class="li"> When constructing a netlist, coincidence of a <strong>ConnSegment</strong> end on these implies an electrical connection to that external port.</div>
159 </li>
160 <li class="level2"><div class="li"> Each <strong>pin</strong> (or group of pins?) represent an external electrical connection with this <strong>circuit</strong>.</div>
161 </li>
162 <li class="level2"><div class="li"> There is a necessary link between a <strong>pin</strong> and the circuit&#039;s <strong>Mport</strong> which it represents.</div>
163 </li>
164 </ul>
165 </li>
166 </ul>
167 <ul>
168 <li class="level1"><div class="li"> <strong>complex</strong> objects represent instantiating a sub-<strong>circuit</strong>, and will be linked to a specific <strong>instance</strong> structure.</div>
169 <ul>
170 <li class="level2"><div class="li"> Graphically, this means a <strong>symbolic</strong> representation of the instantiated circuit will be placed on the page.</div>
171 </li>
172 <li class="level2"><div class="li"> Nets ending co-incident with the <strong>pins</strong> of that embedded symbol represent electrical connectivity with the instantiated sub-<strong>circuit</strong> entity.</div>
173 </li>
174 </ul>
175 </li>
176 </ul>
178 </div>
179 <!-- EDIT115 SECTION "Page" [3941-5460] -->
180 <h1 class="sectionedit116"><a name="brainstorms" id="brainstorms">Brainstorms</a></h1>
181 <div class="level1">
185 (from conversation on MSN/<acronym title="Internet Relay Chat">IRC</acronym> on 10th April 2007 – Peter Brett / Peter Clifton)
187 </p>
188 <ul>
189 <li class="level1"><div class="li"> In order to do back annotation, need to be able to change the board part references for anywhere in the schematic. It then makes sense to dissociate the concepts of <strong>InstanceID</strong> and <strong>Board Reference</strong>, and use an <strong>override table</strong> that can override an attribute at any given path within the current <strong>circuit</strong> based on a path composed of <strong>InstanceID</strong>s. <strong>InstanceID</strong>s would be special-cased throughout libgeda as a means for uniquely identifying circuits and instances. An entry in the override table might have the form ”/id1/id2/id3:refdes:U3”</div>
190 </li>
191 </ul>
192 <ul>
193 <li class="level1"><div class="li"> It might be useful to allow nets to have attributes, for instance to specify minimum copper width and spacing for a net, independently from the attributes of net segments.</div>
194 </li>
195 </ul>
196 <ul>
197 <li class="level1"><div class="li"> The schematic editor needs to have sidebars for browsing hierarchy and inspecting attributes. This needs to include a way of seeing where the attributes have been inherited from.</div>
198 </li>
199 </ul>
200 <ul>
201 <li class="level1"><div class="li"> We need to do lazy netlisting, on a circuit-by-circuit basis – the netlists should only be combined into a flat netlist when required by a tool (and even then, most tools can potentially make good use of hierarchy information).</div>
202 </li>
203 </ul>
204 <ul>
205 <li class="level1"><div class="li"> In order to make finding objects by hierarchical path fast (e.g. to implement override tables discussed above) there needs to be a fast way of generating unique identifiers for objects (e.g. 32-bit ints) that can then be used as keys in hashtables.</div>
206 </li>
207 </ul>
209 </div>
210 <!-- EDIT116 SECTION "Brainstorms" [5461-] --></body>
211 </html>