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.
|
|
|
|
|
#
|
2019-06-14 17:43:41 +02:00
|
|
|
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
|
|
|
|
# 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 *
|
2016-11-08 18:57:35 +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="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
|
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
|
|
|
|
|
c = sram_config(word_size=1,
|
|
|
|
|
num_words=16,
|
|
|
|
|
num_banks=1)
|
2018-12-12 22:12:26 +01:00
|
|
|
c.words_per_row=1
|
2019-05-16 03:48:00 +02:00
|
|
|
# c = sram_config(word_size=32,
|
|
|
|
|
# num_words=256,
|
|
|
|
|
# num_banks=1)
|
|
|
|
|
# c.words_per_row=2
|
|
|
|
|
# OPTS.use_tech_delay_chain_size = True
|
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)
|
2019-05-21 03:35:52 +02:00
|
|
|
#import sys
|
|
|
|
|
#sys.exit(1)
|
|
|
|
|
|
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]
|
2018-09-17 08:15:22 +02:00
|
|
|
data, port_data = d.analyze(probe_address, probe_data, slews, loads)
|
|
|
|
|
#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":
|
2020-04-22 19:40:04 +02:00
|
|
|
golden_data = {'min_period': 0.898,
|
|
|
|
|
'write1_power': [0.2659137999999999],
|
|
|
|
|
'disabled_write0_power': [0.1782495],
|
|
|
|
|
'disabled_read0_power': [0.14490679999999997],
|
|
|
|
|
'write0_power': [0.3330119],
|
|
|
|
|
'disabled_write1_power': [0.1865223],
|
|
|
|
|
'leakage_power': 0.0014532,
|
|
|
|
|
'disabled_read1_power': [0.1627516],
|
|
|
|
|
'slew_lh': [0.25367799999999996],
|
|
|
|
|
'slew_hl': [0.25367799999999996],
|
|
|
|
|
'delay_lh': [0.23820930000000004],
|
|
|
|
|
'delay_hl': [0.23820930000000004],
|
|
|
|
|
'read1_power': [0.3005756],
|
|
|
|
|
'read0_power': [0.3005888]}
|
2018-09-17 19:03:55 +02:00
|
|
|
elif OPTS.tech_name == "scn4m_subm":
|
2020-04-22 19:40:04 +02:00
|
|
|
golden_data = {'leakage_power': 0.0006356576000000001,
|
|
|
|
|
'write1_power': [11.292700000000002],
|
|
|
|
|
'read0_power': [12.98],
|
|
|
|
|
'disabled_write1_power': [8.3707],
|
|
|
|
|
'write0_power': [14.4447], 'delay_hl': [1.7445000000000002],
|
|
|
|
|
'disabled_read0_power': [6.4325],
|
|
|
|
|
'slew_hl': [1.7437],
|
|
|
|
|
'disabled_write0_power': [8.1307],
|
|
|
|
|
'slew_lh': [1.7437],
|
|
|
|
|
'read1_power': [12.9869],
|
|
|
|
|
'disabled_read1_power': [7.706],
|
2019-09-30 23:02:00 +02:00
|
|
|
'min_period': 6.25,
|
2020-04-22 19:40:04 +02:00
|
|
|
'delay_lh': [1.7445000000000002]}
|
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))
|
2018-07-27 00:45:17 +02:00
|
|
|
|
2016-11-11 23:05:14 +01: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())
|