1111#include < limits>
1212#include < memory>
1313#include < vector>
14+ #include " analytical_draw_manager.h"
1415#include " PreClusterTimingManager.h"
1516#include " analytical_solver.h"
1617#include " ap_flow_enums.h"
@@ -356,10 +357,10 @@ PartialPlacement SimPLGlobalPlacer::place() {
356357 PartialPlacement best_p_placement (ap_netlist_);
357358 double best_ub_hpwl = std::numeric_limits<double >::max ();
358359
359- # ifndef NO_GRAPHICS
360- get_draw_state_vars ()-> set_ap_partial_placement_ref (p_placement);
361- update_screen (ScreenUpdatePriority::MAJOR, " AP starts " , ANALYTICAL_PLACEMENT, nullptr );
362- # endif
360+ // Initialize graphics for analytical placement, setting the reference in
361+ // the draw state.
362+ AnalyticalDrawManager draw_manager (p_placement );
363+
363364 // Run the global placer.
364365 for (size_t i = 0 ; i < max_num_iterations_; i++) {
365366 float iter_start_time = runtime_timer.elapsed_sec ();
@@ -369,22 +370,18 @@ PartialPlacement SimPLGlobalPlacer::place() {
369370 solver_->solve (i, p_placement);
370371 float solver_end_time = runtime_timer.elapsed_sec ();
371372 double lb_hpwl = p_placement.get_hpwl (ap_netlist_);
372- #ifndef NO_GRAPHICS
373- // Per iteration analytical solve display
374- std::string iter_msg = vtr::string_fmt (" AP Iteration %zu after analytical solve" , i);
375- update_screen (ScreenUpdatePriority::MAJOR, iter_msg.c_str (), ANALYTICAL_PLACEMENT, nullptr );
376- #endif
373+
374+ // Update graphics after analytical solver
375+ draw_manager.update_graphics (" Iteration " + std::to_string (i) + " After Solver" );
377376
378377 // Run the legalizer.
379378 float legalizer_start_time = runtime_timer.elapsed_sec ();
380379 partial_legalizer_->legalize (p_placement);
381380 float legalizer_end_time = runtime_timer.elapsed_sec ();
382381 double ub_hpwl = p_placement.get_hpwl (ap_netlist_);
383- #ifndef NO_GRAPHICS
384- // Per iteration legalized display
385- iter_msg = vtr::string_fmt (" AP Iteration %zu after partial legalization" , i);
386- update_screen (ScreenUpdatePriority::MAJOR, iter_msg.c_str (), ANALYTICAL_PLACEMENT, nullptr );
387- #endif
382+
383+ // Update graphics after legalizer
384+ draw_manager.update_graphics (" Iteration " + std::to_string (i) + " After Legalizer" );
388385
389386 // Perform a timing update
390387 float timing_update_start_time = runtime_timer.elapsed_sec ();
@@ -440,8 +437,6 @@ PartialPlacement SimPLGlobalPlacer::place() {
440437
441438 if (hpwl_relative_gap < target_hpwl_relative_gap_)
442439 break ;
443-
444-
445440 }
446441
447442 // Update the setup slacks. This is performed down here (as well as being
@@ -470,13 +465,7 @@ PartialPlacement SimPLGlobalPlacer::place() {
470465 *density_manager_,
471466 pre_cluster_timing_manager_);
472467
473-
474- #ifndef NO_GRAPHICS
475- // Final display of the last iteration's placement
476- get_draw_state_vars ()->set_ap_partial_placement_ref (p_placement);
477- update_screen (ScreenUpdatePriority::MAJOR, " Global Placement Complete" , ANALYTICAL_PLACEMENT, nullptr );
478- get_draw_state_vars ()->clear_ap_partial_placement_ref ();
479- #endif
468+
480469 // Return the placement from the final iteration.
481470 return best_p_placement;
482471}
0 commit comments