2016-11-08 18:57:35 +01:00
|
|
|
#!/usr/bin/env python2.7
|
|
|
|
|
"""
|
|
|
|
|
Run a regresion test on various srams
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import unittest
|
2016-11-11 18:41:43 +01:00
|
|
|
from testutils import header,isclose
|
2016-11-08 18:57:35 +01:00
|
|
|
import sys,os
|
|
|
|
|
sys.path.append(os.path.join(sys.path[0],".."))
|
|
|
|
|
import globals
|
|
|
|
|
import debug
|
|
|
|
|
import calibre
|
|
|
|
|
|
|
|
|
|
OPTS = globals.get_opts()
|
|
|
|
|
|
2016-11-11 22:22:01 +01:00
|
|
|
#@unittest.skip("SKIPPING 21_ngspice_delay_test")
|
2016-11-08 18:57:35 +01:00
|
|
|
class timing_sram_test(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
def runTest(self):
|
|
|
|
|
globals.init_openram("config_20_{0}".format(OPTS.tech_name))
|
|
|
|
|
# we will manually run lvs/drc
|
|
|
|
|
OPTS.check_lvsdrc = False
|
|
|
|
|
OPTS.use_pex = False
|
2016-11-10 20:33:10 +01:00
|
|
|
OPTS.spice_version="ngspice"
|
|
|
|
|
OPTS.force_spice = True
|
|
|
|
|
globals.set_spice()
|
|
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
import sram
|
|
|
|
|
|
|
|
|
|
debug.info(1, "Testing timing for sample 1bit, 16words SRAM with 1 bank")
|
|
|
|
|
s = sram.sram(word_size=OPTS.config.word_size,
|
|
|
|
|
num_words=OPTS.config.num_words,
|
|
|
|
|
num_banks=OPTS.config.num_banks,
|
|
|
|
|
name="test_sram1")
|
|
|
|
|
|
|
|
|
|
OPTS.check_lvsdrc = True
|
|
|
|
|
|
|
|
|
|
import delay
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
|
|
|
|
|
d = delay.delay(s,tempspice)
|
|
|
|
|
data = d.analyze(probe_address, probe_data)
|
|
|
|
|
|
|
|
|
|
if OPTS.tech_name == "freepdk45":
|
|
|
|
|
self.assertTrue(isclose(data['delay1'],0.013649))
|
|
|
|
|
self.assertTrue(isclose(data['delay0'],0.22893))
|
|
|
|
|
self.assertTrue(isclose(data['min_period1'],0.078582763671875))
|
|
|
|
|
self.assertTrue(isclose(data['min_period0'],0.25543212890625))
|
|
|
|
|
elif OPTS.tech_name == "scn3me_subm":
|
2016-11-11 22:22:01 +01:00
|
|
|
self.assertTrue(isclose(data['delay1'],1.66442871094)) # diff than hspice
|
2016-11-08 18:57:35 +01:00
|
|
|
self.assertTrue(isclose(data['delay0'],2.2635000000000005))
|
|
|
|
|
self.assertTrue(isclose(data['min_period1'],1.53564453125))
|
|
|
|
|
self.assertTrue(isclose(data['min_period0'],2.998046875))
|
|
|
|
|
else:
|
|
|
|
|
self.assertTrue(False) # other techs fail
|
|
|
|
|
|
|
|
|
|
os.remove(tempspice)
|
|
|
|
|
|
|
|
|
|
# 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()
|