Table of Contents

This page will serve to document the design rule checker. This is presently documented “as-is”.

For work tasks, see the LaunchPad blueprint.

The DRC code makes extensive use of the "connection lookup" code.

DRC Violations

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.

Executing the DRC() action will wipe out the selected, found, and DRC flags on most objects, although, apparently not elements.

  1. Execute the DRC() action.
  2. Generate the “DRC doesn't catch everything” warning.
  3. Save layer state and turn on all layers.
  4. 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.
  5. InitConnectionLookup – This resets all of the lists that are used for building the connectivity map.
  6. Use DRCFind to check for “insufficient overlap” and “insufficient clearance” in copper objects.
    1. 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 "connection lookup" code.
    2. Check for insufficient overlap:
      1. 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.
      2. Apply a global bloat of value 0, and build a connection list with global “drc” set to true.
      3. 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.
      4. This status propagates back up, and the connection lookup is terminated early.
      5. A drc_violation is created that includes the “Thing” object.
    3. Check for insufficient clearance:
      1. 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.
  7. Check for minimum copper line widths:
    1. Iterate over all copper lines with COPPERLINE_LOOP
    2. Test the thickness value of the line
    3. Generate a drc_violation if the thickness is too thin.
    4. Iterate over all copper arcs with COPPERARC_LOOP
    5. ditto
  8. Check pin annular rings
  9. Check drill sizes
  10. Check pad widths
  11. Check via annular rings
  12. Check via drill sizes
  13. Check silk line widths
  14. Check element silk line widths
  15. Restore the layer stack visibility
  16. return the number of violations found

To Do List

New DRC Violations

Some useful DRC violations to add:

DRC tests

This is to describe ways of testing the DRC code, not things the DRC should check for.

Additional test cases

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.

DRC backend work

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.

Multi-clearance

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.

DRC interface

DRC bugs