Working on methodology of blockages, pins, and routing multiple pins.

This commit is contained in:
Matt Guthaus 2018-09-08 18:55:36 -07:00
parent 96c51f3464
commit 2d86492d91
5 changed files with 52 additions and 80 deletions

View File

@ -65,7 +65,7 @@ class grid:
self.map[n].path=value
def set_blockages(self,block_list,value=True):
debug.info(2,"Adding blockage list={0}".format(str(block_list)))
debug.info(3,"Adding blockage list={0}".format(str(block_list)))
for n in block_list:
self.set_blocked(n,value)
@ -94,17 +94,17 @@ class grid:
def add_source(self,track_list):
debug.info(2,"Adding source list={0}".format(str(track_list)))
debug.info(3,"Adding source list={0}".format(str(track_list)))
for n in track_list:
debug.info(3,"Adding source ={0}".format(str(n)))
debug.info(4,"Adding source ={0}".format(str(n)))
self.set_source(n)
self.set_blocked(n,False)
def add_target(self,track_list):
debug.info(2,"Adding target list={0}".format(str(track_list)))
debug.info(3,"Adding target list={0}".format(str(track_list)))
for n in track_list:
debug.info(3,"Adding target ={0}".format(str(n)))
debug.info(4,"Adding target ={0}".format(str(n)))
self.set_target(n)
self.set_blocked(n,False)

View File

@ -57,7 +57,6 @@ class router:
self.ll = vector(self.boundary[0][0], self.boundary[0][1])
self.ur = vector(self.boundary[1][0], self.boundary[1][1])
def clear_pins(self):
"""
Convert the routed path to blockages.
@ -67,7 +66,7 @@ class router:
self.pin_groups = {}
self.pin_grids = {}
self.pin_blockages = {}
self.rg.reinit()
self.reinit()
def set_top(self,top_name):
""" If we want to route something besides the top-level cell."""
@ -165,7 +164,7 @@ class router:
self.convert_blockages()
def clear_pins(self):
def reinit(self):
"""
Reset the source and destination pins to start a new routing.
Convert the source/dest pins to blockages.
@ -742,7 +741,22 @@ class router:
for path in self.paths:
self.rg.block_path(path)
def run_router(self, detour_scale):
"""
This assumes the blockages, source, and target are all set up.
"""
# returns the path in tracks
(path,cost) = self.rg.route(detour_scale)
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.reinit()
return False
return True
# FIXME: This should be replaced with vector.snap_to_grid at some point

View File

@ -78,19 +78,9 @@ class signal_router(router):
self.add_pin(src,True)
self.add_pin(dest,False)
# returns the path in tracks
(path,cost) = self.rg.route(detour_scale)
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()
if not self.run_router(detour_scale):
return False
self.write_debug_gds()
return True

View File

@ -1,23 +1,26 @@
import debug
from vector3d import vector3d
from grid import grid
from signal_grid import signal_grid
from grid_path import grid_path
from direction import direction
class supply_grid(grid):
class supply_grid(signal_grid):
"""
A two layer routing map. Each cell can be blocked in the vertical
or horizontal layer.
This routes a supply grid. It is derived from a signal grid because it still
routes the pins to the supply rails using the same routines.
It has a few extra routines to support "waves" which are multiple track wide
directional routes (no bends).
"""
def __init__(self, ll, ur, track_width):
""" Create a routing map of width x height cells and 2 in the z-axis. """
grid.__init__(self, ll, ur, track_width)
signal_grid.__init__(self, ll, ur, track_width)
def reinit(self):
""" Reinitialize everything for a new route. """
# Reset all the cells in the map
for p in self.map.values():
p.reset()

View File

@ -72,7 +72,10 @@ class supply_router(router):
self.connect_supply_rail(gnd_name)
self.route_pins_to_rails(gnd_name)
# Start fresh. Not the best for run-time, but simpler.
self.clear_blockages()
self.add_blockages()
self.add_pin_blockages(gnd_name)
self.route_supply_rails(vdd_name,1)
self.connect_supply_rail(vdd_name)
@ -175,67 +178,29 @@ class supply_router(router):
This will route each of the pin components to the supply rails.
After it is done, the cells are added to the pin blockage list.
"""
# For every component
for index in range(self.num_pin_components(pin_name)):
# Block all pin components first
# Block all the pin components first
self.add_component_blockages(pin_name)
# Add the single component of the pin as the source (unmarks it as a blockage too)
# Add the single component of the pin as the source
# which unmarks it as a blockage too
self.add_pin_component(pin_name,index,is_source=True)
# Add all of the rails as targets
# Don't add the other pins, but we could?
self.add_supply_rail_target(pin_name)
#route_supply_pin(pin)
# Actually run the A* router
self.run_router(detour_scale=5)
def route_supply_pin(self, pin):
"""
This will take a single pin and route it to the appropriate supply rail.
Do not allow other pins to be destinations so that everything is connected
to the rails.
"""
# source pin will be a specific layout pin
# target pin will be the rails only
# returns the path in tracks
# (path,cost) = self.rg.route(detour_scale)
# if path:
# debug.info(1,"Found path: cost={0} ".format(cost))
# debug.info(2,str(path))
# self.add_route(path)
# return True
# else:
# self.write_debug_gds()
# # clean up so we can try a reroute
# self.clear_pins()
pass
# def add_route(self,path):
# """
# Add the current wire route to the given design instance.
# """
# debug.info(3,"Set path: " + str(path))
# # Keep track of path for future blockages
# self.paths.append(path)
# # This is marked for debug
# self.rg.add_path(path)
# # For debugging... if the path failed to route.
# if False or path==None:
# self.write_debug_gds()
# # First, simplify the path for
# #debug.info(1,str(self.path))
# contracted_path = self.contract_path(path)
# debug.info(1,str(contracted_path))
# # convert the path back to absolute units from tracks
# abs_path = map(self.convert_point_to_units,contracted_path)
# debug.info(1,str(abs_path))
# self.cell.add_route(self.layers,abs_path)