Commit Graph

500 Commits

Author SHA1 Message Date
Robert O'Callahan 638e904f91 Remove cover() coverage tracking 2025-12-04 16:27:13 +01:00
Robert O'Callahan b23dc345ae Make it safe to access .c_str() for autoidx IDs in a multithreaded context 2025-11-25 22:49:41 +00:00
Robert O'Callahan 948001f39f Merge the two autoidx hashtables into one
When something calls `IdString::c_str()` on an autoidx ID, we need to cache the
full string in a thread-safe way. If we need to allocate an entry in some data
structure to do that, it's difficult to do in a thread-safe no-performance-hazard way.
So instead, store the cached string pointer in the same hashtable as the prefix
pointer.
2025-11-25 21:57:46 +00:00
Robert O'Callahan 8f0ecce53f Forbid creating IdStrings and incrementing autoidx during multithreaded phases, and add dynamic checks for that
We could make it safe to increment autoidx during multithreaded passes, but that's
actually undesirable because it would lead to nondeterminism. If/when we need new
IDs during parallel passes, we'll have to figure out how to allocate them in a
deterministic way, and that will depend on the details of what the pass does.
So don't try to tackle that now.
2025-11-25 21:57:46 +00:00
Robert O'Callahan 4c8b537d71 Remove YOSYS_NO_IDS_REFCNT
Refcounting is hardly used at all so this option is not that useful.

We might want to have a different option that disables GC if that becomes
a performance issue, but that should be a different option.
2025-11-25 21:57:46 +00:00
Emil J. Tywoniak c497b3b24c Revert "rtlil: make tracing optional in IdString garbage collection"
This reverts commit 8c76f93fce.
2025-11-14 15:32:10 +01:00
Emil J. Tywoniak 8c76f93fce rtlil: make tracing optional in IdString garbage collection 2025-11-12 20:22:30 +01:00
Emil J. Tywoniak 1ee4fc9d27 fix YOSYS_XTRACE_GET_PUT 2025-11-12 20:20:51 +01:00
Robert O'Callahan 578d658871 Add timing stats for IdString garbage collection 2025-11-12 11:52:04 +01:00
Robert O'Callahan e95ed7bbab Make NEW_ID create IDs whose string allocation is delayed 2025-11-12 11:52:04 +01:00
Robert O'Callahan b3f3f42577 Remove StaticIdString and just use IdString now that we can make it constexpr 2025-11-12 11:52:04 +01:00
Robert O'Callahan b0e2d75dbe 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-11-12 11:52:04 +01:00
Robert O'Callahan 54bde15329 Implement IdString garbage collection instead of refcounting. 2025-11-12 11:52:04 +01:00
Robert O'Callahan 5133b4bdea Create RTLIL::OwningIdString and use it in a few places 2025-11-12 11:52:04 +01:00
Robert O'Callahan d28f97e9da Remove YOSYS_USE_STICKY_IDS 2025-11-12 11:52:04 +01:00
Robert O'Callahan 0fe79ce01b Make RTLIL::Design::get_all_designs() unconditionally defined 2025-11-12 11:52:04 +01:00
Robert O'Callahan e84bc3c6c5 Remove explicit empty-string check when looking up IdStrings 2025-11-12 11:52:04 +01:00
Robert O'Callahan 20639906e3 Store IdString lengths and use them 2025-11-12 11:52:04 +01:00
Robert O'Callahan 1cf3497d15 Repack SigSpecs when possible 2025-11-07 15:54:56 +00:00
Robert O'Callahan 38d1d071a5 Implement SigSpec::updhash() using a relaxed atomic for thread-safety 2025-11-07 15:54:56 +00:00
Robert O'Callahan 745222fa3b Make SigSpec::unpack() non-const 2025-11-07 15:54:56 +00:00
Robert O'Callahan 870ae18a2d Switch the SigSpec packed representation to allow just a single chunk that's inline in the SigSpec.
Single-chunk SigSpecs are very common and this avoids a heap allocation. It also simplifies
some algorithms.
2025-11-07 15:54:56 +00:00
Robert O'Callahan e1169d03fe Use chunks iterator for SigSpec::extract() 2025-11-07 15:54:56 +00:00
Robert O'Callahan 4939484840 Don't reset the hash when unpacking, instead clear the hash whenever bits are modified 2025-11-07 15:54:56 +00:00
Robert O'Callahan aa4a0fe815 Use size() instead of direct access to width_ in many places 2025-11-07 15:54:56 +00:00
Robert O'Callahan 619f49eabe Remove unnecessary pack() from SigSpec::extend_u0() 2025-11-07 15:54:55 +00:00
Robert O'Callahan b612c1bb39 Simplify SigSpec::as_bit() 2025-11-07 15:54:55 +00:00
Robert O'Callahan a69d48dd19 Instead of using packing and hashing to compute SigSpec ordering and equality, just use the width and chunkwise comparisons
This avoids having to pack and compute hashes, and generally results in a
simpler ordering.
2025-11-07 15:54:55 +00:00
Robert O'Callahan 7394a2c597 Make SigSpec conversion to vector of SigChunk use chunks iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan 974b4dbe25 Make SigSpec::parse_rhs use is_chunk to avoid direct access to chunks_ 2025-11-07 15:54:55 +00:00
Robert O'Callahan 62cd3ddfb8 Make SigSpec::to_sigbit_pool use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan 4ed25c0538 Make SigSpec::to_sigbit_set use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan 39b89aae88 Use SigSpec::try_as_const in some places 2025-11-07 15:54:55 +00:00
Robert O'Callahan dd3940c8bb Make SigSpec::is_one_hot use try_as_const 2025-11-07 15:54:55 +00:00
Robert O'Callahan ce597dc38c Fix try_as_const/as_wire/as_chunk 2025-11-07 15:54:55 +00:00
Robert O'Callahan 0281ed1458 Add try_as_const and use the const iterator a bit more 2025-11-07 15:54:55 +00:00
Robert O'Callahan 0091d14e6d Make SigSpec::has_marked_bits use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan 80b3efb3da Make SigSpec::has_const(State) use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan ed8022f53f Make SigSpec::has_const use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan 1893c61fe2 Make SigSpec::is_fully_undef use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan e2defe7898 Make SigSpec::is_fully_def use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan 152a487cc8 Make SigSpec::is_fully_ones use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan ddd04e13e0 Make SigSpec::is_fully_zero use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan a7ac396fd9 Make is_fully_const use chunk iterator 2025-11-07 15:54:55 +00:00
Robert O'Callahan b0ee67a355 Make SigSpec::is_wire/is_chunk/is_fully_const use chunk iterator 2025-11-07 15:54:54 +00:00
Robert O'Callahan fc7d61132d Make SigSpec::updhash() use chunk iterator 2025-11-07 15:54:54 +00:00
Robert O'Callahan 3f7af10eda Make SigSpec::chunks() return an object that can be iterated over without packing the SigSpec 2025-11-07 15:54:54 +00:00
Robert O'Callahan 8d4f790951 Make Module stop accessing internals of SigSpec 2025-11-07 13:25:38 +00:00
Mohamed Gaber d6b9158fa3
pyosys: fix regressions from 0.58
- consistently use value semantics for objects passed along FFI boundary
  (not ideal but matches previous behavior)
- add new overload of RTLIL::Module: addMemory that does not require a "donor" object
  - the idea is `Module`, `Memory`, `Wire`, `Cell` and `Process` cannot be directly constructed in Python and can only be added to the existing memory hierarchy in `Design` using the `add` methods - `Memory` requiring a donor object was the odd one out here
- fix superclass member wrapping only looking at direct superclass for inheritance instead of recursively checking superclasses
- fix superclass member wrapping not using superclass's denylists
- fix Design's `__str__` function not returning a string
- fix the generator crashing if there's any `std::function` in a header
- misc: add a crude `__repr__` based on `__str__`
2025-10-26 02:21:40 +03: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