diff options
| author | David Shah <davey1576@gmail.com> | 2018-07-08 12:41:11 +0200 | 
|---|---|---|
| committer | David Shah <davey1576@gmail.com> | 2018-07-11 10:42:09 +0200 | 
| commit | 93f379a488ae9f4c103c6d61cad49fba8012bc5a (patch) | |
| tree | 59672f1ae370da7c50b580640bc3709e66051fd3 | |
| parent | c33aa259ad822d9c4ce3f46922504a70e730704c (diff) | |
| download | nextpnr-93f379a488ae9f4c103c6d61cad49fba8012bc5a.tar.gz nextpnr-93f379a488ae9f4c103c6d61cad49fba8012bc5a.tar.bz2 nextpnr-93f379a488ae9f4c103c6d61cad49fba8012bc5a.zip  | |
ecp5: Adding JSON input option (not working yet)
Signed-off-by: David Shah <davey1576@gmail.com>
| -rw-r--r-- | ecp5/main.cc | 35 | 
1 files changed, 35 insertions, 0 deletions
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 <boost/filesystem/convenience.hpp>  #include <boost/program_options.hpp>  #include <iostream> +#include <fstream>  #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<std::string>(), "JSON design file to ingest"); +        options.add_options()("seed", po::value<int>(), "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<int>());          } +        if (vm.count("json")) { +            std::string filename = vm["json"].as<std::string>(); +            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<double>() * 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);  | 
