2018-08-23 00:56:19 +02:00
|
|
|
import gdsMill
|
|
|
|
|
import tech
|
|
|
|
|
from contact import contact
|
|
|
|
|
import math
|
|
|
|
|
import debug
|
|
|
|
|
from pin_layout import pin_layout
|
|
|
|
|
from vector import vector
|
|
|
|
|
from vector3d import vector3d
|
|
|
|
|
from globals import OPTS
|
|
|
|
|
from router import router
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
"""
|
|
|
|
|
|
2018-08-30 00:32:45 +02:00
|
|
|
def __init__(self, gds_name=None, module=None):
|
2018-09-06 20:54:14 +02:00
|
|
|
"""
|
|
|
|
|
Use the gds file for the blockages with the top module topName and
|
2018-08-23 00:56:19 +02:00
|
|
|
layers for the layers to route on
|
|
|
|
|
"""
|
2018-08-30 00:32:45 +02:00
|
|
|
router.__init__(self, gds_name, module)
|
2018-08-23 00:56:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_routing_grid(self):
|
|
|
|
|
"""
|
2018-08-28 19:41:19 +02:00
|
|
|
Create a sprase routing grid with A* expansion functions.
|
2018-08-23 00:56:19 +02:00
|
|
|
"""
|
|
|
|
|
# We will add a halo around the boundary
|
|
|
|
|
# of this many tracks
|
|
|
|
|
size = self.ur - self.ll
|
|
|
|
|
debug.info(1,"Size: {0} x {1}".format(size.x,size.y))
|
|
|
|
|
|
2018-09-06 20:54:14 +02:00
|
|
|
import signal_grid
|
|
|
|
|
self.rg = signal_grid.signal_grid(self.ll, self.ur, self.track_width)
|
2018-08-23 00:56:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def route(self, cell, layers, src, dest, detour_scale=5):
|
|
|
|
|
"""
|
|
|
|
|
Route a single source-destination net and return
|
|
|
|
|
the simplified rectilinear path. Cost factor is how sub-optimal to explore for a feasible route.
|
|
|
|
|
This is used to speed up the routing when there is not much detouring needed.
|
|
|
|
|
"""
|
2018-08-30 00:32:45 +02:00
|
|
|
debug.info(1,"Running signal router from {0} to {1}...".format(src,dest))
|
2018-08-23 00:56:19 +02:00
|
|
|
self.cell = cell
|
|
|
|
|
|
2018-09-06 01:01:11 +02:00
|
|
|
self.pins[src] = []
|
|
|
|
|
self.pins[dest] = []
|
|
|
|
|
|
2018-08-23 00:56:19 +02:00
|
|
|
# Clear the pins if we have previously routed
|
|
|
|
|
if (hasattr(self,'rg')):
|
|
|
|
|
self.clear_pins()
|
|
|
|
|
else:
|
|
|
|
|
# Set up layers and track sizes
|
|
|
|
|
self.set_layers(layers)
|
|
|
|
|
# Creat a routing grid over the entire area
|
|
|
|
|
# FIXME: This could be created only over the routing region,
|
|
|
|
|
# but this is simplest for now.
|
|
|
|
|
self.create_routing_grid()
|
|
|
|
|
# This will get all shapes as blockages
|
|
|
|
|
self.find_blockages()
|
|
|
|
|
|
2018-09-06 01:01:11 +02:00
|
|
|
# Now add the blockages (all shapes except the pins)
|
2018-09-08 19:05:48 +02:00
|
|
|
self.find_pins(src)
|
|
|
|
|
self.find_pins(dest)
|
2018-08-23 00:56:19 +02:00
|
|
|
|
2018-09-06 01:01:11 +02:00
|
|
|
# Now add the blockages
|
2018-09-13 18:10:29 +02:00
|
|
|
self.set_blockages(self.blocked_grids,True)
|
2018-09-18 21:57:39 +02:00
|
|
|
#self.set_blockages(self.pin_partials[src],True)
|
|
|
|
|
#self.set_blockages(self.pin_partials[dest],True)
|
2018-09-08 19:05:48 +02:00
|
|
|
|
2018-08-23 00:56:19 +02:00
|
|
|
# Add blockages from previous paths
|
2018-09-13 18:10:29 +02:00
|
|
|
self.set_path_blockages()
|
2018-09-06 01:01:11 +02: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-09-09 03:55:36 +02:00
|
|
|
if not self.run_router(detour_scale):
|
2018-09-07 23:46:58 +02:00
|
|
|
return False
|
2018-09-09 03:55:36 +02:00
|
|
|
|
2018-09-07 23:46:58 +02:00
|
|
|
self.write_debug_gds()
|
|
|
|
|
|
|
|
|
|
return True
|
2018-08-23 00:56:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|