Skip to content

Commit

Permalink
[circt-test] fix SymbiYosys integration test
Browse files Browse the repository at this point in the history
Signed-off-by: unlsycn <unlsycn@unlsycn.com>
  • Loading branch information
unlsycn committed Nov 27, 2024
1 parent 09fc391 commit 79d6f5f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
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 @@ -215,6 +215,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

0 comments on commit 79d6f5f

Please sign in to comment.