1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
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" />
14 This page will serve to document the design rule checker. This is presently documented “as-is”.
18 For work tasks, see the
<a href=
"https://blueprints.launchpad.net/pcb/+spec/drc" class=
"urlextern" title=
"https://blueprints.launchpad.net/pcb/+spec/drc" rel=
"nofollow">LaunchPad blueprint
</a>.
22 The DRC code makes extensive use of the
<a href=
"pcb-connection_lookup.html" class=
"wikilink1" title=
"pcb-connection_lookup.html"> "connection lookup
"</a> code.
25 <h2 class=
"sectionedit1" id=
"drc_violations">DRC Violations
</h2>
28 <li class=
"level1"><div class=
"li"> Line/arc/silk width is too thin
</div>
30 <li class=
"level1"><div class=
"li"> Pin/via annular ring too small
</div>
32 <li class=
"level1"><div class=
"li"> Pin/via drill size too small
</div>
34 <li class=
"level1"><div class=
"li"> Pad too thin
</div>
36 <li class=
"level1"><div class=
"li"> Silk lines in elements
</div>
38 <li class=
"level1"><div class=
"li"> No paste
</div>
40 <li class=
"level1"><div class=
"li"> Insufficient copper overlap
</div>
42 <li class=
"level1"><div class=
"li"> Insufficient copper spacing
</div>
44 <li class=
"level1"><div class=
"li"> Hole too close to line/pad/pin/via
</div>
46 <li class=
"level1"><div class=
"li"> Hole touches arc
</div>
48 <li class=
"level1"><div class=
"li"> Insufficient clearance inside polygon
</div>
50 <li class=
"level1"><div class=
"li"> Joined line not connected to polygon
</div>
55 <!-- EDIT1 SECTION "DRC Violations" [290-683] -->
56 <h2 class=
"sectionedit2" id=
"process">Process
</h2>
60 Presently, the violations are identified in find.c, and then appended to a list in the gtk hid. In the lesstif and batch hids, you get a pop-up window or a text prompt that describes the error.
64 Executing the DRC() action will wipe out the selected, found, and DRC flags on most objects, although, apparently not elements.
67 <li class=
"level1"><div class=
"li"> Execute the DRC() action.
</div>
69 <li class=
"level1"><div class=
"li"> Generate the “DRC doesn
't catch everything” warning.
</div>
71 <li class=
"level1"><div class=
"li"> Save layer state and turn on all layers.
</div>
73 <li class=
"level1"><div class=
"li"> Clear the FOUNDFLAG, DRCFLAG, and SELECTEDFLAG on all objects. DRC uses these flags to find errors. After clearing all the flags, the undo serial number is incremented. When we
're done, we
'll clear all the flags again, and execute an “undo” to restore the state.
</div>
75 <li class=
"level1"><div class=
"li"> InitConnectionLookup – This resets all of the lists that are used for building the connectivity map.
</div>
77 <li class=
"level1 node"><div class=
"li"> Use DRCFind to check for “insufficient overlap” and “insufficient clearance” in copper objects.
</div>
79 <li class=
"level2"><div class=
"li"> For every element pin, pad, and via, execute DRCFind. DRCFind builds a connection list starting from the given pin/pad/via four times using the
<a href=
"pcb-connection_lookup.html" class=
"wikilink1" title=
"pcb-connection_lookup.html"> "connection lookup
"</a> code.
</div>
81 <li class=
"level2 node"><div class=
"li"> Check for insufficient overlap:
</div>
83 <li class=
"level3"><div class=
"li"> Apply a global bloat of value “Shrink”, and build a connection list, with global drc set to false. This will set the DRCFLAG and SELECTEDFLAG on every object that is touching the given pin/pad/via.
</div>
85 <li class=
"level3"><div class=
"li"> Apply a global bloat of value
0, and build a connection list with global “drc” set to true.
</div>
87 <li class=
"level3"><div class=
"li"> With “drc” set to true, the add_object_to_list function will exit with a return status when it finds something that doesn
't have the SELECTEDFLAG set. “Thing” is set to the new object.
</div>
89 <li class=
"level3"><div class=
"li"> This status propagates back up, and the connection lookup is terminated early.
</div>
91 <li class=
"level3"><div class=
"li"> A drc_violation is created that includes the “Thing” object.
</div>
95 <li class=
"level2 node"><div class=
"li"> Check for insufficient clearance:
</div>
97 <li class=
"level3"><div class=
"li"> Do the same routine as above, except starting with a global bloat of
0, and using a bloat of “Bloat” for the second run through.
</div>
103 <li class=
"level1 node"><div class=
"li"> Check for minimum copper line widths:
</div>
105 <li class=
"level2"><div class=
"li"> Iterate over all copper lines with COPPERLINE_LOOP
</div>
107 <li class=
"level2"><div class=
"li"> Test the thickness value of the line
</div>
109 <li class=
"level2"><div class=
"li"> Generate a drc_violation if the thickness is too thin.
</div>
111 <li class=
"level2"><div class=
"li"> Iterate over all copper arcs with COPPERARC_LOOP
</div>
113 <li class=
"level2"><div class=
"li"> ditto
</div>
117 <li class=
"level1"><div class=
"li"> Check pin annular rings
</div>
119 <li class=
"level1"><div class=
"li"> Check drill sizes
</div>
121 <li class=
"level1"><div class=
"li"> Check pad widths
</div>
123 <li class=
"level1"><div class=
"li"> Check via annular rings
</div>
125 <li class=
"level1"><div class=
"li"> Check via drill sizes
</div>
127 <li class=
"level1"><div class=
"li"> Check silk line widths
</div>
129 <li class=
"level1"><div class=
"li"> Check element silk line widths
</div>
131 <li class=
"level1"><div class=
"li"> Restore the layer stack visibility
</div>
133 <li class=
"level1"><div class=
"li"> return the number of violations found
</div>
138 <!-- EDIT2 SECTION "Process" [684-3245] -->
139 <h2 class=
"sectionedit3" id=
"to_do_list">To Do List
</h2>
143 <!-- EDIT3 SECTION "To Do List" [3246-3266] -->
144 <h3 class=
"sectionedit4" id=
"new_drc_violations">New DRC Violations
</h3>
148 Some useful DRC violations to add:
151 <li class=
"level1"><div class=
"li"> Check for text on copper layers (which is not tested by the DRC)
</div>
153 <li class=
"level1"><div class=
"li"> Check for object proximity to the edge of the board
</div>
155 <li class=
"level1"><div class=
"li"> Violations for holes being too close together
</div>
157 <li class=
"level1"><div class=
"li"> Floating copper
</div>
159 <li class=
"level1"><div class=
"li"> Pin/pad exit violations
</div>
161 <li class=
"level1"><div class=
"li"> Silk screen over pins/pads
</div>
163 <li class=
"level1"><div class=
"li"> Overlapping elements
</div>
168 <!-- EDIT4 SECTION "New DRC Violations" [3267-3607] -->
169 <h3 class=
"sectionedit5" id=
"drc_tests">DRC tests
</h3>
173 This is to describe ways of testing the DRC code, not things the DRC should check for.
176 <li class=
"level1"><div class=
"li"> Go through the DRC code for different kinds of violations to check that all possible code paths are being tested
</div>
178 <li class=
"level1"><div class=
"li"> Review the DRC tests and check that the results are correct! (Done:
201901xx)
</div>
180 <li class=
"level1"><div class=
"li"> Generate graphical output for the DRC report
</div>
182 <li class=
"level1"><div class=
"li"> Generate LaTeX output for the DRC report (wishlist!)
</div>
184 <li class=
"level1"><div class=
"li"> Figure out what else uses the “ConnectionLookup” code and write tests so that we don
't break anything else as we
're reworking the DRC
</div>
190 <h4 id=
"additional_test_cases">Additional test cases
</h4>
194 As I work through the code, I
'm going to jot some things down here regarding tests that ought to be done. Much of this stuff tests the more general geometry code too, so, maybe two birds with one stone.
197 <li class=
"level1"><div class=
"li"> Square pads
<br/>
198 In lots of cases, square pads are handled differently than ones with round ends, so, square pads should definitely be tested.
</div>
200 <li class=
"level1"><div class=
"li"> Objects in the same layer group (physical layer) but on different (logical) layers
</div>
202 <li class=
"level1"><div class=
"li"> End points of lines/arcs
<br/>
203 The end point condition is frequently tested for, and a separate test is called for these cases.
</div>
208 <!-- EDIT5 SECTION "DRC tests" [3608-4751] -->
209 <h3 class=
"sectionedit6" id=
"drc_backend_work">DRC backend work
</h3>
212 <li class=
"level1 node"><div class=
"li"> Separate the DRC code from the “ConnectionLookup” code.
<br/>
213 This is mostly complete, however, there are a few reasons why this is not going to completely happen for a while.
</div>
215 <li class=
"level2"><div class=
"li"> The global “drc” variable is going to be difficult to get rid of, since we do want the code to do certain things during a DRC check that we otherwise might not.
</div>
217 <li class=
"level2"><div class=
"li"> The global bloat parameter is also going to be tough to get rid of completely. I think what should happen, is that the DRC should generate a list of connected objects, then bloat/shrink all of them as appropriate, and then run the lookup code again. The lookup code shouldn
't need to know anything about bloating things. However, because of the way the lists are generated (separate lists for every type for every layer!) it will be some work to actually do this.
</div>
221 <li class=
"level1"><div class=
"li"> Get rid of the “drc”, “User”, and “AndDraw” parameters. (Still trying to figure out what the implications of this would be)
</div>
223 <li class=
"level1"><div class=
"li"> Factor all of the different DRC tests into separate functions so that they can be executed individually.
</div>
225 <li class=
"level1"><div class=
"li"> Parameterize the DRC functions, and use those parameters to generate the pane in the preferences widnow.
</div>
227 <li class=
"level1"><div class=
"li"> Have DRC functions operate on “DataType” objects so that you can selectively apply the DRC to, say, the objects in the buffer
</div>
229 <li class=
"level1"><div class=
"li"> Work through more of Peter C
's work to see how much of it we should incorporate (home/cparker/peterc_drc, he has quite a bit of good stuff here, but I
'd like to include it intelligently instead of just picking the commits.)
</div>
231 <li class=
"level1"><div class=
"li"> Write functions to compute the distance between objects.
</div>
233 <li class=
"level1"><div class=
"li"> Put the testing into a background thread so that the
<abbr title=
"Graphical User Interface">GUI
</abbr> is still responsive while the test is executing
</div>
238 <!-- EDIT6 SECTION "DRC backend work" [4752-6466] -->
239 <h3 class=
"sectionedit7" id=
"online_drc">Online DRC
</h3>
243 The online part of the DRC is that part that is active during normal design activities. It does things like preventing you from drawing traces too close together.
247 Right now this functionality exists only for lines and is present in the line.c source file.
251 <!-- EDIT7 SECTION "Online DRC" [6467-6743] -->
252 <h3 class=
"sectionedit8" id=
"multi-clearance">Multi-clearance
</h3>
256 One of the primary hurdles with implementing multi-clearance DRC, or, different DRC requirements for different traces or nets, is the way in which our DRC is implemented. Presently we use an algorithm that bloats or shrinks the objects we
're testing, and looks for changes in connectivity. In a multi-clearance DRC environment, the amount that you would need to bloat your object now depends on the objects around it, which may not have been discovered yet.
260 <!-- EDIT8 SECTION "Multi-clearance" [6744-7225] -->
261 <h3 class=
"sectionedit9" id=
"drc_interface">DRC interface
</h3>
264 <li class=
"level1"><div class=
"li"> Create a DRC panel in the preferences window that allows for adjusting settings (possibly with image descriptions of the violations) and running specific tests individually. This will require that parameterization in the back-end work to be finished first.
</div>
269 <!-- EDIT9 SECTION "DRC interface" [7226-7509] -->
270 <h3 class=
"sectionedit10" id=
"drc_bugs">DRC bugs
</h3>
273 <li class=
"level1"><div class=
"li"> Find more than one “insufficient overlap” or “insufficient gap” per pin/pad/via
<br/>
274 The insufficient overlap case cannot propagate, due to the nature of how it works, however, the insufficient gap one can, and it does now as of the
4.2.0 release.
</div>
276 <li class=
"level1"><div class=
"li"> On MacOS the images in the DRC window of the GTK HID are garbled
</div>
278 <li class=
"level1"><div class=
"li"> The pixmap renderer (gtk) should consider the size of the violation when deciding what area to render for the preview image.
</div>
283 <!-- EDIT10 SECTION "DRC bugs" [7510-] --></body>