From 6a7d721562d2804b4e85ffb26126eacca7c03308 Mon Sep 17 00:00:00 2001 From: Matt Guthaus Date: Mon, 19 Nov 2018 09:28:29 -0800 Subject: [PATCH] Add new bbox routine for pin enclosures --- compiler/base/pin_layout.py | 20 ++++++++++++++++++++ compiler/router/pin_group.py | 9 +++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/compiler/base/pin_layout.py b/compiler/base/pin_layout.py index c1e6d79a..417bd6af 100644 --- a/compiler/base/pin_layout.py +++ b/compiler/base/pin_layout.py @@ -62,6 +62,26 @@ class pin_layout: else: return False + def bbox(self, pin_list): + """ + Given a list of layout pins, create a bounding box layout. + """ + (ll, ur) = self.rect + min_x = ll.x + max_x = ur.x + min_y = ll.y + max_y = ur.y + + filtered_list = [x for x in pin_list if x != None] + debug.check(len(filtered_list)>0,"Cannot find bbox of empty list.") + for pin in filtered_list: + min_x = min(min_x, pin.ll().x) + max_x = max(max_x, pin.ur().x) + min_y = min(min_y, pin.ll().y) + max_y = max(max_y, pin.ur().y) + + self.rect = [vector(min_x,min_y),vector(max_x,max_y)] + def inflate(self, spacing=None): """ Inflate the rectangle by the spacing (or other rule) diff --git a/compiler/router/pin_group.py b/compiler/router/pin_group.py index 695a5432..bb147ab1 100644 --- a/compiler/router/pin_group.py +++ b/compiler/router/pin_group.py @@ -464,14 +464,15 @@ class pin_group: # If it is contained, it won't need a connector if pin.contained_by_any(self.enclosures): continue - + left_connector = self.find_left_connector(pin, self.enclosures) right_connector = self.find_right_connector(pin, self.enclosures) above_connector = self.find_above_connector(pin, self.enclosures) below_connector = self.find_below_connector(pin, self.enclosures) - for connector in [left_connector, right_connector, above_connector, below_connector]: - if connector: - self.enclosures.append(connector) + import copy + bbox_connector = copy.copy(pin) + bbox_connector.bbox([left_connector, right_connector, above_connector, below_connector]) + self.enclosures.append(bbox_connector) # Now, make sure each pin touches an enclosure. If not, add a connector. # This could only happen when there was no enclosure in any cardinal direction from a pin