diff options
author | David Shah <davey1576@gmail.com> | 2018-06-17 13:24:42 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-17 13:24:42 +0200 |
commit | 153b800f6a5da9af277e64b4cd4aee1c10ca0a01 (patch) | |
tree | b63cd3783367beab4cacba8060582aa2ad40272a | |
parent | 1b077320dc63b4dc1ecd1e9310dc80d89492d113 (diff) | |
download | nextpnr-153b800f6a5da9af277e64b4cd4aee1c10ca0a01.tar.gz nextpnr-153b800f6a5da9af277e64b4cd4aee1c10ca0a01.tar.bz2 nextpnr-153b800f6a5da9af277e64b4cd4aee1c10ca0a01.zip |
place_sa: Make placement independant of unordered_map ordering
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r-- | common/place_sa.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common/place_sa.cc b/common/place_sa.cc index 79700d3f..22e750c2 100644 --- a/common/place_sa.cc +++ b/common/place_sa.cc @@ -306,15 +306,19 @@ void place_design_sa(Design *design) rnd_state rnd; rnd.state = 1; std::vector<CellInfo *> autoplaced; - // Place cells randomly initially + // Sort to-place cells for deterministic initial placement for (auto cell : design->cells) { CellInfo *ci = cell.second; if (ci->bel == BelId()) { - place_initial(design, ci, rnd); autoplaced.push_back(cell.second); - placed_cells++; } - // log_info("placed %d/%d\n", int(placed_cells), int(total_cells)); + } + std::sort(autoplaced.begin(), autoplaced.end(), + [](CellInfo *a, CellInfo *b) { return a->name < b->name; }); + // Place cells randomly initially + for (auto cell : autoplaced) { + place_initial(design, cell, rnd); + placed_cells++; } // Build up a fast position/type to Bel lookup table int max_x = 0, max_y = 0; |