From 9b82a44d254d8db663e7b7b1b9db330faa2118fa Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2024 08:26:59 +0200 Subject: [PATCH 01/16] Fix help message typo --- passes/cmds/logcmd.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passes/cmds/logcmd.cc b/passes/cmds/logcmd.cc index 8e51af4b3..3b82ac48c 100644 --- a/passes/cmds/logcmd.cc +++ b/passes/cmds/logcmd.cc @@ -59,7 +59,7 @@ struct LogPass : public Pass { log(" -push\n"); log(" push a new level on the pass counter\n"); log("\n"); - log(" -push\n"); + log(" -pop\n"); log(" pop from the pass counter\n"); log("\n"); } From 9b6afcf3f83fea413b57c3790c25ba43b9914ce2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2024 08:29:48 +0200 Subject: [PATCH 02/16] Release version 0.42 --- CHANGELOG | 8 +++++++- Makefile | 4 ++-- docs/source/conf.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7c3ad481e..0f80a9f5e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,8 +2,14 @@ List of major changes and improvements between releases ======================================================= -Yosys 0.41 .. Yosys 0.42-dev +Yosys 0.41 .. Yosys 0.42 -------------------------- + * New commands and options + - Added "box_derive" pass to derive box modules. + - Added option "assert-mod-count" to "select" pass. + - Added option "-header","-push" and "-pop" to "log" pass. + * Intel support + - Dropped Quartus support in "synth_intel_alm" pass. Yosys 0.40 .. Yosys 0.41 -------------------------- diff --git a/Makefile b/Makefile index 594e740a9..7bfd6010c 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+129 +YOSYS_VER := 0.42 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo @@ -157,7 +157,7 @@ endif OBJS = kernel/version_$(GIT_REV).o bumpversion: - sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline c1ad377.. | wc -l`/;" Makefile +# sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline c1ad377.. | wc -l`/;" Makefile ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q) diff --git a/docs/source/conf.py b/docs/source/conf.py index fcd6adce8..c9c923e82 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -5,7 +5,7 @@ import os project = 'YosysHQ Yosys' author = 'YosysHQ GmbH' copyright ='2024 YosysHQ GmbH' -yosys_ver = "0.41" +yosys_ver = "0.42" # select HTML theme html_theme = 'furo' From b056e8c0ba2b6f7c94d9102a42a03feb66e8d452 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2024 08:34:06 +0200 Subject: [PATCH 03/16] Next dev cycle --- CHANGELOG | 3 +++ Makefile | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0f80a9f5e..d8e13b041 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,9 @@ List of major changes and improvements between releases ======================================================= +Yosys 0.42 .. Yosys 0.43-dev +-------------------------- + Yosys 0.41 .. Yosys 0.42 -------------------------- * New commands and options diff --git a/Makefile b/Makefile index 7bfd6010c..0c2e11953 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.42 +YOSYS_VER := 0.42+0 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo @@ -157,7 +157,7 @@ endif OBJS = kernel/version_$(GIT_REV).o bumpversion: -# sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline c1ad377.. | wc -l`/;" Makefile + sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline 9b6afcf.. | wc -l`/;" Makefile ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q) From dc693652583e83db82cc95c407e4778e640473d7 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Sun, 26 May 2024 18:21:45 +0300 Subject: [PATCH 04/16] cxxrtl: failing test: unconnected blackbox outputs don't compile. --- tests/cxxrtl/run-test.sh | 4 ++++ tests/cxxrtl/test_unconnected_output.v | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/cxxrtl/test_unconnected_output.v diff --git a/tests/cxxrtl/run-test.sh b/tests/cxxrtl/run-test.sh index 89de71c6b..fd11a3783 100755 --- a/tests/cxxrtl/run-test.sh +++ b/tests/cxxrtl/run-test.sh @@ -11,3 +11,7 @@ run_subtest () { run_subtest value run_subtest value_fuzz + +# Compile-only test. +../../yosys -p "read_verilog test_unconnected_output.v; proc; clean; write_cxxrtl cxxrtl-test-unconnected_output.cc" +${CC:-gcc} -std=c++11 -c -o cxxrtl-test-unconnected_output -I../../backends/cxxrtl/runtime cxxrtl-test-unconnected_output.cc diff --git a/tests/cxxrtl/test_unconnected_output.v b/tests/cxxrtl/test_unconnected_output.v new file mode 100644 index 000000000..84d172bdb --- /dev/null +++ b/tests/cxxrtl/test_unconnected_output.v @@ -0,0 +1,24 @@ +(* cxxrtl_blackbox *) +module blackbox(...); + (* cxxrtl_edge = "p" *) + input clk; + + (* cxxrtl_sync *) + output [7:0] out1; + + (* cxxrtl_sync *) + output [7:0] out2; +endmodule + +module unconnected_output( + input clk, + in, + output out +); + blackbox bb ( + .clock (clock), + .in (in), + .out1 (out), + .out2 (/* unconnected */), + ); +endmodule From e97c36d4c4189d57eb84e8d6f57de85dfdd551f8 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Sun, 26 May 2024 18:31:32 +0300 Subject: [PATCH 05/16] cxxrtl: don't emit syncs for empty lhs. --- backends/cxxrtl/cxxrtl_backend.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/cxxrtl/cxxrtl_backend.cc b/backends/cxxrtl/cxxrtl_backend.cc index 9ddbd33b0..8dc14863d 100644 --- a/backends/cxxrtl/cxxrtl_backend.cc +++ b/backends/cxxrtl/cxxrtl_backend.cc @@ -1138,7 +1138,7 @@ struct CxxrtlWorker { f << indent << "// cell " << cell->name.str() << " syncs\n"; for (auto conn : cell->connections()) if (cell->output(conn.first)) - if (is_cxxrtl_sync_port(cell, conn.first)) { + if (is_cxxrtl_sync_port(cell, conn.first) && !conn.second.empty()) { f << indent; dump_sigspec_lhs(conn.second, for_debug); f << " = " << mangle(cell) << access << mangle_wire_name(conn.first) << ".curr;\n"; From 54d5e567459e6ba39114d5cebf4291705fe2f1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Nguyen?= Date: Fri, 7 Jun 2024 05:15:38 +0200 Subject: [PATCH 06/16] cxxrtl: fix `debug_info()` deprecation message. --- backends/cxxrtl/runtime/cxxrtl/cxxrtl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/cxxrtl/runtime/cxxrtl/cxxrtl.h b/backends/cxxrtl/runtime/cxxrtl/cxxrtl.h index 057d34cf9..70f30e7f9 100644 --- a/backends/cxxrtl/runtime/cxxrtl/cxxrtl.h +++ b/backends/cxxrtl/runtime/cxxrtl/cxxrtl.h @@ -1582,7 +1582,7 @@ struct module { // Compatibility method. #if __has_attribute(deprecated) - __attribute__((deprecated("Use `debug_info(path, &items, /*scopes=*/nullptr);` instead. (`path` could be \"top \".)"))) + __attribute__((deprecated("Use `debug_info(&items, /*scopes=*/nullptr, path);` instead. (`path` could be \"top \".)"))) #endif void debug_info(debug_items &items, std::string path) { debug_info(&items, /*scopes=*/nullptr, path); From b0ab1cf8c3a2d864b6ce0675a1235e9293e5730e Mon Sep 17 00:00:00 2001 From: Mike Inouye Date: Fri, 7 Jun 2024 22:51:28 +0000 Subject: [PATCH 07/16] Fix memory leak in verific file parsing. Signed-off-by: Mike Inouye --- frontends/verific/verific.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index b4b0664d3..f7c2cefd2 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -3510,6 +3510,12 @@ struct VerificPass : public Pass { verific_error_msg.clear(); log_cmd_error("Reading Verilog/SystemVerilog sources failed.\n"); } + char* fn; + int i = 0; + + FOREACH_ARRAY_ITEM(&file_names, i, fn) { + free(fn); + } set_modules_to_blackbox(map, work, flag_lib); verific_import_pending = true; goto check_error; From 82783646e57264e82ac29ade76dc2bee6c416667 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 8 Jun 2024 00:17:45 +0000 Subject: [PATCH 08/16] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0c2e11953..da8aac473 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.42+0 +YOSYS_VER := 0.42+2 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From b593f5c01ce993a16fbba8197d85b58993302239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Mon, 10 Jun 2024 15:51:43 +0200 Subject: [PATCH 09/16] Update the overview comment in `ast.h` --- frontends/ast/ast.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/frontends/ast/ast.h b/frontends/ast/ast.h index f05b568be..59a393e08 100644 --- a/frontends/ast/ast.h +++ b/frontends/ast/ast.h @@ -17,12 +17,7 @@ * * --- * - * This is the AST frontend library. - * - * The AST frontend library is not a frontend on it's own but provides a - * generic abstract syntax tree (AST) abstraction for HDL code and can be - * used by HDL frontends. See "ast.h" for an overview of the API and the - * Verilog frontend for an usage example. + * This is support code for the Verilog frontend at frontends/verilog * */ From ef90458820461988f389e6b7f069956fd4156673 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 11 Jun 2024 00:17:10 +0000 Subject: [PATCH 10/16] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index da8aac473..92fce6c7d 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.42+2 +YOSYS_VER := 0.42+10 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From df4e630ac49274336b3f1ac6a1ad9e1226a41ed6 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:17:56 +1200 Subject: [PATCH 11/16] Docs: Add section for script parsing Document `!` and `:`. Add warning that semicolons need spaces. --- .../getting_started/scripting_intro.rst | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/docs/source/getting_started/scripting_intro.rst b/docs/source/getting_started/scripting_intro.rst index bda76b74e..a6b4cb6bb 100644 --- a/docs/source/getting_started/scripting_intro.rst +++ b/docs/source/getting_started/scripting_intro.rst @@ -8,10 +8,40 @@ file format and how you can make your own synthesis scripts. Yosys script files typically use the :file:`.ys` extension and contain a set of commands for Yosys to run sequentially. These commands are the same ones we were using on the previous page like :cmd:ref:`read_verilog` and -:cmd:ref:`hierarchy`. As with the interactive shell, each command consists of -the command name, and an optional whitespace separated list of arguments. -Commands are terminated with the newline character, or by a semicolon (;). Empty -lines, and lines starting with the hash sign (#), are ignored. +:cmd:ref:`hierarchy`. + +Script parsing +~~~~~~~~~~~~~~ + +As with the interactive shell, each command consists of the command name, and an +optional whitespace separated list of arguments. Commands are terminated with +the newline character, and anything after a hash sign ``#`` is a comment (i.e. +it is ignored). + +It is also possible to terminate commands with a semicolon ``;``. This is +particularly useful in conjunction with the ``-p `` command line +option, where ```` can be a string with multiple commands separated by +semicolon. In-line comments can also be made with the colon ``:``, where the end +of the comment is a semicolon ``;`` or a new line. + +.. code-block:: + :caption: Using the ``-p`` option + + $ yosys -p "read_verilog fifo.v; :this is a comment; prep" + +.. warning:: + + The space after the semicolon is required for correct parsing. ``log a;log + b;`` for example will display ``a;log b`` instead of ``a`` and ``b`` as might + be expected. + +Another special character that can be used in Yosys scripts is the bang ``!``. +Anything after the bang will be executed as a shell command. This can only be +terminated with a new line. Any semicolons, hashes, or other special characters +will be passed to the shell. If an error code is returned from the shell it +will be raised by Yosys. :cmd:ref:`exec` provides a much more flexible way of +executing commands, allowing the output to be logged and more control over when +to generate errors. The synthesis starter script ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 7f89a45ad724888b111227127b14a48e0b5e48ad Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Mon, 10 Jun 2024 21:27:19 +0200 Subject: [PATCH 12/16] cxxxrtl: fix use of format specifiers in test This fix a few instances of incorrect (and non-portable) use of format specifiers. --- tests/cxxrtl/test_value_fuzz.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/cxxrtl/test_value_fuzz.cc b/tests/cxxrtl/test_value_fuzz.cc index a7bbb293a..7e8fbb0a9 100644 --- a/tests/cxxrtl/test_value_fuzz.cc +++ b/tests/cxxrtl/test_value_fuzz.cc @@ -1,3 +1,4 @@ +#include #include #include #include @@ -62,17 +63,17 @@ void test_binary_operation_for_bitsize(Operation &op) for (size_t i = 0; i * chunk_bits < Bits; i++) { if ((chunk_type)(iresult >> (i * chunk_bits)) != vresult.data[i]) { std::printf("Test failure:\n"); - std::printf("Bits: %i\n", Bits); - std::printf("a: %016lx\n", ia); - std::printf("b: %016lx\n", ib); - std::printf("iresult: %016lx\n", iresult); - std::printf("vresult: %016lx\n", vresult.template get()); + std::printf("Bits: %zu\n", Bits); + std::printf("a: %016" PRIx64 "\n", ia); + std::printf("b: %016" PRIx64 "\n", ib); + std::printf("iresult: %016" PRIx64 "\n", iresult); + std::printf("vresult: %016" PRIx64 "\n", vresult.template get()); std::terminate(); } } } - std::printf("Test passed @ Bits = %i.\n", Bits); + std::printf("Test passed @ Bits = %zu.\n", Bits); } template From a55e8594b7a70fc84d0bc6dd1e3075b2737daaab Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Jun 2024 00:17:25 +0000 Subject: [PATCH 13/16] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 92fce6c7d..87f8f17f9 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.42+10 +YOSYS_VER := 0.42+12 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From 3ed2865ac5a251e89b6ef3ca86d4cdc50f2256e2 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Fri, 7 Jun 2024 14:30:46 +0300 Subject: [PATCH 14/16] cxxrtl: capi: don't use deprecated invocation. --- backends/cxxrtl/runtime/cxxrtl/capi/cxxrtl_capi.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/cxxrtl/runtime/cxxrtl/capi/cxxrtl_capi.cc b/backends/cxxrtl/runtime/cxxrtl/capi/cxxrtl_capi.cc index 3c62401dd..34801c2d1 100644 --- a/backends/cxxrtl/runtime/cxxrtl/capi/cxxrtl_capi.cc +++ b/backends/cxxrtl/runtime/cxxrtl/capi/cxxrtl_capi.cc @@ -47,7 +47,7 @@ cxxrtl_handle cxxrtl_create_at(cxxrtl_toplevel design, const char *top_path_) { cxxrtl_handle handle = new _cxxrtl_handle; handle->module = std::move(design->module); - handle->module->debug_info(handle->objects, top_path); + handle->module->debug_info(&handle->objects, nullptr, top_path); delete design; return handle; } From 62bff3a20436ee547a500e27e6cc6b7f550a6013 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Fri, 7 Jun 2024 14:31:13 +0300 Subject: [PATCH 15/16] cxxrtl: don't need to specify a value for "path". Callers of the deprecated method had a path already. --- backends/cxxrtl/runtime/cxxrtl/cxxrtl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/cxxrtl/runtime/cxxrtl/cxxrtl.h b/backends/cxxrtl/runtime/cxxrtl/cxxrtl.h index 70f30e7f9..d1d6bd8dc 100644 --- a/backends/cxxrtl/runtime/cxxrtl/cxxrtl.h +++ b/backends/cxxrtl/runtime/cxxrtl/cxxrtl.h @@ -1582,7 +1582,7 @@ struct module { // Compatibility method. #if __has_attribute(deprecated) - __attribute__((deprecated("Use `debug_info(&items, /*scopes=*/nullptr, path);` instead. (`path` could be \"top \".)"))) + __attribute__((deprecated("Use `debug_info(&items, /*scopes=*/nullptr, path);` instead."))) #endif void debug_info(debug_items &items, std::string path) { debug_info(&items, /*scopes=*/nullptr, path); From 2fd2b6538df31f345ac1378b3185ff8785f5684e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 14 Jun 2024 00:17:13 +0000 Subject: [PATCH 16/16] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 87f8f17f9..7760cec43 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.42+12 +YOSYS_VER := 0.42+15 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo