@@ -260,6 +260,33 @@ void RouteBase::resetRoutabilityResources()
260260 inflatedAreaDelta_ = 0 ;
261261}
262262
263+ void RouteBase::revertToMinCongestion ()
264+ {
265+ log_->info (GPL,
266+ 55 ,
267+ " Reverting inflation values and target density from the "
268+ " iteration with "
269+ " minimum observed routing congestion." );
270+ log_->info (
271+ GPL, 56 , " Minimum observed routing congestion: {:.4f}" , minRc_);
272+ log_->info (GPL,
273+ 57 ,
274+ " Target density at minimum routing congestion:" );
275+
276+ // revert
277+ nbc_->revertGCellSizeToMinRc ();
278+ for (auto & nb : nbVec_) {
279+ log_->info (GPL,
280+ 58 ,
281+ " \t {}\t : {:.4f}" ,
282+ nb->group ()->getName (), minRcTargetDensity_);
283+ nb->setTargetDensity (minRcTargetDensity_);
284+ nb->restoreRemovedFillers ();
285+ nb->updateDensitySize ();
286+ }
287+ resetRoutabilityResources ();
288+ }
289+
263290void RouteBase::init ()
264291{
265292 // tg_ init
@@ -513,6 +540,15 @@ std::pair<bool, bool> RouteBase::routability(
513540 int routability_driven_revert_count)
514541{
515542 increaseCounter ();
543+ if (routability_driven_revert_count >= max_routability_revert_) {
544+ log_->info (GPL,
545+ 91 ,
546+ " Routability mode reached the maximum allowed reverts {}" ,
547+ routability_driven_revert_count);
548+
549+ revertToMinCongestion ();
550+ return std::make_pair (false , true );
551+ }
516552
517553 // create Tile Grid
518554 std::unique_ptr<TileGrid> tg (new TileGrid ());
@@ -564,6 +600,20 @@ std::pair<bool, bool> RouteBase::routability(
564600 curRc,
565601 minRc_,
566602 min_RC_violated_cnt_);
603+
604+ // rc not improvement detection -- (not improved the RC values 3 times in a
605+ // row)
606+ if (min_RC_violated_cnt_ >= max_routability_no_improvement_) {
607+ log_->info (GPL,
608+ 54 ,
609+ " No improvement in routing congestion for {} consecutive "
610+ " iterations (limit is {})." ,
611+ min_RC_violated_cnt_,
612+ max_routability_no_improvement_);
613+
614+ revertToMinCongestion ();
615+ return std::make_pair (false , true );
616+ }
567617 }
568618
569619 // set inflated ratio
@@ -664,60 +714,15 @@ std::pair<bool, bool> RouteBase::routability(
664714
665715 nbVec_[0 ]->cutFillerCells (inflatedAreaDelta_);
666716
667- //
668- // max density detection or,
669- // rc not improvement detection -- (not improved the RC values 3 times in a
670- // row)
671- //
672- bool is_max_density_exceeded
673- = nbVec_[0 ]->getTargetDensity () > rbVars_.maxDensity ;
674- bool congestion_not_improving
675- = min_RC_violated_cnt_ >= max_routability_no_improvement_;
676- bool is_max_routability_revert
677- = routability_driven_revert_count >= max_routability_revert_;
678-
679- if (is_max_density_exceeded || congestion_not_improving
680- || is_max_routability_revert) {
681- if (is_max_density_exceeded) {
682- log_->info (GPL,
683- 53 ,
684- " Target density {:.4f} exceeds the maximum allowed {:.4f}." ,
685- nbVec_[0 ]->getTargetDensity (),
686- rbVars_.maxDensity );
687- }
688- if (congestion_not_improving) {
689- log_->info (GPL,
690- 54 ,
691- " No improvement in routing congestion for {} consecutive "
692- " iterations (limit is {})." ,
693- min_RC_violated_cnt_,
694- max_routability_no_improvement_);
695- }
696- if (is_max_routability_revert) {
697- log_->info (GPL,
698- 91 ,
699- " Routability mode reached the maximum allowed reverts {}" ,
700- routability_driven_revert_count);
701- }
702-
703- log_->info (
704- GPL,
705- 55 ,
706- " Reverting inflation values and target density from the iteration with "
707- " minimum observed routing congestion." );
708-
709- log_->info (GPL, 56 , " Minimum observed routing congestion: {:.4f}" , minRc_);
717+ // max density detection
718+ if (nbVec_[0 ]->getTargetDensity () > rbVars_.maxDensity ) {
710719 log_->info (GPL,
711- 57 ,
712- " Target density at minimum routing congestion: {:.4f}" ,
713- minRcTargetDensity_);
714-
715- nbVec_[0 ]->setTargetDensity (minRcTargetDensity_);
716- nbc_->revertGCellSizeToMinRc ();
717- nbVec_[0 ]->restoreRemovedFillers ();
718- nbVec_[0 ]->updateDensitySize ();
719- resetRoutabilityResources ();
720+ 53 ,
721+ " Target density {:.4f} exceeds the maximum allowed {:.4f}." ,
722+ nbVec_[0 ]->getTargetDensity (),
723+ rbVars_.maxDensity );
720724
725+ revertToMinCongestion ();
721726 return std::make_pair (false , true );
722727 }
723728
0 commit comments