From 4d1b68871746e469a71eaeab3036a71ca04bdc00 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 21 Nov 2025 14:46:01 +1300 Subject: [PATCH 1/9] Tests: Add testcase for problematic ABC DONE check --- tests/techmap/bug5495.abc | 2 ++ tests/techmap/bug5495.sh | 7 +++++++ tests/techmap/bug5495.v | 7 +++++++ 3 files changed, 16 insertions(+) create mode 100644 tests/techmap/bug5495.abc create mode 100755 tests/techmap/bug5495.sh create mode 100644 tests/techmap/bug5495.v diff --git a/tests/techmap/bug5495.abc b/tests/techmap/bug5495.abc new file mode 100644 index 000000000..60a29a58a --- /dev/null +++ b/tests/techmap/bug5495.abc @@ -0,0 +1,2 @@ + +fraig_store; fraig_restore diff --git a/tests/techmap/bug5495.sh b/tests/techmap/bug5495.sh new file mode 100755 index 000000000..181797e32 --- /dev/null +++ b/tests/techmap/bug5495.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if ! timeout 5 ../../yosys bug5495.v -p 'hierarchy; techmap; abc -script bug5495.abc' ; then + echo "Yosys failed to complete" + exit 1 +fi + diff --git a/tests/techmap/bug5495.v b/tests/techmap/bug5495.v new file mode 100644 index 000000000..37ce73ec8 --- /dev/null +++ b/tests/techmap/bug5495.v @@ -0,0 +1,7 @@ +module simple(I1, I2, O); + input wire I1; + input wire I2; + output wire O; + + assign O = I1 | I2; +endmodule From e33ca173889a9a7791f3bae94cc88aa38c053c79 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 21 Nov 2025 03:50:07 +0000 Subject: [PATCH 2/9] Force a newline to appear before YOSYS_ABC_DONE --- passes/techmap/abc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passes/techmap/abc.cc b/passes/techmap/abc.cc index 3a814d0b7..0963ecfde 100644 --- a/passes/techmap/abc.cc +++ b/passes/techmap/abc.cc @@ -1064,7 +1064,7 @@ void AbcModuleState::prepare_module(RTLIL::Design *design, RTLIL::Module *module abc_script += stringf("; write_blif %s/output.blif", run_abc.tempdir_name); abc_script = add_echos_to_abc_cmd(abc_script); #if defined(__linux__) && !defined(YOSYS_DISABLE_SPAWN) - abc_script += "; echo \"YOSYS_ABC_DONE\"\n"; + abc_script += "; echo; echo \"YOSYS_ABC_DONE\"\n"; #endif for (size_t i = 0; i+1 < abc_script.size(); i++) From 44ab884b062a38385d91b893390413cad6fdea82 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 21 Nov 2025 16:30:27 +1300 Subject: [PATCH 3/9] bug5495.sh: Skip test if timeout isn't available --- tests/techmap/bug5495.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/techmap/bug5495.sh b/tests/techmap/bug5495.sh index 181797e32..64bf2ca99 100755 --- a/tests/techmap/bug5495.sh +++ b/tests/techmap/bug5495.sh @@ -1,5 +1,10 @@ #!/usr/bin/env bash +if ! which timeout ; then + echo "No 'timeout', skipping test" + exit 0 +fi + if ! timeout 5 ../../yosys bug5495.v -p 'hierarchy; techmap; abc -script bug5495.abc' ; then echo "Yosys failed to complete" exit 1 From 542723d12179186305a3f6dc25f3d7a6a5056d3c Mon Sep 17 00:00:00 2001 From: KrystalDelusion <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 22 Nov 2025 09:51:07 +1300 Subject: [PATCH 4/9] Check ENABLE_ABC validity From https://github.com/YosysHQ/yosys/pull/5497#issuecomment-3561398279, for ENABLE_ABC=1 to be valid, either ABC must be linked (LINK_ABC=1), or it must be possible to spawn executables (DISABLE_SPAWN=0). This configuration (ENABLE_ABC=1 LINK_ABC=0 DISABLE_SPAWN=1) already fails compilation in `abc.cc` trying to call `run_command()` which doesn't exist if DISABLE_SPAWN=1. All we are doing here is catching the known bad configuration and providing an explanation for why it isn't working. --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 0c673cdf8..b45b46fbf 100644 --- a/Makefile +++ b/Makefile @@ -474,6 +474,9 @@ else ifeq ($(ABCEXTERNAL),) TARGETS := $(PROGRAM_PREFIX)yosys-abc$(EXE) $(TARGETS) endif +ifeq ($(DISABLE_SPAWN),1) +$(error ENABLE_ABC=1 requires either LINK_ABC=1 or DISABLE_SPAWN=0) +endif endif endif From 615e338acd75eb43a50fd276203763d0d55b7592 Mon Sep 17 00:00:00 2001 From: Mike Inouye Date: Fri, 21 Nov 2025 14:10:05 -0800 Subject: [PATCH 5/9] Fix abc_new pass when not in NDEBUG --- passes/techmap/abc_new.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/passes/techmap/abc_new.cc b/passes/techmap/abc_new.cc index 21ffa075b..4a4f3cee8 100644 --- a/passes/techmap/abc_new.cc +++ b/passes/techmap/abc_new.cc @@ -38,7 +38,8 @@ std::vector order_modules(Design *design, std::vector modules sort.edge(submodule, m); } } - log_assert(sort.sort()); + bool sorted = sort.sort(); + log_assert(sorted); return sort.sorted; } From f098352ae6d0a8947df74f6a714954bb7f105f9f Mon Sep 17 00:00:00 2001 From: Mike Inouye Date: Fri, 21 Nov 2025 14:23:32 -0800 Subject: [PATCH 6/9] Enable xaiger2 pass when not in NDEBUG --- frontends/aiger2/xaiger.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontends/aiger2/xaiger.cc b/frontends/aiger2/xaiger.cc index d983f8c41..510da0be8 100644 --- a/frontends/aiger2/xaiger.cc +++ b/frontends/aiger2/xaiger.cc @@ -110,7 +110,8 @@ struct Xaiger2Frontend : public Frontend { for (int i = 0; i < (int) O; i++) { int po; *f >> po; - log_assert(f->get() == '\n'); + int c = f->get(); + log_assert(c == '\n'); outputs.push_back(po); } From 33a49452d9da3aa1c6a7949b7cdf1c744cca4c7d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 22 Nov 2025 00:23:19 +0000 Subject: [PATCH 7/9] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0c673cdf8..3c53c877d 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,7 @@ ifeq ($(OS), Haiku) CXXFLAGS += -D_DEFAULT_SOURCE endif -YOSYS_VER := 0.59+110 +YOSYS_VER := 0.59+117 YOSYS_MAJOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f1) YOSYS_MINOR := $(shell echo $(YOSYS_VER) | cut -d'.' -f2 | cut -d'+' -f1) YOSYS_COMMIT := $(shell echo $(YOSYS_VER) | cut -d'+' -f2) From 53614a37a13088333e8192ef57dd614aa4ff5cd6 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Mon, 24 Nov 2025 18:28:36 +1300 Subject: [PATCH 8/9] Use `Tcl_Size` instead of `int` to fix build errors Fixes these build errors I'm getting locally with `tcl-devel-9.0.0-7.fc42.x86_64`. I guess Tcl 9 broke this. ``` passes/cmds/sdc/sdc.cc:438:6: error: no matching function for call to 'Tcl_ListObjLength' 438 | if (Tcl_ListObjLength(interp, listObj, &listLength) == TCL_OK) { | ^~~~~~~~~~~~~~~~~ /usr/include/tclDecls.h:1788:13: note: candidate function not viable: no known conversion from 'int *' to 'Tcl_Size *' (aka 'long *') for 3rd argument 1788 | EXTERN int Tcl_ListObjLength(Tcl_Interp *interp, | ^ 1789 | Tcl_Obj *listPtr, Tcl_Size *lengthPtr); | ~~~~~~~~~~~~~~~~~~~ passes/cmds/sdc/sdc.cc:446:8: error: no matching function for call to 'Tcl_ListObjLength' 446 | if (Tcl_ListObjLength(interp, subListObj, &subListLength) == TCL_OK) { | ^~~~~~~~~~~~~~~~~ /usr/include/tclDecls.h:1788:13: note: candidate function not viable: no known conversion from 'int *' to 'Tcl_Size *' (aka 'long *') for 3rd argument 1788 | EXTERN int Tcl_ListObjLength(Tcl_Interp *interp, | ^ 1789 | Tcl_Obj *listPtr, Tcl_Size *lengthPtr); | ~~~~~~~~~~~~~~~~~~~ ``` --- passes/cmds/sdc/sdc.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/passes/cmds/sdc/sdc.cc b/passes/cmds/sdc/sdc.cc index eb1951665..fad001e50 100644 --- a/passes/cmds/sdc/sdc.cc +++ b/passes/cmds/sdc/sdc.cc @@ -8,6 +8,11 @@ #include #include +#if TCL_MAJOR_VERSION < 9 +typedef int YS_Tcl_Size; +#else +typedef Tcl_Size YS_Tcl_Size; +#endif USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN @@ -432,7 +437,7 @@ static size_t get_node_count(Tcl_Interp* interp) { std::vector> gather_nested_calls(Tcl_Interp* interp) { Tcl_Obj* listObj = Tcl_GetVar2Ex(interp, "sdc_calls", nullptr, TCL_GLOBAL_ONLY); - int listLength; + YS_Tcl_Size listLength; std::vector> sdc_calls; if (Tcl_ListObjLength(interp, listObj, &listLength) == TCL_OK) { @@ -442,7 +447,7 @@ std::vector> gather_nested_calls(Tcl_Interp* interp) { if (Tcl_ListObjIndex(interp, listObj, i, &subListObj) != TCL_OK) { log_error("broken list of lists\n"); } - int subListLength; + YS_Tcl_Size subListLength; if (Tcl_ListObjLength(interp, subListObj, &subListLength) == TCL_OK) { // Valid list - extract elements for (int j = 0; j < subListLength; j++) { From e8cbc92462088abead8776a7494af0bc24f9e702 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Mon, 24 Nov 2025 11:46:09 +0100 Subject: [PATCH 9/9] abc_new: sorted -> is_sorted --- passes/techmap/abc_new.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/passes/techmap/abc_new.cc b/passes/techmap/abc_new.cc index 4a4f3cee8..4e279c577 100644 --- a/passes/techmap/abc_new.cc +++ b/passes/techmap/abc_new.cc @@ -38,8 +38,8 @@ std::vector order_modules(Design *design, std::vector modules sort.edge(submodule, m); } } - bool sorted = sort.sort(); - log_assert(sorted); + bool is_sorted = sort.sort(); + log_assert(is_sorted); return sort.sorted; }