3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-04-05 14:04:07 +00:00

Add options to set tool paths

This commit is contained in:
Clifford Wolf 2017-02-09 14:09:14 +01:00
parent e69d39434a
commit 7085657687
4 changed files with 39 additions and 16 deletions

View file

@ -25,6 +25,7 @@ sbyfile = None
workdir = None workdir = None
opt_force = False opt_force = False
opt_backup = False opt_backup = False
exe_paths = dict()
def usage(): def usage():
print(""" print("""
@ -38,11 +39,18 @@ sby [options] <jobname>.sby
-b -b
backup workdir if it already exists backup workdir if it already exists
--yosys <path_to_executable>
--abc <path_to_executable>
--smtbmc <path_to_executable>
--sprove <path_to_executable>
configure which executable to use for the respective tool
""") """)
sys.exit(1) sys.exit(1)
try: try:
opts, args = getopt.getopt(sys.argv[1:], "d:bf", []) opts, args = getopt.getopt(sys.argv[1:], "d:bf", ["yosys=",
"abc=", "smtbmc=", "sprove="])
except: except:
usage() usage()
@ -53,6 +61,14 @@ for o, a in opts:
opt_force = True opt_force = True
elif o == "-b": elif o == "-b":
opt_backup = True opt_backup = True
elif o == "--yosys":
exe_paths["yosys"] = a
elif o == "--abc":
exe_paths["abc"] = a
elif o == "--smtbmc":
exe_paths["smtbmc"] = a
elif o == "--sprove":
exe_paths["sprove"] = a
else: else:
usage() usage()
@ -82,6 +98,10 @@ if opt_force:
shutil.rmtree(workdir, ignore_errors=True) shutil.rmtree(workdir, ignore_errors=True)
job = SbyJob(sbyfile, workdir, early_logmsgs) job = SbyJob(sbyfile, workdir, early_logmsgs)
for k, v in exe_paths.items():
job.exe_paths[k] = v
job.run() job.run()
sys.exit(job.retcode) sys.exit(job.retcode)

View file

@ -132,6 +132,13 @@ class SbyJob:
self.workdir = workdir self.workdir = workdir
self.status = "UNKNOWN" self.status = "UNKNOWN"
self.exe_paths = {
"yosys": "yosys",
"abc": "yosys-abc",
"smtbmc": "yosys-smtbmc",
"sprove": "super_prove",
}
self.tasks_running = [] self.tasks_running = []
self.tasks_all = [] self.tasks_all = []
@ -298,7 +305,7 @@ class SbyJob:
print("write_ilang ../model/design.il", file=f) print("write_ilang ../model/design.il", file=f)
task = SbyTask(self, "script", [], task = SbyTask(self, "script", [],
"cd %s/src; yosys -ql ../model/design.log ../model/design.ys" % (self.workdir)) "cd %s/src; %s -ql ../model/design.log ../model/design.ys" % (self.workdir, self.exe_paths["yosys"]))
task.checkretcode = True task.checkretcode = True
return [task] return [task]
@ -319,7 +326,7 @@ class SbyJob:
print("write_smt2 -wires design_%s.smt2" % model_name, file=f) print("write_smt2 -wires design_%s.smt2" % model_name, file=f)
task = SbyTask(self, model_name, self.model("ilang"), task = SbyTask(self, model_name, self.model("ilang"),
"cd %s/model; yosys -ql design_%s.log design_%s.ys" % (self.workdir, model_name, model_name)) "cd %s/model; %s -ql design_%s.log design_%s.ys" % (self.workdir, self.exe_paths["yosys"], model_name, model_name))
task.checkretcode = True task.checkretcode = True
return [task] return [task]
@ -342,7 +349,7 @@ class SbyJob:
print("write_aiger -zinit -map design_aiger.aim design_aiger.aig", file=f) print("write_aiger -zinit -map design_aiger.aim design_aiger.aig", file=f)
task = SbyTask(self, "aig", self.model("ilang"), task = SbyTask(self, "aig", self.model("ilang"),
"cd %s/model; yosys -ql design_aiger.log design_aiger.ys" % (self.workdir)) "cd %s/model; %s -ql design_aiger.log design_aiger.ys" % (self.workdir, self.exe_paths["yosys"]))
task.checkretcode = True task.checkretcode = True
return [task] return [task]

View file

@ -29,25 +29,21 @@ def run(mode, job, engine_idx, engine):
if abc_command[0] == "bmc3": if abc_command[0] == "bmc3":
assert mode == "bmc" assert mode == "bmc"
assert len(abc_command) == 1 assert len(abc_command) == 1
abc_script = "bmc3 -F %d -v" % job.opt_depth abc_command[0] += " -F %d -v" % job.opt_depth
elif abc_command[0] == "sim3": elif abc_command[0] == "sim3":
assert mode == "bmc" assert mode == "bmc"
abc_script = "sim3 -F %d -v" % job.opt_depth abc_command[0] += " -F %d -v" % job.opt_depth
elif abc_command[0] == "pdr": elif abc_command[0] == "pdr":
assert mode == "prove" assert mode == "prove"
abc_script = "pdr"
else: else:
assert False assert False
if len(abc_command) > 1:
abc_script += " " + " ".join(abc_command[1:])
task = SbyTask(job, "engine_%d" % engine_idx, job.model("aig"), task = SbyTask(job, "engine_%d" % engine_idx, job.model("aig"),
("cd %s; yosys-abc -c 'read_aiger model/design_aiger.aig; fold; strash; %s; " + ("cd %s; %s -c 'read_aiger model/design_aiger.aig; fold; strash; %s; write_cex -a engine_%d/trace.aiw'") %
"write_cex -a engine_%d/trace.aiw'") % (job.workdir, abc_script, engine_idx), (job.workdir, job.exe_paths["abc"], " ".join(abc_command), engine_idx),
logfile=open("%s/engine_%d/logfile.txt" % (job.workdir, engine_idx), "w")) logfile=open("%s/engine_%d/logfile.txt" % (job.workdir, engine_idx), "w"))
task.noprintregex = re.compile(r"^\.+$") task.noprintregex = re.compile(r"^\.+$")
@ -83,9 +79,9 @@ def run(mode, job, engine_idx, engine):
if task_status == "FAIL": if task_status == "FAIL":
task2 = SbyTask(job, "engine_%d" % engine_idx, job.model("smt2"), task2 = SbyTask(job, "engine_%d" % engine_idx, job.model("smt2"),
("cd %s; yosys-smtbmc --noprogress --dump-vcd engine_%d/trace.vcd --dump-vlogtb engine_%d/trace_tb.v " + ("cd %s; %s --noprogress --dump-vcd engine_%d/trace.vcd --dump-vlogtb engine_%d/trace_tb.v " +
"--dump-smtc engine_%d/trace.smtc --aig model/design_aiger.aim:engine_%d/trace.aiw --aig-noheader model/design_smt2.smt2") % "--dump-smtc engine_%d/trace.smtc --aig model/design_aiger.aim:engine_%d/trace.aiw --aig-noheader model/design_smt2.smt2") %
(job.workdir, engine_idx, engine_idx, engine_idx, engine_idx), (job.workdir, job.exe_paths["smtbmc"], engine_idx, engine_idx, engine_idx, engine_idx),
logfile=open("%s/engine_%d/logfile2.txt" % (job.workdir, engine_idx), "w")) logfile=open("%s/engine_%d/logfile2.txt" % (job.workdir, engine_idx), "w"))
task2_status = None task2_status = None

View file

@ -65,8 +65,8 @@ def run(mode, job, engine_idx, engine):
trace_prefix += "%" trace_prefix += "%"
task = SbyTask(job, taskname, job.model(model_name), task = SbyTask(job, taskname, job.model(model_name),
("cd %s; yosys-smtbmc --noprogress %s -t %d --dump-vcd %s.vcd --dump-vlogtb %s_tb.v --dump-smtc %s.smtc model/design_smt2.smt2") % ("cd %s; %s --noprogress %s -t %d --dump-vcd %s.vcd --dump-vlogtb %s_tb.v --dump-smtc %s.smtc model/design_smt2.smt2") %
(job.workdir, " ".join(smtbmc_opts), job.opt_depth, trace_prefix, trace_prefix, trace_prefix), (job.workdir, job.exe_paths["smtbmc"], " ".join(smtbmc_opts), job.opt_depth, trace_prefix, trace_prefix, trace_prefix),
logfile=open(logfile_prefix + ".txt", "w")) logfile=open(logfile_prefix + ".txt", "w"))
if mode == "prove_basecase": if mode == "prove_basecase":