mirror of https://github.com/VLSIDA/OpenRAM.git
Fixed router test 03. Cleaned up code.
This commit is contained in:
parent
b61df7614d
commit
2350be8e39
|
|
@ -17,20 +17,16 @@ class grid:
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, width, height):
|
||||
def __init__(self):
|
||||
""" Create a routing map of width x height cells and 2 in the z-axis. """
|
||||
self.width=width
|
||||
self.height=height
|
||||
self.NONPREFERRED_COST = 5
|
||||
self.VIA_COST = 3
|
||||
self.source = []
|
||||
self.target = []
|
||||
self.blocked = []
|
||||
self.map={}
|
||||
|
||||
# let's leave this sparse, create cells on demand
|
||||
# for x in range(width):
|
||||
# for y in range(height):
|
||||
# for z in range(2):
|
||||
# self.map[vector3d(x,y,z)]=cell()
|
||||
# let's leave the map sparse, cells are created on demand
|
||||
self.map={}
|
||||
|
||||
# priority queue for the maze routing
|
||||
self.q = Q.PriorityQueue()
|
||||
|
|
@ -73,11 +69,6 @@ class grid:
|
|||
# img.save(filename)
|
||||
|
||||
def set_property(self,ll,ur,z,name,value=True):
|
||||
assert(ur[1] >= ll[1] and ur[0] >= ll[0])
|
||||
assert(ll[0]<self.width and ll[0]>=0)
|
||||
assert(ll[1]<self.height and ll[1]>=0)
|
||||
assert(ur[0]<self.width and ur[0]>=0)
|
||||
assert(ur[1]<self.height and ur[1]>=0)
|
||||
for x in range(int(ll[0]),int(ur[0])+1):
|
||||
for y in range(int(ll[1]),int(ur[1])+1):
|
||||
n = vector3d(x,y,z)
|
||||
|
|
@ -252,21 +243,14 @@ class grid:
|
|||
cost = 0
|
||||
for p0,p1 in plist:
|
||||
if p0.z != p1.z: # via
|
||||
cost += 2
|
||||
cost += self.VIA_COST
|
||||
elif p0.x != p1.x: # horizontal
|
||||
cost += 2 if (p0.z == 1) else 1
|
||||
cost += self.NONPREFERRED_COST if (p0.z == 1) else 1
|
||||
elif p0.y != p1.y: # vertical
|
||||
cost += 2 if (p0.z == 0) else 1
|
||||
cost += self.NONPREFERRED_COST if (p0.z == 0) else 1
|
||||
else:
|
||||
debug.error("Non-changing direction!")
|
||||
|
||||
# for p in path:
|
||||
# if p.z != prev_p.z:
|
||||
# via_cost += 2 # we count a via as 2x a wire track
|
||||
# prev_layer = p.z
|
||||
# prev_p = p
|
||||
#
|
||||
#return len(path)+via_cost
|
||||
return cost
|
||||
|
||||
def get_inertia(self,p0,p1):
|
||||
|
|
|
|||
|
|
@ -84,14 +84,7 @@ class router:
|
|||
size = self.ur - self.ll
|
||||
debug.info(1,"Size: {0} x {1}".format(size.x,size.y))
|
||||
|
||||
# The routing grid starts at the self.ll and goes up/right
|
||||
# The +1 is because the source/dest object may get expanded outside the region
|
||||
self.height_in_tracks = int(math.ceil(self.ur.x/self.track_width))+2
|
||||
self.width_in_tracks = int(math.ceil(self.ur.y/self.track_width))+2
|
||||
|
||||
debug.info(1,"Size (in tracks, from ll): {0} x {1}".format(self.width_in_tracks, self.height_in_tracks))
|
||||
|
||||
self.rg = grid.grid(self.height_in_tracks,self.width_in_tracks)
|
||||
self.rg = grid.grid()
|
||||
|
||||
|
||||
def find_pin(self,pin):
|
||||
|
|
@ -370,7 +363,7 @@ class router:
|
|||
ur = snap_to_grid(ur)
|
||||
|
||||
# to scale coordinates to tracks
|
||||
debug.info(1,"Converting [ {0} , {1} ]".format(ll,ur))
|
||||
#debug.info(1,"Converting [ {0} , {1} ]".format(ll,ur))
|
||||
ll=ll.scale(self.track_factor)
|
||||
ur=ur.scale(self.track_factor)
|
||||
ll = ll.floor() if round_bigger else ll.round()
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ class no_blockages_test(unittest.TestCase):
|
|||
layer_stack =("metal1","via1","metal2")
|
||||
r.route(layer_stack,src="A",dest="B")
|
||||
r.add_route(self)
|
||||
self.gds_write("mytemp.gds")
|
||||
|
||||
|
||||
r = routing("test1", "01_no_blockages_test")
|
||||
|
|
|
|||
|
|
@ -49,21 +49,10 @@ class no_blockages_test(unittest.TestCase):
|
|||
self.gdsname = "{0}/{1}.gds".format(os.path.dirname(os.path.realpath(__file__)),gdsname)
|
||||
r=router.router(self.gdsname)
|
||||
layer_stack =("metal1","via1","metal2")
|
||||
(src_rect,path,dest_rect)=r.route(layer_stack,src="A",dest="B")
|
||||
r.rg.view()
|
||||
self.add_rect(layer=layer_stack[0],
|
||||
offset=src_rect[0],
|
||||
width=src_rect[1].x-src_rect[0].x,
|
||||
height=src_rect[1].y-src_rect[0].y)
|
||||
self.add_wire(layer_stack,path)
|
||||
self.add_rect(layer=layer_stack[0],
|
||||
offset=dest_rect[0],
|
||||
width=dest_rect[1].x-dest_rect[0].x,
|
||||
height=dest_rect[1].y-dest_rect[0].y)
|
||||
r.route(layer_stack,src="A",dest="B")
|
||||
r.add_route(self)
|
||||
|
||||
|
||||
|
||||
r = routing("test1", "AB_blockages")
|
||||
r = routing("test1", "02_blockages_test")
|
||||
self.local_check(r)
|
||||
|
||||
# fails if there are any DRC errors on any cells
|
||||
|
|
|
|||
|
|
@ -49,21 +49,11 @@ class no_blockages_test(unittest.TestCase):
|
|||
self.gdsname = "{0}/{1}.gds".format(os.path.dirname(os.path.realpath(__file__)),gdsname)
|
||||
r=router.router(self.gdsname)
|
||||
layer_stack =("metal1","via1","metal2")
|
||||
(src_rect,path,dest_rect)=r.route(layer_stack,src="A",dest="B")
|
||||
#r.rg.view()
|
||||
self.add_rect(layer=layer_stack[0],
|
||||
offset=src_rect[0],
|
||||
width=src_rect[1].x-src_rect[0].x,
|
||||
height=src_rect[1].y-src_rect[0].y)
|
||||
self.add_wire(layer_stack,path)
|
||||
self.add_rect(layer=layer_stack[0],
|
||||
offset=dest_rect[0],
|
||||
width=dest_rect[1].x-dest_rect[0].x,
|
||||
height=dest_rect[1].y-dest_rect[0].y)
|
||||
|
||||
r.route(layer_stack,src="A",dest="B")
|
||||
r.add_route(self)
|
||||
|
||||
|
||||
r = routing("test1", "AB_same_layer_pins")
|
||||
r = routing("test1", "03_same_layer_pins_test")
|
||||
self.local_check(r)
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue