diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 9c7e3888c..352fbb84e 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -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 RTLIL::constpad; const pool &RTLIL::builtin_ff_cell_types() {