2018-05-12 01:32:00 +02:00
|
|
|
#!/usr/bin/env python3
|
2016-11-08 18:57:35 +01:00
|
|
|
"""
|
2018-05-12 01:32:00 +02:00
|
|
|
Run a regression test on various srams
|
2016-11-08 18:57:35 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import unittest
|
2018-01-31 20:48:41 +01:00
|
|
|
from testutils import header,openram_test
|
2016-11-08 18:57:35 +01:00
|
|
|
import sys,os
|
|
|
|
|
sys.path.append(os.path.join(sys.path[0],".."))
|
|
|
|
|
import globals
|
2017-11-16 22:52:58 +01:00
|
|
|
from globals import OPTS
|
2019-03-06 23:12:24 +01:00
|
|
|
from sram_factory import factory
|
2016-11-08 18:57:35 +01:00
|
|
|
import debug
|
|
|
|
|
|
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-03-08 19:47:41 +01:00
|
|
|
globals.init_openram("config_{0}".format(OPTS.tech_name))
|
2017-11-23 00:57:29 +01:00
|
|
|
OPTS.spice_name="ngspice"
|
2017-11-16 22:52:58 +01:00
|
|
|
OPTS.analytical_delay = False
|
2018-10-25 18:07:00 +02:00
|
|
|
OPTS.netlist_only = True
|
|
|
|
|
|
2017-11-16 02:02:53 +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
|
2017-11-16 02:02:53 +01:00
|
|
|
import characterizer
|
|
|
|
|
reload(characterizer)
|
|
|
|
|
from characterizer import setup_hold
|
2016-11-08 18:57:35 +01:00
|
|
|
import sram
|
2017-07-06 17:42:25 +02:00
|
|
|
import tech
|
|
|
|
|
slews = [tech.spice["rise_time"]*2]
|
|
|
|
|
|
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)
|
2018-02-14 00:54:50 +01:00
|
|
|
#print data
|
2017-08-07 19:24:45 +02:00
|
|
|
if OPTS.tech_name == "freepdk45":
|
2018-09-13 20:40:24 +02:00
|
|
|
golden_data = {'hold_times_HL': [-0.01586914],
|
|
|
|
|
'hold_times_LH': [-0.01586914],
|
|
|
|
|
'setup_times_HL': [0.02685547],
|
|
|
|
|
'setup_times_LH': [0.03295898]}
|
2018-09-17 19:03:55 +02:00
|
|
|
elif OPTS.tech_name == "scn4m_subm":
|
|
|
|
|
golden_data = {'hold_times_HL': [-0.08911132999999999],
|
|
|
|
|
'hold_times_LH': [-0.0769043],
|
|
|
|
|
'setup_times_HL': [0.1184082],
|
|
|
|
|
'setup_times_LH': [0.1672363]}
|
2017-08-07 19:24:45 +02: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()))
|
|
|
|
|
|
2018-07-27 01:05:24 +02:00
|
|
|
self.assertTrue(self.check_golden_data(data,golden_data,0.25))
|
|
|
|
|
|
2017-11-16 02:02:53 +01:00
|
|
|
reload(characterizer)
|
2017-08-07 19:24:45 +02:00
|
|
|
globals.end_openram()
|
2016-11-08 18:57:35 +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__":
|
|
|
|
|
(OPTS, args) = globals.parse_args()
|
|
|
|
|
del sys.argv[1:]
|
|
|
|
|
header(__file__, OPTS.tech_name)
|
|
|
|
|
unittest.main()
|