diff options
author | Eddie Hung <eddie.hung+gitlab@gmail.com> | 2018-07-24 01:19:09 +0000 |
---|---|---|
committer | Eddie Hung <eddie.hung+gitlab@gmail.com> | 2018-07-24 01:19:09 +0000 |
commit | 30ec1cfbd7dd02578fa2a3e33612e863f01ea959 (patch) | |
tree | e77d130f96c8061374318f036856aa73d431017d /common/placer1.cc | |
parent | eeb93d6eda613c0946867118c1ff93f2462e417f (diff) | |
parent | 771edd1fda8692930e186a8913b7588d18fda710 (diff) | |
download | nextpnr-30ec1cfbd7dd02578fa2a3e33612e863f01ea959.tar.gz nextpnr-30ec1cfbd7dd02578fa2a3e33612e863f01ea959.tar.bz2 nextpnr-30ec1cfbd7dd02578fa2a3e33612e863f01ea959.zip |
Merge branch 'redist_slack' into 'redist_slack'
Update budgets during routing
See merge request SymbioticEDA/nextpnr!15
Diffstat (limited to 'common/placer1.cc')
-rw-r--r-- | common/placer1.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/placer1.cc b/common/placer1.cc index be20c072..461fc4e8 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -80,6 +80,7 @@ class SAPlacer size_t placed_cells = 0; // Initial constraints placer + ctx->lock(); for (auto &cell_entry : ctx->cells) { CellInfo *cell = cell_entry.second.get(); auto loc = cell->attrs.find(ctx->id("BEL")); @@ -118,16 +119,19 @@ class SAPlacer } std::sort(autoplaced.begin(), autoplaced.end(), [](CellInfo *a, CellInfo *b) { return a->name < b->name; }); ctx->shuffle(autoplaced); + ctx->unlock(); // Place cells randomly initially log_info("Creating initial placement for remaining %d cells.\n", int(autoplaced.size())); for (auto cell : autoplaced) { + ctx->lock(); place_initial(cell); placed_cells++; if ((placed_cells - constr_placed_cells) % 500 == 0) log_info(" initial placement placed %d/%d cells\n", int(placed_cells - constr_placed_cells), int(autoplaced.size())); + ctx->unlock(); } if ((placed_cells - constr_placed_cells) % 500 != 0) log_info(" initial placement placed %d/%d cells\n", int(placed_cells - constr_placed_cells), @@ -136,6 +140,7 @@ class SAPlacer log_info("Running simulated annealing placer.\n"); // Calculate metric after initial placement + ctx->lock(); curr_metric = 0; curr_tns = 0; for (auto &net : ctx->nets) { @@ -143,6 +148,7 @@ class SAPlacer metrics[net.first] = wl; curr_metric += wl; } + ctx->unlock(); int n_no_progress = 0; wirelen_t min_metric = curr_metric; @@ -185,6 +191,7 @@ class SAPlacer if (temp <= 1e-3 && n_no_progress >= 5) { if (iter % 5 != 0) log_info(" at iteration #%d: temp = %f, cost = %f\n", iter, temp, double(curr_metric)); + ctx->unlock(); break; } @@ -242,8 +249,12 @@ class SAPlacer metrics[net.first] = wl; curr_metric += wl; } + + // Let the UI show visualization updates. + ctx->yield(); } // Final post-pacement validitiy check + ctx->lock(); for (auto bel : ctx->getBels()) { IdString cell = ctx->getBoundBelCell(bel); if (!ctx->isBelLocationValid(bel)) { @@ -261,6 +272,7 @@ class SAPlacer } } } + ctx->unlock(); return true; } @@ -446,7 +458,9 @@ bool placer1(Context *ctx) placer.place(); log_info("Checksum: 0x%08x\n", ctx->checksum()); #ifndef NDEBUG + ctx->lock(); ctx->check(); + ctx->unlock(); #endif return true; } catch (log_execution_error_exception) { |