Merge branch 'dev' of github.com:VLSIDA/PrivateRAM into dev

This commit is contained in:
Matt Guthaus 2018-11-02 16:34:36 -07:00
commit 852bfbc031
5 changed files with 43 additions and 36 deletions

View File

@ -62,14 +62,10 @@ class route(design):
plist = list(pairwise(self.path)) plist = list(pairwise(self.path))
for p0,p1 in plist: for p0,p1 in plist:
if p0.z != p1.z: # via if p0.z != p1.z: # via
# offset if not rotated
#via_offset = vector(p0.x+0.5*self.c.width,p0.y+0.5*self.c.height)
# offset if rotated
via_offset = vector(p0.x+0.5*self.c.height,p0.y-0.5*self.c.width)
via_size = [self.num_vias]*2 via_size = [self.num_vias]*2
self.obj.add_via(self.layer_stack,via_offset,size=via_size,rotate=90) self.obj.add_via_center(self.layer_stack,vector(p0.x,p0.y),size=via_size,rotate=90)
elif p0.x != p1.x and p0.y != p1.y: # diagonal! elif p0.x != p1.x and p0.y != p1.y: # diagonal!
debug.error("Non-changing direction! {}".format(self.path)) debug.error("Diagonal route! {}".format(self.path),-3)
else: else:
# this will draw an extra corner at the end but that is ok # this will draw an extra corner at the end but that is ok
self.draw_corner_wire(p1) self.draw_corner_wire(p1)

View File

@ -43,11 +43,14 @@ class direction(Enum):
return offset return offset
def cardinal_directions(): def cardinal_directions(up_down_too=False):
return [direction.NORTH, direction.EAST, direction.SOUTH, direction.WEST] temp_dirs = [direction.NORTH, direction.EAST, direction.SOUTH, direction.WEST]
if up_down_too:
temp_dirs.extend([direction.UP, direction.DOWN])
return temp_dirs
def cardinal_offsets(): def cardinal_offsets(up_down_too=False):
return [direction.get_offset(d) for d in direction.cardinal_directions()] return [direction.get_offset(d) for d in direction.cardinal_directions(up_down_too)]
def all_directions(): def all_directions():
return [direction.NORTH, direction.EAST, direction.SOUTH, direction.WEST, return [direction.NORTH, direction.EAST, direction.SOUTH, direction.WEST,

View File

@ -22,6 +22,11 @@ class grid_cell:
self.source=False self.source=False
self.target=False self.target=False
def get_cost(self):
# We can display the cost of the frontier
if self.min_cost > 0:
return self.min_cost
def get_type(self): def get_type(self):
if self.blocked: if self.blocked:
@ -36,8 +41,4 @@ class grid_cell:
if self.path: if self.path:
return "P" return "P"
# We can display the cost of the frontier
if self.min_cost > 0:
return self.min_cost
return None return None

View File

@ -150,7 +150,7 @@ class grid_path:
return cost return cost
def expand_dirs(self,up_down_too=True): def expand_dirs(self):
""" """
Expand from the end in each of the four cardinal directions plus up Expand from the end in each of the four cardinal directions plus up
or down but not expanding to blocked cells. Expands in all or down but not expanding to blocked cells. Expands in all
@ -162,9 +162,7 @@ class grid_path:
""" """
neighbors = [] neighbors = []
for d in list(direction): for d in direction.cardinal_directions(True):
if not up_down_too and (d==direction.UP or d==direction.DOWN):
continue
n = self.neighbor(d) n = self.neighbor(d)
if n: if n:
neighbors.append(n) neighbors.append(n)

View File

@ -337,7 +337,7 @@ class router(router_tech):
# FIXME: These duplicate a bit of work # FIXME: These duplicate a bit of work
# These are the paths that have already been routed. # These are the paths that have already been routed.
self.set_path_blockages() self.set_blockages(self.path_blockages)
# Don't mark the other components as targets since we want to route # Don't mark the other components as targets since we want to route
# directly to a rail, but unblock all the source components so we can # directly to a rail, but unblock all the source components so we can
@ -404,13 +404,6 @@ class router(router_tech):
""" Flag the blockages in the grid """ """ Flag the blockages in the grid """
self.rg.set_blocked(blockages, value) self.rg.set_blocked(blockages, value)
def set_path_blockages(self,value=True):
""" Flag the paths as blockages """
# These are the paths that have already been routed.
for path_set in self.path_blockages:
for c in path_set:
self.rg.set_blocked(c,value)
def get_blockage_tracks(self, ll, ur, z): def get_blockage_tracks(self, ll, ur, z):
debug.info(3,"Converting blockage ll={0} ur={1} z={2}".format(str(ll),str(ur),z)) debug.info(3,"Converting blockage ll={0} ur={1} z={2}".format(str(ll),str(ur),z))
@ -924,11 +917,13 @@ class router(router_tech):
if path: if path:
debug.info(2,"Found path: cost={0} ".format(cost)) debug.info(2,"Found path: cost={0} ".format(cost))
debug.info(3,str(path)) debug.info(3,str(path))
self.paths.append(path) self.paths.append(path)
self.add_route(path)
path_set = grid_utils.flatten_set(path) path_set = grid_utils.flatten_set(path)
inflated_path = grid_utils.inflate_set(path_set,self.supply_rail_space_width) inflated_path = grid_utils.inflate_set(path_set,self.supply_rail_space_width)
self.path_blockages.append(inflated_path) self.path_blockages.append(inflated_path)
self.add_route(path)
else: else:
self.write_debug_gds("failed_route.gds") self.write_debug_gds("failed_route.gds")
# clean up so we can try a reroute # clean up so we can try a reroute
@ -985,16 +980,30 @@ class router(router_tech):
# midpoint offset # midpoint offset
off=vector((shape[1].x+shape[0].x)/2, off=vector((shape[1].x+shape[0].x)/2,
(shape[1].y+shape[0].y)/2) (shape[1].y+shape[0].y)/2)
if g[2]==1:
# Upper layer is upper right label
type_off=off+partial_track
else:
# Lower layer is lower left label
type_off=off-partial_track
if t!=None: if t!=None:
if g[2]==1:
# Upper layer is upper right label
type_off=off+partial_track
else:
# Lower layer is lower left label
type_off=off-partial_track
self.cell.add_label(text=str(t), self.cell.add_label(text=str(t),
layer="text", layer="text",
offset=type_off) offset=type_off)
t=self.rg.map[g].get_cost()
partial_track=vector(self.track_width/6.0,0)
if t!=None:
if g[2]==1:
# Upper layer is right label
type_off=off+partial_track
else:
# Lower layer is left label
type_off=off-partial_track
self.cell.add_label(text=str(t),
layer="text",
offset=type_off)
self.cell.add_label(text="{0},{1}".format(g[0],g[1]), self.cell.add_label(text="{0},{1}".format(g[0],g[1]),
layer="text", layer="text",
offset=shape[0], offset=shape[0],
@ -1008,9 +1017,9 @@ class router(router_tech):
""" """
debug.info(0,"Adding router info") debug.info(0,"Adding router info")
show_blockages = True show_blockages = False
show_blockage_grids = True show_blockage_grids = False
show_enclosures = True show_enclosures = False
show_all_grids = True show_all_grids = True
if show_all_grids: if show_all_grids: