2019-04-26 21:21:50 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2021-01-22 20:23:28 +01:00
|
|
|
# Copyright (c) 2016-2021 Regents of the University of California and The Board
|
2019-06-14 17:43:41 +02:00
|
|
|
# of Regents for the Oklahoma Agricultural and Mechanical College
|
|
|
|
|
# (acting for and on behalf of Oklahoma State University)
|
|
|
|
|
# All rights reserved.
|
2019-04-26 21:21:50 +02:00
|
|
|
#
|
2018-08-23 00:56:19 +02:00
|
|
|
import debug
|
|
|
|
|
from router import router
|
|
|
|
|
|
2020-12-21 22:51:50 +01:00
|
|
|
|
2018-08-23 00:56:19 +02:00
|
|
|
class signal_router(router):
|
2018-09-06 20:54:14 +02:00
|
|
|
"""
|
|
|
|
|
A router class to read an obstruction map from a gds and plan a
|
2018-08-23 00:56:19 +02:00
|
|
|
route on a given layer. This is limited to two layer routes.
|
|
|
|
|
"""
|
|
|
|
|
|
2021-05-05 22:45:12 +02:00
|
|
|
def __init__(self, layers, design, bbox=None):
|
2018-09-06 20:54:14 +02:00
|
|
|
"""
|
2018-10-04 23:04:29 +02:00
|
|
|
This will route on layers in design. It will get the blockages from
|
|
|
|
|
either the gds file name or the design itself (by saving to a gds file).
|
2018-08-23 00:56:19 +02:00
|
|
|
"""
|
2021-05-05 22:45:12 +02:00
|
|
|
router.__init__(self, layers, design, bbox)
|
2018-08-23 00:56:19 +02:00
|
|
|
|
2018-10-04 23:04:29 +02:00
|
|
|
def route(self, src, dest, detour_scale=5):
|
2020-11-03 15:29:17 +01:00
|
|
|
"""
|
2018-08-23 00:56:19 +02:00
|
|
|
Route a single source-destination net and return
|
2020-11-03 15:29:17 +01:00
|
|
|
the simplified rectilinear path. Cost factor is how sub-optimal to explore for a feasible route.
|
2018-08-23 00:56:19 +02:00
|
|
|
This is used to speed up the routing when there is not much detouring needed.
|
|
|
|
|
"""
|
2020-12-21 22:51:50 +01:00
|
|
|
debug.info(1, "Running signal router from {0} to {1}...".format(src, dest))
|
2018-08-23 00:56:19 +02:00
|
|
|
|
2018-09-06 01:01:11 +02:00
|
|
|
self.pins[src] = []
|
|
|
|
|
self.pins[dest] = []
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-08-23 00:56:19 +02:00
|
|
|
# Clear the pins if we have previously routed
|
2020-12-21 22:51:50 +01:00
|
|
|
if (hasattr(self, 'rg')):
|
2018-08-23 00:56:19 +02:00
|
|
|
self.clear_pins()
|
|
|
|
|
else:
|
|
|
|
|
# Creat a routing grid over the entire area
|
|
|
|
|
# FIXME: This could be created only over the routing region,
|
|
|
|
|
# but this is simplest for now.
|
2021-01-15 22:25:57 +01:00
|
|
|
self.create_routing_grid(signal_grid)
|
2018-08-23 00:56:19 +02:00
|
|
|
|
2018-10-04 23:04:29 +02:00
|
|
|
# Get the pin shapes
|
|
|
|
|
self.find_pins_and_blockages([src, dest])
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-10-04 23:04:29 +02:00
|
|
|
# Block everything
|
|
|
|
|
self.prepare_blockages()
|
|
|
|
|
# Clear the pins we are routing
|
2020-12-21 22:51:50 +01:00
|
|
|
self.set_blockages(self.pin_components[src], False)
|
|
|
|
|
self.set_blockages(self.pin_components[dest], False)
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-08-23 00:56:19 +02:00
|
|
|
# Now add the src/tgt if they are not blocked by other shapes
|
2018-09-18 21:57:39 +02:00
|
|
|
self.add_source(src)
|
|
|
|
|
self.add_target(dest)
|
2018-08-23 00:56:19 +02:00
|
|
|
|
2018-10-04 23:04:29 +02:00
|
|
|
if not self.run_router(detour_scale=detour_scale):
|
|
|
|
|
self.write_debug_gds(stop_program=False)
|
2018-09-07 23:46:58 +02:00
|
|
|
return False
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2022-03-18 22:44:13 +01:00
|
|
|
#self.write_debug_gds(stop_program=False)
|
2018-09-07 23:46:58 +02:00
|
|
|
return True
|
2018-08-23 00:56:19 +02:00
|
|
|
|
2020-11-03 15:29:17 +01:00
|
|
|
|
|
|
|
|
|
2018-08-23 00:56:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|