aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorEddie Hung <eddieh@ece.ubc.ca>2018-07-28 12:51:37 -0700
committerEddie Hung <eddieh@ece.ubc.ca>2018-07-28 12:51:37 -0700
commit0eaa92bd6a160696c2f221501d610c99d9231bef (patch)
tree6f21160deed301364cd866adf9d8dd2244e7c995 /common
parente0517caf1aeb520733edb49f13b4ef61923d41f1 (diff)
parent95ac8386542af257e487e2dbe8ad6cfe6e848a21 (diff)
downloadnextpnr-0eaa92bd6a160696c2f221501d610c99d9231bef.tar.gz
nextpnr-0eaa92bd6a160696c2f221501d610c99d9231bef.tar.bz2
nextpnr-0eaa92bd6a160696c2f221501d610c99d9231bef.zip
Merge remote-tracking branch 'origin/master' into redist_slack
Diffstat (limited to 'common')
-rw-r--r--common/nextpnr.h5
-rw-r--r--common/placer1.cc11
2 files changed, 9 insertions, 7 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h
index c4c05ae0..38a313fd 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -204,6 +204,11 @@ struct DecalXY
{
DecalId decal;
float x = 0, y = 0;
+
+ bool operator==(const DecalXY &other) const
+ {
+ return (decal == other.decal && x == other.x && y == other.y);
+ }
};
struct BelPin
diff --git a/common/placer1.cc b/common/placer1.cc
index 99ae6765..d0771e5c 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -75,10 +75,10 @@ class SAPlacer
bool place()
{
log_break();
+ ctx->lock();
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"));
@@ -112,6 +112,7 @@ class SAPlacer
}
int constr_placed_cells = placed_cells;
log_info("Placed %d cells based on constraints.\n", int(placed_cells));
+ ctx->yield();
// Sort to-place cells for deterministic initial placement
std::vector<CellInfo *> autoplaced;
@@ -123,28 +124,25 @@ 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),
int(autoplaced.size()));
+ ctx->yield();
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) {
@@ -152,7 +150,6 @@ class SAPlacer
metrics[net.first] = wl;
curr_metric += wl;
}
- ctx->unlock();
int n_no_progress = 0;
wirelen_t min_metric = curr_metric;
@@ -257,7 +254,7 @@ class SAPlacer
ctx->yield();
}
// Final post-pacement validitiy check
- ctx->lock();
+ ctx->yield();
for (auto bel : ctx->getBels()) {
IdString cell = ctx->getBoundBelCell(bel);
if (!ctx->isBelLocationValid(bel)) {