Skip to content

Commit 34deb5c

Browse files
make member variables of Placer private
1 parent 1e10c27 commit 34deb5c

File tree

4 files changed

+68
-17
lines changed

4 files changed

+68
-17
lines changed

vpr/src/place/place.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ void try_place(const Netlist<>& net_list,
9797
Placer placer(net_list, placer_opts, analysis_opts, noc_opts, directs, place_delay_model, cube_bb);
9898

9999
#ifndef NO_GRAPHICS
100-
if (placer.noc_cost_handler_.has_value()) {
101-
get_draw_state_vars()->set_noc_link_bandwidth_usages_ref(placer.noc_cost_handler_->get_link_bandwidth_usages());
100+
if (placer.noc_cost_handler().has_value()) {
101+
get_draw_state_vars()->set_noc_link_bandwidth_usages_ref(placer.noc_cost_handler()->get_link_bandwidth_usages());
102102
}
103103
#endif
104104

105105
const int width_fac = placer_opts.place_chan_width;
106-
init_draw_coords((float)width_fac, placer.placer_state_.blk_loc_registry());
106+
init_draw_coords((float)width_fac, placer.placer_state().blk_loc_registry());
107107

108108
placer.place();
109109

vpr/src/place/place_log_util.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ PlacementLogPrinter::PlacementLogPrinter(const Placer& placer)
1313
: placer_(placer) {}
1414

1515
void PlacementLogPrinter::print_place_status_header() const {
16-
const bool noc_enabled = placer_.noc_opts_.noc;
16+
const bool noc_enabled = placer_.noc_opts().noc;
1717

1818
VTR_LOG("\n");
1919
if (!noc_enabled) {
@@ -38,16 +38,18 @@ void PlacementLogPrinter::print_place_status_header() const {
3838
}
3939

4040
void PlacementLogPrinter::print_place_status(float elapsed_sec) const {
41-
const t_annealing_state& annealing_state = placer_.annealer_->get_annealing_state();
42-
const auto& [swap_stats, move_type_stats, placer_stats] = placer_.annealer_->get_stats();
43-
const int tot_moves = placer_.annealer_->get_total_iteration();
44-
const bool noc_enabled = placer_.noc_opts_.noc;
45-
const NocCostTerms& noc_cost_terms = placer_.costs_.noc_cost_terms;
41+
const PlacementAnnealer& annealer = placer_.annealer();
42+
const t_annealing_state& annealing_state = annealer.get_annealing_state();
43+
const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats();
44+
const int tot_moves = annealer.get_total_iteration();
4645

47-
const bool is_timing_driven = placer_.placer_opts_.place_algorithm.is_timing_driven();
48-
const float cpd = is_timing_driven ? placer_.critical_path_.delay() : std::numeric_limits<float>::quiet_NaN();
49-
const float sTNS = is_timing_driven ? placer_.timing_info_->setup_total_negative_slack() : std::numeric_limits<float>::quiet_NaN();
50-
const float sWNS = is_timing_driven ? placer_.timing_info_->setup_worst_negative_slack() : std::numeric_limits<float>::quiet_NaN();
46+
const bool noc_enabled = placer_.noc_opts().noc;
47+
const NocCostTerms& noc_cost_terms = placer_.costs().noc_cost_terms;
48+
49+
const bool is_timing_driven = placer_.placer_opts().place_algorithm.is_timing_driven();
50+
const float cpd = is_timing_driven ? placer_.critical_path().delay() : std::numeric_limits<float>::quiet_NaN();
51+
const float sTNS = is_timing_driven ? placer_.timing_info()->setup_total_negative_slack() : std::numeric_limits<float>::quiet_NaN();
52+
const float sWNS = is_timing_driven ? placer_.timing_info()->setup_worst_negative_slack() : std::numeric_limits<float>::quiet_NaN();
5153

5254
VTR_LOG(
5355
"%4zu %6.1f %7.1e "
@@ -78,7 +80,7 @@ void PlacementLogPrinter::print_place_status(float elapsed_sec) const {
7880
void PlacementLogPrinter::print_resources_utilization() const {
7981
const auto& cluster_ctx = g_vpr_ctx.clustering();
8082
const auto& device_ctx = g_vpr_ctx.device();
81-
const auto& block_locs = placer_.placer_state_.block_locs();
83+
const auto& block_locs = placer_.placer_state().block_locs();
8284

8385
size_t max_block_name = 0;
8486
size_t max_tile_name = 0;
@@ -113,8 +115,9 @@ void PlacementLogPrinter::print_resources_utilization() const {
113115
}
114116

115117
void PlacementLogPrinter::print_placement_swaps_stats() const {
116-
const auto& [swap_stats, move_type_stats, placer_stats] = placer_.annealer_->get_stats();
117-
const t_annealing_state& annealing_state = placer_.annealer_->get_annealing_state();
118+
const PlacementAnnealer& annealer = placer_.annealer();
119+
const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats();
120+
const t_annealing_state& annealing_state = annealer.get_annealing_state();
118121

119122
size_t total_swap_attempts = swap_stats.num_swap_rejected + swap_stats.num_swap_accepted + swap_stats.num_swap_aborted;
120123
VTR_ASSERT(total_swap_attempts > 0);

vpr/src/place/placer.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,3 +512,32 @@ void Placer::copy_locs_to_global_state() {
512512
get_draw_state_vars()->set_graphics_blk_loc_registry_ref(global_blk_loc_registry);
513513
#endif
514514
}
515+
516+
const PlacementAnnealer& Placer::annealer() const {
517+
return *annealer_;
518+
}
519+
520+
const t_placer_opts& Placer::placer_opts() const {
521+
return placer_opts_;
522+
}
523+
524+
const t_noc_opts& Placer::noc_opts() const {
525+
return noc_opts_;
526+
}
527+
528+
const t_placer_costs& Placer::costs() const {
529+
return costs_;
530+
}
531+
532+
const tatum::TimingPathInfo& Placer::critical_path() const {
533+
return critical_path_;
534+
}
535+
std::shared_ptr<const SetupTimingInfo> Placer::timing_info() const {
536+
return timing_info_;
537+
}
538+
const PlacerState& Placer::placer_state() const {
539+
return placer_state_;
540+
}
541+
const std::optional<NocCostHandler>& Placer::noc_cost_handler() const {
542+
return noc_cost_handler_;
543+
}

vpr/src/place/placer.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,27 @@ class Placer {
3636
*/
3737
void copy_locs_to_global_state();
3838

39+
/*
40+
* Getters
41+
*/
42+
const PlacementAnnealer& annealer() const;
43+
44+
const t_placer_opts& placer_opts() const;
45+
46+
const t_noc_opts& noc_opts() const;
47+
48+
const t_placer_costs& costs() const;
49+
50+
const tatum::TimingPathInfo& critical_path() const;
51+
52+
std::shared_ptr<const SetupTimingInfo> timing_info() const;
53+
54+
const PlacerState& placer_state() const;
55+
56+
const std::optional<NocCostHandler>& noc_cost_handler() const;
57+
3958
//TODO: make this private
40-
public:
59+
private:
4160
const t_placer_opts& placer_opts_;
4261
const t_analysis_opts& analysis_opts_;
4362
const t_noc_opts& noc_opts_;

0 commit comments

Comments
 (0)