diff --git a/compiler/base/hierarchy_layout.py b/compiler/base/hierarchy_layout.py index fdadcec9..229bb0f8 100644 --- a/compiler/base/hierarchy_layout.py +++ b/compiler/base/hierarchy_layout.py @@ -754,36 +754,42 @@ class layout(lef.lef): """ def remove_net_from_graph(pin, g): - # Remove the pin from the keys + """ + Remove the pin from the graph and all conflicts + """ g.pop(pin,None) + # Remove the pin from all conflicts - # This is O(n^2), so maybe optimize it. + # FIXME: This is O(n^2), so maybe optimize it. for other_pin,conflicts in g.items(): if pin in conflicts: conflicts.remove(pin) g[other_pin]=conflicts return g - def vcg_pins_overlap(pins1, pins2, vertical): - # Check all the pin pairs on two nets and return a pin - # overlap if any pin overlaps vertically - for pin1 in pins1: - for pin2 in pins2: + def vcg_nets_overlap(net1, net2, vertical): + """ + Check all the pin pairs on two nets and return a pin + overlap if any pin overlaps + """ + + for pin1 in net1: + for pin2 in net2: if vcg_pin_overlap(pin1, pin2, vertical): return True return False def vcg_pin_overlap(pin1, pin2, vertical): - # Check for vertical overlap of the two pins + """ Check for vertical or horizontal overlap of the two pins """ - # Pin 1 must be in the "TOP" set - x_overlap = pin1.by() > pin2.by() and abs(pin1.center().x-pin2.center().x)