Skip to content

Commit 82bc33d

Browse files
remove X_coord and Y_coord from feasibe_region_move_generator
1 parent 118165e commit 82bc33d

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

vpr/src/place/move_generators/feasible_region_move_generator.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,22 @@ e_create_move FeasibleRegionMoveGenerator::propose_move(t_pl_blocks_to_be_moved&
4848

4949
//from block data
5050
t_pl_loc from = block_locs[b_from].loc;
51-
auto cluster_from_type = cluster_ctx.clb_nlist.block_type(b_from);
52-
auto grid_from_type = g_vpr_ctx.device().grid.get_physical_type({from.x, from.y, from.layer});
51+
t_logical_block_type_ptr cluster_from_type = cluster_ctx.clb_nlist.block_type(b_from);
52+
t_physical_tile_type_ptr grid_from_type = g_vpr_ctx.device().grid.get_physical_type({from.x, from.y, from.layer});
5353
VTR_ASSERT(is_tile_compatible(grid_from_type, cluster_from_type));
5454

5555
/* Calculate the feasible region */
5656
t_pl_loc to;
5757
// Currently, we don't change the layer for this move
5858
to.layer = from.layer;
59-
int max_x, min_x, max_y, min_y;
6059

61-
X_coord.clear();
62-
Y_coord.clear();
60+
int max_x = std::numeric_limits<int>::min();
61+
int min_x = std::numeric_limits<int>::max();
62+
int max_y = std::numeric_limits<int>::min();
63+
int min_y = std::numeric_limits<int>::max();
64+
65+
bool found = false;
66+
6367
//For critical input nodes, calculate the x & y min-max values
6468
for (ClusterPinId pin_id : cluster_ctx.clb_nlist.block_input_pins(b_from)) {
6569
ClusterNetId net_id = cluster_ctx.clb_nlist.pin_net(pin_id);
@@ -69,28 +73,25 @@ e_create_move FeasibleRegionMoveGenerator::propose_move(t_pl_blocks_to_be_moved&
6973
int ipin = cluster_ctx.clb_nlist.pin_net_index(pin_id);
7074
if (criticalities->criticality(net_id, ipin) > placer_opts.place_crit_limit) {
7175
ClusterBlockId bnum = cluster_ctx.clb_nlist.net_driver_block(net_id);
72-
X_coord.push_back(block_locs[bnum].loc.x);
73-
Y_coord.push_back(block_locs[bnum].loc.y);
76+
const t_pl_loc& loc = block_locs[bnum].loc;
77+
min_x = std::min(min_x, loc.x);
78+
max_x = std::max(max_x, loc.x);
79+
min_y = std::min(min_y, loc.y);
80+
max_y = std::max(max_y, loc.y);
81+
found = true;
7482
}
7583
}
76-
if (!X_coord.empty()) {
77-
max_x = *(std::max_element(X_coord.begin(), X_coord.end()));
78-
min_x = *(std::min_element(X_coord.begin(), X_coord.end()));
79-
max_y = *(std::max_element(Y_coord.begin(), Y_coord.end()));
80-
min_y = *(std::min_element(Y_coord.begin(), Y_coord.end()));
81-
} else {
82-
max_x = from.x;
83-
min_x = from.x;
84-
max_y = from.y;
85-
min_y = from.y;
84+
85+
if (!found) {
86+
min_x = max_x = from.x;
87+
min_y = max_y = from.y;
8688
}
8789

8890
//Get the most critical output of the node
89-
int xt, yt;
9091
ClusterBlockId b_output = cluster_ctx.clb_nlist.net_pin_block(net_from, pin_from);
9192
t_pl_loc output_loc = block_locs[b_output].loc;
92-
xt = output_loc.x;
93-
yt = output_loc.y;
93+
int xt = output_loc.x;
94+
int yt = output_loc.y;
9495

9596
/**
9697
* @brief determine the feasible region
@@ -133,9 +134,8 @@ e_create_move FeasibleRegionMoveGenerator::propose_move(t_pl_blocks_to_be_moved&
133134

134135
// Try to find a legal location inside the feasible region
135136
if (!find_to_loc_median(cluster_from_type, from, &FR_coords, to, b_from, blk_loc_registry, rng_)) {
136-
/** If there is no legal location in the feasible region, calculate the center of the FR and try to find a legal location
137-
* in a range around this center.
138-
*/
137+
/* If there is no legal location in the feasible region, calculate the center of the FR and try to find a legal location
138+
* in a range around this center. */
139139
t_pl_loc center;
140140
center.x = (FR_coords.xmin + FR_coords.xmax) / 2;
141141
center.y = (FR_coords.ymin + FR_coords.ymax) / 2;

vpr/src/place/move_generators/feasible_region_move_generator.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,4 @@ class FeasibleRegionMoveGenerator : public MoveGenerator {
3434
float rlim,
3535
const t_placer_opts& placer_opts,
3636
const PlacerCriticalities* criticalities) override;
37-
38-
private:
39-
std::vector<int> X_coord;
40-
std::vector<int> Y_coord;
4137
};

0 commit comments

Comments
 (0)