2016-11-08 18:57:35 +01:00
|
|
|
#!/usr/bin/env python2.7
|
|
|
|
|
"""
|
|
|
|
|
Run a regresion test on various srams
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
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
|
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):
|
|
|
|
|
globals.init_openram("config_20_{0}".format(OPTS.tech_name))
|
|
|
|
|
OPTS.check_lvsdrc = False
|
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-01-26 21:47:32 +01:00
|
|
|
|
2017-11-16 02:02:53 +01:00
|
|
|
# This is a hack to reload the characterizer __init__ with the spice version
|
|
|
|
|
import characterizer
|
|
|
|
|
reload(characterizer)
|
|
|
|
|
from characterizer import setup_hold
|
2018-01-26 22:23:11 +01:00
|
|
|
if not OPTS.spice_exe:
|
2018-02-01 00:38:02 +01:00
|
|
|
debug.error("Could not find {} simulator.".format(OPTS.spice_name),-1)
|
2016-11-10 20:33:10 +01:00
|
|
|
|
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])
|
|
|
|
|
sh = setup_hold.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":
|
|
|
|
|
golden_data = {'setup_times_LH': [0.01464844],
|
|
|
|
|
'hold_times_LH': [0.0024414059999999997],
|
|
|
|
|
'hold_times_HL': [-0.003662109],
|
|
|
|
|
'setup_times_HL': [0.008544922]}
|
|
|
|
|
elif OPTS.tech_name == "scn3me_subm":
|
2018-02-16 22:54:05 +01:00
|
|
|
golden_data = {'setup_times_LH': [0.07568359],
|
|
|
|
|
'hold_times_LH': [0.008544922],
|
|
|
|
|
'hold_times_HL': [-0.05859374999999999],
|
|
|
|
|
'setup_times_HL': [0.03295898]}
|
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()))
|
|
|
|
|
# Check each result
|
|
|
|
|
for k in data.keys():
|
|
|
|
|
if type(data[k])==list:
|
|
|
|
|
for i in range(len(data[k])):
|
2018-01-31 20:48:41 +01:00
|
|
|
self.isclose(data[k][i],golden_data[k][i],0.15)
|
2017-08-07 19:24:45 +02:00
|
|
|
else:
|
2018-01-31 20:48:41 +01:00
|
|
|
self.isclose(data[k],golden_data[k],0.15)
|
2017-08-07 19:24:45 +02:00
|
|
|
|
2016-11-15 18:03:16 +01:00
|
|
|
# reset these options
|
2016-11-08 18:57:35 +01:00
|
|
|
OPTS.check_lvsdrc = True
|
2017-11-23 00:57:29 +01:00
|
|
|
OPTS.spice_name="hspice"
|
2017-11-16 22:52:58 +01:00
|
|
|
OPTS.analytical_delay = True
|
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
|
|
|
|
|
|
|
|
# instantiate a copdsay of the class to actually run the test
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
(OPTS, args) = globals.parse_args()
|
|
|
|
|
del sys.argv[1:]
|
|
|
|
|
header(__file__, OPTS.tech_name)
|
|
|
|
|
unittest.main()
|