3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-17 03:15:47 +00:00

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`.
This commit is contained in:
Krystine Sherwin 2025-11-07 17:45:07 +13:00
parent e4c5900acd
commit 7302bf9a66
No known key found for this signature in database
5 changed files with 39 additions and 8 deletions

View file

@ -567,10 +567,13 @@ struct RTLILFrontendWorker {
if (try_parse_keyword("parameter")) {
bool is_signed = false;
bool is_real = false;
bool is_unsized = false;
if (try_parse_keyword("signed")) {
is_signed = true;
} else if (try_parse_keyword("real")) {
is_real = true;
} else if (try_parse_keyword("unsized")) {
is_unsized = true;
}
RTLIL::IdString param_name = parse_id();
RTLIL::Const val = parse_const();
@ -578,6 +581,8 @@ struct RTLILFrontendWorker {
val.flags |= RTLIL::CONST_FLAG_SIGNED;
if (is_real)
val.flags |= RTLIL::CONST_FLAG_REAL;
if (is_unsized)
val.flags |= RTLIL::CONST_FLAG_UNSIZED;
cell->parameters.insert({std::move(param_name), std::move(val)});
expect_eol();
} else if (try_parse_keyword("connect")) {