3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-29 20:59:03 +00:00
Commit graph

1843 commits

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