mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-16 14:41:33 +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
2a4a9aedfe
commit
3ebecb631c
1 changed files with 13 additions and 0 deletions
|
@ -72,6 +72,19 @@ void RTLIL::IdString::prepopulate()
|
||||||
#undef X
|
#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;
|
dict<std::string, std::string> RTLIL::constpad;
|
||||||
|
|
||||||
const pool<IdString> &RTLIL::builtin_ff_cell_types() {
|
const pool<IdString> &RTLIL::builtin_ff_cell_types() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue