From 9b86083524b2e90b49a825365710a8ceb1bd689b Mon Sep 17 00:00:00 2001 From: mguthaus Date: Mon, 24 Apr 2017 13:47:56 -0700 Subject: [PATCH] Fixed rotated via bug. May still have a via-to-via spacing problem. --- compiler/route.py | 7 +++++-- compiler/router/router.py | 4 ++-- compiler/router/tests/01_no_blockages_test.py | 1 + compiler/router/tests/02_blockages_test.py | 1 + compiler/router/tests/03_same_layer_pins_test.py | 1 + compiler/router/tests/04_diff_layer_pins_test.py | 1 + compiler/router/tests/05_two_nets_test.py | 3 +-- compiler/router/tests/regress.py | 1 + 8 files changed, 13 insertions(+), 6 deletions(-) diff --git a/compiler/route.py b/compiler/route.py index 69c5796f..ea32a6f7 100644 --- a/compiler/route.py +++ b/compiler/route.py @@ -57,8 +57,11 @@ class route(design.design): plist = pairwise(self.path) for p0,p1 in plist: if p0.z != p1.z: # via - via_offset = vector(p0.x-0.5*self.c.width,p0.y-0.5*self.c.height) - self.add_via(self.layer_stack,via_offset) + # offset if not rotated + #via_offset = vector(p0.x+0.5*self.c.width,p0.y+0.5*self.c.height) + # offset if rotated + via_offset = vector(p0.x+0.5*self.c.height,p0.y-0.5*self.c.width) + self.add_via(self.layer_stack,via_offset,rotate=90) elif p0.x != p1.x and p0.y != p1.y: # diagonal! debug.error("Non-changing direction!") else: diff --git a/compiler/router/router.py b/compiler/router/router.py index 7bf06f94..beee12c5 100644 --- a/compiler/router/router.py +++ b/compiler/router/router.py @@ -178,13 +178,13 @@ class router: # Make sure there's a pin enclosure on the source and dest src_shape = self.convert_track_to_shape(contracted_path[0]) - cell.add_rect(layer=self.layers[contracted_path[0].z], + cell.add_rect(layer=self.layers[2*contracted_path[0].z], offset=src_shape[0], width=src_shape[1].x-src_shape[0].x, height=src_shape[1].y-src_shape[0].y) dest_shape = self.convert_track_to_shape(contracted_path[-1]) - cell.add_rect(layer=self.layers[contracted_path[-1].z], + cell.add_rect(layer=self.layers[2*contracted_path[-1].z], offset=dest_shape[0], width=dest_shape[1].x-dest_shape[0].x, height=dest_shape[1].y-dest_shape[0].y) diff --git a/compiler/router/tests/01_no_blockages_test.py b/compiler/router/tests/01_no_blockages_test.py index b7c82943..c5694a8e 100644 --- a/compiler/router/tests/01_no_blockages_test.py +++ b/compiler/router/tests/01_no_blockages_test.py @@ -10,6 +10,7 @@ import globals import debug import calibre +OPTS = globals.OPTS class no_blockages_test(unittest.TestCase): """ diff --git a/compiler/router/tests/02_blockages_test.py b/compiler/router/tests/02_blockages_test.py index 4d9546aa..d4bc7f6f 100644 --- a/compiler/router/tests/02_blockages_test.py +++ b/compiler/router/tests/02_blockages_test.py @@ -10,6 +10,7 @@ import globals import debug import calibre +OPTS = globals.OPTS class blockages_test(unittest.TestCase): """ diff --git a/compiler/router/tests/03_same_layer_pins_test.py b/compiler/router/tests/03_same_layer_pins_test.py index a31074d9..a85c99b0 100644 --- a/compiler/router/tests/03_same_layer_pins_test.py +++ b/compiler/router/tests/03_same_layer_pins_test.py @@ -10,6 +10,7 @@ import globals import debug import calibre +OPTS = globals.OPTS class same_layer_pins_test(unittest.TestCase): """ diff --git a/compiler/router/tests/04_diff_layer_pins_test.py b/compiler/router/tests/04_diff_layer_pins_test.py index 03dad3af..d391eb96 100644 --- a/compiler/router/tests/04_diff_layer_pins_test.py +++ b/compiler/router/tests/04_diff_layer_pins_test.py @@ -10,6 +10,7 @@ import globals import debug import calibre +OPTS = globals.OPTS class diff_layer_pins_test(unittest.TestCase): """ diff --git a/compiler/router/tests/05_two_nets_test.py b/compiler/router/tests/05_two_nets_test.py index 57fbf0d4..f4dc9526 100644 --- a/compiler/router/tests/05_two_nets_test.py +++ b/compiler/router/tests/05_two_nets_test.py @@ -10,6 +10,7 @@ import globals import debug import calibre +OPTS = globals.OPTS class two_nets_test(unittest.TestCase): """ @@ -55,11 +56,9 @@ class two_nets_test(unittest.TestCase): layer_stack =("metal1","via1","metal2") r.route(layer_stack,src="A",dest="B") r.add_route(self) - #self.gds_write("temp1.gds") r.route(layer_stack,src="C",dest="D") r.add_route(self) - #self.gds_write("temp2.gds") diff --git a/compiler/router/tests/regress.py b/compiler/router/tests/regress.py index 5b958faf..68ad49fe 100644 --- a/compiler/router/tests/regress.py +++ b/compiler/router/tests/regress.py @@ -4,6 +4,7 @@ import re import unittest import sys,os sys.path.append(os.path.join(sys.path[0],"..")) +sys.path.append(os.path.join(sys.path[0],"../..")) import globals (OPTS, args) = globals.parse_args()