mirror of https://github.com/VLSIDA/OpenRAM.git
Fix option reload problems and checkpointing so that it works properly.
This commit is contained in:
parent
58646ab8e6
commit
265b5d977a
|
|
@ -1,16 +1,18 @@
|
|||
import os
|
||||
import debug
|
||||
import globals
|
||||
from globals import OPTS,find_exe,get_tool
|
||||
from .lib import *
|
||||
from .delay import *
|
||||
from .setup_hold import *
|
||||
|
||||
|
||||
debug.info(2,"Initializing characterizer...")
|
||||
|
||||
debug.info(1,"Initializing characterizer...")
|
||||
OPTS.spice_exe = ""
|
||||
|
||||
if not OPTS.analytical_delay:
|
||||
debug.info(1, "Finding spice simulator.")
|
||||
|
||||
if OPTS.spice_name != "":
|
||||
OPTS.spice_exe=find_exe(OPTS.spice_name)
|
||||
if OPTS.spice_exe=="":
|
||||
|
|
@ -24,6 +26,7 @@ if not OPTS.analytical_delay:
|
|||
|
||||
if OPTS.spice_exe == "":
|
||||
debug.error("No recognizable spice version found. Unable to perform characterization.",1)
|
||||
|
||||
else:
|
||||
debug.info(1,"Analytical model enabled.")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ def read_config(config_file, is_unit_test=True):
|
|||
# If a unit test fails, we don't have to worry about restoring the old config values
|
||||
# that may have been tested.
|
||||
if is_unit_test and CHECKPOINT_OPTS:
|
||||
OPTS = copy.deepcopy(CHECKPOINT_OPTS)
|
||||
OPTS.__dict__ = CHECKPOINT_OPTS.__dict__.copy()
|
||||
return
|
||||
|
||||
# Create a full path relative to current dir unless it is already an abs path
|
||||
|
|
@ -213,12 +213,17 @@ def read_config(config_file, is_unit_test=True):
|
|||
|
||||
# Make a checkpoint of the options so we can restore
|
||||
# after each unit test
|
||||
CHECKPOINT_OPTS = copy.deepcopy(OPTS)
|
||||
|
||||
if not CHECKPOINT_OPTS:
|
||||
CHECKPOINT_OPTS = copy.copy(OPTS)
|
||||
|
||||
def end_openram():
|
||||
""" Clean up openram for a proper exit """
|
||||
cleanup_paths()
|
||||
|
||||
import verify
|
||||
verify.print_drc_stats()
|
||||
verify.print_lvs_stats()
|
||||
verify.print_pex_stats()
|
||||
|
||||
|
||||
|
||||
|
|
@ -227,6 +232,7 @@ def cleanup_paths():
|
|||
"""
|
||||
We should clean up the temp directory after execution.
|
||||
"""
|
||||
global OPTS
|
||||
if not OPTS.purge_temp:
|
||||
debug.info(0,"Preserving temp directory: {}".format(OPTS.openram_temp))
|
||||
return
|
||||
|
|
@ -341,6 +347,8 @@ def print_time(name, now_time, last_time=None):
|
|||
|
||||
def report_status():
|
||||
""" Check for valid arguments and report the info about the SRAM being generated """
|
||||
global OPTS
|
||||
|
||||
# Check if all arguments are integers for bits, size, banks
|
||||
if type(OPTS.word_size)!=int:
|
||||
debug.error("{0} is not an integer in config file.".format(OPTS.word_size))
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class library_lvs_test(openram_test):
|
|||
def runTest(self):
|
||||
globals.init_openram("config_20_{0}".format(OPTS.tech_name))
|
||||
import verify
|
||||
OPTS.check_lvsdrc=True
|
||||
|
||||
(gds_dir, sp_dir, allnames) = setup_files()
|
||||
lvs_errors = 0
|
||||
debug.info(1, "Performing LVS on: " + ", ".join(allnames))
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class timing_sram_test(openram_test):
|
|||
globals.init_openram("config_20_{0}".format(OPTS.tech_name))
|
||||
OPTS.spice_name="hspice"
|
||||
OPTS.analytical_delay = False
|
||||
|
||||
|
||||
# This is a hack to reload the characterizer __init__ with the spice version
|
||||
from importlib import reload
|
||||
|
|
@ -83,7 +84,6 @@ class timing_sram_test(openram_test):
|
|||
else:
|
||||
self.isclose(data[k],golden_data[k],0.15)
|
||||
|
||||
reload(characterizer)
|
||||
globals.end_openram()
|
||||
|
||||
# instantiate a copdsay of the class to actually run the test
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ class timing_setup_test(openram_test):
|
|||
if not OPTS.spice_exe:
|
||||
debug.error("Could not find {} simulator.".format(OPTS.spice_name),-1)
|
||||
|
||||
|
||||
import sram
|
||||
import tech
|
||||
slews = [tech.spice["rise_time"]*2]
|
||||
|
|
@ -58,7 +57,6 @@ class timing_setup_test(openram_test):
|
|||
else:
|
||||
self.isclose(data[k],golden_data[k],0.15)
|
||||
|
||||
reload(characterizer)
|
||||
globals.end_openram()
|
||||
|
||||
# instantiate a copdsay of the class to actually run the test
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ class timing_sram_test(openram_test):
|
|||
else:
|
||||
self.isclose(data[k],golden_data[k],0.15)
|
||||
|
||||
reload(characterizer)
|
||||
globals.end_openram()
|
||||
|
||||
# instantiate a copdsay of the class to actually run the test
|
||||
|
|
|
|||
|
|
@ -16,6 +16,17 @@ class sram_func_test(openram_test):
|
|||
|
||||
def runTest(self):
|
||||
globals.init_openram("config_20_{0}".format(OPTS.tech_name))
|
||||
|
||||
OPTS.use_pex = True
|
||||
|
||||
# This is a hack to reload the characterizer __init__ with the spice version
|
||||
from importlib import reload
|
||||
import characterizer
|
||||
reload(characterizer)
|
||||
from characterizer import setup_hold
|
||||
if not OPTS.spice_exe:
|
||||
debug.error("Could not find {} simulator.".format(OPTS.spice_name),-1)
|
||||
|
||||
global verify
|
||||
import verify
|
||||
|
||||
|
|
@ -31,8 +42,6 @@ class sram_func_test(openram_test):
|
|||
import tech
|
||||
|
||||
debug.info(1, "Testing timing for sample 1bit, 16words SRAM with 1 bank")
|
||||
global OPTS
|
||||
OPTS.use_pex = True
|
||||
s = sram.sram(word_size=OPTS.word_size,
|
||||
num_words=OPTS.num_words,
|
||||
num_banks=OPTS.num_banks,
|
||||
|
|
|
|||
|
|
@ -73,10 +73,7 @@ class openram_test(openram_test):
|
|||
shutil.rmtree(out_path, ignore_errors=True)
|
||||
self.assertEqual(os.path.exists(out_path),False)
|
||||
|
||||
# The default was on, so disable it.
|
||||
OPTS.check_lvsdrc=False
|
||||
globals.end_openram()
|
||||
OPTS.check_lvsdrc=True
|
||||
|
||||
# instantiate a copy of the class to actually run the test
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Reference in New Issue