This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
pcb:connection_lookup [2018/12/23 18:21] cparker |
pcb:connection_lookup [2018/12/23 20:00] cparker |
||
---|---|---|---|
Line 11: | Line 11: | ||
=====Detailed Algorithm===== | =====Detailed Algorithm===== | ||
- | 1. InitConnectionLookup() | + | - InitConnectionLookup() |
- | A. InitComponentLookup() | + | - InitComponentLookup() |
- | a. Compute the number of pads on each side of the pcb | + | - Compute the number of pads on each side of the pcb |
- | b. Allocate enough memory for the PadLists to hold pointers to all of them, and initialize the list structures. | + | - Allocate enough memory for the PadLists to hold pointers to all of them, and initialize the list structures. |
- | B. InitLayoutLookup() | + | - InitLayoutLookup() |
- | a. 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. | + | - 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. |
- | b. Allocate enough memory for the pin and via combined list, and initialize it. | + | - Allocate enough memory for the pin and via combined list, and initialize it. |
- | c. Allocate enough memory for the rats list to hold all of the rats. | + | - Allocate enough memory for the rats list to hold all of the rats. |
- | 2. ListStart(type, ptr1, ptr2, ptr3) | + | - ListStart(type, ptr1, ptr2, ptr3) |
- | A. Add the seed object to the lists. | + | - Add the seed object to the lists. |
- | 3. DoIt(flag, bloat, AndRats, AndDraw, is_drc) | + | - DoIt(flag, bloat, AndRats, AndDraw, is_drc) |
- | A. Set the global drc flag and bloat value | + | - Set the global drc flag and bloat value |
- | B. Update layer "no_drc" flags | + | - Update layer "no_drc" flags |
- | C. Lookup connection loop: | + | - Lookup connection loop: |
- | a. LookupPVConnectionsToPVList(flag) | + | - Note that if any of the four lookup functions returns true, it will likely short-circuit the rest of the tests. |
- | i. Save our current position in the PV list | + | - LookupPVConnectionsToPVList(flag) |
- | ii. If our current position is not the last item in the list: | + | - Save our current position in the PV list |
- | 1. Get the current list item | + | - If our current position is not the last item in the list: |
- | 2. Expand the bounding box by the global bloat for the search | + | - Get the current list item |
- | 3. to be continued... | + | - Expand the bounding box by the global bloat for the search |
- | iii. Restore the list position | + | - 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 on the pad tree around the current PV (LOCtoPVpad_callback) | ||
+ | - If the PV doesn't intersect the pad layer (top or bottom), return false (keep looking for objects) | ||
+ | - If we haven't already flagged the pad, the PV and pad intersect, and the PV isn't just a hole, add the pad to the list, and longjmp back to LookupLOConnectionToPVList | ||
+ | - Otherwise, return 0 (keep looking for objects) | ||
+ | - For each layer: | ||
+ | - if the no_drc flag is set, skip this layer | ||
+ | - Set a jump point, and do an r_search on the layer's line tree around the via (LOCtoPVline_callback) | ||
+ | - Repeat the pad procedure here | ||
+ | - If we returned via long jump, return true (abort search) | ||
+ | - Otherwise, set a jump point and do an r_search on the layer's arc tree around the via (LOCtoPVarc_callback) | ||
+ | - Repeat the pad procedure here | ||
+ | - If we returned via long jump, return true (abort search) | ||
+ | - Otherwise, set a jump point and do an r_search on the layer's polygon tree around the via (LOCtoPVpoly_callback) | ||
+ | - If the PV doesn't intersect the polygon layer, return 0 (continue search) | ||
+ | - If we haven't yet flagged the polygon and the PV isn't just a hole... | ||
+ | - If there's no thermal and the polygon is clearing, return 0 (continue search) | ||
+ | - Otherwise... | ||
+ | - compute the width of the search box | ||
+ | - if the pv has the square flag set, | ||
+ | - compute the corner points | ||
+ | - if the rectangle is in the polygon (IsRectangleInPolygon) add it to the list (... ends up in add_object_to_list) | ||
+ | - if we're doing the drc and the object didn't have the selected flag set, long jump back to to LookupLOConnectionToPVList | ||
+ | - otherwise return 0 (continue search) | ||
+ | - otherwise, if the pv has the octagon flag set... | ||
+ | - create a dummy octagon polygon | ||
+ | - if the dummy octagon and the polygon intersect (isects), add it to the list | ||
+ | - if we're doing the drc and the object didn't have the selected flag set, long jump back to to LookupLOConnectionToPVList | ||
+ | - otherwise, pv is round, and if intersects the polygon (IsPointInPolygon) | ||
+ | - add it to the list | ||
+ | - if we're doing the drc and the object didn't have the selected flag set, long jump back to LookupLOConnectionToPVList | ||
+ | - return 0 (continue search) | ||
+ | - Move on to the next layer | ||
+ | - If we're following rats, set a jump point and do an r_search on the rat tree (LOCtoPVrat_callback) | ||
+ | - If we haven't already found the rat, add it to the list, and long jump back to LookupLOConnectionToPVList | ||
| | ||
| |