From 38bf12771bb4f0d03d80ce1a30690f2f16cb2595 Mon Sep 17 00:00:00 2001 From: mrg Date: Fri, 11 Dec 2020 10:06:00 -0800 Subject: [PATCH] Make DRC/LVS scripts use relative paths --- compiler/tests/testutils.py | 22 ++++++++++------------ compiler/verify/calibre.py | 17 +++++++---------- compiler/verify/magic.py | 8 ++++---- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/compiler/tests/testutils.py b/compiler/tests/testutils.py index d60dde40..1f31bfaf 100644 --- a/compiler/tests/testutils.py +++ b/compiler/tests/testutils.py @@ -21,8 +21,8 @@ class openram_test(unittest.TestCase): self.reset() - tempgds = "{0}{1}.gds".format(OPTS.openram_temp, w.name) - w.gds_write(tempgds) + tempgds = "{}.gds".format(w.name) + w.gds_write("{0}{1}".format(OPTS.openram_temp, tempgds)) import verify result=verify.run_drc(w.name, tempgds, None) @@ -36,13 +36,13 @@ class openram_test(unittest.TestCase): self.reset() - tempspice = "{0}{1}.sp".format(OPTS.openram_temp, a.name) - tempgds = "{0}{1}.gds".format(OPTS.openram_temp, a.name) + tempspice = "{}.sp".format(a.name) + tempgds = "{}.gds".format(a.name) - a.lvs_write(tempspice) + a.lvs_write("{0}{1}".format(OPTS.openram_temp, tempspice)) # cannot write gds in netlist_only mode if not OPTS.netlist_only: - a.gds_write(tempgds) + a.gds_write("{0}{1}".format(OPTS.openram_temp, tempgds)) import verify # Run both DRC and LVS even if DRC might fail @@ -80,15 +80,13 @@ class openram_test(unittest.TestCase): self.cleanup() def run_pex(self, a, output=None): - if output == None: - output = OPTS.openram_temp + a.name + ".pex.netlist" - tempspice = "{0}{1}.sp".format(OPTS.openram_temp, a.name) - tempgds = "{0}{1}.gds".format(OPTS.openram_temp, a.name) + tempspice = "{}.sp".format(a.name) + tempgds = "{}.gds".format(a.name) - a.gds_write(tempgds) + a.gds_write("{0}{1}".format(OPTS.openram_temp, tempgds)) import verify - result=verify.run_pex(a.name, tempgds, tempspice, output=output, final_verification=False) + result=verify.run_pex(a.name, tempgds, tempspice, final_verification=False) if result != 0: self.fail("PEX ERROR: {}".format(a.name)) return output diff --git a/compiler/verify/calibre.py b/compiler/verify/calibre.py index 9d079c2a..8eedd06f 100644 --- a/compiler/verify/calibre.py +++ b/compiler/verify/calibre.py @@ -63,8 +63,8 @@ def write_drc_script(cell_name, gds_name, extract, final_verification=False, out run_file = output_path + "run_drc.sh" f = open(run_file, "w") f.write("#!/bin/sh\n") - cmd = "{0} -gui -drc {1}drc_runset -batch".format(OPTS.drc_exe[1], - output_path) + cmd = "{0} -gui -drc drc_runset -batch".format(OPTS.drc_exe[1]) + f.write(cmd) f.write("\n") f.close() @@ -125,8 +125,8 @@ def write_lvs_script(cell_name, gds_name, sp_name, final_verification=False, out run_file = output_path + "run_lvs.sh" f = open(run_file, "w") f.write("#!/bin/sh\n") - cmd = "{0} -gui -lvs {1}lvs_runset -batch".format(OPTS.lvs_exe[1], - output_path) + cmd = "{0} -gui -lvs lvs_runset -batch".format(OPTS.lvs_exe[1]) + f.write(cmd) f.write("\n") f.close() @@ -178,8 +178,8 @@ def write_pex_script(cell_name, extract, output, final_verification=False, outpu run_file = output_path + "run_pex.sh" f = open(run_file, "w") f.write("#!/bin/sh\n") - cmd = "{0} -gui -pex {1}pex_runset -batch".format(OPTS.pex_exe[1], - OPTS.openram_temp) + cmd = "{0} -gui -pex pex_runset -batch".format(OPTS.pex_exe[1]) + f.write(cmd) f.write("\n") f.close() @@ -204,13 +204,10 @@ def run_drc(cell_name, gds_name, sp_name, extract=False, final_verification=Fals else: # Copy file to local dir if it isn't already if not os.path.isfile(OPTS.openram_temp + os.path.basename(gds_name)): - shutil.copy(gds_name, OPTS.openram_temp) + shutil.copy(gds_name, OPTS.openram_temp + os.path.basename(gds_name)) drc_runset = write_drc_script(cell_name, gds_name, extract, final_verification, OPTS.openram_temp) - if not os.path.isfile(OPTS.openram_temp + os.path.basename(gds_name)): - shutil.copy(gds_name, OPTS.openram_temp + os.path.basename(gds_name)) - (outfile, errfile, resultsfile) = run_script(cell_name, "drc") # check the result for these lines in the summary: diff --git a/compiler/verify/magic.py b/compiler/verify/magic.py index 8cc0cf92..8972ce0f 100644 --- a/compiler/verify/magic.py +++ b/compiler/verify/magic.py @@ -153,10 +153,10 @@ def write_drc_script(cell_name, gds_name, extract, final_verification, output_pa from tech import blackbox_cells except ImportError: blackbox_cells = [] - for cell_name in blackbox_cells: - mag_file = OPTS.openram_tech + "maglef_lib/" + cell_name + ".mag" + for blackbox_cell_name in blackbox_cells: + mag_file = OPTS.openram_tech + "maglef_lib/" + blackbox_cell_name + ".mag" debug.check(os.path.isfile(mag_file), "Could not find blackbox cell {}".format(mag_file)) - f.write('cp {0} {1}\n'.format(mag_file, OPTS.openram_temp)) + f.write('cp {0} .\n'.format(mag_file)) f.write('echo "$(date): Starting DRC using Magic {}"\n'.format(OPTS.drc_exe[1])) f.write('\n') @@ -164,10 +164,10 @@ def write_drc_script(cell_name, gds_name, extract, final_verification, output_pa f.write("load {} -dereference\n".format(cell_name)) f.write('puts "Finished loading cell {}"\n'.format(cell_name)) f.write("cellname delete \\(UNNAMED\\)\n") - f.write("writeall force\n") f.write("select top cell\n") f.write("expand\n") f.write('puts "Finished expanding"\n') + f.write("drc euclidean on\n") f.write("drc check\n") f.write('puts "Finished drc check"\n') f.write("drc catchup\n")