User Tools

Site Tools


pcb:drc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
pcb:drc [2018/09/23 13:48]
cparker
pcb:drc [2019/03/26 09:50]
cparker [DRC backend work]
Line 5: Line 5:
 The DRC code makes extensive use of the [[pcb:​connection_lookup | "​connection lookup"​]] code. The DRC code makes extensive use of the [[pcb:​connection_lookup | "​connection lookup"​]] code.
  
-===DRC Violations===+=====DRC Violations=====
   * Line/​arc/​silk width is too thin   * Line/​arc/​silk width is too thin
   * Pin/via annular ring too small   * Pin/via annular ring too small
Line 17: Line 17:
   * Hole touches arc   * Hole touches arc
   * Insufficient clearance inside polygon   * Insufficient clearance inside polygon
 +  * Joined line not connected to polygon
  
-===Process===+=====Process=====
 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. 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.
  
Line 26: Line 27:
   - Generate the "DRC doesn'​t catch everything"​ warning.   - Generate the "DRC doesn'​t catch everything"​ warning.
   - Save layer state and turn on all layers.   - Save layer state and turn on all layers.
-  - Clear the FOUNDFLAG, DRCFLAG, and SELECTEDFLAG on all objects. DRC uses these flags to find errors.+  - 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.
   - InitConnectionLookup -- This resets all of the lists that are used for building the connectivity map.   - InitConnectionLookup -- This resets all of the lists that are used for building the connectivity map.
-  - For every element pin, pad, and via, execute DRCFind. DRCFind builds a connection list starting from the given     ​pin/pad/via four times. ​See below for a more detailed description of that process (if I get around to writing it). +  ​- Use DRCFind to check for "​insufficient overlap"​ and "​insufficient clearance"​ in copper objects. 
-    - 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. +    ​- 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 [[pcb:​connection_lookup | "​connection lookup"​]] code. 
-    - Apply a global bloat of value 0, and build a connection list with global "​drc"​ set to true.+    - Check for insufficient overlap: 
 +      - 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. 
 +      - Apply a global bloat of value 0, and build a connection list with global "​drc"​ set to true. 
 +      - 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. 
 +      - This status propagates back up, and the connection lookup is terminated early. 
 +      - A drc_violation is created that includes the "​Thing"​ object. 
 +    - Check for insufficient clearance:​ 
 +      - 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. 
 +  - Check for minimum copper line widths: 
 +    - Iterate over all copper lines with COPPERLINE_LOOP 
 +    - Test the thickness value of the line 
 +    - Generate a drc_violation if the thickness is too thin. 
 +    - Iterate over all copper arcs with COPPERARC_LOOP 
 +    - ditto 
 +  - Check pin annular rings 
 +  - Check drill sizes 
 +  - Check pad widths 
 +  - Check via annular rings 
 +  - Check via drill sizes 
 +  - Check silk line widths 
 +  - Check element silk line widths 
 +  - Restore the layer stack visibility 
 +  - return the number of violations found
   ​   ​
-===To Do List=== +=====To Do List===== 
-DRC tests:+====New ​DRC Violations==== 
 +Some useful DRC violations to add: 
 +  * Check for text on copper layers (which is not tested by the DRC) 
 +  * Check for object proximity to the edge of the board 
 +  * Violations for holes being too close together 
 +  * Floating copper 
 +  * Pin/pad exit violations 
 +  * Silk screen over pins/pads 
 +  * Overlapping elements 
 +====DRC tests==== 
 +This is to describe ways of testing the DRC code, not things the DRC should check for. 
   * Go through the DRC code for different kinds of violations to check that all possible code paths are being tested   * Go through the DRC code for different kinds of violations to check that all possible code paths are being tested
 +  * Review the DRC tests and check that the results are correct! (Done: 201901xx)
   * Generate graphical output for the DRC report   * Generate graphical output for the DRC report
   * Generate LaTeX output for the DRC report (wishlist!)   * Generate LaTeX output for the DRC report (wishlist!)
   * 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   * 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
  
-DRC backend work: +===Additional test cases=== 
-  * Separate the DRC code from the "​ConnectionLookup"​ code.+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. 
 + 
 +  * Square pads \\ In lots of cases, square pads are handled differently than ones with round ends, so, square pads should definitely be tested. 
 +  * Objects in the same layer group (physical layer) but on different (logical) layers 
 +  * End points of lines/arcs \\ The end point condition is frequently tested for, and a separate test is called for these cases. 
 + 
 +====DRC backend work==== 
 +  * Separate the DRC code from the "​ConnectionLookup"​ code.\\ This is mostly complete, however, there are a few reasons why this is not going to completely happen for a while.  
 +    * 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.  
 +    * 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.
   * Get rid of the "​drc",​ "​User",​ and "​AndDraw"​ parameters. (Still trying to figure out what the implications of this would be)   * Get rid of the "​drc",​ "​User",​ and "​AndDraw"​ parameters. (Still trying to figure out what the implications of this would be)
   * Factor all of the different DRC tests into separate functions so that they can be executed individually.   * Factor all of the different DRC tests into separate functions so that they can be executed individually.
 +  * Parameterize the DRC functions, and use those parameters to generate the pane in the preferences widnow.
   * Have DRC functions operate on "​DataType"​ objects so that you can selectively apply the DRC to, say, the objects in the buffer   * Have DRC functions operate on "​DataType"​ objects so that you can selectively apply the DRC to, say, the objects in the buffer
   * 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.)   * 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.)
 +  * Write functions to compute the distance between objects.
 +  * Put the testing into a background thread so that the GUI is still responsive while the test is executing
 +
 +====Online DRC====
 +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.
 +
 +Right now this functionality exists only for lines and is present in the line.c source file.
  
-DRC interface: +====Multi-clearance==== 
-  * 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 +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. 
-  * Figure out what the lesstif HID requirements are for the DRC code (it works differently,​ presenting violation by violation)+====DRC interface==== 
 +  * 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.
  
-DRC bugs: +====DRC bugs==== 
-  * Highlight both offending objects instead of just one^^^ +  * Highlight both offending objects instead of just one (done: 4.2.0) 
-  * Find more than one "​insufficient overlap"​ or "​insufficient gap" per pin/pad/via^^^ +  * Find more than one "​insufficient overlap"​ or "​insufficient gap" per pin/​pad/​via ​\\ 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. 
-  * Check for duplicate DRC errors before appending a new one (can happen if more than one pin is connected to an object)+  * Check for duplicate DRC errors before appending a new one (can happen if more than one pin is connected to an object) (done: 4.2.0)
   * On MacOS the images in the DRC window of the GTK HID are garbled   * On MacOS the images in the DRC window of the GTK HID are garbled
pcb/drc.txt · Last modified: 2020/06/28 12:37 by cparker