@@ -308,7 +308,7 @@ void NesterovPlace::updateIterGraphics(
308308
309309 if (npVars_.debug_generate_images && iter == 0 ) {
310310 std::string gif_path = fmt::format (" {}/placement.gif" , reports_dir);
311- graphics_->gifStart (gif_path);
311+ placement_gif_key_ = graphics_->gifStart (gif_path);
312312 }
313313
314314 if (npVars_.debug_generate_images && iter % 10 == 0 ) {
@@ -325,7 +325,8 @@ void NesterovPlace::updateIterGraphics(
325325 std::string label_name = fmt::format (" frame_label_{}" , iter);
326326
327327 graphics_->addFrameLabel (bbox, label, label_name);
328- graphics_->gifAddFrame (region, width_px, dbu_per_pixel, delay);
328+ graphics_->gifAddFrame (
329+ placement_gif_key_, region, width_px, dbu_per_pixel, delay);
329330 graphics_->deleteLabel (label_name);
330331 }
331332
@@ -747,10 +748,35 @@ void NesterovPlace::runRoutability(int iter,
747748 label,
748749 /* select_buffers = */ false ,
749750 " Heat Maps/Estimated Congestion (RUDY)" );
751+
752+ odb::Rect region;
753+ int width_px = 500 ;
754+ odb::Rect bbox = pbc_->db ()->getChip ()->getBlock ()->getBBox ()->getBox ();
755+ int max_dim = std::max (bbox.dx (), bbox.dy ());
756+ double dbu_per_pixel = static_cast <double >(max_dim) / 1000.0 ;
757+ int delay = 20 ;
758+ std::string label_name = fmt::format (" frame_label_routability_{}" , iter);
759+
760+ if (routability_gif_key_ == -1 ) {
761+ log_->report (" start routability gif at iter {}" , iter);
762+ std::string gif_path
763+ = fmt::format (" {}/routability.gif" , routability_driven_dir);
764+ gif_path = fmt::format (" {}/routability.gif" , routability_driven_dir);
765+ routability_gif_key_ = graphics_->gifStart (gif_path);
766+ }
767+
768+ graphics_->addFrameLabel (bbox, label, label_name);
769+
770+ graphics_->setDisplayControl (" Heat Maps/Estimated Congestion (RUDY)" ,
771+ true );
772+ graphics_->gifAddFrame (
773+ routability_gif_key_, region, width_px, dbu_per_pixel, delay);
774+ graphics_->setDisplayControl (" Heat Maps/Estimated Congestion (RUDY)" ,
775+ false );
776+
777+ graphics_->deleteLabel (label_name);
750778 }
751779
752- log_->report (" call routability with average_overflow_unscaled_: {:.3f}" ,
753- average_overflow_unscaled_);
754780 // recover the densityPenalty values
755781 // if further routability-driven is needed
756782 std::pair<bool , bool > result
@@ -799,6 +825,11 @@ void NesterovPlace::runRoutability(int iter,
799825 }
800826
801827 if (!is_routability_need_) {
828+ if (graphics_ && graphics_->enabled () && npVars_.debug_generate_images
829+ && routability_gif_key_ != -1 ) {
830+ graphics_->gifEnd (routability_gif_key_);
831+ routability_gif_key_ = -1 ;
832+ }
802833 for (auto & nb : nbVec_) {
803834 end_routability_area += nb->getNesterovInstsArea ();
804835 }
@@ -818,7 +849,7 @@ bool NesterovPlace::isConverged(int gpl_iter_count,
818849
819850 if (num_region_converge == nbVec_.size ()) {
820851 if (graphics_ && graphics_->enabled () && npVars_.debug_generate_images ) {
821- graphics_->gifEnd ();
852+ graphics_->gifEnd (placement_gif_key_ );
822853 }
823854 return true ;
824855 }
0 commit comments