mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-11 04:01:28 +00:00
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.
This commit is contained in:
parent
6921a2cc3e
commit
6a1d8abf7c
1 changed files with 13 additions and 0 deletions
|
@ -72,6 +72,19 @@ void RTLIL::IdString::prepopulate()
|
|||
#undef X
|
||||
}
|
||||
|
||||
static constexpr bool check_well_known_id_order()
|
||||
{
|
||||
int size = sizeof(IdTable) / sizeof(IdTable[0]);
|
||||
for (int i = 1; i < size; ++i)
|
||||
if (IdTable[i - 1].name >= IdTable[i].name)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ensure the statically allocated IdStrings in kernel/constids.inc are unique
|
||||
// and in sorted ascii order, as required by the ID macro.
|
||||
static_assert(check_well_known_id_order());
|
||||
|
||||
dict<std::string, std::string> RTLIL::constpad;
|
||||
|
||||
const pool<IdString> &RTLIL::builtin_ff_cell_types() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue