@@ -510,6 +510,7 @@ static int get_blk_type_first_loc(t_pl_loc& loc, t_pl_macro pl_macro, std::vecto
510510static std::vector<t_grid_empty_locs_block_type> init_blk_types_empty_locations (int block_type_index) {
511511 const auto & compressed_block_grid = g_vpr_ctx.placement ().compressed_block_grids [block_type_index];
512512 const auto & device_ctx = g_vpr_ctx.device ();
513+ const auto & grid = device_ctx.grid ;
513514
514515 // create a vector to store all columns containing block_type_index with their lowest y and number of remaining blocks
515516 std::vector<t_grid_empty_locs_block_type> block_type_empty_locs;
@@ -525,9 +526,12 @@ static std::vector<t_grid_empty_locs_block_type> init_blk_types_empty_locations(
525526 // traverse all column and store their empty locations in block_type_empty_locs
526527 for (int x_loc = min_cx; x_loc <= max_cx; x_loc++) {
527528 t_grid_empty_locs_block_type empty_loc;
528- empty_loc.first_avail_loc .x = compressed_block_grid.grid [x_loc].at (0 ).x ;
529- empty_loc.first_avail_loc .y = compressed_block_grid.grid [x_loc].at (0 ).y ;
530- empty_loc.first_avail_loc .sub_tile = 0 ;
529+ auto first_avail_loc = compressed_block_grid.grid [x_loc].begin ()->second ;
530+ empty_loc.first_avail_loc .x = first_avail_loc.x ;
531+ empty_loc.first_avail_loc .y = first_avail_loc.y ;
532+ const auto & physical_type = grid[first_avail_loc.x ][first_avail_loc.y ].type ;
533+ const auto & compatible_sub_tiles = compressed_block_grid.compatible_sub_tiles_for_tile .at (physical_type->index );
534+ empty_loc.first_avail_loc .sub_tile = *std::min_element (compatible_sub_tiles.begin (), compatible_sub_tiles.end ());
531535 empty_loc.num_of_empty_locs_in_y_axis = compressed_block_grid.grid [x_loc].size ();
532536 block_type_empty_locs.push_back (empty_loc);
533537 }
0 commit comments