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