aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ice40/main.cc')
-rw-r--r--ice40/main.cc50
1 files changed, 39 insertions, 11 deletions
diff --git a/ice40/main.cc b/ice40/main.cc
index 88ef4155..445e81ba 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
options.add_options()("test","just a check");
options.add_options()("gui","start gui");
options.add_options()("svg","dump SVG file");
- options.add_options()("file", po::value<std::vector<std::string>>(), "python file to execute");
+ options.add_options()("run", po::value<std::vector<std::string>>(), "python file to execute");
options.add_options()("json", po::value<std::string>(), "JSON design file to ingest");
options.add_options()("version,v","show version");
options.add_options()("lp384","set device type to iCE40LP384");
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
options.add_options()("up5k","set device type to iCE40UP5K");
po::positional_options_description pos;
- pos.add("file", -1);
+ pos.add("run", -1);
po::variables_map vm;
try {
@@ -86,10 +86,11 @@ int main(int argc, char *argv[])
if (vm.count("help") || argc == 1)
{
+ help:
std::cout << basename(argv[0]) << " -- Next Generation Place and Route (git sha1 " GIT_COMMIT_HASH_STR ")\n";
std::cout << "\n";
std::cout << options << "\n";
- return 1;
+ return argc != 1;
}
if (vm.count("version"))
@@ -101,25 +102,52 @@ int main(int argc, char *argv[])
}
ChipArgs chipArgs;
- chipArgs.type = ChipArgs::HX1K;
- if (vm.count("lp384"))
+ if (vm.count("lp384")) {
+ if (chipArgs.type != ChipArgs::NONE)
+ goto help;
chipArgs.type = ChipArgs::LP384;
+ }
- if (vm.count("lp1k"))
+ if (vm.count("lp1k")) {
+ if (chipArgs.type != ChipArgs::NONE)
+ goto help;
chipArgs.type = ChipArgs::LP1K;
+ }
- if (vm.count("lp8k"))
+ if (vm.count("lp8k")) {
+ if (chipArgs.type != ChipArgs::NONE)
+ goto help;
chipArgs.type = ChipArgs::LP8K;
+ }
- if (vm.count("hx1k"))
+ if (vm.count("hx1k")) {
+ if (chipArgs.type != ChipArgs::NONE)
+ goto help;
chipArgs.type = ChipArgs::HX1K;
+ }
- if (vm.count("hx8k"))
+ if (vm.count("hx8k")) {
+ if (chipArgs.type != ChipArgs::NONE)
+ goto help;
chipArgs.type = ChipArgs::HX8K;
+ }
- if (vm.count("up5k"))
+ if (vm.count("up5k")) {
+ if (chipArgs.type != ChipArgs::NONE)
+ goto help;
chipArgs.type = ChipArgs::UP5K;
+ }
+
+ if (chipArgs.type == ChipArgs::NONE)
+ chipArgs.type = ChipArgs::HX1K;
+
+#ifdef ICE40_HX1K_ONLY
+ if (chipArgs.type != ChipArgs::HX1K) {
+ std::cout << "This version of nextpnr-ice40 is built with HX1K-support only.\n";
+ return 1;
+ }
+#endif
Design design(chipArgs);
init_python(argv[0]);
@@ -206,7 +234,7 @@ int main(int argc, char *argv[])
parse_json_file(f, filename, &design);
}
- if (vm.count("file"))
+ if (vm.count("run"))
{
std::vector<std::string> files = vm["file"].as<std::vector<std::string>>();
for(auto filename : files)