3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-10-01 05:29:29 +00:00

autoname.cc: Return number of renames

Was previously the number of proposed renames, but since renames can be skipped this causes the final count to differ from the number of actually renamed objects.
Check counts in `tests/various/autoname.ys`.
This commit is contained in:
Krystine Sherwin 2025-09-26 11:05:50 +12:00
parent bc77b6213b
commit fef6bdae6c
No known key found for this signature in database
2 changed files with 10 additions and 1 deletions

View file

@ -81,6 +81,7 @@ int autoname_worker(Module *module, const dict<Wire*, unsigned int>& wire_score)
}
}
int count = 0;
// compare against double best score for following comparisons so we don't
// pre-empt a future iteration
best_name.score *= 2;
@ -91,6 +92,7 @@ int autoname_worker(Module *module, const dict<Wire*, unsigned int>& wire_score)
IdString n = module->uniquify(IdString(it.second.name));
log_debug("Rename cell %s in %s to %s.\n", log_id(it.first), log_id(module), log_id(n));
module->rename(it.first, n);
count++;
}
for (auto &it : proposed_wire_names) {
@ -99,9 +101,10 @@ int autoname_worker(Module *module, const dict<Wire*, unsigned int>& wire_score)
IdString n = module->uniquify(IdString(it.second.name));
log_debug("Rename wire %s in %s to %s.\n", log_id(it.first), log_id(module), log_id(n));
module->rename(it.first, n);
count++;
}
return proposed_cell_names.size() + proposed_wire_names.size();
return count;
}
struct AutonamePass : public Pass {