Add -d option to not delete temp directory on successful runs.

This commit is contained in:
Matt Guthaus 2018-02-01 11:53:02 -08:00
parent 8ef1e0af2c
commit d552d88f45
3 changed files with 11 additions and 2 deletions

View File

@ -50,7 +50,9 @@ def parse_args():
optparse.make_option("-r", "--remove_netlist_trimming", action="store_false", dest="trim_netlist", optparse.make_option("-r", "--remove_netlist_trimming", action="store_false", dest="trim_netlist",
help="Disable removal of noncritical memory cells during characterization"), help="Disable removal of noncritical memory cells during characterization"),
optparse.make_option("-c", "--characterize", action="store_false", dest="analytical_delay", optparse.make_option("-c", "--characterize", action="store_false", dest="analytical_delay",
help="Perform characterization to calculate delays (default is analytical models)") help="Perform characterization to calculate delays (default is analytical models)"),
optparse.make_option("-d", "--dontpurge", action="store_false", dest="purge_temp",
help="Don't purge the contents of the temp directory after a successful run")
# -h --help is implicit. # -h --help is implicit.
} }
@ -185,6 +187,9 @@ def cleanup_paths():
""" """
We should clean up the temp directory after execution. We should clean up the temp directory after execution.
""" """
if not OPTS.purge_temp:
debug.info(0,"Preserving temp directory: {}".format(OPTS.openram_temp))
return
if os.path.exists(OPTS.openram_temp): if os.path.exists(OPTS.openram_temp):
shutil.rmtree(OPTS.openram_temp, ignore_errors=True) shutil.rmtree(OPTS.openram_temp, ignore_errors=True)

View File

@ -42,6 +42,9 @@ class options(optparse.Values):
output_name = "sram" output_name = "sram"
# Use analytical delay models by default rather than (slow) characterization # Use analytical delay models by default rather than (slow) characterization
analytical_delay = True analytical_delay = True
# Purge the temp directory after a successful run (doesn't purge on errors, anyhow)
purge_temp = True
# These are the default modules that can be over-riden # These are the default modules that can be over-riden
decoder = "hierarchical_decoder" decoder = "hierarchical_decoder"

View File

@ -39,6 +39,7 @@ class openram_test(unittest.TestCase):
self.reset() self.reset()
self.fail("LVS mismatch: {}".format(a.name)) self.fail("LVS mismatch: {}".format(a.name))
if OPTS.purge_temp:
self.cleanup() self.cleanup()
def cleanup(self): def cleanup(self):