From 784de0f6e3cdac8e68f0f0685b4f4e9de4ba433d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 4 Jun 2025 08:01:21 +0200 Subject: [PATCH 1/2] Make attrmap able to alter memory attributes as well --- passes/techmap/attrmap.cc | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/passes/techmap/attrmap.cc b/passes/techmap/attrmap.cc index 96e65ff2e..58f5a47e5 100644 --- a/passes/techmap/attrmap.cc +++ b/passes/techmap/attrmap.cc @@ -270,26 +270,19 @@ struct AttrmapPass : public Pass { { for (auto module : design->selected_modules()) { - for (auto wire : module->selected_wires()) + for (auto wire : module->selected_members()) attrmap_apply(stringf("%s.%s", log_id(module), log_id(wire)), actions, wire->attributes); - for (auto cell : module->selected_cells()) - attrmap_apply(stringf("%s.%s", log_id(module), log_id(cell)), actions, cell->attributes); - - for (auto proc : module->processes) + for (auto proc : module->selected_processes()) { - if (!design->selected(module, proc.second)) - continue; - attrmap_apply(stringf("%s.%s", log_id(module), log_id(proc.first)), actions, proc.second->attributes); - - std::vector all_cases = {&proc.second->root_case}; + std::vector all_cases = {&proc->root_case}; while (!all_cases.empty()) { RTLIL::CaseRule *cs = all_cases.back(); all_cases.pop_back(); - attrmap_apply(stringf("%s.%s (case)", log_id(module), log_id(proc.first)), actions, cs->attributes); + attrmap_apply(stringf("%s.%s (case)", log_id(module), log_id(proc)), actions, cs->attributes); for (auto &sw : cs->switches) { - attrmap_apply(stringf("%s.%s (switch)", log_id(module), log_id(proc.first)), actions, sw->attributes); + attrmap_apply(stringf("%s.%s (switch)", log_id(module), log_id(proc)), actions, sw->attributes); all_cases.insert(all_cases.end(), sw->cases.begin(), sw->cases.end()); } } From beaca05b405c9547375358df9a86a6193e80902d Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 21 Jun 2025 09:49:56 +1200 Subject: [PATCH 2/2] Include boxes in attrmap Rename `selected_members` iterator to memb. Add comment on `selected_processes` loop for clarity. --- passes/techmap/attrmap.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/passes/techmap/attrmap.cc b/passes/techmap/attrmap.cc index 58f5a47e5..7f5bfc94f 100644 --- a/passes/techmap/attrmap.cc +++ b/passes/techmap/attrmap.cc @@ -263,16 +263,17 @@ struct AttrmapPass : public Pass { if (modattr_mode) { - for (auto module : design->selected_whole_modules()) + for (auto module : design->all_selected_whole_modules()) attrmap_apply(stringf("%s", log_id(module)), actions, module->attributes); } else { - for (auto module : design->selected_modules()) + for (auto module : design->all_selected_modules()) { - for (auto wire : module->selected_members()) - attrmap_apply(stringf("%s.%s", log_id(module), log_id(wire)), actions, wire->attributes); + for (auto memb : module->selected_members()) + attrmap_apply(stringf("%s.%s", log_id(module), log_id(memb)), actions, memb->attributes); + // attrmap already applied to process itself during above loop, but not its children for (auto proc : module->selected_processes()) { std::vector all_cases = {&proc->root_case};