4 ("smtbmc", "yices"): ["yices-smt2"],
5 ("smtbmc", "z3"): ["z3"],
6 ("smtbmc", "cvc4"): ["cvc4"],
7 ("smtbmc", "mathsat"): ["mathsat"],
8 ("smtbmc", "boolector"): ["boolector"],
9 ("smtbmc", "bitwuzla"): ["bitwuzla"],
10 ("smtbmc", "abc"): ["yosys-abc"],
11 ("aiger", "suprove"): ["suprove", "yices"],
12 ("aiger", "avy"): ["avy", "yices"],
13 ("aiger", "aigbmc"): ["aigbmc", "yices"],
14 ("btor", "btormc"): ["btormc", "btorsim"],
15 ("btor", "pono"): ["pono", "btorsim"],
21 with
open("make/rules/found_tools") as found_tools_file
:
22 return [tool
.strip() for tool
in found_tools_file
.readlines()]
25 if __name__
== "__main__":
29 from pathlib
import Path
33 if args
and args
[0] == "run":
34 target
, command
, *required_tools
= args
[1:]
36 with
open("make/rules/found_tools") as found_tools_file
:
37 found_tools
= set(tool
.strip() for tool
in found_tools_file
.readlines())
39 if 'verific' in required_tools
:
40 result
= subprocess
.run(["yosys", "-qp", "read -verific"], capture_output
=True)
43 print(f
"SKIPPING {target}: requires yosys with verific support")
46 required_tools
.remove('verific')
48 missing_tools
= sorted(
49 f
"`{tool}`" for tool
in required_tools
if tool
not in found_tools
52 noskip
= "NOSKIP" in os
.environ
.get("MAKEFLAGS", "")
54 print(f
"SKIPPING {target}: {', '.join(missing_tools)} not found")
56 print("NOSKIP was set, treating this as an error")
60 print(command
, flush
=True)
61 exit(subprocess
.call(command
, shell
=True))
65 for tools
in REQUIRED_TOOLS
.values():
66 check_tools
.update(tools
)
68 for tool
in sorted(check_tools
):
69 if not shutil
.which(tool
):
73 error_msg
= subprocess
.run(
78 if "invalid command line option" in error_msg
:
80 "found `btorsim` binary is too old "
81 "to support the `--vcd` option, ignoring"
85 found_tools
.append(tool
)
87 found_tools
= "\n".join(found_tools
+ [""])
90 with
open("make/rules/found_tools") as found_tools_file
:
91 if found_tools_file
.read() == found_tools
:
93 except FileNotFoundError
:
96 Path("make/rules").mkdir(exist_ok
=True)
98 with
open("make/rules/found_tools", "w") as found_tools_file
:
99 found_tools_file
.write(found_tools
)