diff options
-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); |