Add Context::force and "nextpnr-ice40 --force"

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-06-19 13:38:53 +02:00
parent 7abfd36773
commit 5f37da9704
6 changed files with 19 additions and 7 deletions

View File

@ -273,6 +273,7 @@ NEXTPNR_NAMESPACE_BEGIN
struct Context : Arch
{
bool verbose = false;
bool force = false;
Context(ArchArgs args) : Arch(args) {}

View File

@ -285,7 +285,7 @@ BelId random_bel_for_cell(Context *ctx, CellInfo *cell, SAState &state,
}
}
void place_design_sa(Context *ctx)
bool place_design_sa(Context *ctx)
{
SAState state;
@ -442,6 +442,7 @@ void place_design_sa(Context *ctx)
ctx->getBelName(bel).c_str(ctx), cell_text.c_str());
}
}
return true;
}
NEXTPNR_NAMESPACE_END

View File

@ -23,7 +23,7 @@
NEXTPNR_NAMESPACE_BEGIN
extern void place_design_sa(Context *ctx);
extern bool place_design_sa(Context *ctx);
NEXTPNR_NAMESPACE_END

View File

@ -68,6 +68,7 @@ int main(int argc, char *argv[])
po::options_description options("Allowed options");
options.add_options()("help,h", "show help");
options.add_options()("verbose,v", "verbose output");
options.add_options()("force,f", "keep running after errors");
options.add_options()("gui", "start gui");
options.add_options()("svg", "dump SVG file");
options.add_options()("pack-only",
@ -196,6 +197,10 @@ int main(int argc, char *argv[])
ctx.verbose = true;
}
if (vm.count("force")) {
ctx.force = true;
}
if (vm.count("seed")) {
ctx.rngseed(vm["seed"].as<int>());
}
@ -225,12 +230,16 @@ int main(int argc, char *argv[])
apply_pcf(&ctx, pcf);
}
pack_design(&ctx);
if (!pack_design(&ctx) && !ctx.force)
log_error("Packing design failed.\n");
print_utilisation(&ctx);
if (!vm.count("pack-only")) {
place_design_sa(&ctx);
route_design(&ctx);
if (!place_design_sa(&ctx) && !ctx.force)
log_error("Placing design failed.\n");
if (!route_design(&ctx) && !ctx.force)
log_error("Routing design failed.\n");
}
}

View File

@ -390,7 +390,7 @@ static void promote_globals(Context *ctx)
}
// Main pack function
void pack_design(Context *ctx)
bool pack_design(Context *ctx)
{
pack_constants(ctx);
promote_globals(ctx);
@ -398,6 +398,7 @@ void pack_design(Context *ctx)
pack_lut_lutffs(ctx);
pack_nonlut_ffs(ctx);
pack_ram(ctx);
return true;
}
NEXTPNR_NAMESPACE_END

View File

@ -25,7 +25,7 @@
NEXTPNR_NAMESPACE_BEGIN
void pack_design(Context *ctx);
bool pack_design(Context *ctx);
NEXTPNR_NAMESPACE_END