aboutsummaryrefslogtreecommitdiffstats
path: root/common/placer1.cc
diff options
context:
space:
mode:
Diffstat (limited to 'common/placer1.cc')
-rw-r--r--common/placer1.cc26
1 files changed, 11 insertions, 15 deletions
diff --git a/common/placer1.cc b/common/placer1.cc
index 025c7c15..f713fb88 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -50,9 +50,7 @@ class SAPlacer
{
int num_bel_types = 0;
for (auto bel : ctx->getBels()) {
- int x, y;
- bool gb;
- ctx->estimatePosition(bel, x, y, gb);
+ Loc loc = ctx->getBelLocation(bel);
BelType type = ctx->getBelType(bel);
int type_idx;
if (bel_types.find(type) == bel_types.end()) {
@@ -63,13 +61,13 @@ class SAPlacer
}
if (int(fast_bels.size()) < type_idx + 1)
fast_bels.resize(type_idx + 1);
- if (int(fast_bels.at(type_idx).size()) < (x + 1))
- fast_bels.at(type_idx).resize(x + 1);
- if (int(fast_bels.at(type_idx).at(x).size()) < (y + 1))
- fast_bels.at(type_idx).at(x).resize(y + 1);
- max_x = std::max(max_x, x);
- max_y = std::max(max_y, y);
- fast_bels.at(type_idx).at(x).at(y).push_back(bel);
+ if (int(fast_bels.at(type_idx).size()) < (loc.x + 1))
+ fast_bels.at(type_idx).resize(loc.x + 1);
+ if (int(fast_bels.at(type_idx).at(loc.x).size()) < (loc.y + 1))
+ fast_bels.at(type_idx).at(loc.x).resize(loc.y + 1);
+ max_x = std::max(max_x, loc.x);
+ max_y = std::max(max_y, loc.y);
+ fast_bels.at(type_idx).at(loc.x).at(loc.y).push_back(bel);
}
diameter = std::max(max_x, max_y) + 1;
}
@@ -404,12 +402,10 @@ class SAPlacer
BelId random_bel_for_cell(CellInfo *cell)
{
BelType targetType = ctx->belTypeFromId(cell->type);
- int x, y;
- bool gb;
- ctx->estimatePosition(cell->bel, x, y, gb);
+ Loc curr_loc = ctx->getBelLocation(cell->bel);
while (true) {
- int nx = ctx->rng(2 * diameter + 1) + std::max(x - diameter, 0);
- int ny = ctx->rng(2 * diameter + 1) + std::max(y - diameter, 0);
+ int nx = ctx->rng(2 * diameter + 1) + std::max(curr_loc.x - diameter, 0);
+ int ny = ctx->rng(2 * diameter + 1) + std::max(curr_loc.y - diameter, 0);
int beltype_idx = bel_types.at(targetType);
if (nx >= int(fast_bels.at(beltype_idx).size()))
continue;