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"""
|
||||
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)
|
||||
f = open(full_filename, "r")
|
||||
except IOError:
|
||||
debug.error("Unable to open spice output file: {0}".format(full_filename),1)
|
||||
contents = f.read()
|
||||
val = re.search(r"{0}\s*=\s*(-?\d+.?\d*\S*)\s+.*".format(key), contents)
|
||||
if val != None:
|
||||
|
|
|
|||
|
|
@ -199,6 +199,8 @@ class setup_hold():
|
|||
upper_bound = 1.5*period
|
||||
|
||||
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
|
||||
self.write_stimulus(mode=mode,
|
||||
target_time=target_time,
|
||||
|
|
@ -220,6 +222,9 @@ class setup_hold():
|
|||
debug.error("Initial period/target hold time fails for data value",2)
|
||||
|
||||
# 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":
|
||||
target_time -= 0.5 * (upper_bound - lower_bound)
|
||||
else:
|
||||
|
|
@ -269,6 +274,8 @@ class setup_hold():
|
|||
setuphold_time = target_time - period
|
||||
else:
|
||||
setuphold_time = period - target_time
|
||||
|
||||
debug.info(2,"Converged on setup/hold time: {0} ".format(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():
|
||||
"""Run hspice in batch mode and output rawfile to parse."""
|
||||
temp_stim = "{0}stim.sp".format(OPTS.openram_temp)
|
||||
|
||||
if OPTS.spice_version == "hspice":
|
||||
# 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
|
||||
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
|
||||
valid_retcode=1
|
||||
|
||||
|
||||
spice_stdout = open("{0}spice_stdout.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_stderr.close()
|
||||
|
||||
if (retcode > valid_retcode):
|
||||
debug.error("Spice simulation error: " + OPTS.spice_exe + " " + cmd_args)
|
||||
sys.exit(-1)
|
||||
debug.error("Spice simulation error: " + cmd, -1)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue