Skip to content

Commit 609c8c9

Browse files
committed
equivalent tiles: corrected bug that produced bad tile swap
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent 7865d32 commit 609c8c9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

vpr/src/place/place.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,7 +1839,7 @@ static e_swap_result try_swap(float t,
18391839

18401840
// Find random equivalent type (could be of the same type as the `from` one)
18411841
if (to_block_type->num_equivalent_tiles > 0) {
1842-
int irand_block_type = std::rand() % (to_block_type->num_equivalent_tiles + 1);
1842+
int irand_block_type = vtr::irand(to_block_type->num_equivalent_tiles);
18431843

18441844
// If random index is 0 do not use an equivalent tile.
18451845
if (irand_block_type > 0) {
@@ -2265,7 +2265,11 @@ static bool find_to(t_type_ptr to_type, t_type_ptr from_type, float rlim, const
22652265
VTR_ASSERT_MSG(device_ctx.grid[to.x][to.y].width_offset == 0, "Should be at block base location");
22662266
VTR_ASSERT_MSG(device_ctx.grid[to.x][to.y].height_offset == 0, "Should be at block base location");
22672267

2268-
return true;
2268+
auto& place_ctx = g_vpr_ctx.placement();
2269+
2270+
ClusterBlockId b_from = place_ctx.grid_blocks[from.x][from.y].blocks[from.z];
2271+
2272+
return is_legal_swap_to_location(b_from, to);
22692273
}
22702274

22712275
static e_swap_result assess_swap(float delta_c, float t) {

0 commit comments

Comments
 (0)