mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-14 14:55:26 +00:00
fixup! box_derive: add -apply
This commit is contained in:
parent
424f9f91aa
commit
b85bd37360
2 changed files with 18 additions and 17 deletions
|
@ -86,7 +86,6 @@ struct BoxDerivePass : Pass {
|
||||||
|
|
||||||
for (auto module : d->selected_modules()) {
|
for (auto module : d->selected_modules()) {
|
||||||
for (auto cell : module->selected_cells()) {
|
for (auto cell : module->selected_cells()) {
|
||||||
log_cell(cell);
|
|
||||||
Module *inst_module = d->module(cell->type);
|
Module *inst_module = d->module(cell->type);
|
||||||
if (!inst_module || !inst_module->get_blackbox_attribute())
|
if (!inst_module || !inst_module->get_blackbox_attribute())
|
||||||
continue;
|
continue;
|
||||||
|
@ -97,27 +96,29 @@ struct BoxDerivePass : Pass {
|
||||||
|
|
||||||
auto index = std::make_pair(base->name, cell->parameters);
|
auto index = std::make_pair(base->name, cell->parameters);
|
||||||
|
|
||||||
if (cell->parameters.empty() || done.count(index))
|
if (cell->parameters.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IdString derived_type = base->derive(d, cell->parameters);
|
if (!done.count(index)) {
|
||||||
Module *derived = d->module(derived_type);
|
IdString derived_type = base->derive(d, cell->parameters);
|
||||||
log_assert(derived && "Failed to derive module\n");
|
Module *derived = d->module(derived_type);
|
||||||
log_debug("derived %s\n", derived_type.c_str());
|
log_assert(derived && "Failed to derive module\n");
|
||||||
|
log("derived %s\n", derived_type.c_str());
|
||||||
|
|
||||||
if (!naming_attr.empty() && derived->has_attribute(naming_attr)) {
|
if (!naming_attr.empty() && derived->has_attribute(naming_attr)) {
|
||||||
IdString new_name = RTLIL::escape_id(derived->get_string_attribute(naming_attr));
|
IdString new_name = RTLIL::escape_id(derived->get_string_attribute(naming_attr));
|
||||||
if (!new_name.isPublic())
|
if (!new_name.isPublic())
|
||||||
log_error("Derived module %s cannot be renamed to private name %s.\n",
|
log_error("Derived module %s cannot be renamed to private name %s.\n",
|
||||||
log_id(derived), log_id(new_name));
|
log_id(derived), log_id(new_name));
|
||||||
derived->attributes.erase(naming_attr);
|
derived->attributes.erase(naming_attr);
|
||||||
d->rename(derived, new_name);
|
d->rename(derived, new_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
done[index] = derived;
|
||||||
}
|
}
|
||||||
|
|
||||||
done[index] = derived;
|
|
||||||
if (apply_mode)
|
if (apply_mode)
|
||||||
cell->type = derived_type;
|
cell->type = done[index]->name;
|
||||||
log_cell(cell);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
log("\n");
|
log("\n");
|
||||||
log(" publish\n");
|
log(" publish\n");
|
||||||
log("Makes all module names and cell types public by prefixing\n");
|
log("Makes all module names and cell types public by prefixing\n");
|
||||||
log("% with \\.\n");
|
log("%% with \\.\n");
|
||||||
}
|
}
|
||||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue