interchange: xdc and place constr: address review comments

Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
This commit is contained in:
Alessandro Comodi 2021-07-12 17:02:55 +02:00
parent 3de0be7c06
commit 7abfeb11c3
3 changed files with 13 additions and 23 deletions

View File

@ -402,13 +402,6 @@ class HeAPPlacer
for (auto &cell_entry : ctx->cells) { for (auto &cell_entry : ctx->cells) {
CellInfo *cell = cell_entry.second.get(); CellInfo *cell = cell_entry.second.get();
if (cell->bel != BelId()) {
if (ctx->verbose)
log_error("Cell \'%s\' (%s) has already been constrianed by arch implementation",
cell->name.c_str(ctx), cell->type.c_str(ctx));
continue;
}
auto loc = cell->attrs.find(ctx->id("BEL")); auto loc = cell->attrs.find(ctx->id("BEL"));
if (loc != cell->attrs.end()) { if (loc != cell->attrs.end()) {
std::string loc_name = loc->second.as_string(); std::string loc_name = loc->second.as_string();

View File

@ -83,11 +83,8 @@ void Arch::place_constraints()
cell->name.c_str(getCtx()), nameOfBel(bel), bound_cell->name.c_str(getCtx())); cell->name.c_str(getCtx()), nameOfBel(bel), bound_cell->name.c_str(getCtx()));
bindBel(bel, cell, STRENGTH_USER); bindBel(bel, cell, STRENGTH_USER);
if (!isBelLocationValid(bel))
log_error("Bel \'%s\' is not valid for cell "
"\'%s\' of type \'%s\'\n",
nameOfBel(bel), cell->name.c_str(getCtx()), cell->type.c_str(getCtx()));
cell->attrs.erase(id("BEL"));
constrained_cells.emplace_back(cell->name, bel); constrained_cells.emplace_back(cell->name, bel);
} }
@ -95,8 +92,15 @@ void Arch::place_constraints()
return; return;
log_info("Cell placed via user constraints:\n"); log_info("Cell placed via user constraints:\n");
for (auto cell_bel : constrained_cells) for (auto cell_bel : constrained_cells) {
log_info(" - %s placed at %s\n", cell_bel.first.c_str(getCtx()), nameOfBel(cell_bel.second)); IdString cell_name = cell_bel.first;
BelId bel = cell_bel.second;
if (!isBelLocationValid(bel))
log_error(" - Bel \'%s\' is not valid for cell \'%s\'\n", nameOfBel(bel), cell_name.c_str(getCtx()));
log_info(" - %s placed at %s\n", cell_name.c_str(getCtx()), nameOfBel(cell_bel.second));
}
} }
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END

View File

@ -130,15 +130,8 @@ static int get_cells(ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj *CON
const char *arg0 = Tcl_GetString(objv[1]); const char *arg0 = Tcl_GetString(objv[1]);
IdString cell_name = ctx->id(arg0); IdString cell_name = ctx->id(arg0);
CellInfo *cell = nullptr; auto iter = ctx->cells.find(cell_name);
for (auto &cell_pair : ctx->cells) { if (iter == ctx->cells.end()) {
if (cell_pair.second.get()->name == cell_name) {
cell = cell_pair.second.get();
break;
}
}
if (cell == nullptr) {
Tcl_SetStringResult(interp, "Could not find cell " + cell_name.str(ctx)); Tcl_SetStringResult(interp, "Could not find cell " + cell_name.str(ctx));
return TCL_ERROR; return TCL_ERROR;
} }
@ -146,7 +139,7 @@ static int get_cells(ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj *CON
Tcl_Obj *result = Tcl_NewObj(); Tcl_Obj *result = Tcl_NewObj();
result->typePtr = &cell_object; result->typePtr = &cell_object;
result->internalRep.twoPtrValue.ptr1 = (void *)(ctx); result->internalRep.twoPtrValue.ptr1 = (void *)(ctx);
result->internalRep.twoPtrValue.ptr2 = (void *)(cell); result->internalRep.twoPtrValue.ptr2 = (void *)(iter->second.get());
result->bytes = nullptr; result->bytes = nullptr;
cell_update_string(result); cell_update_string(result);