Fix describe_selection_for_assert

If the current selection is not the provided selection, push the provided selection.
This commit is contained in:
Krystine Sherwin 2024-11-20 11:01:42 +13:00
parent 06427efb83
commit 06f2d1e0fc
No known key found for this signature in database
1 changed files with 3 additions and 0 deletions

View File

@ -999,6 +999,8 @@ static void select_stmt(RTLIL::Design *design, std::string arg, bool disable_emp
static std::string describe_selection_for_assert(RTLIL::Design *design, RTLIL::Selection *sel, bool whole_modules = false)
{
bool push_selection = &design->selection() != sel;
if (push_selection) design->push_selection(*sel);
std::string desc = "Selection contains:\n";
for (auto mod : design->all_selected_modules())
{
@ -1007,6 +1009,7 @@ static std::string describe_selection_for_assert(RTLIL::Design *design, RTLIL::S
for (auto it : mod->selected_members())
desc += stringf("%s/%s\n", id2cstr(mod->name), id2cstr(it->name));
}
if (push_selection) design->pop_selection();
return desc;
}