Skip to content

Commit

Permalink
Merge pull request #297 from jix/imctk-eqy-engine
Browse files Browse the repository at this point in the history
Add support for the imctk-eqy-engine
  • Loading branch information
mmicko authored Sep 16, 2024
2 parents 8bd0719 + b8a001e commit d9a5845
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions sbysrc/sby_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ def __init__(self, sbyconfig, workdir, early_logs, reusedir, taskloop=None, logf
"avy": os.getenv("AVY", "avy"),
"btormc": os.getenv("BTORMC", "btormc"),
"pono": os.getenv("PONO", "pono"),
"imctk-eqy-engine": os.getenv("IMCTK_EQY_ENGINE", "imctk-eqy-engine"),
}

self.taskloop = taskloop or SbyTaskloop()
Expand Down
32 changes: 31 additions & 1 deletion sbysrc/sby_engine_aiger.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

import re, os, getopt, click
import re, os, getopt, click, json
from sby_core import SbyProc
from sby_sim import sim_witness_trace

Expand All @@ -32,6 +32,7 @@ def run(mode, task, engine_idx, engine):
status_2 = "UNKNOWN"

model_variant = ""
json_output = False

if solver_args[0] == "suprove":
if mode not in ["live", "prove"]:
Expand All @@ -52,6 +53,14 @@ def run(mode, task, engine_idx, engine):
solver_cmd = " ".join([task.exe_paths["aigbmc"], str(task.opt_depth - 1)] + solver_args[1:])
status_2 = "PASS" # aigbmc outputs status 2 when BMC passes

elif solver_args[0] == "imctk-eqy-engine":
model_variant = "_fold"
json_output = True
if mode != "prove":
task.error("The aiger solver 'imctk-eqy-engine' is only supported in prove mode.")
args = ["--bmc-depth", str(task.opt_depth), "--jsonl-output"]
solver_cmd = " ".join([task.exe_paths["imctk-eqy-engine"], *args, *solver_args[1:]])

else:
task.error(f"Invalid solver command {solver_args[0]}.")

Expand Down Expand Up @@ -91,6 +100,27 @@ def output_callback(line):
nonlocal produced_cex
nonlocal end_of_cex

if json_output:
# Forward log messages, but strip the prefix containing runtime and memory stats
if not line.startswith('{'):
print(line, file=proc.logfile, flush=True)
matched = re.match(r".*(TRACE|DEBUG|INFO|WARN|ERROR) (.*)", line)
if matched:
if matched[1] == "INFO":
task.log(matched[2])
else:
task.log(f"{matched[1]} {matched[2]}")
return None
event = json.loads(line)
if "aiw" in event:
print(event["aiw"], file=aiw_file)
if "status" in event:
if event["status"] == "pass":
proc_status = "PASS"
elif event["status"] == "fail":
proc_status = "FAIL"
return None

if proc_status is not None:
if not end_of_cex and not produced_cex and line.isdigit():
produced_cex = True
Expand Down

0 comments on commit d9a5845

Please sign in to comment.