place_sa: Make placement independant of unordered_map ordering

Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
David Shah 2018-06-17 13:24:42 +02:00
parent 1b077320dc
commit 153b800f6a

View File

@ -306,15 +306,19 @@ void place_design_sa(Design *design)
rnd_state rnd; rnd_state rnd;
rnd.state = 1; rnd.state = 1;
std::vector<CellInfo *> autoplaced; std::vector<CellInfo *> autoplaced;
// Place cells randomly initially // Sort to-place cells for deterministic initial placement
for (auto cell : design->cells) { for (auto cell : design->cells) {
CellInfo *ci = cell.second; CellInfo *ci = cell.second;
if (ci->bel == BelId()) { if (ci->bel == BelId()) {
place_initial(design, ci, rnd);
autoplaced.push_back(cell.second); 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 // Build up a fast position/type to Bel lookup table
int max_x = 0, max_y = 0; int max_x = 0, max_y = 0;