3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-04 21:39:14 +00:00
Commit graph

1892 commits

Author SHA1 Message Date
Robert O'Callahan
a534fda855 Optimize IdString operations to avoid calling c_str() 2025-10-21 21:21:05 +00:00
Robert O'Callahan
2075b3416f Make NEW_ID create IDs whose string allocation is delayed 2025-10-21 20:55:35 +00:00
Robert O'Callahan
442a969812 Ensure that new_id(_suffix)() cannot create collisions with existing IdStrings. 2025-10-21 17:44:17 +00:00
Robert O'Callahan
bf732df591 Make new_id/new_id_suffix taking string_view to avoid allocating strings 2025-10-21 17:44:17 +00:00
Robert O'Callahan
5cc3f27a5f Remove StaticIdString and just use IdString now that we can make it constexpr 2025-10-21 17:44:17 +00:00
Robert O'Callahan
3c2caffffe Make IdString refcounts a hashtable containing only the nonzero refcounts
This saves space and doesn't cost very much since we hardly ever have nonzero refcounts any more.

It also allows for IdStrings with negative indexes, which we're going to add.
2025-10-21 17:44:17 +00:00
Robert O'Callahan
bc7895505e Implement IdString garbage collection instead of refcounting. 2025-10-21 17:44:15 +00:00
Robert O'Callahan
b3f79ed8e7 Create RTLIL::OwningIdString and use it in a few places 2025-10-21 17:40:52 +00:00
Robert O'Callahan
2ca7b2f7d7 Remove YOSYS_USE_STICKY_IDS 2025-10-21 17:40:52 +00:00
Robert O'Callahan
8b8939e219 Make RTLIL::Design::get_all_designs() unconditionally defined 2025-10-21 17:40:52 +00:00
Robert O'Callahan
3a4fa325cc Remove explicit empty-string check when looking up IdStrings 2025-10-21 17:40:52 +00:00
Robert O'Callahan
d70924ace2 Store IdString lengths and use them 2025-10-21 17:40:49 +00:00
Robert O'Callahan
ae219cb8f9 Make IdString::contains take std::string_view so we avoid a strlen when the parameter is a string constant 2025-10-21 17:37:46 +00:00
Robert O'Callahan
f7ac724ea9 Make IdString::begins_width/ends_with take std::string_view so we avoid a strlen when the parameter is a string constant 2025-10-21 17:37:46 +00:00
Emil J
9a12d92551
Merge pull request #5386 from YosysHQ/emil/liberty-glob-all
Expand wildcards in Liberty file consumers
2025-10-09 20:21:48 +02:00
Emil J
a80462f27f
Merge pull request #5339 from rocallahan/fast-rtlil-parser
Rewrite the RTLIL parser for efficiency
2025-10-08 14:52:37 +02:00
Miodrag Milanović
b7a72811cc
Merge pull request #5408 from rocallahan/atomic-mfp
Make `mfp` const methods thread-safe.
2025-10-08 13:08:16 +02:00
Robert O'Callahan
2f81c55389 Make mfp const methods thread-safe.
In particular, we make the parent links relaxed atomics so concurrent
`ifind()` calls are safe.

This may appear to cause a tiny performance regression but as discussed
in https://yosyshq.discourse.group/t/parallel-optmergepass-implementation/87/16
this is probably just noise.
2025-10-06 22:44:01 +00:00
Mohamed Gaber
80fcce64da
pyosys: fix ref-only classes, implicit conversions
+ cleanup
2025-10-03 11:54:44 +03:00
Mohamed Gaber
447a6cb3f0
misc: WITH_PYTHON -> YOSYS_ENABLE_PYTHON
For consistency.

Also trying a new thing: only rebuilding objects that use the pybind11 library. The idea is these are the only objects that include the Python/pybind headers and thus the only ones that depend on the Python ABI in any capacity, so other objects can be reused across wheel builds. This has the potential to cut down build times.
2025-10-03 11:54:44 +03:00
Mohamed Gaber
54799bb8be
pyosys: globals, set operators for opaque types
There is so much templating going on that compiling wrappers.cc now takes 1m1.668s on an Apple M4…
2025-10-03 11:54:44 +03:00
Mohamed Gaber
88be728353
pyosys: rewrite using pybind11
- Rewrite all Python features to use the pybind11 library instead of boost::python.
  Unlike boost::python, pybind11 is a header-only library that is just included by Pyosys code, saving a lot of compile time on wheels.
- Factor out as much "translation" code from the generator into proper C++ files
- Fix running the embedded interpreter not supporting "from pyosys import libyosys as ys" like wheels
- Move Python-related elements to `pyosys` directory at the root of the repo
- Slight shift in bridging semantics:
  - Containers are declared as "opaque types" and are passed by reference to Python - many methods have been implemented to make them feel right at home without the overhead/ambiguity of copying to Python and then copying back after mutation
  - Monitor/Pass use "trampoline" pattern to support virual methods overridable in Python: virtual methods no longer require `py_` prefix
- Create really short test set for pyosys that just exercises basic functionality
2025-10-03 11:54:44 +03:00
Robert O'Callahan
d45223976a Optimize IdString::empty()
I actually saw this take 0.6% of the time in an `opt_clean` pass (under Module::check()).
Trivial issue, but the fix is also trivial and simple.
2025-10-01 02:49:03 +00:00
Robert O'Callahan
db3d9a1baf When adding named elements to an RTLIL::Module, std::move the name to avoid refcount churn 2025-09-30 21:39:18 +00:00
Robert O'Callahan
86d8dd6224 Add a moving assignment operator for IdString to avoid refcount churn 2025-09-30 21:39:18 +00:00
Robert O'Callahan
39c6e06e3d Add an IdString(std::string_view) constructor for efficiency when we already know the string length 2025-09-30 21:39:18 +00:00
Robert O'Callahan
6b43fca8df Make the Const string constructor take the string by value and move it into the const 2025-09-30 21:39:18 +00:00
Emil J
7719beb4ae
Merge pull request #5349 from rocallahan/cleanup-hashops
Reduce hashops verbiage in `OptMergePass`
2025-09-30 19:34:44 +02:00
Jannis Harder
47639f8a98
Merge pull request #5388 from jix/bufnorm-followup
Refactor and fixes to incremental bufNormalize + related changes
2025-09-29 15:15:29 +02:00
Jannis Harder
86fb2f16f7 bufnorm: Refactor and fix incremental bufNormalize
This fixes some edge cases the previous version didn't handle properly
by simplifying the logic of determining directly driven wires and
representatives to use as buffer inputs.
2025-09-29 08:21:28 +02:00
Akash Levy
4b6b254e31 pyosys cannot parse header with omitted function args 2025-09-28 01:37:30 -07:00
Robert O'Callahan
1c73011e7e Swap SigSpecs using std::swap with moves 2025-09-25 03:04:17 +00:00
Jannis Harder
2dce50516b log: Print static message as fatal error for YOSYS_ABORT 2025-09-24 13:20:27 +02:00
Jannis Harder
86a46b9e5c log: Flush stdout before printing a fatal error to stderr
This hasn't been an issue when using -l to redirect or when stdout is
line buffered, explaining how we didn't notice this earlier, but for
`yosys ... > log` that extra flush is required to ensure all messages
preceding the fatal error are flushed.
2025-09-24 13:20:27 +02:00
Emil Jiří Tywoniak
161cdd349c io: add append_globbed to resolve globs in regular pass arguments 2025-09-24 11:30:29 +02:00
Jannis Harder
9c1d0a2346
Merge pull request #5382 from rocallahan/fix-bounds-check
Fix off-by-one error in bounds check in `RTLIL::SigChunk::operator[]`
2025-09-24 08:41:16 +02:00
Robert O'Callahan
0a17205a95 Fix off-by-one error in bounds check 2025-09-23 21:29:57 +00:00
Robert O'Callahan
1e5f920dbd Remove .c_str() from parameters to log_debug() 2025-09-23 19:10:33 +12:00
Robert O'Callahan
effc52fedc Make ID:: constants be StaticIdStrings for better optimization.
Their internal indexes will be known at compile time, like we already support for the `ID()` macro.
2025-09-23 03:25:16 +00:00
Jannis Harder
e546f3b8f0
Merge pull request #5355 from rocallahan/deprecate-logv_file_error
Deprecate `logv_file_error()`
2025-09-22 14:23:55 +02:00
Emil J
a78eb9e151
Merge pull request #5315 from YosysHQ/emil/write_rtlil-no-sort
write_rtlil: don't sort
2025-09-22 11:14:39 +02:00
Mohamed Gaber
1fa5ceee8c pyosys: restore remaining log functions
Co-authored-by: George Rennie <19538554+georgerennie@users.noreply.github.com>
2025-09-20 16:14:07 +01:00
Robert O'Callahan
4fe21dd652 Reduce hashops verbiage in OptMergePass 2025-09-19 03:31:46 +00:00
George Rennie
5b099abda4 help: fix memory leak for -dump-cells-json 2025-09-17 16:08:36 +01:00
Jannis Harder
d88d6fce87 kernel: Rewrite bufNormalize
This is a complete rewrite of the RTLIL-kernel-side bufnorm code. This
is done to support inout ports and undirected connections as well as to
allow removal of cells while in bufnorm mode.

This doesn't yet update the (experimental) `bufnorm` pass, so to
manually test the new kernel functionality, it is important to only use
`bufnorm -update` and `bufnorm -reset` which rely entirely on the kernel
functionality. Other modes of the `bufnorm` pass may still fail in the
presence of inout ports or undirected connections.
2025-09-17 13:56:46 +02:00
Jannis Harder
1251e92e3a Add $input_port and $connect cell types 2025-09-17 13:56:46 +02:00
Jannis Harder
c4f435569f kernel: Add known_driver method to Wire/SigSpec 2025-09-17 13:56:46 +02:00
Jannis Harder
22423b97c1 kernel: Add RTLIL::PortDir for a combined input and output flag 2025-09-17 13:56:46 +02:00
Emil J
73e47ac3fe
Merge pull request #5357 from rocallahan/builtin-ff
Instead of using `builtin_ff_cell_types()` directly, go through a method `Cell::is_builtin_ff()`
2025-09-17 11:37:16 +02:00
Robert O'Callahan
d24488d3a5 Instead of using builtin_ff_cell_types() directly, go through a method Cell::is_builtin_ff() 2025-09-17 03:24:19 +00:00