diff options
author | Eddie Hung <e.hung@imperial.ac.uk> | 2018-07-24 22:20:10 -0700 |
---|---|---|
committer | Eddie Hung <e.hung@imperial.ac.uk> | 2018-07-24 22:20:10 -0700 |
commit | 9382938661613b84e3ad3155e414aaae2fa87da2 (patch) | |
tree | 107c14811cf2e91c82ee4f9ea983260ee7acea8c /common/placer1.cc | |
parent | 4920cf18fa1128758dac2ffd12bf88d194863f17 (diff) | |
parent | 32c7247785f48b2307e559a0af50d9387bda8b49 (diff) | |
download | nextpnr-9382938661613b84e3ad3155e414aaae2fa87da2.tar.gz nextpnr-9382938661613b84e3ad3155e414aaae2fa87da2.tar.bz2 nextpnr-9382938661613b84e3ad3155e414aaae2fa87da2.zip |
Merge branch 'master' into redist_slack
Diffstat (limited to 'common/placer1.cc')
-rw-r--r-- | common/placer1.cc | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/common/placer1.cc b/common/placer1.cc index 77e33f5b..b7132254 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; } @@ -411,12 +409,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; |