Skip to content

Add in-class initializers for t_placer_costs to fix coverity scan defect #1557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions vpr/src/place/place_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ void t_annealing_state::update_move_lim(float success_target, float success_rate
move_lim = std::max(move_lim, 1);
}

///@brief Clear all data fields.
void t_placer_statistics::reset() {
av_cost = 0.;
av_bb_cost = 0.;
Expand All @@ -288,6 +289,7 @@ void t_placer_statistics::reset() {
std_dev = 0.;
}

///@brief Calculate placer success rate and cost std_dev for this iteration.
void t_placer_statistics::single_swap_update(const t_placer_costs& costs) {
success_sum++;
av_cost += costs.cost;
Expand All @@ -296,6 +298,7 @@ void t_placer_statistics::single_swap_update(const t_placer_costs& costs) {
sum_of_squares += (costs.cost) * (costs.cost);
}

///@brief Update stats when a single swap move has been accepted.
void t_placer_statistics::calc_iteration_stats(const t_placer_costs& costs, int move_lim) {
if (success_sum == 0) {
av_cost = costs.cost;
Expand Down
10 changes: 5 additions & 5 deletions vpr/src/place/place_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
*/
class t_placer_costs {
public: //members
double cost;
double bb_cost;
double timing_cost;
double bb_cost_norm;
double timing_cost_norm;
double cost = 0.;
double bb_cost = 0.;
double timing_cost = 0.;
double bb_cost_norm = 0.;
double timing_cost_norm = 0.;

public: //Constructor
t_placer_costs(t_place_algorithm algo)
Expand Down