2016-11-08 18:57:35 +01:00
|
|
|
#!/usr/bin/env python2.7
|
|
|
|
|
"""
|
|
|
|
|
Run a regresion test on various srams
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import unittest
|
2018-01-30 01:59:29 +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 sram_func_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
|
2018-02-01 01:21:43 +01:00
|
|
|
OPTS.spice_name="" # Unset to use any simulator
|
2017-11-16 22:52:58 +01:00
|
|
|
OPTS.analytical_delay = False
|
2018-02-01 01:21:43 +01:00
|
|
|
|
|
|
|
|
# This is a hack to reload the characterizer __init__ with the spice version
|
2017-11-16 22:52:58 +01:00
|
|
|
import characterizer
|
|
|
|
|
reload(characterizer)
|
|
|
|
|
from characterizer import delay
|
2018-02-01 01:21:43 +01:00
|
|
|
if not OPTS.spice_exe:
|
|
|
|
|
debug.error("Could not find {} simulator.".format(OPTS.spice_name),-1)
|
2017-11-16 22:52:58 +01:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
import sram
|
|
|
|
|
|
|
|
|
|
debug.info(1, "Testing timing for sample 1bit, 16words SRAM with 1 bank")
|
2018-02-23 16:47:01 +01:00
|
|
|
s = sram.sram(word_size=1,
|
|
|
|
|
num_words=16,
|
|
|
|
|
num_banks=1,
|
2017-06-02 20:11:57 +02:00
|
|
|
name="sram_func_test")
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
OPTS.check_lvsdrc = True
|
|
|
|
|
|
|
|
|
|
tempspice = OPTS.openram_temp + "temp.sp"
|
|
|
|
|
s.sp_write(tempspice)
|
|
|
|
|
|
|
|
|
|
probe_address = "1" * s.addr_size
|
|
|
|
|
probe_data = s.word_size - 1
|
|
|
|
|
debug.info(1, "Probe address {0} probe data {1}".format(probe_address, probe_data))
|
|
|
|
|
|
2018-02-12 18:33:23 +01:00
|
|
|
corner = (OPTS.process_corners[0], OPTS.supply_voltages[0], OPTS.temperatures[0])
|
|
|
|
|
d = delay.delay(s,tempspice,corner)
|
2016-11-08 18:57:35 +01:00
|
|
|
d.set_probe(probe_address,probe_data)
|
|
|
|
|
|
|
|
|
|
# This will exit if it doesn't find a feasible period
|
2017-07-06 17:42:25 +02:00
|
|
|
import tech
|
2018-02-23 16:47:01 +01:00
|
|
|
d.load = tech.spice["msflop_in_cap"]*4
|
|
|
|
|
d.slew = tech.spice["rise_time"]*2
|
|
|
|
|
feasible_period = d.find_feasible_period()
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
os.remove(tempspice)
|
2017-11-09 20:13:44 +01:00
|
|
|
OPTS.analytical_delay = True
|
2017-11-16 22:52:58 +01:00
|
|
|
reload(characterizer)
|
2016-11-11 23:05:14 +01: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()
|