diff --git a/compiler/globals.py b/compiler/globals.py index b0a81be5..a40006c2 100644 --- a/compiler/globals.py +++ b/compiler/globals.py @@ -50,7 +50,9 @@ def parse_args(): optparse.make_option("-r", "--remove_netlist_trimming", action="store_false", dest="trim_netlist", help="Disable removal of noncritical memory cells during characterization"), 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. } @@ -185,6 +187,9 @@ def cleanup_paths(): """ 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): shutil.rmtree(OPTS.openram_temp, ignore_errors=True) diff --git a/compiler/options.py b/compiler/options.py index eff37be2..6393a545 100644 --- a/compiler/options.py +++ b/compiler/options.py @@ -42,6 +42,9 @@ class options(optparse.Values): output_name = "sram" # Use analytical delay models by default rather than (slow) characterization 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 decoder = "hierarchical_decoder" diff --git a/compiler/tests/testutils.py b/compiler/tests/testutils.py index c7d62071..ced80bb7 100644 --- a/compiler/tests/testutils.py +++ b/compiler/tests/testutils.py @@ -39,7 +39,8 @@ class openram_test(unittest.TestCase): self.reset() self.fail("LVS mismatch: {}".format(a.name)) - self.cleanup() + if OPTS.purge_temp: + self.cleanup() def cleanup(self): """ Reset the duplicate checker and cleanup files. """