bbox_derive: Fix `done` base type confusion

This commit is contained in:
Martin Povišer 2024-05-21 14:56:15 +02:00
parent 44b0fdc2bf
commit 88af059fad
1 changed files with 7 additions and 5 deletions

View File

@ -54,7 +54,7 @@ struct BboxDerivePass : Pass {
log_cmd_error("Base module %s not found.\n", log_id(base_name)); log_cmd_error("Base module %s not found.\n", log_id(base_name));
} }
dict<dict<RTLIL::IdString, RTLIL::Const>, Module*> done; dict<std::pair<RTLIL::IdString, dict<RTLIL::IdString, RTLIL::Const>>, Module*> done;
for (auto module : d->selected_modules()) { for (auto module : d->selected_modules()) {
for (auto cell : module->selected_cells()) { for (auto cell : module->selected_cells()) {
@ -62,13 +62,15 @@ struct BboxDerivePass : Pass {
if (!inst_module || !inst_module->get_blackbox_attribute()) if (!inst_module || !inst_module->get_blackbox_attribute())
continue; continue;
if (cell->parameters.empty() || done.count(cell->parameters))
continue;
Module *base = inst_module; Module *base = inst_module;
if (base_override) if (base_override)
base = base_override; base = base_override;
auto index = std::make_pair(base->name, cell->parameters);
if (cell->parameters.empty() || done.count(index))
continue;
IdString derived_type = base->derive(d, cell->parameters); IdString derived_type = base->derive(d, cell->parameters);
Module *derived = d->module(derived_type); Module *derived = d->module(derived_type);
log_assert(derived && "Failed to derive module\n"); log_assert(derived && "Failed to derive module\n");
@ -83,7 +85,7 @@ struct BboxDerivePass : Pass {
d->rename(derived, new_name); d->rename(derived, new_name);
} }
done[cell->parameters] = derived; done[index] = derived;
} }
} }
} }