Remove redundant pins when adding each pin

This commit is contained in:
Matt Guthaus 2021-01-25 09:36:27 -08:00
parent db142bcd5a
commit eebc2a93b6
3 changed files with 16 additions and 8 deletions

View File

@ -1235,7 +1235,6 @@ class layout():
self.add_power_pin(new_name, pin.center(), start_layer=start_layer) self.add_power_pin(new_name, pin.center(), start_layer=start_layer)
def add_power_pin(self, name, loc, directions=None, start_layer="m1"): def add_power_pin(self, name, loc, directions=None, start_layer="m1"):
# Hack for min area # Hack for min area
if OPTS.tech_name == "sky130": if OPTS.tech_name == "sky130":
min_area = drc["minarea_{}".format(self.pwr_grid_layer)] min_area = drc["minarea_{}".format(self.pwr_grid_layer)]

View File

@ -27,13 +27,13 @@ class pin_group:
# Flag for when it is enclosed # Flag for when it is enclosed
self.enclosed = False self.enclosed = False
# Remove any redundant pins (i.e. contained in other pins)
irredundant_pin_set = self.remove_redundant_shapes(list(pin_set))
# This is a list because we can have a pin # This is a list because we can have a pin
# group of disconnected sets of pins # group of disconnected sets of pins
# and these are represented by separate lists # and these are represented by separate lists
self.pins = set(irredundant_pin_set) self.pins = set(pin_set)
# Remove any redundant pins (i.e. contained in other pins)
self.remove_redundant_pins()
self.router = router self.router = router
# These are the corresponding pin grids for each pin group. # These are the corresponding pin grids for each pin group.
@ -68,6 +68,10 @@ class pin_group:
total_string += ")" total_string += ")"
return total_string return total_string
def add_pin(self, pin):
self.pins.add(pin)
self.remove_redundant_pins()
def __repr__(self): def __repr__(self):
""" override repr function output """ """ override repr function output """
return str(self) return str(self)
@ -81,6 +85,13 @@ class pin_group:
def is_routed(self): def is_routed(self):
return self.routed return self.routed
def remove_redundant_pins(self):
"""
Remove redundant pin shapes
"""
new_pin_list = self.remove_redundant_shapes(list(self.pins))
self.pins = set(new_pin_list)
def remove_redundant_shapes(self, pin_list): def remove_redundant_shapes(self, pin_list):
""" """
Remove any pin layout that is contained within another. Remove any pin layout that is contained within another.
@ -90,7 +101,6 @@ class pin_group:
if local_debug: if local_debug:
debug.info(0, "INITIAL: {}".format(pin_list)) debug.info(0, "INITIAL: {}".format(pin_list))
# Make a copy of the list to start
new_pin_list = pin_list.copy() new_pin_list = pin_list.copy()
remove_indices = set() remove_indices = set()

View File

@ -824,8 +824,7 @@ class router(router_tech):
group_map[gid] = pin_group(name=pin_name, group_map[gid] = pin_group(name=pin_name,
pin_set=[], pin_set=[],
router=self) router=self)
# We always add it to the first set since they are touching group_map[gid].add_pin(pin)
group_map[gid].pins.add(pin)
self.pin_groups[pin_name] = list(group_map.values()) self.pin_groups[pin_name] = list(group_map.values())