User Tools

Site Tools


pcb:connection_lookup

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
pcb:connection_lookup [2018/09/23 13:53]
cparker created
pcb:connection_lookup [2018/12/23 19:16]
cparker
Line 3: Line 3:
 The connection lookup algorithm starts at an object and looks for any objects that touch the starting object or any object touching the starting object. This code is implemented in find.c and used throughout the code base for a variety of purposes. The connection lookup algorithm starts at an object and looks for any objects that touch the starting object or any object touching the starting object. This code is implemented in find.c and used throughout the code base for a variety of purposes.
  
-===Uses ​of the Connection Lookup Algorithm===+The connection lookup process starts at an object (pins/pads only?) and searches for intersecting objects. For each object it finds, it sets a specified flag. (todo: eventually this should build a list of objects instead). These flags are used in a convoluted way to identify things that have already been found, and if the algorithm should continue looking for more objects.
  
-== DRC ==+One of the tricks that the algorithm uses to restore the state of the flags in some cases is to use ClearFlagOnAllObjects to wipe out a flag (an undoable operation), then do everything without adding operations to the Undo stack, run ClearFlagsOnAllObjects a second time (without undo), and then Undo the first one. I guess the point of this is to prevent the undo system from sucking up resources during these operations? This has led to a global variable "​User"​ which has the effect of causing flag change operations to be added to the undo list. I think this is absolutely horrid. This variable needs to die. I think a better way of accomplishing this goal is by locking the undo system. 
 + 
 +In a number of places, the "​andRats"​ parameter is used. This indicates that rat lines should be considered when looking for overlaps. This way, you can highlight an entire net, even if all the pieces aren't connected with copper. It's important to preserve this functionality. 
 + 
 +=====Detailed Algorithm===== 
 + 
 +  - InitConnectionLookup() 
 +    - InitComponentLookup() 
 +      - Compute the number of pads on each side of the pcb 
 +      - Allocate enough memory for the PadLists to hold pointers to all of them, and initialize the list structures. 
 +    - InitLayoutLookup() 
 +      - For each copper layer, allocate enough memory for each list (lines, arcs, polygons) to hold pointers to all of the objects on the layer, and initialize the list structures. 
 +      - Allocate enough memory for the pin and via combined list, and initialize it. 
 +      - Allocate enough memory for the rats list to hold all of the rats. 
 +  - ListStart(type,​ ptr1, ptr2, ptr3) 
 +    - Add the seed object to the lists. 
 +  - DoIt(flag, bloat, AndRats, AndDraw, is_drc) 
 +    - Set the global drc flag and bloat value 
 +    - Update layer "​no_drc"​ flags 
 +    - Lookup connection loop: 
 +      - Note that if any of the four lookup functions returns true, it will likely short-circuit the rest of the tests. 
 +      - LookupPVConnectionsToPVList(flag) 
 +        - Save our current position in the PV list 
 +        - If our current position is not the last item in the list: 
 +          - Get the current list item 
 +          - Expand the bounding box by the global bloat for the search 
 +          - Set a jump point, and do an r_search on the via tree around the current PV (pv_pv_callback) 
 +            - If the vias are buried and the layers don't intersect, return and continue the search. 
 +            - If the new PV hasn't been marked yet, and the new one overlaps with the current one, 
 +              - If it's just a hole (no copper annulus), throw a warning and continue the search 
 +              - Otherwise, add the new PV to the list (add_object_to_list) 
 +                - If this is a DRC and the selected flag wasn't set, long jump back to LookupPVConnectionsToPVList 
 +                - Otherwise, continue the search 
 +          - If we returned via a long jump, return true (found something/​want to stop lookup up objects) 
 +          - Otherwise check the pin tree (repeat via tree steps) 
 +          - If we returned via a long jump, return true (found something/​want to stop lookup up objects) 
 +          - Otherwise, keep looking through the PV list until we get to the end. 
 +        - Restore the list position (why? Probably so that LookupLOConnectionsToPVList can iterate over the same group of objects) 
 +        - Return false (no new objects/we want to keep looking up objects) 
 +      - LookupLOConnectionsToPVList(flag,​ AndRats) 
 +        - If our current position is not the last item in the list: 
 +          - Get the current list item 
 +          - Expand the bounding box by the global bloat for the search 
 +          - Set a jump point, and do an r_search around the current PV (pv_pv_callback) 
 +   
 +   
 +   
 +   
 +   
 +====Uses of the Connection Lookup Algorithm==== 
 + 
 +=== DRC ===
 The DRC uses the connection lookup code in combination with the "​Bloat"​ and "​Shrink"​ settings to detect places with insufficient spacing and overlap. ​ The DRC uses the connection lookup code in combination with the "​Bloat"​ and "​Shrink"​ settings to detect places with insufficient spacing and overlap. ​
  
-== Places that call DoIt == +=== NotifyLine === 
-=Notes from 20180810=+action.c 
 + 
 +=== NotifyMode === 
 +action.c 
 + 
 +=== ActionConnection === 
 +action.c 
 + 
 +=== ActionDisplay === 
 +action.c 
 + 
 +=== ActionSaveTo === 
 +action.c 
 + 
 +=== IPCD HID === 
 + 
 +=== GTK HID === 
 +netlist window 
 + 
 +=== netlist.c === 
 + 
 +=== report.c === 
 + 
 +=== Places that call DoIt === 
 +==Notes from 20180810==
 Saves list of unused pins and pads: Saves list of unused pins and pads:
 ActionSaveTo:​action.c:​5752 ActionSaveTo:​action.c:​5752
pcb/connection_lookup.txt · Last modified: 2019/01/27 10:34 by cparker