3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-11 12:11:27 +00:00
Commit graph

1800 commits

Author SHA1 Message Date
Robert O'Callahan
2a2c586e2c Make log_experimental() just take an std::string, since it doesn't need to be varargs. 2025-09-09 15:41:03 +02:00
Robert O'Callahan
25cba6181e Make log_warning()/log_warning_noprefix() use variadic templates. 2025-09-09 15:41:03 +02:00
Robert O'Callahan
66d2c2af08 Make log_header() use variadic templates. 2025-09-09 15:41:03 +02:00
Robert O'Callahan
d34ac0c87d Make log() use the FmtString infrastructure.
Now `log()` supports `std::string`.

We have to fix a few places where the format parameter was not a compile time constant.
This is mostly trivial.
2025-09-09 15:41:03 +02:00
Robert O'Callahan
3f69a768f4 Hide public logv_ variant declarations that don't need to be public 2025-09-09 15:41:03 +02:00
Jannis Harder
0116dc4384 Add windows workaround to constids.inc 2025-09-09 10:04:08 +12:00
Jannis Harder
6498265eb0 Add macOS workaround to constids.inc
The ID(OVERFLOW) IdString isn't used widely enough that we require a
statically allocated IdString, but I think it's good to have an example
workaround in place in case more collisions come up.
2025-09-09 10:04:08 +12:00
Jannis Harder
9213bc5d54 Update kernel/constids.inc to include all literal ids
I've used this shell command to obtain the list:

    rg -I -t cpp -t yacc -o \
        'ID\((\$?[a-zA-Z0-9_]+)\)|ID::($?[a-zA-Z0-9_]+)' -r 'X($1$2)' \
        | LC_ALL=C sort -u

This removed the entries X(_TECHMAP_FAIL_) and X(nomem2init).
2025-09-09 09:56:55 +12:00
Jannis Harder
a97381448a Ensure static IdStrings get prepopulated when initializing yosys
An alternative would be to call ensure_prepopulated() in various
IdString methods.
2025-09-09 09:56:55 +12:00
Jannis Harder
b6db32873d Add IdString const &id_string() const to StaticIdString and IdString
The vast majority of ID(...) uses are in a context that is overloaded
for StaticIdString or will cause implicit conversion to an IdString
constant reference. For some sufficently overloaded contexts, implicit
conversion may fail, so it's useful to have a method to force obtaining
a `IdString const &` from an ID(...) use.

When turning all literal IdStrings of the codebase into StaticIdStrings
this was needed in exactly one place, for which this commit adds an
`id_string()` call.
2025-09-09 09:56:55 +12:00
Jannis Harder
3ebecb631c Add a compile time check that kernel/constids.inc is sorted
This is an invariant now required by the ID macro, so it's better to
have an actual check and not rely on a comment at the top of
kernel/constids.inc.
2025-09-09 09:56:55 +12:00
Jannis Harder
2a4a9aedfe Ensure the ID macro consistently uses YOSYS_NAMESPACE_PREFIX
The previous version of the ID macro used this for everything in the
Yosys namespace, so the new version should continue to do so.
2025-09-09 09:56:55 +12:00
Robert O'Callahan
23af52c3c8 Use well-known constants in ID macro and make the constant values known at compile time 2025-09-09 09:56:55 +12:00
Jannis Harder
3d14108a96
Merge pull request #5323 from rocallahan/IdString-references
Pass `IdString` by reference in more places
2025-09-08 20:40:24 +02:00
Robert O'Callahan
030e5ec438 Make IdString hashing take a reference to the IdString instead of copying it 2025-09-04 14:17:08 +02:00
Robert O'Callahan
ddf7ba5a34 Make ID() macro return a reference to the underlying IdString instead of copying it
Lambda return type deduction infers `IdString` here.
2025-09-04 14:17:08 +02:00
Robert O'Callahan
b2ccfb2d0e Make in() variadic operator take parameters by reference so we don't copy IdStrings
Template argument deduction strips references.
2025-09-04 14:17:08 +02:00
Robert O'Callahan
54a258f854 In hash_cell_inputs, avoid constructing an std::pair (which requires copying the port IdString) 2025-09-04 14:17:08 +02:00
Robert O'Callahan
41b6c0cb9f Make CellTypes methods take IdString by reference to avoid refcount churn 2025-09-04 14:17:08 +02:00
Robert O'Callahan
c7df6954b9 Remove .c_str() from stringf parameters 2025-09-01 23:34:42 +00:00
Robert O'Callahan
c41ba912d8 Support IdString parameters in stringf 2025-09-01 23:34:42 +00:00
Emil J
2163b3ebe4
Merge pull request #5313 from rocallahan/hash-ref
hash_ops should take all parameters by reference instead of requiring copies of vectors, tuples etc
2025-08-25 16:31:36 +02:00
Emil J
a67a3ca49c
Merge pull request #4497 from YosysHQ/emil/bitpattern-comments
bitpattern: comments
2025-08-25 15:25:37 +02:00
Robert O'Callahan
b5aa3ab9f7 hash_ops should take all parameters by reference instead of requiring copies of vectors, tuples etc 2025-08-25 03:09:04 +00:00
Robert O'Callahan
3a5742ffd2 Improve commutative hashing.
The simple XOR `commutative_eat()` implementation produces a lot of collisions.
https://www.preprints.org/manuscript/201710.0192/v1/download is a useful reference on this topic.

Running the included `hashTest.cc` without the hashlib changes, I get 49,580,349 collisions.
The 49,995,000 (i,j) pairs (0 <= i < 10000, i < j < 10000) hash into only 414,651 unique hash values.
We get simple collisions like (0,1) colliding with (2,3).

With the hashlib changes, we get only 707,099 collisions and 49,287,901 unique hash values.
Much better! The `commutative_hash` implementation corresponds to `Sum(4)` in the paper
mentioned above.
2025-08-19 21:45:52 +00:00
Emil J. Tywoniak
6a2984540b bitpattern: comments 2025-08-18 19:57:45 +02:00
KrystalDelusion
4a324e1da8
Merge pull request #5292 from rocallahan/wasm-varargs
Fix vararg alignment
2025-08-16 10:29:36 +12:00
Robert O'Callahan
6d62a1fff7 Fix vararg alignment 2025-08-15 05:43:53 +00:00
Robert O'Callahan
2654bd5355 Compute is_port in AbcPass without iterating through all cells and wires in the module every time we run ABC.
This does not scale when we run ABC thousands of times in a single AbcPass.
2025-08-14 22:29:45 +00:00
Emil J
fb024c4d55
Merge pull request #5135 from YosysHQ/emil/ast-ownership
ast, read_verilog: ownership in AST, use C++ styles for parser and lexer
2025-08-12 10:58:12 +02:00
Krystine Sherwin
1afe8d9f4d
celltypes: Comment pointing to ConstEval
`CellTypes::eval()` is more generic but also more limited.  `ConstEval::eval()` requires more setup (both in code and at runtime) but has more complete support.
2025-08-12 10:57:59 +12:00
Krystine Sherwin
db4ffaffd2
consteval: Fix $bwmux handling
If the cell type has a S signal and hasn't already been handled, use `CellTypes::eval(cell, A, B, S)`.
2025-08-12 10:57:58 +12:00
Krystine Sherwin
22aa9fba3b
test_cell: Support more cell types
Still unsupported:
- wide muxes (`$_MUX16_` and friends)

Partially supported types have comments in `test_cell.cc`.

Fix `CellTypes::eval() for `$_NMUX_`.
Fix `RTLIL::Cell::fixup_parameters()` for $concat, $bwmux and $bweqx.
2025-08-12 10:57:58 +12:00
Emil J. Tywoniak
99ab73424d verilog_location: rename location to Location to avoid conflict with Pass::location 2025-08-11 13:34:10 +02:00
Emil J
aedc237c7a rtlil: remove comment
Co-authored-by: KrystalDelusion <93062060+KrystalDelusion@users.noreply.github.com>
2025-08-11 13:34:10 +02:00
Emil J. Tywoniak
ecec9a760b ast, read_verilog: unify location types, reduce filename copying 2025-08-11 13:34:10 +02:00
Emil J. Tywoniak
c8e0ac0c61 ast, read_verilog: ownership in AST, use C++ styles for parser and lexer 2025-08-11 13:34:10 +02:00
KrystalDelusion
1ae82d7b9d
Merge pull request #5233 from YosysHQ/krys/equiv_assume
Assumptions for equiv_*
2025-08-09 10:39:04 +12:00
Emil J
d68d28d05e
Merge pull request #5183 from YosysHQ/emil/test-diagnostics
logger: add -expect types prefix-log, prefix-warning, prefix-error
2025-08-08 14:46:25 +02:00
Emil J. Tywoniak
fcd9f98245 equiv_simple: refactor 2025-08-08 01:35:33 +02:00
Emil J
21b9c8e4c6
Merge pull request #5236 from rocallahan/const-lookup
Make `dict` and `pool` const lookup methods never rehash the hashtable
2025-08-07 11:43:39 +02:00
George Rennie
96108ad8b4 kernel/register.h: whitespace 2025-08-06 21:34:37 +01:00
Emil J
8576d2d147
Merge pull request #5263 from rocallahan/stringf-width
Making `stringf()` use the format conversion specs as-is without widening them
2025-08-06 11:36:28 +02:00
Krystine Sherwin
891a907a30
Add and use ENABLE_HELP_SOURCE
Conditionally include help source tracking to preserve ABI.
Docs builds can (and should) use `ENABLE_HELP_SOURCE` so that the generated sphinx docs can perform default grouping and link to source files.
Regular user-builds don't need the source tracking.
2025-08-06 13:52:13 +12:00
Krystine Sherwin
7fe4ae45fd
log_help: Fix mem leaks
`_content` vector owns elements so that when the `ContentListing` is deleted so is the content.
Remove `get_content()` method in favour of `begin()` and `end()` const iterators.
More `const` in general, and iterations over `ContentListing` use `&content` to avoid copying data.
2025-08-06 13:52:12 +12:00
Krystine Sherwin
3959d19291
Reapply "Add groups to command reference"
This reverts commit 81f87ce6ed.
2025-08-06 13:52:12 +12:00
KrystalDelusion
fd2ea51e1e
Merge pull request #5133 from YosysHQ/krys/functional_ordering
Maintain port ordering for functional backend
2025-08-05 12:52:44 +12:00
Robert O'Callahan
ffd52a0d8e Making stringf() use the format conversion specs as-is without widening them.
And make sure our fast-path for `%d` and `%u` narrows to `int` correctly.

Resolves #5260
2025-07-31 10:54:56 +00:00
KrystalDelusion
a18acaca82
Merge pull request #5068 from YosysHQ/krys/bugpoint_fixes
Updates to bugpoint
2025-07-30 10:05:22 +12:00
Emil J
41295175dc
Merge pull request #5248 from calewis/try_unordereded_map
Use unordered_map instead of dict for IdString's char* to index storage.
2025-07-29 18:40:07 +02:00