Adjust openram options.

Remove option -d (dontpurge) and replace with keeptemp
Add option -d (debug) to drop into pdb.
Add option -k (--keeptemp) to keep temp files
This commit is contained in:
mrg 2020-11-05 13:12:26 -08:00
parent a52aac5f31
commit 2c76a2680f
12 changed files with 43 additions and 35 deletions

View File

@ -90,7 +90,7 @@ class hierarchy_design(hierarchy_spice.spice, hierarchy_layout.layout):
"LVS failed for {0} with {1} errors(s)".format(self.cell_name,
self.lvs_errors))
if OPTS.purge_temp:
if not OPTS.keep_temp:
os.remove(tempspice)
os.remove(tempgds)
@ -112,7 +112,7 @@ class hierarchy_design(hierarchy_spice.spice, hierarchy_layout.layout):
"DRC failed for {0} with {1} error(s)".format(self.cell_name,
num_errors))
if OPTS.purge_temp:
if not OPTS.keep_temp:
os.remove(tempgds)
def LVS(self, final_verification=False):
@ -134,7 +134,7 @@ class hierarchy_design(hierarchy_spice.spice, hierarchy_layout.layout):
debug.check(num_errors == 0,
"LVS failed for {0} with {1} error(s)".format(self.cell_name,
num_errors))
if OPTS.purge_temp:
if not OPTS.keep_temp:
os.remove(tempspice)
os.remove(tempgds)

View File

@ -260,7 +260,7 @@ class stimuli():
# create plots for all signals
self.sf.write("* probe is used for hspice/xa, while plot is used in ngspice\n")
if OPTS.debug_level>0:
if OPTS.verbose_level>0:
if OPTS.spice_name in ["hspice", "xa"]:
self.sf.write(".probe V(*)\n")
else:

View File

@ -90,7 +90,7 @@ log.create_file = True
def info(lev, str):
from globals import OPTS
if (OPTS.debug_level >= lev):
if (OPTS.verbose_level >= lev):
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
# classname = frm.f_globals['__name__']

View File

@ -63,7 +63,7 @@ def parse_args():
optparse.make_option("-v",
"--verbose",
action="count",
dest="debug_level",
dest="verbose_level",
help="Increase the verbosity level"),
optparse.make_option("-t",
"--tech",
@ -83,11 +83,16 @@ def parse_args():
action="store_false",
dest="analytical_delay",
help="Perform characterization to calculate delays (default is analytical models)"),
optparse.make_option("-k",
"--keeptemp",
action="store_true",
dest="keep_temp",
help="Keep the contents of the temp directory after a successful run"),
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")
"--debug",
action="store_true",
dest="debug",
help="Run in debug mode to drop to pdb on failure")
# -h --help is implicit.
}
@ -366,7 +371,7 @@ def cleanup_paths():
We should clean up the temp directory after execution.
"""
global OPTS
if not OPTS.purge_temp:
if OPTS.keep_temp:
debug.info(0,
"Preserving temp directory: {}".format(OPTS.openram_temp))
return
@ -534,12 +539,12 @@ def print_time(name, now_time, last_time=None, indentation=2):
global OPTS
# Don't print during testing
if not OPTS.is_unit_test or OPTS.debug_level > 0:
if not OPTS.is_unit_test or OPTS.verbose_level > 0:
if last_time:
time = str(round((now_time-last_time).total_seconds(),1)) + " seconds"
time = str(round((now_time - last_time).total_seconds(), 1)) + " seconds"
else:
time = now_time.strftime('%m/%d/%Y %H:%M:%S')
debug.print_raw("{0} {1}: {2}".format("*"*indentation, name, time))
debug.print_raw("{0} {1}: {2}".format("*" * indentation, name, time))
def report_status():

View File

@ -80,7 +80,10 @@ class options(optparse.Values):
os.getpid())
# This is the verbosity level to control debug information. 0 is none, 1
# is minimal, etc.
debug_level = 0
verbose_level = 0
# Drop to pdb on failure?
debug = False
###################
# Run-time vs accuracy options.
@ -141,7 +144,8 @@ class options(optparse.Values):
# Route the input/output pins to the perimeter
perimeter_pins = False
purge_temp = True
keep_temp = False
# These are the default modules that can be over-riden
bitcell_suffix = ""

View File

@ -26,7 +26,7 @@ class openram_test(unittest.TestCase):
if result != 0:
self.fail("DRC failed: {}".format(w.name))
if OPTS.purge_temp:
if not OPTS.keep_temp:
self.cleanup()
def local_check(self, a, final_verification=False):
@ -49,7 +49,7 @@ class openram_test(unittest.TestCase):
if result != 0:
self.fail("LVS mismatch: {}".format(a.name))
if OPTS.purge_temp:
if not OPTS.keep_temp:
self.cleanup()
def cleanup(self):

View File

@ -15,7 +15,6 @@ from globals import OPTS
from sram_factory import factory
import debug
#@unittest.skip("SKIPPING 05_array_test")
class array_test(openram_test):

View File

@ -34,9 +34,9 @@ class hspice_pex_pinv_test(openram_test):
reload(characterizer)
# generate the pinv
prev_purge_value = OPTS.purge_temp
prev_keep_value = OPTS.keep_temp
# force set purge to false to save the sp file
OPTS.purge_temp = False
OPTS.keep_temp = True
debug.info(2, "Checking 1x size inverter")
tx = pinv.pinv(name="pinv", size=1)
tempgds = "{0}{1}.gds".format(OPTS.openram_temp, tx.name)
@ -52,7 +52,7 @@ class hspice_pex_pinv_test(openram_test):
# now generate its pex file
pex_file = self.run_pex(tx)
OPTS.purge_temp = prev_purge_value # restore the old purge value
OPTS.keep_temp = prev_keep_value # restore the old keep
# generate simulation for pex, make sure the simulation is successful
pex_delay = self.simulate_delay(test_module=pex_file,
top_level_name=tx.name)

View File

@ -33,8 +33,8 @@ class ngspice_pex_pinv_test(openram_test):
reload(characterizer)
# generate the pinv module
prev_purge_value = OPTS.purge_temp
OPTS.purge_temp = False # force set purge to false to save the sp file
prev_keep_value = OPTS.keep_temp
OPTS.keep_temp = True # force set keep to true to save the sp file
debug.info(2, "Checking 1x size inverter")
tx = pinv.pinv(name="pinv", size=1)
tempgds = "{0}{1}.gds".format(OPTS.openram_temp, tx.name)
@ -50,8 +50,8 @@ class ngspice_pex_pinv_test(openram_test):
# now generate its pex file
pex_file = self.run_pex(tx)
# restore the old purge value
OPTS.purge_temp = prev_purge_value
# restore the old keep value
OPTS.keep_temp = prev_keep_value
# generate simulation for pex, make sure the simulation is successful
pex_delay = self.simulate_delay(test_module=pex_file,
top_level_name=tx.name)

View File

@ -40,7 +40,7 @@ class openram_back_end_test(openram_test):
# specify the same verbosity for the system call
options = ""
for i in range(OPTS.debug_level):
for i in range(OPTS.verbose_level):
options += " -v"
if OPTS.spice_name:
@ -86,7 +86,7 @@ class openram_back_end_test(openram_test):
self.assertEqual(len(re.findall('WARNING', output)), 0)
# now clean up the directory
if OPTS.purge_temp:
if not OPTS.keep_temp:
if os.path.exists(out_path):
shutil.rmtree(out_path, ignore_errors=True)
self.assertEqual(os.path.exists(out_path), False)

View File

@ -40,7 +40,7 @@ class openram_front_end_test(openram_test):
# specify the same verbosity for the system call
options = ""
for i in range(OPTS.debug_level):
for i in range(OPTS.verbose_level):
options += " -v"
if OPTS.spice_name:
@ -86,7 +86,7 @@ class openram_front_end_test(openram_test):
self.assertEqual(len(re.findall('WARNING', output)), 0)
# now clean up the directory
if OPTS.purge_temp:
if not OPTS.keep_temp:
if os.path.exists(out_path):
shutil.rmtree(out_path, ignore_errors=True)
self.assertEqual(os.path.exists(out_path), False)

View File

@ -10,6 +10,8 @@ import sys, os, glob
sys.path.append(os.getenv("OPENRAM_HOME"))
from globals import OPTS
import debug
import pdb
import traceback
class openram_test(unittest.TestCase):
@ -27,7 +29,7 @@ class openram_test(unittest.TestCase):
if result != 0:
self.fail("DRC failed: {}".format(w.name))
if OPTS.purge_temp:
if not OPTS.keep_temp:
self.cleanup()
def local_check(self, a, final_verification=False):
@ -74,7 +76,7 @@ class openram_test(unittest.TestCase):
# For debug...
# import pdb; pdb.set_trace()
if OPTS.purge_temp:
if not OPTS.keep_temp:
self.cleanup()
def run_pex(self, a, output=None):
@ -321,9 +323,7 @@ def header(filename, technology):
def debugTestRunner(post_mortem=None):
"""unittest runner doing post mortem debugging on failing tests"""
import pdb
import traceback
if post_mortem is None and not OPTS.purge_temp:
if post_mortem is None and OPTS.debug:
post_mortem = pdb.post_mortem
class DebugTestResult(unittest.TextTestResult):