@@ -852,6 +852,16 @@ bool find_to_loc_centroid(t_logical_block_type_ptr blk_type,
852852 centroid,
853853 num_layers);
854854
855+ // If no compressed location can be found on this layer, return false.
856+ // TODO: Maybe search in the layers above or below.
857+ const t_physical_tile_loc& compressed_loc_on_layer = centroid_compressed_loc[to_layer_num];
858+ if (compressed_loc_on_layer.x == OPEN || compressed_loc_on_layer.y == OPEN ) {
859+ VTR_ASSERT_MSG (compressed_loc_on_layer.x == OPEN && compressed_loc_on_layer.y == OPEN ,
860+ " When searching for a compressed location, and a location cannot be found "
861+ " both x and y should be OPEN." );
862+ return false ;
863+ }
864+
855865 // Determine the valid compressed grid location ranges
856866 int delta_cx;
857867 t_bb search_range;
@@ -860,12 +870,12 @@ bool find_to_loc_centroid(t_logical_block_type_ptr blk_type,
860870 // If not --> search around the current location of the block but in the direction of the center location that the move proposed
861871 if (range_limiters.original_rlim > 0.15 * range_limiters.first_rlim ) {
862872 search_range = get_compressed_grid_target_search_range (compressed_block_grid,
863- centroid_compressed_loc[to_layer_num] ,
873+ compressed_loc_on_layer ,
864874 std::min<float >(range_limiters.original_rlim , range_limiters.dm_rlim ));
865875 } else {
866876 search_range = get_compressed_grid_bounded_search_range (compressed_block_grid,
867877 from_compressed_loc[to_layer_num],
868- centroid_compressed_loc[to_layer_num] ,
878+ compressed_loc_on_layer ,
869879 std::min<float >(range_limiters.original_rlim , range_limiters.dm_rlim ));
870880 }
871881 delta_cx = search_range.xmax - search_range.xmin ;
0 commit comments