Skip to content

Commit 5288a17

Browse files
authored
Merge pull request #2227 from hermanschmit/zerodiv
This is a fix to avoid division by zero in initial_placement.
2 parents 3bd9be1 + bffc826 commit 5288a17

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vpr/src/place/initial_placement.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,10 @@ static std::vector<ClusterBlockId> find_centroid_loc(t_pl_macro pl_macro, t_pl_l
400400
}
401401

402402
//Calculate the centroid location
403-
centroid.x = acc_x / acc_weight;
404-
centroid.y = acc_y / acc_weight;
403+
if (acc_weight > 0) {
404+
centroid.x = acc_x / acc_weight;
405+
centroid.y = acc_y / acc_weight;
406+
}
405407

406408
return connected_blocks_to_update;
407409
}

0 commit comments

Comments
 (0)