Robert O'Callahan
b3baba4522
Merge cd370bf6d1
into c2291c10a6
2025-09-10 11:49:17 +02: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
Robert O'Callahan
cd370bf6d1
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-01 02:45:58 +00:00
Robert O'Callahan
a515055be4
Make Const::is_*() functions work on packed bits without decaying to vector<State>
2025-09-01 02:45:58 +00:00
Robert O'Callahan
9c96e61e9b
Const::decode_string() doesn't need to call bitvectorize
2025-09-01 02:45:58 +00:00
Robert O'Callahan
a57b7dfd2e
Make Const::as_string work without reducing packed bits to vector<State>
2025-09-01 02:45:58 +00:00
Robert O'Callahan
652190bd50
Hash strings 8 bytes at a time
2025-09-01 02:45:57 +00:00
Robert O'Callahan
c2ad2a407a
Optimize Const::hash_into to hash packed bits efficiently
2025-09-01 02:45:57 +00:00
Robert O'Callahan
7814aa0c31
Use fast path for 32-bit Const integer constructor in more places
2025-09-01 02:45:57 +00:00
Robert O'Callahan
ec52d6c649
Fast path for Const::operator==
2025-09-01 02:45:57 +00:00
Robert O'Callahan
60099e5005
Make Const::as_bool and Const::as_int work with packed bits without decaying to vector<State>
2025-09-01 02:45:57 +00:00
Robert O'Callahan
e206b059f6
Make Const::Const(long long) constructor use packed bits internally if possible
2025-09-01 02:45:57 +00:00
Robert O'Callahan
31fc0f53e5
Deprecate Const::bitvectorize()
2025-09-01 02:45:57 +00:00
Robert O'Callahan
e41bf86cc3
Deprecate Const::bits()
2025-09-01 02:45:57 +00:00
Robert O'Callahan
360a625785
Update kernel to avoid bits()
2025-09-01 02:45:57 +00:00
Robert O'Callahan
e151fbc5df
Update Const API with alternatives to direct use of bits()
...
In particular, `Const::resize()`, `Const::set()`, and `Const::iterator`.
2025-09-01 02:44:23 +00:00
Robert O'Callahan
8bae779bb8
Fix Const::const_iterator tag to be bidirectional_iterator_tag
2025-08-31 23:43:27 +00:00
Robert O'Callahan
4657768506
Fix const_iterator postincrement behavior
2025-08-31 23:42:53 +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