techmap: sort celltypeMap as it determines techmap order
authorEddie Hung <eddie@fpgeh.com>
Tue, 21 Apr 2020 03:56:38 +0000 (20:56 -0700)
committerAlberto Gonzalez <boqwxp@airmail.cc>
Thu, 14 May 2020 20:06:55 +0000 (20:06 +0000)
passes/techmap/techmap.cc

index 16bc9c80347f4bab4e093bcefa7d1367786a354c..8a8756757889196b910fbd884cda0a842e44f083 100644 (file)
@@ -1313,11 +1313,13 @@ struct TechmapPass : public Pass {
                                        celltypeMap[RTLIL::escape_id(q)].insert(module->name);
                                free(p);
                        } else {
-                               std::string module_name = module->name.begins_with("\\$") ?
+                               IdString module_name = module->name.begins_with("\\$") ?
                                                module->name.substr(1) : module->name.str();
                                celltypeMap[module_name].insert(module->name);
                        }
                }
+               for (auto &i : celltypeMap)
+                       i.second.sort(RTLIL::sort_by_id_str());
 
                for (auto module : design->modules())
                        worker.module_queue.insert(module);
@@ -1389,6 +1391,8 @@ struct FlattenPass : public Pass {
                dict<IdString, pool<IdString>> celltypeMap;
                for (auto module : design->modules())
                        celltypeMap[module->name].insert(module->name);
+               for (auto &i : celltypeMap)
+                       i.second.sort(RTLIL::sort_by_id_str());
 
                RTLIL::Module *top_mod = nullptr;
                if (design->full_selection())