3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-25 00:22:34 +00:00

Merge branch 'YosysHQ:main' into main

This commit is contained in:
Akash Levy 2025-09-30 11:14:33 -07:00 committed by GitHub
commit c26f38faeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 31 additions and 19 deletions

View file

@ -6,15 +6,14 @@ body:
attributes: attributes:
value: > value: >
If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area If you have a general question, please ask it on the [Discourse forum](https://yosyshq.discourse.group/).
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 feature request, please fill out the appropriate issue form, this form is for bugs and/or regressions. 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 Please contact [YosysHQ GmbH](https://www.yosyshq.com/) if you need
commercial support for Yosys. commercial support or work done for Yosys.
- type: input - type: input
id: yosys_version id: yosys_version

View file

@ -6,8 +6,7 @@ body:
attributes: attributes:
value: > value: >
If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area If you have a general question, please ask it on the [Discourse forum](https://yosyshq.discourse.group/).
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 found a bug in Yosys, or in building the documentation, If you have found a bug in Yosys, or in building the documentation,

View file

@ -1,18 +1,17 @@
name: Feature Request name: Feature Request
description: "Submit a feature request for Yosys" description: "Submit a feature request for Yosys"
labels: ["feature-request"] labels: ["feature-request"]
body: body:
- type: markdown - type: markdown
attributes: attributes:
value: > value: >
If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area If you have a general question, please ask it on the [Discourse forum](https://yosyshq.discourse.group/).
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 bug report, please fill out the appropriate issue form, this form is for feature requests. 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 Please contact [YosysHQ GmbH](https://www.yosyshq.com/) if you need
commercial support or work done for Yosys. commercial support or work done for Yosys.

View file

@ -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?_ _What are the reasons/motivation for this change?_
_Explain how this is achieved._ _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._

View file

@ -567,8 +567,12 @@ ifeq ($(ENABLE_VERIFIC_YOSYSHQ_EXTENSIONS),1)
VERIFIC_COMPONENTS += extensions VERIFIC_COMPONENTS += extensions
CXXFLAGS += -DYOSYSHQ_VERIFIC_EXTENSIONS CXXFLAGS += -DYOSYSHQ_VERIFIC_EXTENSIONS
else 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),) ifneq ($(wildcard $(VERIFIC_DIR)/extensions),)
VERIFIC_COMPONENTS += extensions VERIFIC_COMPONENTS += extensions
OBJS += kernel/log_compat.o
endif endif
endif endif
CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC

View file

@ -9,7 +9,7 @@ Writing extensions
.. todo:: update to use :file:`/code_examples/extensions/test*.log` .. todo:: update to use :file:`/code_examples/extensions/test*.log`
This chapter contains some bits and pieces of information about programming 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 YosysHQ Discourse.
.. todo:: mention coding guide .. todo:: mention coding guide

View file

@ -115,7 +115,7 @@ public:
return; return;
} }
[[nodiscard]] [[nodiscard]]
hash_t yield() { hash_t yield() const {
return (hash_t)state; return (hash_t)state;
} }
@ -383,7 +383,11 @@ public:
commutative_hash() { commutative_hash() {
buckets.fill(0); buckets.fill(0);
} }
void eat(Hasher h) { template <typename T>
void eat(const T &obj) {
eat(hash_ops<T>::hash(obj));
}
void eat(const Hasher &h) {
Hasher::hash_t v = h.yield(); Hasher::hash_t v = h.yield();
size_t index = v & (buckets.size() - 1); size_t index = v & (buckets.size() - 1);
buckets[index] += v; buckets[index] += v;

View file

@ -34,6 +34,9 @@
USING_YOSYS_NAMESPACE USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN PRIVATE_NAMESPACE_BEGIN
template <typename T, typename U>
inline Hasher hash_pair(const T &t, const U &u) { return hash_ops<std::pair<T, U>>::hash(t, u); }
struct OptMergeWorker struct OptMergeWorker
{ {
RTLIL::Design *design; RTLIL::Design *design;
@ -52,7 +55,7 @@ struct OptMergeWorker
hashlib::commutative_hash comm; hashlib::commutative_hash comm;
for (int i = 0; i < s_width; i++) for (int i = 0; i < s_width; i++)
comm.eat(hash_ops<std::pair<SigBit, SigSpec>>::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); return comm.hash_into(h);
} }
@ -87,8 +90,8 @@ struct OptMergeWorker
if (cell->type.in(ID($and), ID($or), ID($xor), ID($xnor), ID($add), ID($mul), 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_))) { ID($logic_and), ID($logic_or), ID($_AND_), ID($_OR_), ID($_XOR_))) {
hashlib::commutative_hash comm; hashlib::commutative_hash comm;
comm.eat(hash_ops<RTLIL::SigSpec>::hash(assign_map(cell->getPort(ID::A)))); comm.eat(assign_map(cell->getPort(ID::A)));
comm.eat(hash_ops<RTLIL::SigSpec>::hash(assign_map(cell->getPort(ID::B)))); comm.eat(assign_map(cell->getPort(ID::B)));
h = comm.hash_into(h); h = comm.hash_into(h);
} else if (cell->type.in(ID($reduce_xor), ID($reduce_xnor))) { } else if (cell->type.in(ID($reduce_xor), ID($reduce_xnor))) {
SigSpec a = assign_map(cell->getPort(ID::A)); SigSpec a = assign_map(cell->getPort(ID::A));
@ -108,7 +111,7 @@ struct OptMergeWorker
for (const auto& [port, sig] : cell->connections()) { for (const auto& [port, sig] : cell->connections()) {
if (cell->output(port)) if (cell->output(port))
continue; continue;
comm.eat(hash_ops<std::pair<IdString, SigSpec>>::hash(port, assign_map(sig))); comm.eat(hash_pair(port, assign_map(sig)));
} }
h = comm.hash_into(h); h = comm.hash_into(h);
if (cell->is_builtin_ff()) if (cell->is_builtin_ff())
@ -121,7 +124,7 @@ struct OptMergeWorker
{ {
hashlib::commutative_hash comm; hashlib::commutative_hash comm;
for (const auto& param : cell->parameters) { for (const auto& param : cell->parameters) {
comm.eat(hash_ops<std::pair<IdString, Const>>::hash(param)); comm.eat(param);
} }
return comm.hash_into(h); return comm.hash_into(h);
} }