From 8c1431f37337b5adb09341981121d140b8abdca7 Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Tue, 23 Jul 2024 17:01:57 +0200 Subject: [PATCH 1/7] Guess VHDL frontend for both *.vhd and *vhdl files --- kernel/yosys.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/yosys.cc b/kernel/yosys.cc index fca2bca67..5a3e9eb2d 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -1133,7 +1133,9 @@ bool run_frontend(std::string filename, std::string command, RTLIL::Design *desi command = " -vlog2k"; else if (filename_trim.size() > 2 && filename_trim.compare(filename_trim.size()-3, std::string::npos, ".sv") == 0) command = " -sv"; - else if (filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-4, std::string::npos, ".vhd") == 0) + else if ((filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-4, std::string::npos, ".vhd") == 0) + || + (filename_trim.size() > 4 && filename_trim.compare(filename_trim.size()-5, std::string::npos, ".vhdl") == 0)) command = " -vhdl"; else if (filename_trim.size() > 4 && filename_trim.compare(filename_trim.size()-5, std::string::npos, ".blif") == 0) command = "blif"; From ce11ddbf219fecc4580619a0f989cde67707895b Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Tue, 23 Jul 2024 17:55:04 +0200 Subject: [PATCH 2/7] Simplified run_frontend by using a lambda function for file extension checks and combining blif and eblif into a single condition. --- kernel/yosys.cc | 61 +++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 5a3e9eb2d..efdc54b79 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -1126,33 +1126,40 @@ bool run_frontend(std::string filename, std::string command, RTLIL::Design *desi design = yosys_design; if (command == "auto") { - std::string filename_trim = filename; - if (filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-3, std::string::npos, ".gz") == 0) - filename_trim.erase(filename_trim.size()-3); - if (filename_trim.size() > 2 && filename_trim.compare(filename_trim.size()-2, std::string::npos, ".v") == 0) - command = " -vlog2k"; - else if (filename_trim.size() > 2 && filename_trim.compare(filename_trim.size()-3, std::string::npos, ".sv") == 0) - command = " -sv"; - else if ((filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-4, std::string::npos, ".vhd") == 0) - || - (filename_trim.size() > 4 && filename_trim.compare(filename_trim.size()-5, std::string::npos, ".vhdl") == 0)) - command = " -vhdl"; - else if (filename_trim.size() > 4 && filename_trim.compare(filename_trim.size()-5, std::string::npos, ".blif") == 0) - command = "blif"; - else if (filename_trim.size() > 5 && filename_trim.compare(filename_trim.size()-6, std::string::npos, ".eblif") == 0) - command = "blif"; - else if (filename_trim.size() > 4 && filename_trim.compare(filename_trim.size()-5, std::string::npos, ".json") == 0) - command = "json"; - else if (filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-3, std::string::npos, ".il") == 0) - command = "rtlil"; - else if (filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-3, std::string::npos, ".ys") == 0) - command = "script"; - else if (filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-4, std::string::npos, ".tcl") == 0) - command = "tcl"; - else if (filename == "-") - command = "script"; - else - log_error("Can't guess frontend for input file `%s' (missing -f option)!\n", filename.c_str()); + std::string filename_trim = filename; + + auto has_extension = [](const std::string& filename, const std::string& extension) { + if (filename.size() >= extension.size()) { + return filename.compare(filename.size() - extension.size(), extension.size(), extension) == 0; + } + return false; + }; + + if (has_extension(filename_trim, ".gz")) { + filename_trim.erase(filename_trim.size() - 3); + } + + if (has_extension(filename_trim, ".v")) { + command = " -vlog2k"; + } else if (has_extension(filename_trim, ".sv")) { + command = " -sv"; + } else if (has_extension(filename_trim, ".vhd") || has_extension(filename_trim, ".vhdl")) { + command = " -vhdl"; + } else if (has_extension(filename_trim, ".blif") || has_extension(filename_trim, ".eblif")) { + command = "blif"; + } else if (has_extension(filename_trim, ".json")) { + command = "json"; + } else if (has_extension(filename_trim, ".il")) { + command = "rtlil"; + } else if (has_extension(filename_trim, ".ys")) { + command = "script"; + } else if (has_extension(filename_trim, ".tcl")) { + command = "tcl"; + } else if (filename == "-") { + command = "script"; + } else { + log_error("Can't guess frontend for input file `%s' (missing -f option)!\n", filename.c_str()); + } } if (command == "script") From e063b96104985aedfc2ce9f518415fec1d2d2d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Thu, 25 Jul 2024 11:43:19 +0200 Subject: [PATCH 3/7] synthprop: Reformat the help --- passes/sat/synthprop.cc | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/passes/sat/synthprop.cc b/passes/sat/synthprop.cc index 25416b6c4..5553abec2 100644 --- a/passes/sat/synthprop.cc +++ b/passes/sat/synthprop.cc @@ -185,35 +185,25 @@ struct SyntProperties : public Pass { log("\n"); log(" synthprop [options]\n"); log("\n"); - log("This creates synthesizable properties for selected module.\n"); + log("This creates synthesizable properties for the selected module.\n"); log("\n"); log("\n"); log(" -name \n"); - log("\n"); - log("Name output port for assertions (default: assertions).\n"); - log("\n"); + log(" name of the output port for assertions (default: assertions).\n"); log("\n"); log(" -map \n"); - log("\n"); - log("Write port mapping for synthesizable properties.\n"); - log("\n"); + log(" write the port mapping for synthesizable properties into the given file.\n"); log("\n"); log(" -or_outputs\n"); - log("\n"); - log("Or all outputs together to create a single output that goes high when any\n"); - log("property is violated, instead of generating individual output bits.\n"); - log("\n"); + log(" Or all outputs together to create a single output that goes high when\n"); + log(" any property is violated, instead of generating individual output bits.\n"); log("\n"); log(" -reset \n"); - log("\n"); - log("Name of top-level reset input. Latch a high state on the generated outputs\n"); - log("until an asynchronous top-level reset input is activated.\n"); - log("\n"); + log(" name of the top-level reset input. Latch a high state on the generated\n"); + log(" outputs until an asynchronous top-level reset input is activated.\n"); log("\n"); log(" -resetn \n"); - log("\n"); - log("Name of top-level reset input (inverse polarity). Latch a high state on the\n"); - log("generated outputs until an asynchronous top-level reset input is activated.\n"); + log(" like above but with inverse polarity\n"); log("\n"); log("\n"); } From 7ee685a0b02770f86263802a155955b8d1ebd00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Thu, 25 Jul 2024 11:35:39 +0200 Subject: [PATCH 4/7] proc_rom: Set `src` on the emitted memory --- passes/proc/proc_rom.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/passes/proc/proc_rom.cc b/passes/proc/proc_rom.cc index ebc2377aa..ae6774547 100644 --- a/passes/proc/proc_rom.cc +++ b/passes/proc/proc_rom.cc @@ -183,6 +183,12 @@ struct RomWorker mem.rd_ports.push_back(std::move(rd)); mem.emit(); + + if (sw->has_attribute(ID::src)) { + mem.inits[0].cell->attributes[ID::src] = sw->attributes[ID::src]; + mem.rd_ports[0].cell->attributes[ID::src] = sw->attributes[ID::src]; + } + for (auto cs: sw->cases) delete cs; sw->cases.clear(); From 610d27dc1c235d2080fc060bc8251a73453920b5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 00:17:42 +0000 Subject: [PATCH 5/7] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bd95cd132..7a77ee4df 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,7 @@ ifeq ($(OS), Haiku) CXXFLAGS += -D_DEFAULT_SOURCE endif -YOSYS_VER := 0.43+22 +YOSYS_VER := 0.43+26 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From 1c41db69785ed9744b6274cdf30e8470df881257 Mon Sep 17 00:00:00 2001 From: James Meech <43966357+JamesTimothyMeech@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:53:08 +0100 Subject: [PATCH 6/7] Update interactive_investigation.rst The text starting at line 118 refers to proc twice but it should refer to opt and then to proc. --- .../using_yosys/more_scripting/interactive_investigation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/using_yosys/more_scripting/interactive_investigation.rst b/docs/source/using_yosys/more_scripting/interactive_investigation.rst index db34f041b..03a1faefa 100644 --- a/docs/source/using_yosys/more_scripting/interactive_investigation.rst +++ b/docs/source/using_yosys/more_scripting/interactive_investigation.rst @@ -115,7 +115,7 @@ leads us to the third diagram: Output of the third :cmd:ref:`show` command in :ref:`example_ys` -Here we see that the :cmd:ref:`proc` command not only has removed the artifacts +Here we see that the :cmd:ref:`opt` command not only has removed the artifacts left behind by :cmd:ref:`proc`, but also determined correctly that it can remove the first ``$mux`` cell without changing the behavior of the circuit. From 960bca019639402df3211ad0687b01522a01ba22 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2024 00:17:35 +0000 Subject: [PATCH 7/7] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7a77ee4df..456aa2a40 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,7 @@ ifeq ($(OS), Haiku) CXXFLAGS += -D_DEFAULT_SOURCE endif -YOSYS_VER := 0.43+26 +YOSYS_VER := 0.43+34 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo