Fixed return codes for packer, placer and router

This commit is contained in:
Miodrag Milanovic 2018-06-21 17:56:45 +02:00
parent 54549d36e9
commit 8fac26c2b7
4 changed files with 217 additions and 197 deletions

View File

@ -478,10 +478,14 @@ class SAPlacer
bool place_design_sa(Context *ctx)
{
try {
SAPlacer placer(ctx);
placer.place();
log_info("Checksum: 0x%08x\n", ctx->checksum());
return true;
} catch (log_execution_error_exception) {
return false;
}
}
NEXTPNR_NAMESPACE_END

View File

@ -395,6 +395,7 @@ NEXTPNR_NAMESPACE_BEGIN
bool route_design(Context *ctx)
{
try {
delay_t ripup_penalty = ctx->getRipupDelayPenalty();
RipupScoreboard scores;
@ -441,8 +442,8 @@ bool route_design(Context *ctx)
if (driver_port_it != net_info->driver.cell->pins.end())
driver_port = driver_port_it->second;
auto src_wire =
ctx->getWireBelPin(src_bel, ctx->portPinFromId(driver_port));
auto src_wire = ctx->getWireBelPin(src_bel,
ctx->portPinFromId(driver_port));
if (src_wire == WireId())
continue;
@ -460,8 +461,8 @@ bool route_design(Context *ctx)
if (user_port_it != user_it.cell->pins.end())
user_port = user_port_it->second;
auto dst_wire =
ctx->getWireBelPin(dst_bel, ctx->portPinFromId(user_port));
auto dst_wire = ctx->getWireBelPin(
dst_bel, ctx->portPinFromId(user_port));
if (dst_wire == WireId())
continue;
@ -504,7 +505,8 @@ bool route_design(Context *ctx)
for (auto net_name : netsArray) {
if (printNets)
log_info(" routing net %s. (%d users)\n", net_name.c_str(ctx),
log_info(" routing net %s. (%d users)\n",
net_name.c_str(ctx),
int(ctx->nets.at(net_name)->users.size()));
Router router(ctx, scores, net_name, false);
@ -515,7 +517,8 @@ bool route_design(Context *ctx)
if (!router.routedOkay) {
if (printNets)
log_info(" failed to route to %s.\n",
log_info(
" failed to route to %s.\n",
ctx->getWireName(router.failedDest).c_str(ctx));
ripupQueue.insert(net_name);
}
@ -530,8 +533,8 @@ bool route_design(Context *ctx)
int normalRouteCnt = netCnt - int(ripupQueue.size());
if ((ctx->verbose || iterCnt == 1) && (netCnt % 100 != 0))
log_info(" processed %d nets. (%d routed, %d failed)\n", netCnt,
normalRouteCnt, int(ripupQueue.size()));
log_info(" processed %d nets. (%d routed, %d failed)\n",
netCnt, normalRouteCnt, int(ripupQueue.size()));
if (ctx->verbose)
log_info(" routing pass visited %d PIPs (%.2f%% revisits).\n",
@ -539,7 +542,8 @@ bool route_design(Context *ctx)
if (!ripupQueue.empty()) {
if (ctx->verbose || iterCnt == 1)
log_info("failed to route %d nets. re-routing in ripup mode.\n",
log_info("failed to route %d nets. re-routing in ripup "
"mode.\n",
int(ripupQueue.size()));
printNets = ctx->verbose && (ripupQueue.size() < 10);
@ -594,10 +598,12 @@ bool route_design(Context *ctx)
}
if ((ctx->verbose || iterCnt == 1) && (netCnt % 100 != 0))
log_info(" routed %d nets, ripped %d nets.\n", netCnt, ripCnt);
log_info(" routed %d nets, ripped %d nets.\n", netCnt,
ripCnt);
if (ctx->verbose)
log_info(" routing pass visited %d PIPs (%.2f%% revisits).\n",
log_info(" routing pass visited %d PIPs (%.2f%% "
"revisits).\n",
visitCnt, (100.0 * revisitCnt) / visitCnt);
if (ctx->verbose && !netsQueue.empty())
@ -607,18 +613,22 @@ bool route_design(Context *ctx)
}
if (!ctx->verbose)
log_info("iteration %d: routed %d nets without ripup, routed %d "
log_info(
"iteration %d: routed %d nets without ripup, routed %d "
"nets with ripup.\n",
iterCnt, normalRouteCnt, int(ripupQueue.size()));
if (iterCnt == 8 || iterCnt == 16 || iterCnt == 32 || iterCnt == 64 ||
iterCnt == 128)
if (iterCnt == 8 || iterCnt == 16 || iterCnt == 32 ||
iterCnt == 64 || iterCnt == 128)
ripup_penalty += ctx->getRipupDelayPenalty();
}
log_info("routing complete after %d iterations.\n", iterCnt);
log_info("Checksum: 0x%08x\n", ctx->checksum());
return true;
} catch (log_execution_error_exception) {
return false;
}
}
bool get_actual_route_delay(Context *ctx, WireId src_wire, WireId dst_wire,

View File

@ -19,7 +19,7 @@ void Worker::parsejson(const std::string &filename)
{
std::string fn = filename;
std::ifstream f(fn);
try {
parse_json_file(f, fn, ctx);
if (!pack_design(ctx))
log_error("Packing design failed.\n");
@ -31,8 +31,10 @@ void Worker::parsejson(const std::string &filename)
log_error("Placing design failed.\n");
if (!route_design(ctx))
log_error("Routing design failed.\n");
print_utilisation(ctx);
Q_EMIT log("done");
} catch (log_execution_error_exception) {
Q_EMIT log("failed");
}
}
TaskManager::TaskManager(Context *ctx)

View File

@ -487,6 +487,7 @@ static void promote_globals(Context *ctx)
// Main pack function
bool pack_design(Context *ctx)
{
try {
log_break();
pack_constants(ctx);
promote_globals(ctx);
@ -496,6 +497,9 @@ bool pack_design(Context *ctx)
pack_ram(ctx);
log_info("Checksum: 0x%08x\n", ctx->checksum());
return true;
} catch (log_execution_error_exception) {
return false;
}
}
NEXTPNR_NAMESPACE_END