Skip to content

Commit 93af9f1

Browse files
authored
Merge pull request #1601 from acomodi/fix-divide-by-zero
rr_graph: avoide div-by-zero issues while getting the delay norm fac
2 parents 18b7ca6 + b6b5332 commit 93af9f1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

vpr/src/route/rr_graph_indexed_data.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ static float get_delay_normalization_fac() {
278278
Tdel_num += 1;
279279
}
280280

281+
if (Tdel_num == 0) {
282+
VTR_LOG_WARN("No valid cost index was found to get the delay normalization factor. Setting delay normalization factor to 1e-9 (1 ns)\n");
283+
return 1e-9;
284+
}
285+
281286
float delay_norm_fac = Tdel_sum / Tdel_num;
282287

283288
if (getEchoEnabled() && isEchoFileEnabled(E_ECHO_RR_GRAPH_INDEXED_DATA)) {

0 commit comments

Comments
 (0)