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
32641bbf93
Make IdString::contains take std::string_view so we avoid a strlen when the parameter is a string constant
2025-11-12 11:52:04 +01:00
Robert O'Callahan
2319d82efb
Make IdString::begins_width/ends_with take std::string_view so we avoid a strlen when the parameter is a string constant
2025-11-12 11:52:04 +01:00
KrystalDelusion
529886f7fb
Merge pull request #5473 from YosysHQ/krys/unsized_params
...
Handle unsized params
2025-11-12 07:14:44 +13:00
Emil J. Tywoniak
ee5b8a97b9
rtlil: avoid clang warning
2025-11-10 12:02:36 +01:00
Emil J. Tywoniak
0452955069
rtlil: add explanatory note to SigSpec::Chunks
2025-11-10 12:02:21 +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
92ea557979
Build a temporary SigChunk list in the iterator in the cases where that's needed
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
Krystine Sherwin
7302bf9a66
Add CONST_FLAG_UNSIZED
...
In order to support unsized constants being used as parameters, the `const` struct needs to know if it is unsized (so that the parameter can be used to set the size).
Add unsized flag to param value serialization and rtlil back-/front-end.
Add cell params to `tests/rtlil/everything.v`.
2025-11-07 17:45:07 +13:00
KrystalDelusion
52c108cd6a
Merge pull request #4596 from YosysHQ/emil/path-sep-refactor
...
Refactor getting dirs and filenames from paths to files
2025-11-05 09:12:54 +13:00
Miodrag Milanović
0751b74e7a
Merge pull request #5441 from donn/pyosys_bugfixes
...
pyosys: fix a number of regressions from 0.58
2025-11-04 07:36:25 +01:00
Krystine Sherwin
336877a353
io.cc: Drop unused variable
2025-11-04 12:27:31 +13:00
Vaibhav Singh
88d101b462
kernel: Fix define ID issue, needs undef first
2025-10-31 14:06:00 +05:30
Robert O'Callahan
a27b1a83ae
Don't recompute hash using moved-out-of value
2025-10-28 07:41:10 +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 Jiří Tywoniak
79cd4e08c4
io: use std::filesystem
2025-10-14 15:47:07 +02:00
Emil J. Tywoniak
5cfe6a9c1e
reduce OS ifdefs, refactor getting dirs and filenames from paths to files
2025-10-14 15:46:17 +02: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 `StaticIdString`s 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
Robert O'Callahan
64ffcbc394
Deprecate logv_file_error()
2025-09-16 23:26:38 +00:00
Robert O'Callahan
a7c46f7b4a
Remove .c_str() calls from parameters to log_warning()/log_warning_noprefix()
2025-09-16 23:02:16 +00:00
Robert O'Callahan
d1fd6de6da
Remove .c_str() calls from parameters to log_header()
2025-09-16 23:00:42 +00:00
Robert O'Callahan
5ac6858f26
Remove .c_str() from log_cmd_error() and log_file_error() parameters
2025-09-16 22:59:08 +00:00
Jannis Harder
b95549b469
Merge pull request #5348 from rocallahan/remove-string_buf
...
Remove `string_buf` by making `log_signal()` and `log_const()` return `std::string`
2025-09-16 20:20:56 +02:00
Emil J. Tywoniak
fdbdd193c1
rtlil: add roundtrip test for design -stash and design -save, fix #5321
2025-09-16 15:47:16 +02:00
Emil J. Tywoniak
d6d1f16c43
hashlib: add insertion order const iterator
2025-09-16 15:39:13 +02:00
rhanqtl
11b829ba70
fix(parse): #5234 adjust width of rhs according to lhs
2025-09-16 15:24:23 +02:00
Robert O'Callahan
fee2b8992c
Stop using `mutable` in `Const`.
...
Now that we only call `bitvectorize()` in non-const methods, we can move the casting-away-const to only happen
in `bitvectorize()`, which is deprecated so only some plugins (maybe) are using it.
This means `const` `Const` methods don't change the underlying data, which means
they'll be safe to use from multiple threads if/when we want to do that.
2025-09-16 03:17:24 +00:00
Robert O'Callahan
29810f1e7c
Make Const::is_*() functions work on packed bits without decaying to vector<State>
2025-09-16 03:17:24 +00:00
Robert O'Callahan
caaf9a4400
Const::decode_string() doesn't need to call bitvectorize
2025-09-16 03:17:24 +00:00
Robert O'Callahan
cb1186aac5
Make Const::as_string work without reducing packed bits to vector<State>
2025-09-16 03:17:24 +00:00
Robert O'Callahan
f61e3377a9
Hash strings 8 bytes at a time
2025-09-16 03:17:24 +00:00
Robert O'Callahan
67a274ed1f
Optimize Const::hash_into to hash packed bits efficiently
2025-09-16 03:17:24 +00:00
Robert O'Callahan
1a367b907c
Use fast path for 32-bit Const integer constructor in more places
2025-09-16 03:17:24 +00:00
Robert O'Callahan
9ad83cc67b
Fast path for Const::operator==
2025-09-16 03:17:24 +00:00
Robert O'Callahan
b597ad777e
Make Const::as_bool and Const::as_int work with packed bits without decaying to vector<State>
2025-09-16 03:17:24 +00:00
Robert O'Callahan
b06085ab6c
Make Const::Const(long long) constructor use packed bits internally if possible
2025-09-16 03:17:24 +00:00
Robert O'Callahan
61caa5e042
Deprecate Const::bitvectorize()
2025-09-16 03:17:23 +00:00
Robert O'Callahan
1e244cd78a
Deprecate Const::bits()
2025-09-16 03:17:23 +00:00
Robert O'Callahan
6dc9a8bacf
Update kernel to avoid bits()
2025-09-16 03:17:23 +00:00
Robert O'Callahan
662a3df987
Update Const API with alternatives to direct use of bits()
...
In particular, `Const::resize()`, `Const::set()`, and `Const::iterator`.
2025-09-16 03:17:22 +00:00
Robert O'Callahan
514fb8f901
Fix Const::const_iterator tag to be bidirectional_iterator_tag
2025-09-16 03:17:22 +00:00
Robert O'Callahan
03127173c6
Fix const_iterator postincrement behavior
2025-09-16 03:17:22 +00:00
Robert O'Callahan
8492c49f6c
Remove `string_buf` by making `log_signal()` and `log_const()` return `std::string`
...
We only have to fix one caller in-tree so this probably has very low impact on out-of-tree plugins.
Resolves #5215
2025-09-16 03:06:17 +00:00
Robert O'Callahan
ae0ca7578a
Use a pool of ABC processes.
...
Doing ABC runs in parallel can actually make things slower when every ABC run requires
spawning an ABC subprocess --- especially when using popen(), which on glibc does not
use vfork(). What seems to happen is that constant fork()ing keeps making the main
process data pages copy-on-write, so the main process code that is setting up each ABC
call takes a lot of minor page-faults, slowing it down.
The solution is pretty straightforward although a little tricky to implement.
We just reuse ABC subprocesses. Instead of passing the ABC script name on the command
line, we spawn an ABC REPL and pipe a command into it to source the script. When that's
done we echo an `ABC_DONE` token instead of exiting. Yosys then puts the ABC process
onto a stack which we can pull from the next time we do an ABC run.
For one of our large designs, this is an additional 5x speedup of the primary AbcPass.
It does 5155 ABC runs, all very small; runtime of the AbcPass goes from 760s to 149s
(not very scientific benchmarking but the effect size is large).
2025-09-15 17:22:15 +02:00
Robert O'Callahan
27462da208
Run ABCs in parallel.
...
Large circuits can run hundreds or thousands of ABCs in a single AbcPass.
For some circuits, some of those ABC runs can run for hundreds of seconds.
Running ABCs in parallel with each other and in parallel with main-thread
processing (reading and writing BLIF files, copying ABC BLIF output into
the design) can give large speedups.
2025-09-15 17:18:42 +02:00
Jannis Harder
b87a33d64e
Merge pull request #5211 from rocallahan/remove-log_str
...
Remove `log_str()` functions and convert their `log_signal()` users t…
2025-09-12 14:10:47 +02:00
Jannis Harder
dd9627ed05
Merge pull request #5336 from rocallahan/remove-log-cstr
...
Remove `.c_str()` calls from `log()`/`log_error()`
2025-09-12 14:09:48 +02:00
Robert O'Callahan
b98e54416f
When looking up the IdString table, it can never be empty after we've called prepopulate, so remove some dead code.
2025-09-12 05:29:22 +00:00
Robert O'Callahan
e0ae7b7af4
Remove .c_str() calls from log()/log_error()
...
There are some leftovers, but this is an easy regex-based approach that removes most of them.
2025-09-11 20:59:37 +00:00
Robert O'Callahan
c7017f7f79
Remove `log_str()` functions and convert their `log_signal()` users to return `std::string`
...
This is a small but easy step towards removing the `log_id_cache`.
See issue #5210 .
2025-09-11 04:00:49 +00:00
Emil J
201c40072c
Merge pull request #5327 from YosysHQ/emil/do_insert-dont-build-new-hash
...
hashlib: don't build an unused hash for expired value in do_insert
2025-09-09 21:53:39 +02:00
Jannis Harder
75a97241fa
Maintain logging ABI compatiblity with YosysHQ Verific Extensions
...
The YosysHQ Verific Extensions are compiled separately using their own
stripped-down version of the Yosys headers. To maintain ABI
compatibility with older extension builds post C++-ification of Yosys's
logging APIs, which are backwards compatible on the API but not ABI
level, this commit adds ABI compatible versions of a subset of the old
logging API used by the extensions.
2025-09-09 15:41:03 +02:00
Robert O'Callahan
a137d03c32
Make log_cmd_error() use variadic templates.
2025-09-09 15:41:03 +02:00
Robert O'Callahan
243f5f5201
Make log_file_error() use variadic templates.
2025-09-09 15:41:03 +02:00
Robert O'Callahan
974455378b
Make log_error() use variadic templates.
2025-09-09 15:41:03 +02:00
Robert O'Callahan
c3924d0616
Move log_abort()'s call to log_error() into an out-of-line non-varargs function
2025-09-09 15:41:03 +02:00
Robert O'Callahan
1b5373de0d
Move log_assert_worker()'s call to log_error() into an out-of-line non-varags function
2025-09-09 15:41:03 +02:00
Robert O'Callahan
ea2bb5b79a
Make log_file_info() use variadic templates.
2025-09-09 15:41:03 +02:00
Robert O'Callahan
ec5f62e6d4
Make log_file_warning() use variadic templates.
2025-09-09 15:41:03 +02:00
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
Emil J. Tywoniak
ccf140f2ef
hashlib: don't build an unused hash for expired value in do_insert
2025-09-04 14:47:45 +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