diff options
author | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-01-29 11:11:05 -0800 |
---|---|---|
committer | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-02-02 07:34:56 -0800 |
commit | 8d9390fc460bf98932afa5ef8362f932b48cf744 (patch) | |
tree | 537cb3d7ed9bf5e75fb035a5c91d26857c729b21 /common/placer1.cc | |
parent | 16394d3158f6dc608f8fcbbcac96f851824915bd (diff) | |
download | nextpnr-8d9390fc460bf98932afa5ef8362f932b48cf744.tar.gz nextpnr-8d9390fc460bf98932afa5ef8362f932b48cf744.tar.bz2 nextpnr-8d9390fc460bf98932afa5ef8362f932b48cf744.zip |
Fix regression in use of FastBels.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'common/placer1.cc')
-rw-r--r-- | common/placer1.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/common/placer1.cc b/common/placer1.cc index e2c3dd22..2d63ea42 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -76,7 +76,7 @@ class SAPlacer }; public: - SAPlacer(Context *ctx, Placer1Cfg cfg) : ctx(ctx), fast_bels(ctx, cfg.minBelsForGridPick), cfg(cfg) + SAPlacer(Context *ctx, Placer1Cfg cfg) : ctx(ctx), fast_bels(ctx, /*check_bel_available=*/false, cfg.minBelsForGridPick), cfg(cfg) { for (auto bel : ctx->getBels()) { Loc loc = ctx->getBelLocation(bel); @@ -85,6 +85,16 @@ class SAPlacer } diameter = std::max(max_x, max_y) + 1; + std::unordered_set<IdString> cell_types_in_use; + for (auto cell : sorted(ctx->cells)) { + IdString cell_type = cell.second->type; + cell_types_in_use.insert(cell_type); + } + + for(auto cell_type : cell_types_in_use) { + fast_bels.addCellType(cell_type); + } + net_bounds.resize(ctx->nets.size()); net_arc_tcost.resize(ctx->nets.size()); old_udata.reserve(ctx->nets.size()); @@ -711,11 +721,12 @@ class SAPlacer curr_loc.y = std::min(region_bounds[cell->region->name].y1, curr_loc.y); } + FastBels::FastBelsData *bel_data; + auto type_cnt = fast_bels.getBelsForCellType(targetType, &bel_data); + while (true) { int nx = ctx->rng(2 * dx + 1) + std::max(curr_loc.x - dx, 0); int ny = ctx->rng(2 * dy + 1) + std::max(curr_loc.y - dy, 0); - FastBels::FastBelsData *bel_data; - auto type_cnt = fast_bels.getBelsForCellType(targetType, &bel_data); if (cfg.minBelsForGridPick >= 0 && type_cnt < cfg.minBelsForGridPick) nx = ny = 0; if (nx >= int(bel_data->size())) |