mirror of https://github.com/VLSIDA/OpenRAM.git
Break subprocess call into arg list.
This commit is contained in:
parent
da7ec0d00b
commit
d7afb27322
|
|
@ -27,7 +27,11 @@ def relative_compare(value1,value2):
|
||||||
|
|
||||||
def parse_output(filename, key):
|
def parse_output(filename, key):
|
||||||
"""Parses a hspice output.lis file for a key value"""
|
"""Parses a hspice output.lis file for a key value"""
|
||||||
f = open("{0}/{1}.lis".format(OPTS.openram_temp, filename), "r")
|
full_filename="{0}{1}.lis".format(OPTS.openram_temp, filename)
|
||||||
|
try:
|
||||||
|
f = open(full_fliename, "r")
|
||||||
|
except:
|
||||||
|
debug.error("Unable to read spice output file: {0}".format(full_filename),1)
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
val = re.search(r"{0}\s*=\s*(-?\d+.?\d*\S*)\s+.*".format(key), contents)
|
val = re.search(r"{0}\s*=\s*(-?\d+.?\d*\S*)\s+.*".format(key), contents)
|
||||||
if val != None:
|
if val != None:
|
||||||
|
|
|
||||||
|
|
@ -447,20 +447,21 @@ def run_sim():
|
||||||
temp_stim = "{0}stim.sp".format(OPTS.openram_temp)
|
temp_stim = "{0}stim.sp".format(OPTS.openram_temp)
|
||||||
if OPTS.spice_version == "hspice":
|
if OPTS.spice_version == "hspice":
|
||||||
# TODO: Should make multithreading parameter a configuration option
|
# TODO: Should make multithreading parameter a configuration option
|
||||||
cmd_args = "-mt 8 -i {1} -o {2}timing 2>&1 /dev/null".format(OPTS.spice_exe,
|
cmd_args = [OPTS.spice_exe, "-mt 8", "-i {0}".format(temp_stim), "-o {0}timing".format(OPTS.openram_temp)]
|
||||||
temp_stim,
|
valid_retcode=0
|
||||||
OPTS.openram_temp)
|
|
||||||
else:
|
else:
|
||||||
cmd_args = "-b -i {1} -o {2}timing.lis 2>&1 /dev/null".format(OPTS.spice_exe,
|
cmd_args = [OPTS.spice_exe, "-b", "-o {0}timing.lis".format(OPTS.openram_temp), "{0}".format(temp_stim)]
|
||||||
temp_stim,
|
# for some reason, ngspice-25 returns 1 when it only has acceptable warnings
|
||||||
OPTS.openram_temp)
|
valid_retcode=1
|
||||||
|
|
||||||
FNULL = open(os.devnull, 'w')
|
spice_stdout = open("{0}spice_stdout.log".format(OPTS.openram_temp), 'w')
|
||||||
debug.info(2, OPTS.spice_exe + " " + cmd_args)
|
spice_stderr = open("{0}spice_stderr.log".format(OPTS.openram_temp), 'w')
|
||||||
retcode = subprocess.call([OPTS.spice_exe, cmd_args], stdout=FNULL, stderr=FNULL)
|
debug.info(1, " ".join(cmd_args))
|
||||||
FNULL.close()
|
retcode = subprocess.call(cmd_args, stdout=spice_stdout, stderr=spice_stderr)
|
||||||
|
spice_stdout.close()
|
||||||
|
spice_stderr.close()
|
||||||
|
|
||||||
if (retcode > 0):
|
if (retcode > valid_retcode):
|
||||||
debug.error("Spice simulation error: " + OPTS.spice_exe + " " + cmd_args)
|
debug.error("Spice simulation error: " + OPTS.spice_exe + " " + cmd_args)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue