From 1deab29b0591dd23da0c1d5c2c4fd8190abd6920 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Mon, 1 Feb 2021 07:26:54 -0800 Subject: Moving missing empty check into initial placement loop. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- common/placer_heap.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'common/placer_heap.cc') diff --git a/common/placer_heap.cc b/common/placer_heap.cc index 9b581bb1..e14a4660 100644 --- a/common/placer_heap.cc +++ b/common/placer_heap.cc @@ -523,20 +523,29 @@ class HeAPPlacer bool placed = false; int attempt_count = 0; while (!placed) { - if (!available_bels.count(ci->type) || available_bels.at(ci->type).empty()) { - log_error("Unable to place cell '%s', no BELs remaining to implement cell type '%s'\n", - ci->name.c_str(ctx), - ci->type.c_str(ctx)); - } ++attempt_count; if (attempt_count > 25000) { log_error("Unable to find a placement location for cell '%s'\n", ci->name.c_str(ctx)); } + // Make sure this cell type is in the available BEL map at + // all. + if (!available_bels.count(ci->type)) { + log_error("Unable to place cell '%s', no BELs remaining to implement cell type '%s'\n", + ci->name.c_str(ctx), + ci->type.c_str(ctx)); + } + // Find an unused BEL from bels_for_cell_type. auto &bels_for_cell_type = available_bels.at(ci->type); BelId bel; while(true) { + if (bels_for_cell_type.empty()) { + log_error("Unable to place cell '%s', no BELs remaining to implement cell type '%s'\n", + ci->name.c_str(ctx), + ci->type.c_str(ctx)); + } + BelId candidate_bel = bels_for_cell_type.back(); bels_for_cell_type.pop_back(); if(bels_used.count(candidate_bel)) { -- cgit v1.2.3