Merge branch 'dev'

This commit is contained in:
Jesse Cirimelli-Low 2018-11-11 07:24:03 -08:00
commit 91a63fb5c2
1 changed files with 23 additions and 17 deletions

View File

@ -754,36 +754,42 @@ class layout(lef.lef):
""" """
def remove_net_from_graph(pin, g): 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) g.pop(pin,None)
# Remove the pin from all conflicts # 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(): for other_pin,conflicts in g.items():
if pin in conflicts: if pin in conflicts:
conflicts.remove(pin) conflicts.remove(pin)
g[other_pin]=conflicts g[other_pin]=conflicts
return g return g
def vcg_pins_overlap(pins1, pins2, vertical): def vcg_nets_overlap(net1, net2, vertical):
# Check all the pin pairs on two nets and return a pin """
# overlap if any pin overlaps vertically Check all the pin pairs on two nets and return a pin
for pin1 in pins1: overlap if any pin overlaps
for pin2 in pins2: """
for pin1 in net1:
for pin2 in net2:
if vcg_pin_overlap(pin1, pin2, vertical): if vcg_pin_overlap(pin1, pin2, vertical):
return True return True
return False return False
def vcg_pin_overlap(pin1, pin2, vertical): 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 # Pin 1 must be in the "TOP" set
x_overlap = pin1.by() > pin2.by() and abs(pin1.center().x-pin2.center().x)<pitch x_overlap = pin1.by() > pin2.by() and abs(pin1.center().x-pin2.center().x)<pitch
# Pin 1 must be in the "LET" set # Pin 1 must be in the "LEFT" set
y_overlap = pin1.lx() < pin2.lx() and abs(pin1.center().y-pin2.center().y)<pitch y_overlap = pin1.lx() < pin2.lx() and abs(pin1.center().y-pin2.center().y)<pitch
overlaps = (not vertical and x_overlap) or (vertical and y_overlap)
return (not vertical and x_overlap) or (vertical and y_overlap) return overlaps
@ -813,16 +819,16 @@ class layout(lef.lef):
# Find the vertical pin conflicts # Find the vertical pin conflicts
# FIXME: O(n^2) but who cares for now # FIXME: O(n^2) but who cares for now
for net_name1 in nets: for net_name1 in nets:
vcg[net_name1]=[] if net_name1 not in vcg.keys():
vcg[net_name1]=[]
for net_name2 in nets: for net_name2 in nets:
if net_name2 not in vcg.keys():
vcg[net_name2]=[]
# Skip yourself # Skip yourself
if net_name1 == net_name2: if net_name1 == net_name2:
continue continue
if vcg_pins_overlap(nets[net_name1], nets[net_name2], vertical): if vcg_nets_overlap(nets[net_name1], nets[net_name2], vertical):
try: vcg[net_name2].append(net_name1)
vcg[net_name2].append(net_name1)
except:
vcg[net_name2] = [net_name1]
#FIXME: What if we have a cycle? #FIXME: What if we have a cycle?