abc9_ops -prep_box: Adjust for repeated invocation

`abc9_ops -prep_box` command interprets the `abc9_box` attribute and
prepares a .box file for ABC consumption. Previously this command was
removing the attribute as it was processing each module which prevented
repeated invocation of this command unless the box definitions were
refreshed from a source file.

Also the command was keeping existing `abc9_box_id` attributes instead
of overwriting them with values from a new number sequence.

Change both behaviors to allow repeated invocations of the command on
the same design.
This commit is contained in:
Martin Povišer 2024-12-05 16:16:57 +01:00
parent 66734f522d
commit 481d596c43
1 changed files with 0 additions and 3 deletions

View File

@ -969,13 +969,10 @@ void prep_box(RTLIL::Design *design)
if (it == module->attributes.end()) if (it == module->attributes.end())
continue; continue;
bool box = it->second.as_bool(); bool box = it->second.as_bool();
module->attributes.erase(it);
if (!box) if (!box)
continue; continue;
auto r = module->attributes.insert(ID::abc9_box_id); auto r = module->attributes.insert(ID::abc9_box_id);
if (!r.second)
continue;
r.first->second = abc9_box_id++; r.first->second = abc9_box_id++;
if (module->get_bool_attribute(ID::abc9_flop)) { if (module->get_bool_attribute(ID::abc9_flop)) {