mirror of https://github.com/VLSIDA/OpenRAM.git
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:
parent
a52aac5f31
commit
2c76a2680f
|
|
@ -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,
|
"LVS failed for {0} with {1} errors(s)".format(self.cell_name,
|
||||||
self.lvs_errors))
|
self.lvs_errors))
|
||||||
|
|
||||||
if OPTS.purge_temp:
|
if not OPTS.keep_temp:
|
||||||
os.remove(tempspice)
|
os.remove(tempspice)
|
||||||
os.remove(tempgds)
|
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,
|
"DRC failed for {0} with {1} error(s)".format(self.cell_name,
|
||||||
num_errors))
|
num_errors))
|
||||||
|
|
||||||
if OPTS.purge_temp:
|
if not OPTS.keep_temp:
|
||||||
os.remove(tempgds)
|
os.remove(tempgds)
|
||||||
|
|
||||||
def LVS(self, final_verification=False):
|
def LVS(self, final_verification=False):
|
||||||
|
|
@ -134,7 +134,7 @@ class hierarchy_design(hierarchy_spice.spice, hierarchy_layout.layout):
|
||||||
debug.check(num_errors == 0,
|
debug.check(num_errors == 0,
|
||||||
"LVS failed for {0} with {1} error(s)".format(self.cell_name,
|
"LVS failed for {0} with {1} error(s)".format(self.cell_name,
|
||||||
num_errors))
|
num_errors))
|
||||||
if OPTS.purge_temp:
|
if not OPTS.keep_temp:
|
||||||
os.remove(tempspice)
|
os.remove(tempspice)
|
||||||
os.remove(tempgds)
|
os.remove(tempgds)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ class stimuli():
|
||||||
|
|
||||||
# create plots for all signals
|
# create plots for all signals
|
||||||
self.sf.write("* probe is used for hspice/xa, while plot is used in ngspice\n")
|
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"]:
|
if OPTS.spice_name in ["hspice", "xa"]:
|
||||||
self.sf.write(".probe V(*)\n")
|
self.sf.write(".probe V(*)\n")
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ log.create_file = True
|
||||||
|
|
||||||
def info(lev, str):
|
def info(lev, str):
|
||||||
from globals import OPTS
|
from globals import OPTS
|
||||||
if (OPTS.debug_level >= lev):
|
if (OPTS.verbose_level >= lev):
|
||||||
frm = inspect.stack()[1]
|
frm = inspect.stack()[1]
|
||||||
mod = inspect.getmodule(frm[0])
|
mod = inspect.getmodule(frm[0])
|
||||||
# classname = frm.f_globals['__name__']
|
# classname = frm.f_globals['__name__']
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ def parse_args():
|
||||||
optparse.make_option("-v",
|
optparse.make_option("-v",
|
||||||
"--verbose",
|
"--verbose",
|
||||||
action="count",
|
action="count",
|
||||||
dest="debug_level",
|
dest="verbose_level",
|
||||||
help="Increase the verbosity level"),
|
help="Increase the verbosity level"),
|
||||||
optparse.make_option("-t",
|
optparse.make_option("-t",
|
||||||
"--tech",
|
"--tech",
|
||||||
|
|
@ -83,11 +83,16 @@ def parse_args():
|
||||||
action="store_false",
|
action="store_false",
|
||||||
dest="analytical_delay",
|
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("-k",
|
||||||
|
"--keeptemp",
|
||||||
|
action="store_true",
|
||||||
|
dest="keep_temp",
|
||||||
|
help="Keep the contents of the temp directory after a successful run"),
|
||||||
optparse.make_option("-d",
|
optparse.make_option("-d",
|
||||||
"--dontpurge",
|
"--debug",
|
||||||
action="store_false",
|
action="store_true",
|
||||||
dest="purge_temp",
|
dest="debug",
|
||||||
help="Don't purge the contents of the temp directory after a successful run")
|
help="Run in debug mode to drop to pdb on failure")
|
||||||
# -h --help is implicit.
|
# -h --help is implicit.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -366,7 +371,7 @@ def cleanup_paths():
|
||||||
We should clean up the temp directory after execution.
|
We should clean up the temp directory after execution.
|
||||||
"""
|
"""
|
||||||
global OPTS
|
global OPTS
|
||||||
if not OPTS.purge_temp:
|
if OPTS.keep_temp:
|
||||||
debug.info(0,
|
debug.info(0,
|
||||||
"Preserving temp directory: {}".format(OPTS.openram_temp))
|
"Preserving temp directory: {}".format(OPTS.openram_temp))
|
||||||
return
|
return
|
||||||
|
|
@ -534,12 +539,12 @@ def print_time(name, now_time, last_time=None, indentation=2):
|
||||||
global OPTS
|
global OPTS
|
||||||
|
|
||||||
# Don't print during testing
|
# 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:
|
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:
|
else:
|
||||||
time = now_time.strftime('%m/%d/%Y %H:%M:%S')
|
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():
|
def report_status():
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,10 @@ class options(optparse.Values):
|
||||||
os.getpid())
|
os.getpid())
|
||||||
# This is the verbosity level to control debug information. 0 is none, 1
|
# This is the verbosity level to control debug information. 0 is none, 1
|
||||||
# is minimal, etc.
|
# is minimal, etc.
|
||||||
debug_level = 0
|
verbose_level = 0
|
||||||
|
# Drop to pdb on failure?
|
||||||
|
debug = False
|
||||||
|
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Run-time vs accuracy options.
|
# Run-time vs accuracy options.
|
||||||
|
|
@ -141,7 +144,8 @@ class options(optparse.Values):
|
||||||
# Route the input/output pins to the perimeter
|
# Route the input/output pins to the perimeter
|
||||||
perimeter_pins = False
|
perimeter_pins = False
|
||||||
|
|
||||||
purge_temp = True
|
keep_temp = False
|
||||||
|
|
||||||
|
|
||||||
# These are the default modules that can be over-riden
|
# These are the default modules that can be over-riden
|
||||||
bitcell_suffix = ""
|
bitcell_suffix = ""
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class openram_test(unittest.TestCase):
|
||||||
if result != 0:
|
if result != 0:
|
||||||
self.fail("DRC failed: {}".format(w.name))
|
self.fail("DRC failed: {}".format(w.name))
|
||||||
|
|
||||||
if OPTS.purge_temp:
|
if not OPTS.keep_temp:
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
|
||||||
def local_check(self, a, final_verification=False):
|
def local_check(self, a, final_verification=False):
|
||||||
|
|
@ -49,7 +49,7 @@ class openram_test(unittest.TestCase):
|
||||||
if result != 0:
|
if result != 0:
|
||||||
self.fail("LVS mismatch: {}".format(a.name))
|
self.fail("LVS mismatch: {}".format(a.name))
|
||||||
|
|
||||||
if OPTS.purge_temp:
|
if not OPTS.keep_temp:
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ from globals import OPTS
|
||||||
from sram_factory import factory
|
from sram_factory import factory
|
||||||
import debug
|
import debug
|
||||||
|
|
||||||
#@unittest.skip("SKIPPING 05_array_test")
|
|
||||||
|
|
||||||
class array_test(openram_test):
|
class array_test(openram_test):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@ class hspice_pex_pinv_test(openram_test):
|
||||||
reload(characterizer)
|
reload(characterizer)
|
||||||
|
|
||||||
# generate the pinv
|
# 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
|
# 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")
|
debug.info(2, "Checking 1x size inverter")
|
||||||
tx = pinv.pinv(name="pinv", size=1)
|
tx = pinv.pinv(name="pinv", size=1)
|
||||||
tempgds = "{0}{1}.gds".format(OPTS.openram_temp, tx.name)
|
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
|
# now generate its pex file
|
||||||
pex_file = self.run_pex(tx)
|
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
|
# generate simulation for pex, make sure the simulation is successful
|
||||||
pex_delay = self.simulate_delay(test_module=pex_file,
|
pex_delay = self.simulate_delay(test_module=pex_file,
|
||||||
top_level_name=tx.name)
|
top_level_name=tx.name)
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ class ngspice_pex_pinv_test(openram_test):
|
||||||
reload(characterizer)
|
reload(characterizer)
|
||||||
|
|
||||||
# generate the pinv module
|
# generate the pinv module
|
||||||
prev_purge_value = OPTS.purge_temp
|
prev_keep_value = OPTS.keep_temp
|
||||||
OPTS.purge_temp = False # force set purge to false to save the sp file
|
OPTS.keep_temp = True # force set keep to true to save the sp file
|
||||||
debug.info(2, "Checking 1x size inverter")
|
debug.info(2, "Checking 1x size inverter")
|
||||||
tx = pinv.pinv(name="pinv", size=1)
|
tx = pinv.pinv(name="pinv", size=1)
|
||||||
tempgds = "{0}{1}.gds".format(OPTS.openram_temp, tx.name)
|
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
|
# now generate its pex file
|
||||||
pex_file = self.run_pex(tx)
|
pex_file = self.run_pex(tx)
|
||||||
# restore the old purge value
|
# restore the old keep value
|
||||||
OPTS.purge_temp = prev_purge_value
|
OPTS.keep_temp = prev_keep_value
|
||||||
# generate simulation for pex, make sure the simulation is successful
|
# generate simulation for pex, make sure the simulation is successful
|
||||||
pex_delay = self.simulate_delay(test_module=pex_file,
|
pex_delay = self.simulate_delay(test_module=pex_file,
|
||||||
top_level_name=tx.name)
|
top_level_name=tx.name)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class openram_back_end_test(openram_test):
|
||||||
|
|
||||||
# specify the same verbosity for the system call
|
# specify the same verbosity for the system call
|
||||||
options = ""
|
options = ""
|
||||||
for i in range(OPTS.debug_level):
|
for i in range(OPTS.verbose_level):
|
||||||
options += " -v"
|
options += " -v"
|
||||||
|
|
||||||
if OPTS.spice_name:
|
if OPTS.spice_name:
|
||||||
|
|
@ -86,7 +86,7 @@ class openram_back_end_test(openram_test):
|
||||||
self.assertEqual(len(re.findall('WARNING', output)), 0)
|
self.assertEqual(len(re.findall('WARNING', output)), 0)
|
||||||
|
|
||||||
# now clean up the directory
|
# now clean up the directory
|
||||||
if OPTS.purge_temp:
|
if not OPTS.keep_temp:
|
||||||
if os.path.exists(out_path):
|
if os.path.exists(out_path):
|
||||||
shutil.rmtree(out_path, ignore_errors=True)
|
shutil.rmtree(out_path, ignore_errors=True)
|
||||||
self.assertEqual(os.path.exists(out_path), False)
|
self.assertEqual(os.path.exists(out_path), False)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class openram_front_end_test(openram_test):
|
||||||
|
|
||||||
# specify the same verbosity for the system call
|
# specify the same verbosity for the system call
|
||||||
options = ""
|
options = ""
|
||||||
for i in range(OPTS.debug_level):
|
for i in range(OPTS.verbose_level):
|
||||||
options += " -v"
|
options += " -v"
|
||||||
|
|
||||||
if OPTS.spice_name:
|
if OPTS.spice_name:
|
||||||
|
|
@ -86,7 +86,7 @@ class openram_front_end_test(openram_test):
|
||||||
self.assertEqual(len(re.findall('WARNING', output)), 0)
|
self.assertEqual(len(re.findall('WARNING', output)), 0)
|
||||||
|
|
||||||
# now clean up the directory
|
# now clean up the directory
|
||||||
if OPTS.purge_temp:
|
if not OPTS.keep_temp:
|
||||||
if os.path.exists(out_path):
|
if os.path.exists(out_path):
|
||||||
shutil.rmtree(out_path, ignore_errors=True)
|
shutil.rmtree(out_path, ignore_errors=True)
|
||||||
self.assertEqual(os.path.exists(out_path), False)
|
self.assertEqual(os.path.exists(out_path), False)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import sys, os, glob
|
||||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||||
from globals import OPTS
|
from globals import OPTS
|
||||||
import debug
|
import debug
|
||||||
|
import pdb
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
class openram_test(unittest.TestCase):
|
class openram_test(unittest.TestCase):
|
||||||
|
|
@ -27,7 +29,7 @@ class openram_test(unittest.TestCase):
|
||||||
if result != 0:
|
if result != 0:
|
||||||
self.fail("DRC failed: {}".format(w.name))
|
self.fail("DRC failed: {}".format(w.name))
|
||||||
|
|
||||||
if OPTS.purge_temp:
|
if not OPTS.keep_temp:
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
|
||||||
def local_check(self, a, final_verification=False):
|
def local_check(self, a, final_verification=False):
|
||||||
|
|
@ -74,7 +76,7 @@ class openram_test(unittest.TestCase):
|
||||||
|
|
||||||
# For debug...
|
# For debug...
|
||||||
# import pdb; pdb.set_trace()
|
# import pdb; pdb.set_trace()
|
||||||
if OPTS.purge_temp:
|
if not OPTS.keep_temp:
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
|
||||||
def run_pex(self, a, output=None):
|
def run_pex(self, a, output=None):
|
||||||
|
|
@ -321,9 +323,7 @@ def header(filename, technology):
|
||||||
|
|
||||||
def debugTestRunner(post_mortem=None):
|
def debugTestRunner(post_mortem=None):
|
||||||
"""unittest runner doing post mortem debugging on failing tests"""
|
"""unittest runner doing post mortem debugging on failing tests"""
|
||||||
import pdb
|
if post_mortem is None and OPTS.debug:
|
||||||
import traceback
|
|
||||||
if post_mortem is None and not OPTS.purge_temp:
|
|
||||||
post_mortem = pdb.post_mortem
|
post_mortem = pdb.post_mortem
|
||||||
|
|
||||||
class DebugTestResult(unittest.TextTestResult):
|
class DebugTestResult(unittest.TextTestResult):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue