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-08-23 00:56:19 +02:00
|
|
|
self.get_pin(src)
|
|
|
|
|
self.get_pin(dest)
|
|
|
|
|
|
2018-09-06 01:01:11 +02:00
|
|
|
# Now add the blockages
|
2018-08-23 00:56:19 +02:00
|
|
|
self.add_blockages()
|
|
|
|
|
# Add blockages from previous paths
|
2018-09-06 01:01:11 +02:00
|
|
|
self.add_path_blockages()
|
|
|
|
|
|
2018-08-23 00:56:19 +02:00
|
|
|
|
|
|
|
|
# Now add the src/tgt if they are not blocked by other shapes
|
|
|
|
|
self.add_pin(src,True)
|
|
|
|
|
self.add_pin(dest,False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# returns the path in tracks
|
2018-08-28 19:41:19 +02:00
|
|
|
(path,cost) = self.rg.route(detour_scale)
|
2018-08-23 00:56:19 +02:00
|
|
|
if path:
|
|
|
|
|
debug.info(1,"Found path: cost={0} ".format(cost))
|
|
|
|
|
debug.info(2,str(path))
|
|
|
|
|
self.add_route(path)
|
|
|
|
|
else:
|
|
|
|
|
self.write_debug_gds()
|
|
|
|
|
# clean up so we can try a reroute
|
|
|
|
|
self.clear_pins()
|
2018-09-07 23:46:58 +02:00
|
|
|
return False
|
2018-08-23 00:56:19 +02:00
|
|
|
|
2018-09-07 23:46:58 +02:00
|
|
|
self.write_debug_gds()
|
|
|
|
|
|
|
|
|
|
return True
|
2018-08-23 00:56:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|