Clean up `passes/cmds/scatter.cc`.
authorAlberto Gonzalez <boqwxp@airmail.cc>
Thu, 9 Apr 2020 05:34:28 +0000 (05:34 +0000)
committerAlberto Gonzalez <boqwxp@airmail.cc>
Thu, 16 Apr 2020 18:49:55 +0000 (18:49 +0000)
passes/cmds/scatter.cc

index 7123ba9fb68ff6ddfb735effde6b2c5aafbf5176..8c95e42891febe23f58b0a28892d4e9decdd21ed 100644 (file)
@@ -46,22 +46,19 @@ struct ScatterPass : public Pass {
                CellTypes ct(design);
                extra_args(args, 1, design);
 
-               for (auto &mod_it : design->modules_)
+               for (auto module : design->selected_modules())
                {
-                       if (!design->selected(mod_it.second))
-                               continue;
-
-                       for (auto &c : mod_it.second->cells_)
-                       for (auto &p : c.second->connections_)
+                       for (auto cell : module->cells())
+                       for (auto &p : cell->connections_)
                        {
-                               RTLIL::Wire *wire = mod_it.second->addWire(NEW_ID, p.second.size());
+                               RTLIL::Wire *wire = module->addWire(NEW_ID, p.second.size());
 
-                               if (ct.cell_output(c.second->type, p.first)) {
+                               if (ct.cell_output(cell->type, p.first)) {
                                        RTLIL::SigSig sigsig(p.second, wire);
-                                       mod_it.second->connect(sigsig);
+                                       module->connect(sigsig);
                                } else {
                                        RTLIL::SigSig sigsig(wire, p.second);
-                                       mod_it.second->connect(sigsig);
+                                       module->connect(sigsig);
                                }
 
                                p.second = wire;