mirror of https://github.com/VLSIDA/OpenRAM.git
Fix even more DRC errors in graph router
This commit is contained in:
parent
8354de654f
commit
48b556c43a
|
|
@ -12,7 +12,7 @@ from openram.tech import drc
|
||||||
from .direction import direction
|
from .direction import direction
|
||||||
from .graph_node import graph_node
|
from .graph_node import graph_node
|
||||||
from .graph_probe import graph_probe
|
from .graph_probe import graph_probe
|
||||||
from .graph_utils import *
|
from .graph_utils import snap
|
||||||
|
|
||||||
|
|
||||||
class graph:
|
class graph:
|
||||||
|
|
@ -80,12 +80,12 @@ class graph:
|
||||||
offset = self.router.offset
|
offset = self.router.offset
|
||||||
p = node.center
|
p = node.center
|
||||||
lengths = [blockage.width(), blockage.height()]
|
lengths = [blockage.width(), blockage.height()]
|
||||||
centers = snap_to_grid(blockage.center())
|
centers = blockage.center()
|
||||||
ll, ur = blockage.rect
|
ll, ur = blockage.rect
|
||||||
safe = [True, True]
|
safe = [True, True]
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
if lengths[i] >= offset * 2:
|
if lengths[i] >= offset * 2:
|
||||||
min_diff = snap_offset_to_grid(min(abs(ll[i] - p[i]), abs(ur[i] - p[i])))
|
min_diff = snap(min(abs(ll[i] - p[i]), abs(ur[i] - p[i])))
|
||||||
if min_diff < offset:
|
if min_diff < offset:
|
||||||
safe[i] = False
|
safe[i] = False
|
||||||
elif centers[i] != p[i]:
|
elif centers[i] != p[i]:
|
||||||
|
|
@ -104,7 +104,7 @@ class graph:
|
||||||
|
|
||||||
for via in self.graph_vias:
|
for via in self.graph_vias:
|
||||||
ll, ur = via.rect
|
ll, ur = via.rect
|
||||||
center = snap_to_grid(via.center())
|
center = via.center()
|
||||||
if via.on_segment(ll, point, ur) and \
|
if via.on_segment(ll, point, ur) and \
|
||||||
(center.x != point.x or center.y != point.y):
|
(center.x != point.x or center.y != point.y):
|
||||||
return True
|
return True
|
||||||
|
|
@ -180,7 +180,7 @@ class graph:
|
||||||
else: # Square-like pin
|
else: # Square-like pin
|
||||||
points = [shape.center()]
|
points = [shape.center()]
|
||||||
for p in points:
|
for p in points:
|
||||||
p = snap_to_grid(p)
|
p = snap(p)
|
||||||
x_values.add(p.x)
|
x_values.add(p.x)
|
||||||
y_values.add(p.y)
|
y_values.add(p.y)
|
||||||
|
|
||||||
|
|
@ -188,8 +188,8 @@ class graph:
|
||||||
offset = vector(drc["grid"], drc["grid"])
|
offset = vector(drc["grid"], drc["grid"])
|
||||||
for blockage in self.graph_blockages:
|
for blockage in self.graph_blockages:
|
||||||
ll, ur = blockage.rect
|
ll, ur = blockage.rect
|
||||||
nll = snap_to_grid(ll - offset)
|
nll = snap(ll - offset)
|
||||||
nur = snap_to_grid(ur + offset)
|
nur = snap(ur + offset)
|
||||||
# Add minimum offset to the blockage corner nodes to prevent overlap
|
# Add minimum offset to the blockage corner nodes to prevent overlap
|
||||||
x_values.update([nll.x, nur.x])
|
x_values.update([nll.x, nur.x])
|
||||||
y_values.update([nll.y, nur.y])
|
y_values.update([nll.y, nur.y])
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ from openram import OPTS
|
||||||
from .router_tech import router_tech
|
from .router_tech import router_tech
|
||||||
from .graph import graph
|
from .graph import graph
|
||||||
from .graph_shape import graph_shape
|
from .graph_shape import graph_shape
|
||||||
|
from .graph_utils import snap
|
||||||
|
|
||||||
|
|
||||||
class graph_router(router_tech):
|
class graph_router(router_tech):
|
||||||
|
|
@ -51,7 +52,7 @@ class graph_router(router_tech):
|
||||||
self.fake_pins = []
|
self.fake_pins = []
|
||||||
|
|
||||||
# Set the offset here
|
# Set the offset here
|
||||||
self.offset = self.layer_widths[0] / 2
|
self.offset = snap(self.layer_widths[0] / 2)
|
||||||
|
|
||||||
|
|
||||||
def route(self, vdd_name="vdd", gnd_name="gnd"):
|
def route(self, vdd_name="vdd", gnd_name="gnd"):
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
from openram.base.pin_layout import pin_layout
|
from openram.base.pin_layout import pin_layout
|
||||||
from openram.base.vector import vector
|
from openram.base.vector import vector
|
||||||
from openram.tech import drc
|
from openram.tech import drc
|
||||||
from .graph_utils import snap_to_grid
|
from .graph_utils import snap
|
||||||
|
|
||||||
|
|
||||||
class graph_shape(pin_layout):
|
class graph_shape(pin_layout):
|
||||||
|
|
@ -21,10 +21,28 @@ class graph_shape(pin_layout):
|
||||||
|
|
||||||
# Snap the shape to the grid here
|
# Snap the shape to the grid here
|
||||||
ll, ur = self.rect
|
ll, ur = self.rect
|
||||||
self.rect = [snap_to_grid(ll), snap_to_grid(ur)]
|
self.rect = [snap(ll), snap(ur)]
|
||||||
self.inflated_from = inflated_from
|
self.inflated_from = inflated_from
|
||||||
|
|
||||||
|
|
||||||
|
def center(self):
|
||||||
|
""" Override the default `center` behavior. """
|
||||||
|
|
||||||
|
return snap(super().center())
|
||||||
|
|
||||||
|
|
||||||
|
def height(self):
|
||||||
|
""" Override the default `height` behavior. """
|
||||||
|
|
||||||
|
return snap(super().height())
|
||||||
|
|
||||||
|
|
||||||
|
def width(self):
|
||||||
|
""" Override the default `width` behavior. """
|
||||||
|
|
||||||
|
return snap(super().width())
|
||||||
|
|
||||||
|
|
||||||
def get_inflated_from(self):
|
def get_inflated_from(self):
|
||||||
"""
|
"""
|
||||||
Return `self` if `self.inflated_from` is None. Otherwise, return
|
Return `self` if `self.inflated_from` is None. Otherwise, return
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,9 @@ from openram.base import vector
|
||||||
from openram.tech import drc
|
from openram.tech import drc
|
||||||
|
|
||||||
|
|
||||||
def snap_to_grid(v):
|
def snap(a):
|
||||||
""" Use custom `snap_to_grid` since `vector.snap_to_grid` isn't working. """
|
""" Use custom `snap` since `vector.snap_to_grid` isn't working. """
|
||||||
|
|
||||||
return vector(snap_offset_to_grid(v.x), snap_offset_to_grid(v.y))
|
if isinstance(a, vector):
|
||||||
|
return vector(snap(a.x), snap(a.y))
|
||||||
|
return round(a, len(str(drc["grid"]).split('.')[1]))
|
||||||
def snap_offset_to_grid(offset):
|
|
||||||
"""
|
|
||||||
Use custom `snap_offset_to_grid` since `vector.snap_offset_to_grid` isn't
|
|
||||||
working.
|
|
||||||
"""
|
|
||||||
|
|
||||||
return round(offset, len(str(drc["grid"]).split('.')[1]))
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue