|
14 | 14 | #include "placer_state.h"
|
15 | 15 | #include "PlacerCriticalities.h"
|
16 | 16 |
|
| 17 | + |
| 18 | +/** |
| 19 | + * @brief If the number of blocks compatible with the moving block is less than this value, |
| 20 | + * the search reagion is expanded to include all blocks in the column. It is specially useful |
| 21 | + * for IO blocks which are on the perimeter of the device. This would allow the IO blocks to |
| 22 | + * moved between top and bottom edges even when the rlim is small. |
| 23 | + */ |
| 24 | +size_t G_MIN_NUM_BLOCKS_IN_COLUMN = 3; |
| 25 | + |
17 | 26 | //f_placer_breakpoint_reached is used to stop the placer when a breakpoint is reached.
|
18 | 27 | // When this flag is true, it stops the placer after the current perturbation. Thus, when a breakpoint is reached, this flag is set to true.
|
19 | 28 | //Note: The flag is only effective if compiled with VTR_ENABLE_DEBUG_LOGGING
|
@@ -1002,26 +1011,36 @@ bool find_compatible_compressed_loc_in_range(t_logical_block_type_ptr type,
|
1002 | 1011 | //The candidates are stored in a flat_map so we can efficiently find the set of valid
|
1003 | 1012 | //candidates with upper/lower bound.
|
1004 | 1013 | const auto& block_rows = compressed_block_grid.get_column_block_map(to_loc.x, to_layer_num);
|
1005 |
| - auto y_lower_iter = block_rows.lower_bound(search_range.ymin); |
1006 |
| - if (y_lower_iter == block_rows.end()) { |
1007 |
| - continue; |
1008 |
| - } |
1009 |
| - |
1010 |
| - auto y_upper_iter = block_rows.upper_bound(search_range.ymax); |
1011 |
| - |
1012 |
| - if (y_lower_iter->first > search_range.ymin) { |
1013 |
| - //No valid blocks at this x location which are within rlim_y |
1014 |
| - // |
1015 |
| - if (type->index != 1) |
| 1014 | + auto y_lower_iter = block_rows.begin(); |
| 1015 | + auto y_upper_iter = block_rows.end(); |
| 1016 | + |
| 1017 | + if (block_rows.size() > G_MIN_NUM_BLOCKS_IN_COLUMN || search_range.is_fixed) { |
| 1018 | + y_lower_iter = block_rows.lower_bound(search_range.ymin); |
| 1019 | + if (y_lower_iter == block_rows.end()) { |
1016 | 1020 | continue;
|
1017 |
| - else { |
1018 |
| - //Fall back to allow the whole y range |
1019 |
| - y_lower_iter = block_rows.begin(); |
1020 |
| - y_upper_iter = block_rows.end(); |
1021 |
| - |
1022 |
| - search_range.ymin = y_lower_iter->first; |
1023 |
| - search_range.ymax = (y_upper_iter - 1)->first; |
1024 | 1021 | }
|
| 1022 | + y_upper_iter = block_rows.upper_bound(search_range.ymax); |
| 1023 | + |
| 1024 | + if (y_lower_iter->first > search_range.ymin) { |
| 1025 | + //No valid blocks at this x location which are within rlim_y |
| 1026 | + // |
| 1027 | + if (type->index != 1) { |
| 1028 | + continue; |
| 1029 | + } else if (!search_range.is_fixed) { |
| 1030 | + //Fall back to allow the whole y range |
| 1031 | + y_lower_iter = block_rows.begin(); |
| 1032 | + y_upper_iter = block_rows.end(); |
| 1033 | + |
| 1034 | + search_range.ymin = y_lower_iter->first; |
| 1035 | + search_range.ymax = (y_upper_iter - 1)->first; |
| 1036 | + } |
| 1037 | + } |
| 1038 | + } else { // search_range is not fixed and there are less than G_MIN_NUM_BLOCKS_IN_COLUMN blocks at this x location |
| 1039 | + y_lower_iter = block_rows.begin(); |
| 1040 | + y_upper_iter = block_rows.end(); |
| 1041 | + |
| 1042 | + search_range.ymin = y_lower_iter->first; |
| 1043 | + search_range.ymax = (y_upper_iter - 1)->first; |
1025 | 1044 | }
|
1026 | 1045 |
|
1027 | 1046 | int y_range = std::distance(y_lower_iter, y_upper_iter);
|
@@ -1176,6 +1195,7 @@ bool intersect_range_limit_with_floorplan_constraints(ClusterBlockId b_from,
|
1176 | 1195 | if (compressed_regions[0].empty()) {
|
1177 | 1196 | return false;
|
1178 | 1197 | }
|
| 1198 | + search_range.is_fixed = true; |
1179 | 1199 |
|
1180 | 1200 | Region range_reg(search_range.xmin, search_range.ymin,
|
1181 | 1201 | search_range.xmax, search_range.ymax, layer_num);
|
|
0 commit comments