Add ICE40_HX1K_ONLY config macro

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-06-07 12:26:02 +02:00
parent 9eeecf0e62
commit 8bfeaeaced
2 changed files with 46 additions and 11 deletions

View File

@ -277,6 +277,12 @@ PortPin PortPinFromId(IdString id)
Chip::Chip(ChipArgs args) Chip::Chip(ChipArgs args)
{ {
#ifdef ICE40_HX1K_ONLY
if (args.type == ChipArgs::HX1K) {
chip_info = chip_info_1k;
return;
}
#else
if (args.type == ChipArgs::LP384) { if (args.type == ChipArgs::LP384) {
chip_info = chip_info_384; chip_info = chip_info_384;
return; return;
@ -293,6 +299,7 @@ Chip::Chip(ChipArgs args)
fprintf(stderr, "Unsupported chip type\n"); fprintf(stderr, "Unsupported chip type\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
#endif
abort(); abort();
} }

View File

@ -86,10 +86,11 @@ int main(int argc, char *argv[])
if (vm.count("help") || argc == 1) 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 << basename(argv[0]) << " -- Next Generation Place and Route (git sha1 " GIT_COMMIT_HASH_STR ")\n";
std::cout << "\n"; std::cout << "\n";
std::cout << options << "\n"; std::cout << options << "\n";
return 1; return argc != 1;
} }
if (vm.count("version")) if (vm.count("version"))
@ -101,25 +102,52 @@ int main(int argc, char *argv[])
} }
ChipArgs chipArgs; 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; chipArgs.type = ChipArgs::LP384;
}
if (vm.count("lp1k")) if (vm.count("lp1k")) {
if (chipArgs.type != ChipArgs::NONE)
goto help;
chipArgs.type = ChipArgs::LP1K; chipArgs.type = ChipArgs::LP1K;
}
if (vm.count("lp8k")) if (vm.count("lp8k")) {
if (chipArgs.type != ChipArgs::NONE)
goto help;
chipArgs.type = ChipArgs::LP8K; 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 (chipArgs.type != ChipArgs::NONE)
goto help;
chipArgs.type = ChipArgs::HX8K;
}
if (vm.count("up5k")) {
if (chipArgs.type != ChipArgs::NONE)
goto help;
chipArgs.type = ChipArgs::UP5K;
}
if (chipArgs.type == ChipArgs::NONE)
chipArgs.type = ChipArgs::HX1K; chipArgs.type = ChipArgs::HX1K;
if (vm.count("hx8k")) #ifdef ICE40_HX1K_ONLY
chipArgs.type = ChipArgs::HX8K; if (chipArgs.type != ChipArgs::HX1K) {
std::cout << "This version of nextpnr-ice40 is built with HX1K-support only.\n";
if (vm.count("up5k")) return 1;
chipArgs.type = ChipArgs::UP5K; }
#endif
Design design(chipArgs); Design design(chipArgs);
init_python(argv[0]); init_python(argv[0]);