diff --git a/compiler/base/pin_layout.py b/compiler/base/pin_layout.py index 2058d137..e6a35a0a 100644 --- a/compiler/base/pin_layout.py +++ b/compiler/base/pin_layout.py @@ -517,6 +517,13 @@ class pin_layout: if len(intersections) == 2: (p1, p2) = intersections return math.sqrt(pow(p1[0]-p2[0], 2) + pow(p1[1]-p2[1], 2)) + # If we have a rectangular overlap region + elif len(intersections) == 4: + points = intersections + ll = vector(min(p.x for p in points), min(p.y for p in points)) + ur = vector(max(p.x for p in points), max(p.y for p in points)) + new_shape = pin_layout("", [ll, ur], self.lpp) + return max(new_shape.height(), new_shape.width()) else: # This is where we had a corner intersection or none return 0 diff --git a/compiler/router/router.py b/compiler/router/router.py index 6b2e3ab4..d5f2dada 100644 --- a/compiler/router/router.py +++ b/compiler/router/router.py @@ -574,20 +574,18 @@ class router(router_tech): debug.info(3, "Converting pin [ {0} , {1} ]".format(ll, ur)) # scale the size bigger to include neaby tracks - ll = ll.scale(self.track_factor).floor() - ur = ur.scale(self.track_factor).ceil() + ll_scaled = ll.scale(self.track_factor).floor() + ur_scaled = ur.scale(self.track_factor).ceil() # Keep tabs on tracks with sufficient and insufficient overlap sufficient_list = set() insufficient_list = set() zindex = self.get_zindex(pin.lpp) - for x in range(int(ll[0]) - expansion, int(ur[0]) + 1 + expansion): - for y in range(int(ll[1] - expansion), int(ur[1]) + 1 + expansion): - (full_overlap, partial_overlap) = self.convert_pin_coord_to_tracks(pin, - vector3d(x, - y, - zindex)) + for x in range(int(ll_scaled[0]) - expansion, int(ur_scaled[0]) + 1 + expansion): + for y in range(int(ll_scaled[1] - expansion), int(ur_scaled[1]) + 1 + expansion): + cur_grid = vector3d(x, y, zindex) + (full_overlap, partial_overlap) = self.convert_pin_coord_to_tracks(pin, cur_grid) if full_overlap: sufficient_list.update([full_overlap]) if partial_overlap: