Placer : Emit non-fatal error messages before ending the program

This commit is contained in:
Adrien Prost-Boucle 2024-09-24 10:02:47 +02:00
parent 320f20b691
commit ee573757e2

View File

@ -313,25 +313,31 @@ class HeAPPlacer
BelId bel; BelId bel;
PlaceStrength strength; PlaceStrength strength;
std::tie(cell, bel, strength) = sc; std::tie(cell, bel, strength) = sc;
// In case no bel was found, emit a warning instead of continuing to a crash // Just skip unbound cells here, these errors are handled just after
// This helps to investigate and to devise a workaround in user design if (bel == BelId())
if (bel == BelId()) {
log_warning("No bel found to bind cell '%s' of type '%s'\n", cell->name.c_str(ctx), cell->type.c_str(ctx));
continue; continue;
}
ctx->bindBel(bel, cell, strength); ctx->bindBel(bel, cell, strength);
} }
// Find and display all errors to help in finding the root cause of issues
unsigned num_errors = 0;
for (auto &cell : ctx->cells) { for (auto &cell : ctx->cells) {
if (cell.second->isPseudo()) if (cell.second->isPseudo())
continue; continue;
if (cell.second->bel == BelId()) if (cell.second->bel == BelId()) {
log_error("Found unbound cell %s\n", cell.first.c_str(ctx)); log_nonfatal_error("Found unbound cell '%s' of type '%s'\n", cell.first.c_str(ctx), cell.second->type.c_str(ctx));
if (ctx->getBoundBelCell(cell.second->bel) != cell.second.get()) num_errors++;
log_error("Found cell %s with mismatched binding\n", cell.first.c_str(ctx)); }
if (ctx->debug) else if (ctx->getBoundBelCell(cell.second->bel) != cell.second.get()) {
log_nonfatal_error("Found mismatched binding for '%s' or type '%s'\n", cell.first.c_str(ctx), cell.second->type.c_str(ctx));
num_errors++;
}
else if (ctx->debug)
log_info("AP soln: %s -> %s\n", cell.first.c_str(ctx), ctx->nameOfBel(cell.second->bel)); log_info("AP soln: %s -> %s\n", cell.first.c_str(ctx), ctx->nameOfBel(cell.second->bel));
} }
if (num_errors > 0) {
log_error("Stopping the program after %u errors found\n", num_errors);
}
bool any_bad_placements = false; bool any_bad_placements = false;
for (auto bel : ctx->getBels()) { for (auto bel : ctx->getBels()) {