aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2019-05-31 11:09:13 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2019-05-31 11:09:13 +0200
commit545068dec4a0433d17741b508965a391029e3283 (patch)
tree481b314e2202b08344f30fc870e5559721168c94 /common
parent150004e393d325aca75577360bdd7b4aba341070 (diff)
downloadnextpnr-545068dec4a0433d17741b508965a391029e3283.tar.gz
nextpnr-545068dec4a0433d17741b508965a391029e3283.tar.bz2
nextpnr-545068dec4a0433d17741b508965a391029e3283.zip
Initial work on jsonwrite
Diffstat (limited to 'common')
-rw-r--r--common/command.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/command.cc b/common/command.cc
index 3eafdb17..242e5037 100644
--- a/common/command.cc
+++ b/common/command.cc
@@ -35,6 +35,7 @@
#include "command.h"
#include "design_utils.h"
#include "jsonparse.h"
+#include "jsonwrite.h"
#include "log.h"
#include "timing.h"
#include "util.h"
@@ -120,6 +121,7 @@ po::options_description CommandHandler::getGeneralOptions()
#endif
general.add_options()("json", po::value<std::string>(), "JSON design file to ingest");
+ general.add_options()("write", po::value<std::string>(), "JSON design file to write");
general.add_options()("seed", po::value<int>(), "seed value for random number generator");
general.add_options()("randomize-seed,r", "randomize seed value for random number generator");
@@ -303,6 +305,12 @@ int CommandHandler::executeMain(std::unique_ptr<Context> ctx)
customBitstream(ctx.get());
}
+ if (vm.count("write")) {
+ std::string filename = vm["write"].as<std::string>();
+ std::ofstream f(filename);
+ if (!write_json_file(f, filename, ctx.get()))
+ log_error("Loading design failed.\n");
+ }
if (vm.count("save")) {
project.save(ctx.get(), vm["save"].as<std::string>());
}