Skip to content

Commit 19885db

Browse files
avoid a division by zero when the timing cost is zero
1 parent a2277d1 commit 19885db

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

vpr/src/place/placer.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,17 @@ Placer::Placer(const Netlist<>& net_list,
118118

119119
// Gets initial cost and loads bounding boxes.
120120
costs_.bb_cost = net_cost_handler_.comp_bb_cost(e_cost_methods::NORMAL).first;
121-
costs_.bb_cost_norm = 1 / costs_.bb_cost;
122121

123122
if (placer_opts.place_algorithm.is_timing_driven()) {
124123
alloc_and_init_timing_objects_(net_list, analysis_opts);
125124
} else {
126125
VTR_ASSERT(placer_opts.place_algorithm == e_place_algorithm::BOUNDING_BOX_PLACE);
127-
// Timing cost and normalization factors are not used
128-
constexpr double INVALID_COST = std::numeric_limits<double>::quiet_NaN();
129-
costs_.timing_cost = INVALID_COST;
130-
costs_.timing_cost_norm = INVALID_COST;
126+
// Timing cost is not used
127+
costs_.timing_cost = std::numeric_limits<double>::quiet_NaN();
131128
}
132129

130+
costs_.update_norm_factors();
131+
133132
if (noc_opts.noc) {
134133
VTR_ASSERT(noc_cost_handler_.has_value());
135134

@@ -215,8 +214,6 @@ void Placer::alloc_and_init_timing_objects_(const Netlist<>& net_list,
215214
write_setup_timing_graph_dot(getEchoFileName(E_ECHO_INITIAL_PLACEMENT_TIMING_GRAPH) + std::string(".dot"),
216215
*timing_info_, debug_tnode);
217216
}
218-
219-
costs_.timing_cost_norm = 1 / costs_.timing_cost;
220217
}
221218

222219
void Placer::check_place_() {

0 commit comments

Comments
 (0)