Fix bugs in channel route.

This commit is contained in:
mrg 2020-06-28 16:58:28 -07:00
parent 5285468380
commit 47f541df0e
1 changed files with 34 additions and 43 deletions

View File

@ -218,19 +218,14 @@ class channel_route(design.design):
min_x = min([pin.center().x for pin in pins]) min_x = min([pin.center().x for pin in pins])
# if we are less than a pitch, just create a non-preferred layer jog # if we are less than a pitch, just create a non-preferred layer jog
if max_x - min_x <= pitch: non_preferred_route = max_x - min_x <= pitch
half_layer_width = 0.5 * drc["minwidth_{0}".format(self.vertical_layer)]
if non_preferred_route:
half_layer_width = 0.5 * drc["minwidth_{0}".format(self.vertical_layer)]
# Add the horizontal trunk on the vertical layer! # Add the horizontal trunk on the vertical layer!
self.add_path(self.vertical_layer, self.add_path(self.vertical_layer,
[vector(min_x - half_layer_width, trunk_offset.y), [vector(min_x - half_layer_width, trunk_offset.y),
vector(max_x + half_layer_width, trunk_offset.y)]) vector(max_x + half_layer_width, trunk_offset.y)])
# Route each pin to the trunk
for pin in pins:
# No bend needed here
mid = vector(pin.center().x, trunk_offset.y)
self.add_path(self.vertical_layer, [pin.center(), mid])
else: else:
# Add the horizontal trunk # Add the horizontal trunk
self.add_path(self.horizontal_layer, self.add_path(self.horizontal_layer,
@ -239,13 +234,14 @@ class channel_route(design.design):
# Route each pin to the trunk # Route each pin to the trunk
for pin in pins: for pin in pins:
mid = vector(pin.center().x, trunk_offset.y)
# Find the correct side of the pin # Find the correct side of the pin
if pin.cy() < trunk_offset.y: if pin.cy() < trunk_offset.y:
pin_pos = pin.uc() pin_pos = pin.uc()
else: else:
pin_pos = pin.bc() pin_pos = pin.bc()
mid = vector(pin_pos.x, trunk_offset.y)
self.add_path(self.vertical_layer, [pin_pos, mid]) self.add_path(self.vertical_layer, [pin_pos, mid])
if not non_preferred_route:
self.add_via_center(layers=self.layer_stack, self.add_via_center(layers=self.layer_stack,
offset=mid, offset=mid,
directions=self.directions) directions=self.directions)
@ -265,20 +261,14 @@ class channel_route(design.design):
min_y = min([pin.center().y for pin in pins]) min_y = min([pin.center().y for pin in pins])
# if we are less than a pitch, just create a non-preferred layer jog # if we are less than a pitch, just create a non-preferred layer jog
if max_y - min_y <= pitch: non_preferred_route = max_y - min_y <= pitch
if non_preferred_route:
half_layer_width = 0.5 * drc["minwidth_{0}".format(self.horizontal_layer)] half_layer_width = 0.5 * drc["minwidth_{0}".format(self.horizontal_layer)]
# Add the vertical trunk on the horizontal layer! # Add the vertical trunk on the horizontal layer!
self.add_path(self.horizontal_layer, self.add_path(self.horizontal_layer,
[vector(trunk_offset.x, min_y - half_layer_width), [vector(trunk_offset.x, min_y - half_layer_width),
vector(trunk_offset.x, max_y + half_layer_width)]) vector(trunk_offset.x, max_y + half_layer_width)])
# Route each pin to the trunk
for pin in pins:
# No bend needed here
mid = vector(trunk_offset.x, pin.center().y)
self.add_path(self.horizontal_layer, [pin.center(), mid])
else: else:
# Add the vertical trunk # Add the vertical trunk
self.add_path(self.vertical_layer, self.add_path(self.vertical_layer,
@ -287,13 +277,14 @@ class channel_route(design.design):
# Route each pin to the trunk # Route each pin to the trunk
for pin in pins: for pin in pins:
mid = vector(trunk_offset.x, pin.center().y)
# Find the correct side of the pin # Find the correct side of the pin
if pin.cx() < trunk_offset.x: if pin.cx() < trunk_offset.x:
pin_pos = pin.rc() pin_pos = pin.rc()
else: else:
pin_pos = pin.lc() pin_pos = pin.lc()
mid = vector(trunk_offset.x, pin_pos.y)
self.add_path(self.horizontal_layer, [pin_pos, mid]) self.add_path(self.horizontal_layer, [pin_pos, mid])
if not non_preferred_route:
self.add_via_center(layers=self.layer_stack, self.add_via_center(layers=self.layer_stack,
offset=mid, offset=mid,
directions=self.directions) directions=self.directions)