From 93f379a488ae9f4c103c6d61cad49fba8012bc5a Mon Sep 17 00:00:00 2001 From: David Shah Date: Sun, 8 Jul 2018 12:41:11 +0200 Subject: ecp5: Adding JSON input option (not working yet) Signed-off-by: David Shah --- ecp5/main.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ecp5/main.cc b/ecp5/main.cc index 55e835e3..a9b02537 100644 --- a/ecp5/main.cc +++ b/ecp5/main.cc @@ -30,10 +30,18 @@ #include #include #include +#include #include "log.h" #include "nextpnr.h" #include "version.h" +#include "place_sa.h" +#include "route.h" +#include "design_utils.h" +#include "timing.h" +#include "jsonparse.h" + + USING_NEXTPNR_NAMESPACE int main(int argc, char *argv[]) @@ -52,6 +60,8 @@ int main(int argc, char *argv[]) #ifndef NO_GUI options.add_options()("gui", "start gui"); #endif + options.add_options()("json", po::value(), "JSON design file to ingest"); + options.add_options()("seed", po::value(), "seed value for random number generator"); po::positional_options_description pos; #ifndef NO_PYTHON @@ -107,6 +117,31 @@ int main(int argc, char *argv[]) ctx.rngseed(vm["seed"].as()); } + if (vm.count("json")) { + std::string filename = vm["json"].as(); + std::ifstream f(filename); + if (!parse_json_file(f, filename, &ctx)) + log_error("Loading design failed.\n"); + + //if (!pack_design(&ctx) && !ctx.force) + // log_error("Packing design failed.\n"); + if (vm.count("freq")) + ctx.target_freq = vm["freq"].as() * 1e6; + assign_budget(&ctx); + ctx.check(); + print_utilisation(&ctx); + ctx.timing_driven = true; + if (vm.count("no-tmdriv")) + ctx.timing_driven = false; + + if (!place_design_sa(&ctx) && !ctx.force) + log_error("Placing design failed.\n"); + ctx.check(); + if (!route_design(&ctx) && !ctx.force) + log_error("Routing design failed.\n"); + + } + #ifndef NO_PYTHON if (vm.count("run")) { init_python(argv[0], true); -- cgit v1.2.3