3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-07 11:41:23 +00:00

Merge pull request #1869 from boqwxp/cleanup_connwrappers

Clean up `passes/cmds/connwrappers.cc`.
This commit is contained in:
whitequark 2020-04-06 11:01:44 +00:00 committed by GitHub
commit db66371915
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,15 +65,13 @@ struct ConnwrappersWorker
decls[key] = decl; decls[key] = decl;
} }
void work(RTLIL::Design *design, RTLIL::Module *module) void work(RTLIL::Module *module)
{ {
std::map<RTLIL::SigBit, std::pair<bool, RTLIL::SigSpec>> extend_map; std::map<RTLIL::SigBit, std::pair<bool, RTLIL::SigSpec>> extend_map;
SigMap sigmap(module); SigMap sigmap(module);
for (auto &it : module->cells_) for (auto cell : module->cells())
{ {
RTLIL::Cell *cell = it.second;
if (!decl_celltypes.count(cell->type)) if (!decl_celltypes.count(cell->type))
continue; continue;
@ -105,13 +103,8 @@ struct ConnwrappersWorker
} }
} }
for (auto &it : module->cells_) for (auto cell : module->selected_cells())
{ {
RTLIL::Cell *cell = it.second;
if (!design->selected(module, cell))
continue;
for (auto &conn : cell->connections_) for (auto &conn : cell->connections_)
{ {
std::vector<RTLIL::SigBit> sigbits = sigmap(conn.second).to_sigbit_vector(); std::vector<RTLIL::SigBit> sigbits = sigmap(conn.second).to_sigbit_vector();
@ -141,8 +134,8 @@ struct ConnwrappersWorker
} }
if (old_sig.size()) if (old_sig.size())
log("Connected extended bits of %s.%s:%s: %s -> %s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(cell->name), log("Connected extended bits of %s.%s:%s: %s -> %s\n", log_id(module->name), log_id(cell->name),
RTLIL::id2cstr(conn.first), log_signal(old_sig), log_signal(conn.second)); log_id(conn.first), log_signal(old_sig), log_signal(conn.second));
} }
} }
} }
@ -200,9 +193,8 @@ struct ConnwrappersPass : public Pass {
log_header(design, "Executing CONNWRAPPERS pass (connect extended ports of wrapper cells).\n"); log_header(design, "Executing CONNWRAPPERS pass (connect extended ports of wrapper cells).\n");
for (auto &mod_it : design->modules_) for (auto module : design->selected_modules())
if (design->selected(mod_it.second)) worker.work(module);
worker.work(design, mod_it.second);
} }
} ConnwrappersPass; } ConnwrappersPass;