diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-06-19 13:38:53 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-06-19 14:10:42 +0200 |
commit | 5f37da970463b4197ddcdfeb94cfd7c7d6803682 (patch) | |
tree | 99ed6e7e7f8d4244f0ad1daf773314830e4194d8 | |
parent | 7abfd3677318152e1ff70d68a6664422b7efe5e6 (diff) | |
download | nextpnr-5f37da970463b4197ddcdfeb94cfd7c7d6803682.tar.gz nextpnr-5f37da970463b4197ddcdfeb94cfd7c7d6803682.tar.bz2 nextpnr-5f37da970463b4197ddcdfeb94cfd7c7d6803682.zip |
Add Context::force and "nextpnr-ice40 --force"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
-rw-r--r-- | common/nextpnr.h | 1 | ||||
-rw-r--r-- | common/place_sa.cc | 3 | ||||
-rw-r--r-- | common/place_sa.h | 2 | ||||
-rw-r--r-- | ice40/main.cc | 15 | ||||
-rw-r--r-- | ice40/pack.cc | 3 | ||||
-rw-r--r-- | ice40/pack.h | 2 |
6 files changed, 19 insertions, 7 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h index 6d0dab86..8063a981 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -273,6 +273,7 @@ NEXTPNR_NAMESPACE_BEGIN struct Context : Arch { bool verbose = false; + bool force = false; Context(ArchArgs args) : Arch(args) {} diff --git a/common/place_sa.cc b/common/place_sa.cc index 7588b245..f5f2858a 100644 --- a/common/place_sa.cc +++ b/common/place_sa.cc @@ -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 diff --git a/common/place_sa.h b/common/place_sa.h index 8eb4fe77..3c49c031 100644 --- a/common/place_sa.h +++ b/common/place_sa.h @@ -23,7 +23,7 @@ NEXTPNR_NAMESPACE_BEGIN -extern void place_design_sa(Context *ctx); +extern bool place_design_sa(Context *ctx); NEXTPNR_NAMESPACE_END diff --git a/ice40/main.cc b/ice40/main.cc index 0ea3dc98..802a08b8 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -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"); } } diff --git a/ice40/pack.cc b/ice40/pack.cc index 1569fe01..60c86a43 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -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 diff --git a/ice40/pack.h b/ice40/pack.h index 5495c986..92b76653 100644 --- a/ice40/pack.h +++ b/ice40/pack.h @@ -25,7 +25,7 @@ NEXTPNR_NAMESPACE_BEGIN -void pack_design(Context *ctx); +bool pack_design(Context *ctx); NEXTPNR_NAMESPACE_END |