Commit Graph

1865 Commits

Author SHA1 Message Date
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
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
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