mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-27 10:55:51 +00:00
Merge pull request #5037 from YosysHQ/flatten_nocleanup
This commit is contained in:
commit
f27fb1a25b
1 changed files with 11 additions and 1 deletions
|
@ -349,6 +349,10 @@ struct FlattenPass : public Pass {
|
||||||
log(" -separator <char>\n");
|
log(" -separator <char>\n");
|
||||||
log(" Use this separator char instead of '.' when concatenating design levels.\n");
|
log(" Use this separator char instead of '.' when concatenating design levels.\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -nocleanup\n");
|
||||||
|
log(" Don't remove unused submodules, leave a flattened version of each\n");
|
||||||
|
log(" submodule in the design.\n");
|
||||||
|
log("\n");
|
||||||
}
|
}
|
||||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
||||||
{
|
{
|
||||||
|
@ -360,6 +364,8 @@ struct FlattenPass : public Pass {
|
||||||
if (design->scratchpad.count("flatten.separator"))
|
if (design->scratchpad.count("flatten.separator"))
|
||||||
worker.separator = design->scratchpad_get_string("flatten.separator");
|
worker.separator = design->scratchpad_get_string("flatten.separator");
|
||||||
|
|
||||||
|
bool cleanup = true;
|
||||||
|
|
||||||
size_t argidx;
|
size_t argidx;
|
||||||
for (argidx = 1; argidx < args.size(); argidx++) {
|
for (argidx = 1; argidx < args.size(); argidx++) {
|
||||||
if (args[argidx] == "-wb") {
|
if (args[argidx] == "-wb") {
|
||||||
|
@ -378,6 +384,10 @@ struct FlattenPass : public Pass {
|
||||||
worker.separator = args[++argidx];
|
worker.separator = args[++argidx];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (args[argidx] == "-nocleanup") {
|
||||||
|
cleanup = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
extra_args(args, argidx, design);
|
extra_args(args, argidx, design);
|
||||||
|
@ -414,7 +424,7 @@ struct FlattenPass : public Pass {
|
||||||
for (auto module : topo_modules.sorted)
|
for (auto module : topo_modules.sorted)
|
||||||
worker.flatten_module(design, module, used_modules, worker.separator);
|
worker.flatten_module(design, module, used_modules, worker.separator);
|
||||||
|
|
||||||
if (top != nullptr)
|
if (cleanup && top != nullptr)
|
||||||
for (auto module : design->modules().to_vector())
|
for (auto module : design->modules().to_vector())
|
||||||
if (!used_modules[module] && !module->get_blackbox_attribute(worker.ignore_wb)) {
|
if (!used_modules[module] && !module->get_blackbox_attribute(worker.ignore_wb)) {
|
||||||
log("Deleting now unused module %s.\n", log_id(module));
|
log("Deleting now unused module %s.\n", log_id(module));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue