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

[circt-test] fix SymbiYosys integration test #7886

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,24 @@ else()
endif()
endif()

#-------------------------------------------------------------------------------
# SymbiYosys Configuration
#-------------------------------------------------------------------------------

# If SymbiYosys hasn't been explicitly disabled, find it.
option(SBY_DISABLE "Disable the SymbiYosys tests.")
if (SBY_DISABLE)
message(STATUS "Disabling SymbiYosys tests.")
else()
find_program(SBY_PATH "sby")
if(EXISTS ${SBY_PATH})
message(STATUS "Found SymbiYosys at ${SBY_PATH}.")
else()
set(SBY_PATH "")
message(STATUS "Did not find SymbiYosys.")
endif()
endif()

#-------------------------------------------------------------------------------
# Tcl bindings
#-------------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions integration_test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@
tools.append(ToolSubst(f"%libz3", config.z3_library))
config.available_features.add('libz3')

# Enable SymbiYosys if it has been detected.
if config.sby_path != "":
tool_dirs.append(config.sby_path)
tools.append('sby')
config.available_features.add('sby')

# Add mlir-cpu-runner if the execution engine is built.
if config.mlir_enable_execution_engine:
config.available_features.add('mlir-cpu-runner')
Expand Down
1 change: 1 addition & 0 deletions integration_test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ config.mlir_enable_execution_engine = "@MLIR_ENABLE_EXECUTION_ENGINE@"
config.slang_frontend_enabled = "@CIRCT_SLANG_FRONTEND_ENABLED@"
config.arcilator_jit_enabled = @ARCILATOR_JIT_ENABLED@
config.driver = "@CIRCT_SOURCE_DIR@/tools/circt-rtl-sim/driver.cpp"
config.sby_path = "@SBY_PATH@"

# Support substitution of the tools_dir with user parameters. This is
# used when we can't determine the tool dir at configuration time.
Expand Down
14 changes: 9 additions & 5 deletions tools/circt-test/circt-test-runner-sby.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,26 @@
"""

# Generate the SymbiYosys script.
script = f"""
script = """
[tasks]
{('\n ').join(tasks)}
{tasks}

{options}

[engines]
smtbmc z3

[script]
read -formal {source_path.name}
prep -top {args.test}
read -formal {source_path_name}
prep -top {test}

[files]
{source_path}
"""
""".format(tasks='\n '.join(tasks),
options=options,
source_path_name=source_path.name,
test=args.test,
source_path=source_path)
with open(script_path, "w") as f:
for line in script.strip().splitlines():
f.write(line.strip() + "\n")
Expand Down