Skip to content

Commit c320b49

Browse files
committed
This is a fix to avoid division by zero in initial_placement.
1 parent 76b8da2 commit c320b49

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
@@ -396,8 +396,10 @@ static std::vector<ClusterBlockId> find_centroid_loc(t_pl_macro pl_macro, t_pl_l
396396
}
397397

398398
//Calculate the centroid location
399-
centroid.x = acc_x / acc_weight;
400-
centroid.y = acc_y / acc_weight;
399+
if (acc_weight > 0) {
400+
centroid.x = acc_x / acc_weight;
401+
centroid.y = acc_y / acc_weight;
402+
}
401403

402404
return connected_blocks_to_update;
403405
}

0 commit comments

Comments
 (0)