From 153b800f6a5da9af277e64b4cd4aee1c10ca0a01 Mon Sep 17 00:00:00 2001 From: David Shah Date: Sun, 17 Jun 2018 13:24:42 +0200 Subject: [PATCH] place_sa: Make placement independant of unordered_map ordering Signed-off-by: David Shah --- common/place_sa.cc | 12 ++++++++---- 1 file 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 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;