From 4fe21dd652ec58255927ef8977553301e05ef604 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Tue, 16 Sep 2025 04:16:11 +0000 Subject: [PATCH 1/6] Reduce hashops verbiage in OptMergePass --- kernel/hashlib.h | 8 ++++++-- passes/opt/opt_merge.cc | 13 ++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/kernel/hashlib.h b/kernel/hashlib.h index 92188a220..70e9736f7 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -114,7 +114,7 @@ public: return; } [[nodiscard]] - hash_t yield() { + hash_t yield() const { return (hash_t)state; } @@ -373,7 +373,11 @@ public: commutative_hash() { buckets.fill(0); } - void eat(Hasher h) { + template + void eat(const T &obj) { + eat(hash_ops::hash(obj)); + } + void eat(const Hasher &h) { Hasher::hash_t v = h.yield(); size_t index = v & (buckets.size() - 1); buckets[index] += v; diff --git a/passes/opt/opt_merge.cc b/passes/opt/opt_merge.cc index fbfdb9b63..ded0e7360 100644 --- a/passes/opt/opt_merge.cc +++ b/passes/opt/opt_merge.cc @@ -33,6 +33,9 @@ USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN +template +inline Hasher hash_pair(const T &t, const U &u) { return hash_ops>::hash(t, u); } + struct OptMergeWorker { RTLIL::Design *design; @@ -51,7 +54,7 @@ struct OptMergeWorker hashlib::commutative_hash comm; for (int i = 0; i < s_width; i++) - comm.eat(hash_ops>::hash({sig_s[i], sig_b.extract(i*width, width)})); + comm.eat(hash_pair(sig_s[i], sig_b.extract(i*width, width))); return comm.hash_into(h); } @@ -86,8 +89,8 @@ struct OptMergeWorker if (cell->type.in(ID($and), ID($or), ID($xor), ID($xnor), ID($add), ID($mul), ID($logic_and), ID($logic_or), ID($_AND_), ID($_OR_), ID($_XOR_))) { hashlib::commutative_hash comm; - comm.eat(hash_ops::hash(assign_map(cell->getPort(ID::A)))); - comm.eat(hash_ops::hash(assign_map(cell->getPort(ID::B)))); + comm.eat(assign_map(cell->getPort(ID::A))); + comm.eat(assign_map(cell->getPort(ID::B))); h = comm.hash_into(h); } else if (cell->type.in(ID($reduce_xor), ID($reduce_xnor))) { SigSpec a = assign_map(cell->getPort(ID::A)); @@ -107,7 +110,7 @@ struct OptMergeWorker for (const auto& [port, sig] : cell->connections()) { if (cell->output(port)) continue; - comm.eat(hash_ops>::hash(port, assign_map(sig))); + comm.eat(hash_pair(port, assign_map(sig))); } h = comm.hash_into(h); if (RTLIL::builtin_ff_cell_types().count(cell->type)) @@ -120,7 +123,7 @@ struct OptMergeWorker { hashlib::commutative_hash comm; for (const auto& param : cell->parameters) { - comm.eat(hash_ops>::hash(param)); + comm.eat(param); } return comm.hash_into(h); } From 4c17ac5ac2c97943166c788f5f25bd6b47158376 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Mon, 29 Sep 2025 23:03:29 +0200 Subject: [PATCH 2/6] .github: suggest Discourse in PR template --- .github/PULL_REQUEST_TEMPLATE.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 82daf609d..7eccdec3b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,9 @@ +_If your work is part of a larger effort, please discuss your general plans on [Discourse](https://yosyshq.discourse.group/) first to align your vision with maintainers._ + _What are the reasons/motivation for this change?_ _Explain how this is achieved._ -_If applicable, please suggest to reviewers how they can test the change._ +_Make sure your change comes with tests. If not possible, share how a reviewer might evaluate it._ + +_These template prompts can be deleted when you're done responding to them_ \ No newline at end of file From b2adaeec6949e7318a269de00337d3fc1c5652d6 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Mon, 29 Sep 2025 23:03:54 +0200 Subject: [PATCH 3/6] .github: replace Slack and GitHub Discussions with Discourse in issue templates --- .github/ISSUE_TEMPLATE/bug_report.yml | 5 ++--- .github/ISSUE_TEMPLATE/docs_report.yml | 3 +-- .github/ISSUE_TEMPLATE/feature_request.yml | 9 ++++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index e4c776ed9..f754d16c7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -6,15 +6,14 @@ body: attributes: value: > - If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area - or join our [IRC Channel](https://web.libera.chat/#yosys) or [Community Slack](https://join.slack.com/t/yosyshq/shared_invite/zt-1aopkns2q-EiQ97BeQDt_pwvE41sGSuA). + If you have a general question, please ask it on the [Discourse forum](https://yosyshq.discourse.group/). If you have a feature request, please fill out the appropriate issue form, this form is for bugs and/or regressions. Please contact [YosysHQ GmbH](https://www.yosyshq.com/) if you need - commercial support for Yosys. + commercial support or work done for Yosys. - type: input id: yosys_version diff --git a/.github/ISSUE_TEMPLATE/docs_report.yml b/.github/ISSUE_TEMPLATE/docs_report.yml index aa65c63b9..c3ad2f7cc 100644 --- a/.github/ISSUE_TEMPLATE/docs_report.yml +++ b/.github/ISSUE_TEMPLATE/docs_report.yml @@ -6,8 +6,7 @@ body: attributes: value: > - If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area - or join our [IRC Channel](https://web.libera.chat/#yosys) or [Community Slack](https://join.slack.com/t/yosyshq/shared_invite/zt-1aopkns2q-EiQ97BeQDt_pwvE41sGSuA). + If you have a general question, please ask it on the [Discourse forum](https://yosyshq.discourse.group/). If you have found a bug in Yosys, or in building the documentation, diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index c521b5296..49d86f341 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,18 +1,17 @@ name: Feature Request -description: "Submit a feature request for Yosys" +description: "Submit a feature request for Yosys" labels: ["feature-request"] body: - type: markdown attributes: value: > - If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area - or join our [IRC Channel](https://web.libera.chat/#yosys) or [Community Slack](https://join.slack.com/t/yosyshq/shared_invite/zt-1aopkns2q-EiQ97BeQDt_pwvE41sGSuA). - + If you have a general question, please ask it on the [Discourse forum](https://yosyshq.discourse.group/). + If you have a bug report, please fill out the appropriate issue form, this form is for feature requests. - + Please contact [YosysHQ GmbH](https://www.yosyshq.com/) if you need commercial support or work done for Yosys. From b86cc0d9b3bfbea3afcd98881b20ab3026131437 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Mon, 29 Sep 2025 23:20:06 +0200 Subject: [PATCH 4/6] docs: replace Slack with Discourse in extensions writing guide --- docs/source/yosys_internals/extending_yosys/extensions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/yosys_internals/extending_yosys/extensions.rst b/docs/source/yosys_internals/extending_yosys/extensions.rst index d30dd2bae..44b1edabc 100644 --- a/docs/source/yosys_internals/extending_yosys/extensions.rst +++ b/docs/source/yosys_internals/extending_yosys/extensions.rst @@ -9,7 +9,7 @@ Writing extensions .. todo:: update to use :file:`/code_examples/extensions/test*.log` This chapter contains some bits and pieces of information about programming -yosys extensions. Don't be afraid to ask questions on the YosysHQ Slack. +yosys extensions. Don't be afraid to ask questions on the Yosys HQ Discourse. .. todo:: mention coding guide From e6fa0223c80d3d4f81d22e582be390c4aafaf971 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 30 Sep 2025 08:44:31 +0200 Subject: [PATCH 5/6] Force linking log_compat when extensions are linked --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 317dbeb9b..91f596258 100644 --- a/Makefile +++ b/Makefile @@ -530,8 +530,12 @@ ifeq ($(ENABLE_VERIFIC_YOSYSHQ_EXTENSIONS),1) VERIFIC_COMPONENTS += extensions CXXFLAGS += -DYOSYSHQ_VERIFIC_EXTENSIONS else +# YosysHQ flavor of Verific always needs extensions linked +# if disabled it will just not be invoked but parts +# are required for it to initialize properly ifneq ($(wildcard $(VERIFIC_DIR)/extensions),) VERIFIC_COMPONENTS += extensions +OBJS += kernel/log_compat.o endif endif CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC From dc7764e2473d5e9c9adcf80052173fc97246ecfe Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Tue, 30 Sep 2025 11:03:19 +0200 Subject: [PATCH 6/6] .github: typos --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- docs/source/yosys_internals/extending_yosys/extensions.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7eccdec3b..d8d929f3f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,4 +6,4 @@ _Explain how this is achieved._ _Make sure your change comes with tests. If not possible, share how a reviewer might evaluate it._ -_These template prompts can be deleted when you're done responding to them_ \ No newline at end of file +_These template prompts can be deleted when you're done responding to them._ \ No newline at end of file diff --git a/docs/source/yosys_internals/extending_yosys/extensions.rst b/docs/source/yosys_internals/extending_yosys/extensions.rst index 44b1edabc..74a7d72d6 100644 --- a/docs/source/yosys_internals/extending_yosys/extensions.rst +++ b/docs/source/yosys_internals/extending_yosys/extensions.rst @@ -9,7 +9,7 @@ Writing extensions .. todo:: update to use :file:`/code_examples/extensions/test*.log` This chapter contains some bits and pieces of information about programming -yosys extensions. Don't be afraid to ask questions on the Yosys HQ Discourse. +yosys extensions. Don't be afraid to ask questions on the YosysHQ Discourse. .. todo:: mention coding guide