3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-23 23:52:32 +00:00

Merge branch 'YosysHQ:main' into main

This commit is contained in:
Akash Levy 2025-04-22 11:23:26 -07:00 committed by GitHub
commit 4fad708795
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 430 additions and 1 deletions

View file

@ -352,6 +352,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
{
@ -363,6 +367,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") {
@ -381,6 +387,10 @@ struct FlattenPass : public Pass {
worker.separator = args[++argidx];
continue;
}
if (args[argidx] == "-nocleanup") {
cleanup = false;
continue;
}
break;
}
extra_args(args, argidx, design);
@ -417,7 +427,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));