mirror of
https://github.com/YosysHQ/sby.git
synced 2025-07-24 15:18:58 +00:00
Rename SbyJob to SbyTask and SbyTask to SbyProc to reduce confusion. Config file tasks now correspond to SbyTasks.
This commit is contained in:
parent
ac9001b22c
commit
7c9e5b026b
10 changed files with 360 additions and 360 deletions
|
@ -17,110 +17,110 @@
|
|||
#
|
||||
|
||||
import re, os, getopt
|
||||
from sby_core import SbyTask
|
||||
from sby_core import SbyProc
|
||||
|
||||
def run(mode, job, engine_idx, engine):
|
||||
def run(mode, task, engine_idx, engine):
|
||||
abc_opts, abc_command = getopt.getopt(engine[1:], "", [])
|
||||
|
||||
if len(abc_command) == 0:
|
||||
job.error("Missing ABC command.")
|
||||
task.error("Missing ABC command.")
|
||||
|
||||
for o, a in abc_opts:
|
||||
job.error("Unexpected ABC engine options.")
|
||||
task.error("Unexpected ABC engine options.")
|
||||
|
||||
if abc_command[0] == "bmc3":
|
||||
if mode != "bmc":
|
||||
job.error("ABC command 'bmc3' is only valid in bmc mode.")
|
||||
abc_command[0] += f" -F {job.opt_depth} -v"
|
||||
task.error("ABC command 'bmc3' is only valid in bmc mode.")
|
||||
abc_command[0] += f" -F {task.opt_depth} -v"
|
||||
|
||||
elif abc_command[0] == "sim3":
|
||||
if mode != "bmc":
|
||||
job.error("ABC command 'sim3' is only valid in bmc mode.")
|
||||
abc_command[0] += f" -F {job.opt_depth} -v"
|
||||
task.error("ABC command 'sim3' is only valid in bmc mode.")
|
||||
abc_command[0] += f" -F {task.opt_depth} -v"
|
||||
|
||||
elif abc_command[0] == "pdr":
|
||||
if mode != "prove":
|
||||
job.error("ABC command 'pdr' is only valid in prove mode.")
|
||||
task.error("ABC command 'pdr' is only valid in prove mode.")
|
||||
|
||||
else:
|
||||
job.error(f"Invalid ABC command {abc_command[0]}.")
|
||||
task.error(f"Invalid ABC command {abc_command[0]}.")
|
||||
|
||||
task = SbyTask(
|
||||
job,
|
||||
proc = SbyProc(
|
||||
task,
|
||||
f"engine_{engine_idx}",
|
||||
job.model("aig"),
|
||||
f"""cd {job.workdir}; {job.exe_paths["abc"]} -c 'read_aiger model/design_aiger.aig; fold; strash; {" ".join(abc_command)}; write_cex -a engine_{engine_idx}/trace.aiw'""",
|
||||
logfile=open(f"{job.workdir}/engine_{engine_idx}/logfile.txt", "w")
|
||||
task.model("aig"),
|
||||
f"""cd {task.workdir}; {task.exe_paths["abc"]} -c 'read_aiger model/design_aiger.aig; fold; strash; {" ".join(abc_command)}; write_cex -a engine_{engine_idx}/trace.aiw'""",
|
||||
logfile=open(f"{task.workdir}/engine_{engine_idx}/logfile.txt", "w")
|
||||
)
|
||||
|
||||
task.noprintregex = re.compile(r"^\.+$")
|
||||
task_status = None
|
||||
proc.noprintregex = re.compile(r"^\.+$")
|
||||
proc_status = None
|
||||
|
||||
def output_callback(line):
|
||||
nonlocal task_status
|
||||
nonlocal proc_status
|
||||
|
||||
match = re.match(r"^Output [0-9]+ of miter .* was asserted in frame [0-9]+.", line)
|
||||
if match: task_status = "FAIL"
|
||||
if match: proc_status = "FAIL"
|
||||
|
||||
match = re.match(r"^Simulation of [0-9]+ frames for [0-9]+ rounds with [0-9]+ restarts did not assert POs.", line)
|
||||
if match: task_status = "UNKNOWN"
|
||||
if match: proc_status = "UNKNOWN"
|
||||
|
||||
match = re.match(r"^Stopping BMC because all 2\^[0-9]+ reachable states are visited.", line)
|
||||
if match: task_status = "PASS"
|
||||
if match: proc_status = "PASS"
|
||||
|
||||
match = re.match(r"^No output asserted in [0-9]+ frames.", line)
|
||||
if match: task_status = "PASS"
|
||||
if match: proc_status = "PASS"
|
||||
|
||||
match = re.match(r"^Property proved.", line)
|
||||
if match: task_status = "PASS"
|
||||
if match: proc_status = "PASS"
|
||||
|
||||
return line
|
||||
|
||||
def exit_callback(retcode):
|
||||
assert retcode == 0
|
||||
assert task_status is not None
|
||||
assert proc_status is not None
|
||||
|
||||
job.update_status(task_status)
|
||||
job.log(f"engine_{engine_idx}: Status returned by engine: {task_status}")
|
||||
job.summary.append(f"""engine_{engine_idx} ({" ".join(engine)}) returned {task_status}""")
|
||||
task.update_status(proc_status)
|
||||
task.log(f"engine_{engine_idx}: Status returned by engine: {proc_status}")
|
||||
task.summary.append(f"""engine_{engine_idx} ({" ".join(engine)}) returned {proc_status}""")
|
||||
|
||||
job.terminate()
|
||||
task.terminate()
|
||||
|
||||
if task_status == "FAIL" and job.opt_aigsmt != "none":
|
||||
task2 = SbyTask(
|
||||
job,
|
||||
if proc_status == "FAIL" and task.opt_aigsmt != "none":
|
||||
proc2 = SbyProc(
|
||||
task,
|
||||
f"engine_{engine_idx}",
|
||||
job.model("smt2"),
|
||||
task.model("smt2"),
|
||||
("cd {}; {} -s {}{} --noprogress --append {} --dump-vcd engine_{i}/trace.vcd --dump-vlogtb engine_{i}/trace_tb.v " +
|
||||
"--dump-smtc engine_{i}/trace.smtc --aig model/design_aiger.aim:engine_{i}/trace.aiw --aig-noheader model/design_smt2.smt2").format
|
||||
(job.workdir, job.exe_paths["smtbmc"], job.opt_aigsmt,
|
||||
"" if job.opt_tbtop is None else f" --vlogtb-top {job.opt_tbtop}",
|
||||
job.opt_append, i=engine_idx),
|
||||
logfile=open(f"{job.workdir}/engine_{engine_idx}/logfile2.txt", "w")
|
||||
(task.workdir, task.exe_paths["smtbmc"], task.opt_aigsmt,
|
||||
"" if task.opt_tbtop is None else f" --vlogtb-top {task.opt_tbtop}",
|
||||
task.opt_append, i=engine_idx),
|
||||
logfile=open(f"{task.workdir}/engine_{engine_idx}/logfile2.txt", "w")
|
||||
)
|
||||
|
||||
task2_status = None
|
||||
proc2_status = None
|
||||
|
||||
def output_callback2(line):
|
||||
nonlocal task2_status
|
||||
nonlocal proc2_status
|
||||
|
||||
match = re.match(r"^## [0-9: ]+ Status: FAILED", line)
|
||||
if match: task2_status = "FAIL"
|
||||
if match: proc2_status = "FAIL"
|
||||
|
||||
match = re.match(r"^## [0-9: ]+ Status: PASSED", line)
|
||||
if match: task2_status = "PASS"
|
||||
if match: proc2_status = "PASS"
|
||||
|
||||
return line
|
||||
|
||||
def exit_callback2(line):
|
||||
assert task2_status is not None
|
||||
assert task2_status == "FAIL"
|
||||
assert proc2_status is not None
|
||||
assert proc2_status == "FAIL"
|
||||
|
||||
if os.path.exists(f"{job.workdir}/engine_{engine_idx}/trace.vcd"):
|
||||
job.summary.append(f"counterexample trace: {job.workdir}/engine_{engine_idx}/trace.vcd")
|
||||
if os.path.exists(f"{task.workdir}/engine_{engine_idx}/trace.vcd"):
|
||||
task.summary.append(f"counterexample trace: {task.workdir}/engine_{engine_idx}/trace.vcd")
|
||||
|
||||
task2.output_callback = output_callback2
|
||||
task2.exit_callback = exit_callback2
|
||||
proc2.output_callback = output_callback2
|
||||
proc2.exit_callback = exit_callback2
|
||||
|
||||
task.output_callback = output_callback
|
||||
task.exit_callback = exit_callback
|
||||
proc.output_callback = output_callback
|
||||
proc.exit_callback = exit_callback
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue