@@ -74,7 +74,7 @@ void PartitionMgr::writeArtNetSpec(const char* fileName)
7474 logger_->error (PAR, 53 , " Design not loaded." );
7575 }
7676
77- std::unordered_map<std::string, std::pair< int , bool > > onlyUseMasters;
77+ std::unordered_map<std::string, MasterInfo > onlyUseMasters;
7878 std::string top_name;
7979 int numInsts = 0 ;
8080 int numPIs = 0 ;
@@ -107,7 +107,7 @@ void PartitionMgr::writeArtNetSpec(const char* fileName)
107107}
108108
109109void PartitionMgr::getFromODB (
110- std::unordered_map<std::string, std::pair< int , bool > >& onlyUseMasters,
110+ std::unordered_map<std::string, MasterInfo >& onlyUseMasters,
111111 std::string& top_name,
112112 int & numInsts,
113113 int & numPIs,
@@ -131,13 +131,15 @@ void PartitionMgr::getFromODB(
131131 for (auto inst : insts) {
132132 dbMaster* master = inst->getMaster ();
133133 bool isMacro = (master->getType () == dbMasterType::BLOCK ? 1 : 0 );
134- if (master->isSequential ()) {
135- numSeq++;
136- }
137- if (onlyUseMasters.find (master->getName ()) == onlyUseMasters.end ()) {
138- onlyUseMasters[master->getName ()] = std::make_pair (0 , isMacro);
134+ if (const sta::LibertyCell* lib_cell = db_network_->libertyCell (inst)) {
135+ if (lib_cell->hasSequentials ()) {
136+ numSeq++;
137+ }
139138 }
140- onlyUseMasters[master->getName ()].first ++;
139+ auto [it, inserted] = onlyUseMasters.try_emplace (master->getName (), MasterInfo{});
140+ MasterInfo& info = it->second ;
141+ info.isMacro = isMacro;
142+ ++info.count ;
141143 }
142144}
143145
@@ -671,7 +673,7 @@ void PartitionMgr::fit_mul(const double* x,
671673}
672674
673675void PartitionMgr::writeFile (
674- const std::unordered_map<std::string, std::pair< int , bool > >& onlyUseMasters,
676+ const std::unordered_map<std::string, MasterInfo >& onlyUseMasters,
675677 const std::string& top_name,
676678 const int numInsts,
677679 const int numPIs,
@@ -693,12 +695,12 @@ void PartitionMgr::writeFile(
693695 outFile << " LIBRARY\n " ;
694696 outFile << " NAME lib\n " ;
695697
696- // unordered_map<string, int > --> cellName / isMacro
697- for (const auto & it : onlyUseMasters) {
698- if (!it. second . second ) {
699- outFile << " STD_CELL " << it. first << ' \n ' ;
698+ // unordered_map<string, MasterInfo > --> cellName / cellCount, isMacro
699+ for (const auto & [name, info] : onlyUseMasters) {
700+ if (!info. isMacro ) {
701+ outFile << " STD_CELL " << name << ' \n ' ;
700702 } else {
701- outFile << " MACRO_CELL " << it. first << ' \n ' ;
703+ outFile << " MACRO_CELL " << name << ' \n ' ;
702704 }
703705 }
704706 outFile << ' \n ' ;
@@ -707,8 +709,8 @@ void PartitionMgr::writeFile(
707709 outFile << " NAME " << top_name << ' \n ' ;
708710 outFile << " LIBRARIES lib" << ' \n ' ;
709711 outFile << " DISTRIBUTION " ;
710- for (const auto & it : onlyUseMasters) {
711- outFile << it. second . first << " " ;
712+ for (const auto & [name, info] : onlyUseMasters) {
713+ outFile << info. count << " " ;
712714 }
713715 outFile << ' \n ' ;
714716 outFile << " SIZE " << int (numInsts * Rratio) << ' \n ' ;
0 commit comments