2023-07-21 09:55:36 -07:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2024-01-03 14:32:44 -08:00
|
|
|
# Copyright (c) 2016-2024 Regents of the University of California, Santa Cruz
|
2023-07-21 09:55:36 -07:00
|
|
|
# All rights reserved.
|
|
|
|
|
#
|
|
|
|
|
"""
|
|
|
|
|
Utility functions for graph router.
|
|
|
|
|
"""
|
|
|
|
|
from openram.base import vector
|
|
|
|
|
from openram.tech import drc
|
|
|
|
|
|
|
|
|
|
|
2023-07-22 14:07:27 -07:00
|
|
|
def snap(a):
|
|
|
|
|
""" Use custom `snap` since `vector.snap_to_grid` isn't working. """
|
2023-07-21 09:55:36 -07:00
|
|
|
|
2023-07-22 14:07:27 -07:00
|
|
|
if isinstance(a, vector):
|
|
|
|
|
return vector(snap(a.x), snap(a.y))
|
|
|
|
|
return round(a, len(str(drc["grid"]).split('.')[1]))
|