aboutsummaryrefslogtreecommitdiffstats
path: root/dummy
diff options
context:
space:
mode:
authorSergiusz Bazanski <q3k@q3k.org>2018-06-22 14:29:28 +0100
committerSergiusz Bazanski <q3k@q3k.org>2018-06-22 14:29:28 +0100
commit858acc5c1c0ee4bbdfb8d2012b80cda656ca39db (patch)
tree7cc94b94e40c05c5a7baae61c9d0db4f23a31b60 /dummy
parent98b1f0c041b01d07f64e8e04503f8eccb05a93de (diff)
parentf86a0d6c8c8792c36c87cf345665ce7c9fbcc60f (diff)
downloadnextpnr-858acc5c1c0ee4bbdfb8d2012b80cda656ca39db.tar.gz
nextpnr-858acc5c1c0ee4bbdfb8d2012b80cda656ca39db.tar.bz2
nextpnr-858acc5c1c0ee4bbdfb8d2012b80cda656ca39db.zip
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr into q3k/gl
Diffstat (limited to 'dummy')
-rw-r--r--dummy/arch.cc6
-rw-r--r--dummy/arch.h5
-rw-r--r--dummy/main.cc98
3 files changed, 104 insertions, 5 deletions
diff --git a/dummy/arch.cc b/dummy/arch.cc
index 103eee4d..0ed0f11e 100644
--- a/dummy/arch.cc
+++ b/dummy/arch.cc
@@ -34,6 +34,8 @@ BelId Arch::getBelByName(IdString name) const { return BelId(); }
IdString Arch::getBelName(BelId bel) const { return IdString(); }
+uint32_t Arch::getBelChecksum(BelId bel) const { return 0; }
+
void Arch::bindBel(BelId bel, IdString cell) {}
void Arch::unbindBel(BelId bel) {}
@@ -75,6 +77,8 @@ WireId Arch::getWireByName(IdString name) const { return WireId(); }
IdString Arch::getWireName(WireId wire) const { return IdString(); }
+uint32_t Arch::getWireChecksum(WireId wire) const { return 0; }
+
void Arch::bindWire(WireId wire, IdString net) {}
void Arch::unbindWire(WireId wire) {}
@@ -98,6 +102,8 @@ PipId Arch::getPipByName(IdString name) const { return PipId(); }
IdString Arch::getPipName(PipId pip) const { return IdString(); }
+uint32_t Arch::getPipChecksum(PipId wire) const { return 0; }
+
void Arch::bindPip(PipId pip, IdString net) {}
void Arch::unbindPip(PipId pip) {}
diff --git a/dummy/arch.h b/dummy/arch.h
index 43ab3290..d8068b22 100644
--- a/dummy/arch.h
+++ b/dummy/arch.h
@@ -87,6 +87,7 @@ struct Arch : BaseCtx
BelId getBelByName(IdString name) const;
IdString getBelName(BelId bel) const;
+ uint32_t getBelChecksum(BelId bel) const;
void bindBel(BelId bel, IdString cell);
void unbindBel(BelId bel);
bool checkBelAvail(BelId bel) const;
@@ -100,6 +101,7 @@ struct Arch : BaseCtx
WireId getWireByName(IdString name) const;
IdString getWireName(WireId wire) const;
+ uint32_t getWireChecksum(WireId wire) const;
void bindWire(WireId wire, IdString net);
void unbindWire(WireId wire);
bool checkWireAvail(WireId wire) const;
@@ -108,6 +110,7 @@ struct Arch : BaseCtx
PipId getPipByName(IdString name) const;
IdString getPipName(PipId pip) const;
+ uint32_t getPipChecksum(PipId pip) const;
void bindPip(PipId pip, IdString net);
void unbindPip(PipId pip);
bool checkPipAvail(PipId pip) const;
@@ -123,7 +126,9 @@ struct Arch : BaseCtx
void estimatePosition(BelId bel, int &x, int &y, bool &gb) const;
delay_t estimateDelay(WireId src, WireId dst) const;
delay_t getDelayEpsilon() const { return 0.01; }
+ delay_t getRipupDelayPenalty() const { return 1.0; }
float getDelayNS(delay_t v) const { return v; }
+ uint32_t getDelayChecksum(delay_t v) const { return 0; }
std::vector<GraphicElement> getFrameGraphics() const;
std::vector<GraphicElement> getBelGraphics(BelId bel) const;
diff --git a/dummy/main.cc b/dummy/main.cc
index 6375eef9..110c5b6c 100644
--- a/dummy/main.cc
+++ b/dummy/main.cc
@@ -20,20 +20,108 @@
#ifdef MAIN_EXECUTABLE
#include <QApplication>
+#include <boost/filesystem/convenience.hpp>
+#include <boost/program_options.hpp>
+#include "log.h"
#include "mainwindow.h"
#include "nextpnr.h"
+#include "pybindings.h"
+#include "version.h"
USING_NEXTPNR_NAMESPACE
int main(int argc, char *argv[])
{
- Context ctx(ArchArgs{});
+ try {
- QApplication a(argc, argv);
- MainWindow w(&ctx);
- w.show();
+ namespace po = boost::program_options;
+ int rc = 0;
- return a.exec();
+ log_files.push_back(stdout);
+
+ 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()("run", po::value<std::vector<std::string>>(),
+ "python file to execute");
+ options.add_options()("version,V", "show version");
+ po::positional_options_description pos;
+ pos.add("run", -1);
+
+ po::variables_map vm;
+ try {
+ po::parsed_options parsed = po::command_line_parser(argc, argv)
+ .options(options)
+ .positional(pos)
+ .run();
+
+ po::store(parsed, vm);
+
+ po::notify(vm);
+ }
+
+ catch (std::exception &e) {
+ std::cout << e.what() << "\n";
+ return 1;
+ }
+
+ if (vm.count("help") || argc == 1) {
+ std::cout << boost::filesystem::basename(argv[0])
+ << " -- Next Generation Place and Route (git "
+ "sha1 " GIT_COMMIT_HASH_STR ")\n";
+ std::cout << "\n";
+ std::cout << options << "\n";
+ return argc != 1;
+ }
+
+ if (vm.count("version")) {
+ std::cout << boost::filesystem::basename(argv[0])
+ << " -- Next Generation Place and Route (git "
+ "sha1 " GIT_COMMIT_HASH_STR ")\n";
+ return 1;
+ }
+
+ Context ctx(ArchArgs{});
+ init_python(argv[0]);
+ python_export_global("ctx", ctx);
+
+ if (vm.count("verbose")) {
+ ctx.verbose = true;
+ }
+
+ if (vm.count("force")) {
+ ctx.force = true;
+ }
+
+ if (vm.count("seed")) {
+ ctx.rngseed(vm["seed"].as<int>());
+ }
+
+ if (vm.count("run")) {
+ std::vector<std::string> files =
+ vm["run"].as<std::vector<std::string>>();
+ for (auto filename : files)
+ execute_python_file(filename.c_str());
+ }
+
+ if (vm.count("gui")) {
+ QApplication a(argc, argv);
+ MainWindow w(&ctx);
+ w.show();
+
+ rc = a.exec();
+ }
+ deinit_python();
+ return rc;
+ } catch (log_execution_error_exception) {
+#if defined(_MSC_VER)
+ _exit(EXIT_FAILURE);
+#else
+ _Exit(EXIT_FAILURE);
+#endif
+ }
}
#endif