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.
|
|
|
|
|
#
|
2021-01-22 20:23:28 +01:00
|
|
|
# Copyright (c) 2016-2021 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
|
|
|
#
|
2016-11-08 18:57:35 +01:00
|
|
|
import unittest
|
2019-05-31 19:51:42 +02:00
|
|
|
from testutils import *
|
2020-11-03 22:18:46 +01:00
|
|
|
import sys, os
|
2019-05-31 19:51:42 +02:00
|
|
|
sys.path.append(os.getenv("OPENRAM_HOME"))
|
2016-11-08 18:57:35 +01:00
|
|
|
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_sram_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"))
|
2019-11-15 19:47:59 +01:00
|
|
|
globals.init_openram(config_file)
|
2017-11-23 00:57:29 +01:00
|
|
|
OPTS.spice_name="ngspice"
|
2017-11-09 20:13:44 +01:00
|
|
|
OPTS.analytical_delay = False
|
2018-11-08 21:19:06 +01:00
|
|
|
OPTS.netlist_only = True
|
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
|
2018-05-12 01:32:00 +02:00
|
|
|
from importlib import reload
|
2017-11-16 02:02:53 +01:00
|
|
|
import characterizer
|
|
|
|
|
reload(characterizer)
|
2019-01-03 14:51:28 +01:00
|
|
|
from characterizer import delay
|
2018-08-31 22:01:17 +02:00
|
|
|
from sram_config import sram_config
|
2021-04-07 02:01:52 +02:00
|
|
|
c = sram_config(word_size=4,
|
2018-08-31 22:01:17 +02:00
|
|
|
num_words=16,
|
|
|
|
|
num_banks=1)
|
2018-09-04 19:47:24 +02:00
|
|
|
c.words_per_row=1
|
2018-12-06 22:11:47 +01:00
|
|
|
c.recompute_sizes()
|
2016-11-08 18:57:35 +01:00
|
|
|
debug.info(1, "Testing timing for sample 1bit, 16words SRAM with 1 bank")
|
2019-03-06 23:12:24 +01:00
|
|
|
s = factory.create(module_type="sram", sram_config=c)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
tempspice = OPTS.openram_temp + "temp.sp"
|
|
|
|
|
s.sp_write(tempspice)
|
|
|
|
|
|
2018-07-18 19:33:18 +02:00
|
|
|
probe_address = "1" * s.s.addr_size
|
|
|
|
|
probe_data = s.s.word_size - 1
|
2018-07-27 23:06:59 +02:00
|
|
|
debug.info(1, "Probe address {0} probe data bit {1}".format(probe_address, probe_data))
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-02-12 18:33:23 +01:00
|
|
|
corner = (OPTS.process_corners[0], OPTS.supply_voltages[0], OPTS.temperatures[0])
|
2018-07-18 19:33:18 +02:00
|
|
|
d = delay(s.s, tempspice, corner)
|
2017-07-06 17:42:25 +02:00
|
|
|
import tech
|
2019-09-05 01:08:18 +02:00
|
|
|
loads = [tech.spice["dff_in_cap"]*4]
|
2017-07-06 17:42:25 +02:00
|
|
|
slews = [tech.spice["rise_time"]*2]
|
2021-05-25 23:49:28 +02:00
|
|
|
load_slews = []
|
|
|
|
|
for slew in slews:
|
|
|
|
|
for load in loads:
|
|
|
|
|
load_slews.append((load, slew))
|
|
|
|
|
data, port_data = d.analyze(probe_address, probe_data, load_slews)
|
2018-09-17 08:15:22 +02:00
|
|
|
#Combine info about port into all data
|
|
|
|
|
data.update(port_data[0])
|
2018-07-27 00:45:17 +02:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
if OPTS.tech_name == "freepdk45":
|
2021-04-07 02:01:52 +02:00
|
|
|
golden_data = {'delay_hl': [0.24671600000000002],
|
|
|
|
|
'delay_lh': [0.24671600000000002],
|
|
|
|
|
'disabled_read0_power': [0.1749204],
|
|
|
|
|
'disabled_read1_power': [0.1873704],
|
|
|
|
|
'disabled_write0_power': [0.204619],
|
|
|
|
|
'disabled_write1_power': [0.2262653],
|
|
|
|
|
'leakage_power': 0.0021375310000000002,
|
|
|
|
|
'min_period': 0.977,
|
|
|
|
|
'read0_power': [0.3856875],
|
|
|
|
|
'read1_power': [0.38856060000000003],
|
|
|
|
|
'slew_hl': [0.2842019],
|
|
|
|
|
'slew_lh': [0.2842019],
|
|
|
|
|
'write0_power': [0.45274410000000004],
|
|
|
|
|
'write1_power': [0.38727789999999995]}
|
2018-09-17 19:03:55 +02:00
|
|
|
elif OPTS.tech_name == "scn4m_subm":
|
2021-04-07 02:01:52 +02:00
|
|
|
golden_data = {'delay_hl': [1.882508],
|
|
|
|
|
'delay_lh': [1.882508],
|
|
|
|
|
'disabled_read0_power': [7.487227],
|
|
|
|
|
'disabled_read1_power': [8.749013],
|
|
|
|
|
'disabled_write0_power': [9.268901],
|
|
|
|
|
'disabled_write1_power': [9.962973],
|
|
|
|
|
'leakage_power': 0.0046686359999999994,
|
|
|
|
|
'min_period': 7.188,
|
|
|
|
|
'read0_power': [16.64011],
|
|
|
|
|
'read1_power': [17.20825],
|
|
|
|
|
'slew_hl': [2.039655],
|
|
|
|
|
'slew_lh': [2.039655],
|
|
|
|
|
'write0_power': [19.31883],
|
|
|
|
|
'write1_power': [15.297369999999999]}
|
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()))
|
2020-11-03 15:29:17 +01:00
|
|
|
|
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
|
|
|
|
2017-07-06 17:42:25 +02:00
|
|
|
globals.end_openram()
|
|
|
|
|
|
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)
|
2019-05-31 19:51:42 +02:00
|
|
|
unittest.main(testRunner=debugTestRunner())
|