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.
|
|
|
|
|
#
|
2024-01-03 23:32:44 +01:00
|
|
|
# Copyright (c) 2016-2024 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
|
|
|
#
|
2022-11-27 22:01:20 +01:00
|
|
|
import sys, os
|
2016-11-08 18:57:35 +01:00
|
|
|
import unittest
|
2019-05-31 19:51:42 +02:00
|
|
|
from testutils import *
|
2022-07-13 19:57:56 +02:00
|
|
|
|
2022-11-27 22:01:20 +01:00
|
|
|
import openram
|
|
|
|
|
from openram import debug
|
|
|
|
|
from openram.sram_factory import factory
|
|
|
|
|
from openram import OPTS
|
|
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2022-02-04 23:38:35 +01:00
|
|
|
@unittest.skip("SKIPPING 21_hspice_delay_test")
|
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"))
|
2022-11-27 22:01:20 +01:00
|
|
|
openram.init_openram(config_file, is_unit_test=True)
|
2017-11-23 00:57:29 +01:00
|
|
|
OPTS.spice_name="hspice"
|
2017-11-09 20:13:44 +01:00
|
|
|
OPTS.analytical_delay = False
|
2018-10-25 18:07:00 +02:00
|
|
|
OPTS.netlist_only = True
|
2020-11-03 15:29:17 +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
|
2022-11-27 22:01:20 +01:00
|
|
|
from openram import characterizer
|
2017-11-16 02:02:53 +01:00
|
|
|
reload(characterizer)
|
2022-11-27 22:01:20 +01:00
|
|
|
from openram.characterizer import delay
|
2022-12-03 00:28:06 +01:00
|
|
|
from openram import sram_config
|
2022-03-07 16:58:41 +01:00
|
|
|
if OPTS.tech_name == "sky130":
|
|
|
|
|
num_spare_rows = 1
|
|
|
|
|
num_spare_cols = 1
|
|
|
|
|
else:
|
|
|
|
|
num_spare_rows = 0
|
|
|
|
|
num_spare_cols = 0
|
|
|
|
|
|
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,
|
2022-03-07 16:58:41 +01:00
|
|
|
num_banks=1,
|
|
|
|
|
num_spare_cols=num_spare_cols,
|
|
|
|
|
num_spare_rows=num_spare_rows)
|
2018-12-12 22:12:26 +01:00
|
|
|
c.words_per_row=1
|
2018-12-06 22:11:47 +01:00
|
|
|
c.recompute_sizes()
|
2018-08-31 22:01:17 +02: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)
|
2020-11-03 15:29:17 +01:00
|
|
|
|
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)
|
2022-11-27 22:01:20 +01:00
|
|
|
from openram 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])
|
2020-04-22 19:40:04 +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.23941909999999997],
|
|
|
|
|
'delay_lh': [0.23941909999999997],
|
|
|
|
|
'disabled_read0_power': [0.18183159999999998],
|
|
|
|
|
'disabled_read1_power': [0.1979447],
|
|
|
|
|
'disabled_write0_power': [0.2129604],
|
|
|
|
|
'disabled_write1_power': [0.23266849999999997],
|
|
|
|
|
'leakage_power': 0.0019882,
|
|
|
|
|
'min_period': 0.938,
|
|
|
|
|
'read0_power': [0.4115467],
|
|
|
|
|
'read1_power': [0.41158859999999997],
|
|
|
|
|
'slew_hl': [0.2798571],
|
|
|
|
|
'slew_lh': [0.2798571],
|
|
|
|
|
'write0_power': [0.45873749999999996],
|
|
|
|
|
'write1_power': [0.40716199999999997]}
|
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.7652000000000003],
|
|
|
|
|
'delay_lh': [1.7652000000000003],
|
|
|
|
|
'disabled_read0_power': [8.2716],
|
|
|
|
|
'disabled_read1_power': [9.5857],
|
|
|
|
|
'disabled_write0_power': [9.9825],
|
|
|
|
|
'disabled_write1_power': [10.598400000000002],
|
|
|
|
|
'leakage_power': 0.0006681718,
|
|
|
|
|
'min_period': 6.562,
|
|
|
|
|
'read0_power': [18.6446],
|
|
|
|
|
'read1_power': [18.5126],
|
|
|
|
|
'slew_hl': [1.9026],
|
|
|
|
|
'slew_lh': [1.9026],
|
|
|
|
|
'write0_power': [21.022600000000004],
|
|
|
|
|
'write1_power': [16.6377]}
|
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()))
|
2018-07-27 00:45:17 +02:00
|
|
|
|
2018-07-27 01:05:24 +02:00
|
|
|
self.assertTrue(self.check_golden_data(data,golden_data,0.25))
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2022-11-27 22:01:20 +01:00
|
|
|
openram.end_openram()
|
|
|
|
|
|
2020-11-03 15:29:17 +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__":
|
2022-11-27 22:01:20 +01:00
|
|
|
(OPTS, args) = openram.parse_args()
|
2016-11-08 18:57:35 +01:00
|
|
|
del sys.argv[1:]
|
|
|
|
|
header(__file__, OPTS.tech_name)
|
2019-05-31 19:51:42 +02:00
|
|
|
unittest.main(testRunner=debugTestRunner())
|