Remove openram_temp at end of openram and unit tests.

This commit is contained in:
Matt Guthaus 2016-11-11 14:05:14 -08:00
parent b51c124810
commit 9ea1a06244
43 changed files with 79 additions and 28 deletions

View File

@ -134,7 +134,16 @@ def set_calibre():
debug.warning("Calibre not found. Not performing inline LVS/DRC.") debug.warning("Calibre not found. Not performing inline LVS/DRC.")
OPTS.check_lvsdrc = False OPTS.check_lvsdrc = False
def end_openram():
""" Clean up openram for a proper exit """
cleanup_paths()
def cleanup_paths():
# we should clean up this temp directory after execution...
if os.path.exists(OPTS.openram_temp):
shutil.rmtree(OPTS.openram_temp, ignore_errors=True)
def setup_paths(): def setup_paths():
""" Set up the non-tech related paths. """ """ Set up the non-tech related paths. """
debug.info(2,"Setting up paths...") debug.info(2,"Setting up paths...")
@ -150,14 +159,11 @@ def setup_paths():
sys.path.append("{0}/tests".format(OPENRAM_HOME)) sys.path.append("{0}/tests".format(OPENRAM_HOME))
sys.path.append("{0}/characterizer".format(OPENRAM_HOME)) sys.path.append("{0}/characterizer".format(OPENRAM_HOME))
if not OPTS.openram_temp.endswith('/'): if not OPTS.openram_temp.endswith('/'):
OPTS.openram_temp += "/" OPTS.openram_temp += "/"
debug.info(1, "Temporary files saved in " + OPTS.openram_temp) debug.info(1, "Temporary files saved in " + OPTS.openram_temp)
# we should clean up this temp directory after execution... cleanup_paths()
if os.path.exists(OPTS.openram_temp):
shutil.rmtree(OPTS.openram_temp, ignore_errors=True)
# make the directory if it doesn't exist # make the directory if it doesn't exist
try: try:

View File

@ -117,5 +117,6 @@ libname = OPTS.out_path + s.name + ".lib"
print "LIB: Writing to {0}".format(libname) print "LIB: Writing to {0}".format(libname)
lib.lib(libname,s,sram_file) lib.lib(libname,s,sram_file)
globals.end_openram()
print "End: ", datetime.datetime.now() print "End: ", datetime.datetime.now()

View File

@ -1,5 +1,6 @@
import optparse import optparse
import getpass import getpass
import os
class options(optparse.Values): class options(optparse.Values):
""" """
@ -10,7 +11,7 @@ class options(optparse.Values):
# This is the name of the technology. # This is the name of the technology.
tech_name = "" tech_name = ""
# This is the temp directory where all intermediate results are stored. # This is the temp directory where all intermediate results are stored.
openram_temp = "/tmp/openram_{0}_temp/".format(getpass.getuser()) openram_temp = "/tmp/openram_{0}_{1}_temp/".format(getpass.getuser(),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 debug_level = 0

View File

@ -33,7 +33,7 @@ class library_drc_test(unittest.TestCase):
# fails if there are any DRC errors on any cells # fails if there are any DRC errors on any cells
self.assertEqual(drc_errors, 0) self.assertEqual(drc_errors, 0)
globals.end_openram()
def setup_files(): def setup_files():
gds_dir = OPTS.openram_tech + "/gds_lib" gds_dir = OPTS.openram_tech + "/gds_lib"

View File

@ -37,7 +37,7 @@ class library_lvs_test(unittest.TestCase):
# fail if the error count is not zero # fail if the error count is not zero
self.assertEqual(lvs_errors, 0) self.assertEqual(lvs_errors, 0)
globals.end_openram()
def setup_files(): def setup_files():
gds_dir = OPTS.openram_tech + "/gds_lib" gds_dir = OPTS.openram_tech + "/gds_lib"

View File

@ -54,7 +54,8 @@ class contact_test(unittest.TestCase):
self.local_check(c) self.local_check(c)
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
globals.end_openram()
def local_check(self, c): def local_check(self, c):
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"
c.gds_write(tempgds) c.gds_write(tempgds)

View File

@ -75,7 +75,8 @@ class path_test(unittest.TestCase):
# return it back to it's normal state # return it back to it's normal state
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
globals.end_openram()
def local_check(self, w): def local_check(self, w):
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"
w.gds_write(tempgds) w.gds_write(tempgds)

View File

@ -33,7 +33,7 @@ class ptx_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(fet) self.local_check(fet)
globals.end_openram()
def add_mods(self, fet): def add_mods(self, fet):

View File

@ -33,7 +33,7 @@ class ptx_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(fet) self.local_check(fet)
globals.end_openram()
def add_mods(self, fet): def add_mods(self, fet):

View File

@ -33,7 +33,7 @@ class ptx_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(fet) self.local_check(fet)
globals.end_openram()
def add_mods(self, fet): def add_mods(self, fet):
self.create_contacts() self.create_contacts()

View File

@ -33,7 +33,8 @@ class ptx_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(fet) self.local_check(fet)
globals.end_openram()
def add_mods(self, fet): def add_mods(self, fet):
self.create_contacts() self.create_contacts()
self.add_well_extension(fet) self.add_well_extension(fet)

View File

@ -128,7 +128,8 @@ class wire_test(unittest.TestCase):
# return it back to it's normal state # return it back to it's normal state
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
globals.end_openram()
def local_check(self, w): def local_check(self, w):
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"
w.gds_write(tempgds) w.gds_write(tempgds)

View File

@ -33,7 +33,8 @@ class nand_2_test(unittest.TestCase):
tx = nand_2.nand_2(name="a_nand_1", nmos_width=2 * tech.drc["minwidth_tx"]) tx = nand_2.nand_2(name="a_nand_1", nmos_width=2 * tech.drc["minwidth_tx"])
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(tx) self.local_check(tx)
globals.end_openram()
def local_check(self, tx): def local_check(self, tx):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"

View File

@ -31,7 +31,8 @@ class nand_3_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(tx) self.local_check(tx)
globals.end_openram()
def local_check(self, tx): def local_check(self, tx):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -32,7 +32,7 @@ class nor_2_test(unittest.TestCase):
tx = nor_2.nor_2(name="a_nor_1", nmos_width=2 * tech.drc["minwidth_tx"]) tx = nor_2.nor_2(name="a_nor_1", nmos_width=2 * tech.drc["minwidth_tx"])
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(tx) self.local_check(tx)
globals.end_openram()
def local_check(self, tx): def local_check(self, tx):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"

View File

@ -42,6 +42,7 @@ class pinv_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(tx) self.local_check(tx)
globals.end_openram()
def local_check(self, tx): def local_check(self, tx):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"

View File

@ -33,7 +33,7 @@ class wordline_driver_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(tx) self.local_check(tx)
globals.end_openram()
def local_check(self, tx): def local_check(self, tx):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -31,7 +31,7 @@ class array_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"

View File

@ -57,7 +57,8 @@ class hierarchical_decoder_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -30,7 +30,8 @@ class hierarchical_predecode2x4_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -30,6 +30,7 @@ class hierarchical_predecode3x8_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"

View File

@ -28,7 +28,8 @@ class single_level_column_mux_test(unittest.TestCase):
rows=32, columns=32, word_size=16) rows=32, columns=32, word_size=16)
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -38,7 +38,8 @@ class precharge_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(pc) self.local_check(pc)
globals.end_openram()
def local_check(self, pc): def local_check(self, pc):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -41,7 +41,8 @@ class sense_amp_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -35,6 +35,7 @@ class write_driver_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"

View File

@ -31,6 +31,7 @@ class dff_array_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"

View File

@ -29,7 +29,8 @@ class control_logic_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -31,6 +31,8 @@ class logic_effort_dc_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -28,6 +28,8 @@ class tri_gate_array_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -31,6 +31,8 @@ class replica_bitline_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -35,6 +35,8 @@ class bank_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -30,7 +30,8 @@ class sram_1bank_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -30,6 +30,8 @@ class sram_2bank_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -30,6 +30,8 @@ class sram_4bank_test(unittest.TestCase):
OPTS.check_lvsdrc = True OPTS.check_lvsdrc = True
self.local_check(a) self.local_check(a)
globals.end_openram()
def local_check(self, a): def local_check(self, a):
tempspice = OPTS.openram_temp + "temp.sp" tempspice = OPTS.openram_temp + "temp.sp"
tempgds = OPTS.openram_temp + "temp.gds" tempgds = OPTS.openram_temp + "temp.gds"

View File

@ -60,6 +60,9 @@ class timing_sram_test(unittest.TestCase):
self.assertTrue(False) # other techs fail self.assertTrue(False) # other techs fail
os.remove(tempspice) os.remove(tempspice)
globals.end_openram()
def isclose(value1,value2): def isclose(value1,value2):
""" This is used to compare relative values for convergence. """ """ This is used to compare relative values for convergence. """

View File

@ -41,6 +41,8 @@ class timing_setup_test(unittest.TestCase):
else: else:
self.assertTrue(False) # other techs fail self.assertTrue(False) # other techs fail
globals.end_openram()
def isclose(value1,value2): def isclose(value1,value2):
""" This is used to compare relative values for convergence. """ """ This is used to compare relative values for convergence. """
return (abs(value1 - value2) / max(value1,value2) <= 1e-2) return (abs(value1 - value2) / max(value1,value2) <= 1e-2)

View File

@ -40,6 +40,8 @@ class timing_setup_test(unittest.TestCase):
else: else:
self.assertTrue(False) # other techs fail self.assertTrue(False) # other techs fail
globals.end_openram()
def isclose(value1,value2): def isclose(value1,value2):
""" This is used to compare relative values for convergence. """ """ This is used to compare relative values for convergence. """
return (abs(value1 - value2) / max(value1,value2) <= 1e-2) return (abs(value1 - value2) / max(value1,value2) <= 1e-2)

View File

@ -24,6 +24,8 @@ class sram_func_test(unittest.TestCase):
self.func_test(bank_num=2) self.func_test(bank_num=2)
self.func_test(bank_num=4) self.func_test(bank_num=4)
globals.end_openram()
def func_test(self, bank_num): def func_test(self, bank_num):
import sram import sram

View File

@ -51,6 +51,8 @@ class sram_func_test(unittest.TestCase):
os.remove(tempspice) os.remove(tempspice)
globals.end_openram()
# instantiate a copdsay of the class to actually run the test # instantiate a copdsay of the class to actually run the test
if __name__ == "__main__": if __name__ == "__main__":
(OPTS, args) = globals.parse_args() (OPTS, args) = globals.parse_args()

View File

@ -48,7 +48,7 @@ class lib_test(unittest.TestCase):
os.system("rm {0}".format(libname)) os.system("rm {0}".format(libname))
globals.end_openram()
# instantiate a copdsay of the class to actually run the test # instantiate a copdsay of the class to actually run the test
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -48,7 +48,7 @@ class lef_test(unittest.TestCase):
os.system("rm {0}".format(gdsname)) os.system("rm {0}".format(gdsname))
os.system("rm {0}".format(lefname)) os.system("rm {0}".format(lefname))
globals.end_openram()
# instantiate a copdsay of the class to actually run the test # instantiate a copdsay of the class to actually run the test
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -45,6 +45,8 @@ class verilog_test(unittest.TestCase):
os.system("rm {0}".format(vname)) os.system("rm {0}".format(vname))
globals.end_openram()
# instantiate a copdsay of the class to actually run the test # instantiate a copdsay of the class to actually run the test
if __name__ == "__main__": if __name__ == "__main__":
(OPTS, args) = globals.parse_args() (OPTS, args) = globals.parse_args()

View File

@ -73,6 +73,7 @@ class openram_test(unittest.TestCase):
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)
globals.end_openram()
# instantiate a copdsay of the class to actually run the test # instantiate a copdsay of the class to actually run the test
if __name__ == "__main__": if __name__ == "__main__":