mirror of https://github.com/VLSIDA/OpenRAM.git
Add better info messages. Convert subprocess to a shell command.
This commit is contained in:
parent
7b90b9a0e6
commit
e017f3f4ca
|
|
@ -29,9 +29,9 @@ 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"""
|
||||||
full_filename="{0}{1}.lis".format(OPTS.openram_temp, filename)
|
full_filename="{0}{1}.lis".format(OPTS.openram_temp, filename)
|
||||||
try:
|
try:
|
||||||
f = open(full_fliename, "r")
|
f = open(full_filename, "r")
|
||||||
except:
|
except IOError:
|
||||||
debug.error("Unable to read spice output file: {0}".format(full_filename),1)
|
debug.error("Unable to open 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:
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,8 @@ class setup_hold():
|
||||||
upper_bound = 1.5*period
|
upper_bound = 1.5*period
|
||||||
|
|
||||||
previous_time = target_time
|
previous_time = target_time
|
||||||
|
debug.info(2,"Checking initial setup/hold time: {0} ".format(target_time))
|
||||||
|
|
||||||
# Initial Check if reference setup time passes for correct_value
|
# Initial Check if reference setup time passes for correct_value
|
||||||
self.write_stimulus(mode=mode,
|
self.write_stimulus(mode=mode,
|
||||||
target_time=target_time,
|
target_time=target_time,
|
||||||
|
|
@ -220,6 +222,9 @@ class setup_hold():
|
||||||
debug.error("Initial period/target hold time fails for data value",2)
|
debug.error("Initial period/target hold time fails for data value",2)
|
||||||
|
|
||||||
# We already found it feasible, so advance one step first thing.
|
# We already found it feasible, so advance one step first thing.
|
||||||
|
debug.info(2,"Performing bidir search on setup/hold time: {2} LB: {0} UB: {1} ".format(lower_bound,
|
||||||
|
upper_bound,
|
||||||
|
setuphold_time))
|
||||||
if mode == "HOLD":
|
if mode == "HOLD":
|
||||||
target_time -= 0.5 * (upper_bound - lower_bound)
|
target_time -= 0.5 * (upper_bound - lower_bound)
|
||||||
else:
|
else:
|
||||||
|
|
@ -269,6 +274,8 @@ class setup_hold():
|
||||||
setuphold_time = target_time - period
|
setuphold_time = target_time - period
|
||||||
else:
|
else:
|
||||||
setuphold_time = period - target_time
|
setuphold_time = period - target_time
|
||||||
|
|
||||||
|
debug.info(2,"Converged on setup/hold time: {0} ".format(setuphold_time))
|
||||||
return setuphold_time
|
return setuphold_time
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -445,24 +445,31 @@ def write_supply(stim_file, vdd_name, gnd_name, vdd_voltage, gnd_voltage):
|
||||||
def run_sim():
|
def run_sim():
|
||||||
"""Run hspice in batch mode and output rawfile to parse."""
|
"""Run hspice in batch mode and output rawfile to parse."""
|
||||||
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 = [OPTS.spice_exe, "-mt 8", "-i {0}".format(temp_stim), "-o {0}timing".format(OPTS.openram_temp)]
|
cmd = "{0} -mt 8 -i {1} -o {2}timing".format(OPTS.spice_exe,
|
||||||
|
temp_stim,
|
||||||
|
OPTS.openram_temp)
|
||||||
valid_retcode=0
|
valid_retcode=0
|
||||||
else:
|
else:
|
||||||
cmd_args = [OPTS.spice_exe, "-b", "-o {0}timing.lis".format(OPTS.openram_temp), "{0}".format(temp_stim)]
|
cmd = "{0} -b -o {2}timing.lis {1}".format(OPTS.spice_exe,
|
||||||
|
temp_stim,
|
||||||
|
OPTS.openram_temp)
|
||||||
# for some reason, ngspice-25 returns 1 when it only has acceptable warnings
|
# for some reason, ngspice-25 returns 1 when it only has acceptable warnings
|
||||||
valid_retcode=1
|
valid_retcode=1
|
||||||
|
|
||||||
|
|
||||||
spice_stdout = open("{0}spice_stdout.log".format(OPTS.openram_temp), 'w')
|
spice_stdout = open("{0}spice_stdout.log".format(OPTS.openram_temp), 'w')
|
||||||
spice_stderr = open("{0}spice_stderr.log".format(OPTS.openram_temp), 'w')
|
spice_stderr = open("{0}spice_stderr.log".format(OPTS.openram_temp), 'w')
|
||||||
debug.info(1, " ".join(cmd_args))
|
|
||||||
retcode = subprocess.call(cmd_args, stdout=spice_stdout, stderr=spice_stderr)
|
debug.info(3, cmd)
|
||||||
|
retcode = subprocess.call(cmd, stdout=spice_stdout, stderr=spice_stderr, shell=True)
|
||||||
|
|
||||||
spice_stdout.close()
|
spice_stdout.close()
|
||||||
spice_stderr.close()
|
spice_stderr.close()
|
||||||
|
|
||||||
if (retcode > valid_retcode):
|
if (retcode > valid_retcode):
|
||||||
debug.error("Spice simulation error: " + OPTS.spice_exe + " " + cmd_args)
|
debug.error("Spice simulation error: " + cmd, -1)
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue