Commit Graph

4631 Commits

Author SHA1 Message Date
Martin Povišer a9318db2fa opt_hier: Adjust messages 2025-09-29 12:27:27 +02:00
Martin Povišer ffe2f7a16d opt_hier: Fix two optimizations conflicting
Fix a conflict between the following two:

 * propagation of tied-together inputs in
 * propagation of unused inputs out
2025-09-29 12:27:27 +02:00
KrystalDelusion 7ebd972165
Merge pull request #5277 from YosysHQ/krys/fix_4983_alt
autoname: Avoid integer overflow
2025-09-26 14:11:20 +12:00
Krystine Sherwin fef6bdae6c
autoname.cc: Return number of renames
Was previously the number of proposed renames, but since renames can be skipped this causes the final count to differ from the number of actually renamed objects.
Check counts in `tests/various/autoname.ys`.
2025-09-26 11:05:50 +12:00
Emil J 8c8d18f2d8
Merge pull request #5392 from rocallahan/opt-merge-cleanup
Some small readability improvements to `OptMergeWorker`
2025-09-25 12:15:33 +02:00
Martin Povišer 29e0144ebc
Merge pull request #5381 from povik/abc9-multilib
Support multiple lib files in abc9_exe
2025-09-25 09:45:09 +02:00
Robert O'Callahan 4d209c187d Switch OptMergeWorker cell type switching to use IdString::in() 2025-09-25 03:06:58 +00:00
Robert O'Callahan 1c73011e7e Swap SigSpecs using std::swap with moves 2025-09-25 03:04:17 +00:00
Jannis Harder 71882debe7 simplemap: Remove leftover debug output 2025-09-24 13:20:27 +02:00
Jannis Harder 904d49c6d8 abc9_ops: Remove temporary debug log message
I missed this when adding the -replace_zbufs option.
2025-09-24 13:20:27 +02:00
Jannis Harder 7a69dbb63d
Merge pull request #5372 from rocallahan/abc-done
Make ABC_DONE tracking more robust
2025-09-24 08:40:26 +02:00
Emil J 5f6819fd76
Merge pull request #5361 from YosysHQ/emil/simplemap-transfer-src
simplemap: fix src attribute transfer
2025-09-23 20:40:57 +02:00
Martin Povišer 3f4b6dc5d3 Support multiple lib files in abc9_exe 2025-09-23 20:34:08 +02:00
KrystalDelusion d4071b63f7
Merge pull request #5268 from YosysHQ/krys/cutpoint_inout
Track wire drivers in cutpoint
2025-09-24 04:14:19 +12:00
Robert O'Callahan 1e5f920dbd Remove .c_str() from parameters to log_debug() 2025-09-23 19:10:33 +12:00
Jannis Harder 13a2481da7
Merge pull request #5365 from rocallahan/deterministic-abc
Extract ABC results in the order of `assigned_cells`
2025-09-22 23:21:11 +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
Robert O'Callahan 7f6fae1f66 Extract ABC results in the order of `assigned_cells`.
Currently the order of extraction can vary based on which ABC runs finish first. That's
nondeterministic, therefore bad. Instead, force the processing to happen in the same order
as `assigned_cells`, i.e. the same order we use when not using parallelism. This should
make everything deterministic.

Note that we still allow ABC runs to complete out of order. Out-of-order results are
just not extracted until all the previous runs have completed and their results
extracted.
2025-09-22 05:07:03 +00:00
Robert O'Callahan 4fc782ef2b Make ABC_DONE detection more robust.
1) Change token from ABC_DONE to YOSYS_ABC_DONE to be a bit more robust against false matches.
2) Emit the token from the sourced script so that we don't have to worry about it showing up in the echoing
of the command as it executes. It will only appear in ABC stdout when it executes, i.e. when
our script has completed.
3) `set abcout` doesn't actually switch ABC to line buffering on stdout, since HAVE_SETVBUF is not actually
set in ABC builds in general. So stop using that. ABC does the necessary flushing when
`source` has finished.
2025-09-22 05:01:51 +00:00
Robert O'Callahan 2de641d051 Don't redirect spawned ABCs' stderr to our pipe.
popen() doesn't do this and we should emulate the behavior of popen() as much as possible.
2025-09-22 05:01:51 +00:00
Emil J. Tywoniak 96f87aa2d4 simplemap: fix src attribute transfer 2025-09-18 12:59:12 +02:00
Jannis Harder 4f239b536b abc_new: Hide buffered 'z drivers from read/write_xaiger2
With the updated bufnorm code, buffered 'z drivers are used as anchor
points for undirected connections. These are currently not supported by
read/write_xaiger2, so we temporarily replace those by roughly
equivalent $tribuf cells which will be handled as blackboxes that
properly roundtrip through the xaiger2 front and backend.
2025-09-17 13:56:46 +02:00
Jannis Harder 5f79a6e868 Clean up $buf with 'z inputs, $input_port and $connect cells
This ensures that entering and leaving bufnorm followed by `opt_clean`
is equivalent to just running `opt_clean`.

Also make sure that 'z-$buf cells get techmapped in a compatible way.
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 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 73747f6928 read_verilog: add -relativeshare for synthesis reproducibility testing 2025-09-16 15:47:35 +02:00
Emil J. Tywoniak 68ad52c6ae bugpoint: don't sort 2025-09-16 15:39:13 +02:00
Emil J. Tywoniak e11ea42af0 raise_error: whitespace 2025-09-16 15:39:13 +02:00
Robert O'Callahan 7f247fb125 Update passes/hierarchy to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan 159ca3ba56 Update passes/tests to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan 8cc86b2643 Update passes/techmap to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan d1642bf510 Update passes/sat to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan 2d5ce8c363 Update passes/proc to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan 5600eb2e5b Update passes/opt to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan 23f196a3b8 Update passes/memory to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan e1d0c010ef Update passes/fsm to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan 1b589b065d Update passes/cmds to avoid bits() 2025-09-16 03:17:23 +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
Robert O'Callahan 38f8165c80 Remove direct RTLIL access from gate_t 2025-09-15 17:10:20 +02:00
Robert O'Callahan 222f457a04 Only write out stdcells/lutcosts once for all ABC runs 2025-09-15 17:10:07 +02:00
Robert O'Callahan 13b3418a7f Split `abc_module()` into `prepare_module()` and `run_abc()`
`prepare_module()` will have to run on the main thread.
2025-09-15 17:01:25 +02:00
Claire Xen a2fc7e4dd7
Merge pull request #4252 from zapta/master
Added to the Show command a -wireshape <graphviz-shape> flag.
2025-09-15 15:40:40 +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
Krystine Sherwin f102b25914 Reapply "Merge pull request #5301 from KrystalDelusion/krys/re_5280"
This reverts commit 88eb83a0c3.
2025-09-12 10:41:01 +02:00