OpenRAM/compiler/tests/21_hspice_setuphold_test.py

70 lines
2.5 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/env python3
# See LICENSE for licensing information.
#
2024-01-03 23:32:44 +01:00
# Copyright (c) 2016-2024 Regents of the University of California and The Board
2019-06-14 17:43:41 +02:00
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
2022-11-27 22:01:20 +01:00
import sys, os
2016-11-08 18:57:35 +01:00
import unittest
from testutils import *
2022-11-27 22:01:20 +01:00
import openram
from openram import OPTS
2016-11-08 18:57:35 +01:00
2022-02-04 23:38:35 +01:00
@unittest.skip("SKIPPING 21_hspice_setuphold_test")
class timing_setup_test(openram_test):
2016-11-08 18:57:35 +01:00
def runTest(self):
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
2022-11-27 22:01:20 +01:00
openram.init_openram(config_file, is_unit_test=True)
OPTS.spice_name="hspice"
OPTS.analytical_delay = False
OPTS.netlist_only = True
2020-11-03 15:29:17 +01:00
# This is a hack to reload the characterizer __init__ with the spice version
from importlib import reload
2022-11-27 22:01:20 +01:00
from openram import characterizer
reload(characterizer)
2022-11-27 22:01:20 +01:00
from openram.characterizer import setup_hold
from openram import tech
2017-07-06 17:42:25 +02:00
slews = [tech.spice["rise_time"]*2]
2020-11-03 15:29:17 +01:00
corner = (OPTS.process_corners[0], OPTS.supply_voltages[0], OPTS.temperatures[0])
sh = setup_hold(corner)
2017-07-06 17:42:25 +02:00
data = sh.analyze(slews,slews)
2016-11-08 18:57:35 +01:00
if OPTS.tech_name == "freepdk45":
golden_data = {'hold_times_HL': [-0.0158691],
2018-09-13 23:41:15 +02:00
'hold_times_LH': [-0.0158691],
'setup_times_HL': [0.026855499999999997],
'setup_times_LH': [0.032959]}
elif OPTS.tech_name == "scn4m_subm":
golden_data = {'hold_times_HL': [-0.0805664],
'hold_times_LH': [-0.11718749999999999],
'setup_times_HL': [0.16357419999999998],
'setup_times_LH': [0.1757812]}
elif OPTS.tech_name == "sky130":
2021-06-08 20:14:27 +02:00
golden_data = {'hold_times_HL': [-0.03173828],
'hold_times_LH': [-0.05615234],
'setup_times_HL': [0.078125],
'setup_times_LH': [0.1025391]}
2016-11-08 18:57:35 +01:00
else:
self.assertTrue(False) # other techs fail
# Check if no too many or too few results
self.assertTrue(len(data.keys())==len(golden_data.keys()))
self.assertTrue(self.check_golden_data(data,golden_data,0.25))
2022-11-27 22:01:20 +01:00
openram.end_openram()
2020-11-03 15:29:17 +01:00
# run the test from the command line
2016-11-08 18:57:35 +01:00
if __name__ == "__main__":
2022-11-27 22:01:20 +01:00
(OPTS, args) = openram.parse_args()
2016-11-08 18:57:35 +01:00
del sys.argv[1:]
header(__file__, OPTS.tech_name)
unittest.main(testRunner=debugTestRunner())