mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-20 07:36:39 +00:00
Merge 5db1765bee
into 7f7ad87b7b
This commit is contained in:
commit
4313d332ac
|
@ -349,6 +349,10 @@ struct FlattenPass : public Pass {
|
|||
log(" -separator <char>\n");
|
||||
log(" Use this separator char instead of '.' when concatenating design levels.\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
|
||||
{
|
||||
|
@ -360,6 +364,8 @@ struct FlattenPass : public Pass {
|
|||
if (design->scratchpad.count("flatten.separator"))
|
||||
worker.separator = design->scratchpad_get_string("flatten.separator");
|
||||
|
||||
bool cleanup = true;
|
||||
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++) {
|
||||
if (args[argidx] == "-wb") {
|
||||
|
@ -378,6 +384,10 @@ struct FlattenPass : public Pass {
|
|||
worker.separator = args[++argidx];
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-nocleanup") {
|
||||
cleanup = false;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
extra_args(args, argidx, design);
|
||||
|
@ -414,7 +424,7 @@ struct FlattenPass : public Pass {
|
|||
for (auto module : topo_modules.sorted)
|
||||
worker.flatten_module(design, module, used_modules, worker.separator);
|
||||
|
||||
if (top != nullptr)
|
||||
if (cleanup && top != nullptr)
|
||||
for (auto module : design->modules().to_vector())
|
||||
if (!used_modules[module] && !module->get_blackbox_attribute(worker.ignore_wb)) {
|
||||
log("Deleting now unused module %s.\n", log_id(module));
|
||||
|
|
Loading…
Reference in a new issue