2018-05-12 01:32:00 +02:00
|
|
|
#!/usr/bin/env python3
|
2019-04-26 21:21:50 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2023-01-29 07:56:27 +01:00
|
|
|
# Copyright (c) 2016-2023 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.
|
2019-04-26 21:21:50 +02:00
|
|
|
#
|
2022-11-27 22:01:20 +01:00
|
|
|
import sys, os
|
2016-11-08 18:57:35 +01:00
|
|
|
import unittest
|
2019-05-31 19:51:42 +02:00
|
|
|
from testutils import *
|
2022-07-13 19:57:56 +02:00
|
|
|
|
2022-11-27 22:01:20 +01:00
|
|
|
import openram
|
|
|
|
|
from openram import OPTS
|
2021-03-08 23:40:36 +01:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2022-02-04 23:38:35 +01:00
|
|
|
@unittest.skip("SKIPPING 21_hspice_setuphold_test")
|
2018-01-30 01:59:29 +01:00
|
|
|
class timing_setup_test(openram_test):
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
def runTest(self):
|
2019-11-17 01:44:31 +01:00
|
|
|
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)
|
2017-11-23 00:57:29 +01:00
|
|
|
OPTS.spice_name="hspice"
|
2017-11-16 22:52:58 +01:00
|
|
|
OPTS.analytical_delay = False
|
2018-10-25 18:07:00 +02:00
|
|
|
OPTS.netlist_only = True
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-01-26 21:47:32 +01:00
|
|
|
# This is a hack to reload the characterizer __init__ with the spice version
|
2018-05-12 01:32:00 +02:00
|
|
|
from importlib import reload
|
2022-11-27 22:01:20 +01:00
|
|
|
from openram import characterizer
|
2017-11-16 22:52:58 +01:00
|
|
|
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
|
|
|
|
2018-02-12 18:33:23 +01:00
|
|
|
corner = (OPTS.process_corners[0], OPTS.supply_voltages[0], OPTS.temperatures[0])
|
2018-06-29 18:45:07 +02:00
|
|
|
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":
|
2018-12-06 08:23:40 +01:00
|
|
|
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]}
|
2018-09-17 19:03:55 +02:00
|
|
|
elif OPTS.tech_name == "scn4m_subm":
|
2019-09-30 23:02:00 +02:00
|
|
|
golden_data = {'hold_times_HL': [-0.0805664],
|
|
|
|
|
'hold_times_LH': [-0.11718749999999999],
|
|
|
|
|
'setup_times_HL': [0.16357419999999998],
|
|
|
|
|
'setup_times_LH': [0.1757812]}
|
2021-03-08 23:40:36 +01:00
|
|
|
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],
|
2021-03-08 23:40:36 +01:00
|
|
|
'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
|
|
|
|
|
|
2017-08-07 19:24:45 +02:00
|
|
|
# Check if no too many or too few results
|
|
|
|
|
self.assertTrue(len(data.keys())==len(golden_data.keys()))
|
2018-07-27 01:05:24 +02:00
|
|
|
|
|
|
|
|
self.assertTrue(self.check_golden_data(data,golden_data,0.25))
|
2017-08-07 19:24:45 +02:00
|
|
|
|
2022-11-27 22:01:20 +01:00
|
|
|
openram.end_openram()
|
|
|
|
|
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-11-03 00:34:26 +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)
|
2019-05-31 19:51:42 +02:00
|
|
|
unittest.main(testRunner=debugTestRunner())
|