Route signals to the perimeter in sorted order

This commit is contained in:
Eren Dogan 2023-08-01 21:17:43 -07:00
parent 877f20e071
commit 937585d23c
1 changed files with 12 additions and 4 deletions

View File

@ -53,10 +53,7 @@ class signal_escape_router(router):
self.blockages.append(self.inflate_shape(pin, is_pin=True)) self.blockages.append(self.inflate_shape(pin, is_pin=True))
# Route vdd and gnd # Route vdd and gnd
for name in pin_names: for source, target, _ in self.get_route_pairs(pin_names):
# Route each pin to the perimeter
source = next(iter(self.pins[name]))
target = self.get_closest_perimeter_fake_pin(source)
# Change fake pin's name so the graph will treat it as routable # Change fake pin's name so the graph will treat it as routable
target.name = source.name target.name = source.name
# This is the routing region scale # This is the routing region scale
@ -144,3 +141,14 @@ class signal_escape_router(router):
min_dist = dist min_dist = dist
close_fake = fake close_fake = fake
return close_fake return close_fake
def get_route_pairs(self, pin_names):
""" """
to_route = []
for name in pin_names:
pin = next(iter(self.pins[name]))
fake = self.get_closest_perimeter_fake_pin(pin)
to_route.append((pin, fake, pin.distance(fake)))
return sorted(to_route, key=lambda x: x[2])