@@ -278,7 +278,7 @@ void PartitionMgr::BuildTimingPath(int& Dmax, int& MDmax)
278278
279279 int ff_max = 0 ;
280280 int mac_max = 0 ;
281- for (auto path : pathDepthMap) {
281+ for (const auto & path : pathDepthMap) {
282282 auto inst = block->findInst ((path.first ).c_str ());
283283 if (inst) {
284284 if (inst->getMaster ()->isBlock ()) {
@@ -342,9 +342,10 @@ void PartitionMgr::getRents(float& Rratio, float& p, float& q)
342342 }
343343}
344344
345- bool PartitionMgr::partitionCluster (std::shared_ptr<TritonPart> triton_part,
346- ModuleMgr& modMgr,
347- SharedClusterVector& cv)
345+ bool PartitionMgr::partitionCluster (
346+ const std::shared_ptr<TritonPart>& triton_part,
347+ ModuleMgr& modMgr,
348+ SharedClusterVector& cv)
348349{
349350 int MIN_GATE_NUM_PER_CLUSTER = 100 ;
350351 bool flag = true ;
@@ -396,11 +397,10 @@ bool PartitionMgr::partitionCluster(std::shared_ptr<TritonPart> triton_part,
396397
397398 if (Tvect.size () > 1 ) {
398399 double sumSqrtT = 0.0 ;
399- for (auto itr = Tvect.begin (); itr != Tvect.end (); ++itr) {
400- double t = *itr;
400+ for (const double t : Tvect) {
401401 sumSqrtT += pow ((t - avgT), 2 );
402402 }
403- stdevT = sqrt (double ( sumSqrtT) / count);
403+ stdevT = sqrt (sumSqrtT / count);
404404 }
405405
406406 if (avgInsts >= 1 && avgT >= 1 ) {
@@ -417,8 +417,8 @@ bool PartitionMgr::partitionCluster(std::shared_ptr<TritonPart> triton_part,
417417 return flag;
418418}
419419
420- void PartitionMgr::Partitioning (std::shared_ptr<TritonPart> triton_part,
421- std::shared_ptr<Cluster> cluster,
420+ void PartitionMgr::Partitioning (const std::shared_ptr<TritonPart>& triton_part,
421+ const std::shared_ptr<Cluster>& cluster,
422422 SharedClusterVector& resultCV)
423423{
424424 std::vector<odb::dbInst*> insts;
@@ -534,7 +534,7 @@ void PartitionMgr::Partitioning(std::shared_ptr<TritonPart> triton_part,
534534}
535535
536536int PartitionMgr::getClusterIONum (std::vector<bool >& inside,
537- std::shared_ptr<Cluster> cluster)
537+ const std::shared_ptr<Cluster>& cluster)
538538{
539539 std::vector<odb::dbInst*> cInsts = cluster->getInsts ();
540540 std::unordered_set<odb::dbNet*> cNets;
@@ -589,11 +589,12 @@ void PartitionMgr::linCurvFit(ModuleMgr& modMgr,
589589 double * y = new double [n];
590590
591591 auto modules = modMgr.getModules ();
592- std::sort (modules.begin (),
593- modules.end (),
594- [](std::shared_ptr<Module> m1, std::shared_ptr<Module> m2) {
595- return m1->getAvgInsts () < m2->getAvgInsts ();
596- });
592+ std::sort (
593+ modules.begin (),
594+ modules.end (),
595+ [](const std::shared_ptr<Module>& m1, const std::shared_ptr<Module>& m2) {
596+ return m1->getAvgInsts () < m2->getAvgInsts ();
597+ });
597598
598599 double b = log (modules[n - 1 ]->getAvgK ());
599600 for (int i = 0 ; i < n; i++) {
@@ -641,11 +642,10 @@ std::tuple<double, double, double> PartitionMgr::fitRent(double* x,
641642 double newDev = sqrt (sumsq / n);
642643 if (newDev > oldDev) {
643644 break ;
644- } else {
645- oldDev = newDev;
646- bestN = n;
647- bestRent = rentP;
648645 }
646+ oldDev = newDev;
647+ bestN = n;
648+ bestRent = rentP;
649649 }
650650 double Rratio;
651651 if (bestN == totPoints) {
@@ -716,35 +716,35 @@ void PartitionMgr::writeFile(
716716 exit (0 );
717717 }
718718
719- outFile << " LIBRARY" << std::endl ;
720- outFile << " NAME lib" << std::endl ;
719+ outFile << " LIBRARY\n " ;
720+ outFile << " NAME lib\n " ;
721721
722722 // unordered_map<string, int> --> cellName / isMacro
723723 for (const auto & it : onlyUseMasters) {
724724 if (!it.second .second ) {
725- outFile << " STD_CELL " << it.first << std::endl ;
725+ outFile << " STD_CELL " << it.first << ' \n ' ;
726726 } else {
727- outFile << " MACRO_CELL " << it.first << std::endl ;
727+ outFile << " MACRO_CELL " << it.first << ' \n ' ;
728728 }
729729 }
730- outFile << std::endl ;
730+ outFile << ' \n ' ;
731731
732- outFile << " CIRCUIT" << std::endl ;
733- outFile << " NAME " << top_name << std::endl ;
734- outFile << " LIBRARIES lib" << std::endl ;
732+ outFile << " CIRCUIT\n " ;
733+ outFile << " NAME " << top_name << ' \n ' ;
734+ outFile << " LIBRARIES lib" << ' \n ' ;
735735 outFile << " DISTRIBUTION " ;
736736 for (const auto & it : onlyUseMasters) {
737737 outFile << it.second .first << " " ;
738738 }
739- outFile << std::endl ;
740- outFile << " SIZE " << int (numInsts * Rratio) << std::endl ;
741- outFile << " p " << p << std::endl ;
742- outFile << " q " << q << std::endl ;
743- outFile << " END" << std::endl ;
744- outFile << " SIZE " << numInsts << std::endl ;
745- outFile << " I " << numPIs << std::endl ;
746- outFile << " O " << numPOs << std::endl ;
747- outFile << " END" << std::endl ;
739+ outFile << ' \n ' ;
740+ outFile << " SIZE " << int (numInsts * Rratio) << ' \n ' ;
741+ outFile << " p " << p << ' \n ' ;
742+ outFile << " q " << q << ' \n ' ;
743+ outFile << " END\n " ;
744+ outFile << " SIZE " << numInsts << ' \n ' ;
745+ outFile << " I " << numPIs << ' \n ' ;
746+ outFile << " O " << numPOs << ' \n ' ;
747+ outFile << " END\n " ;
748748 outFile.close ();
749749}
750750
0 commit comments