Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the imctk-eqy-engine #297

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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