Few more checks on parameters and error eol
This commit is contained in:
parent
53034959f3
commit
6c835d76f2
@ -227,7 +227,7 @@ void write_asc(const Context *ctx, std::ostream &out)
|
||||
out << ".device 5k" << std::endl;
|
||||
break;
|
||||
default:
|
||||
NPNR_ASSERT_FALSE("unsupported device type");
|
||||
NPNR_ASSERT_FALSE("unsupported device type\n");
|
||||
}
|
||||
// Set pips
|
||||
for (auto pip : ctx->getPips()) {
|
||||
@ -561,10 +561,10 @@ void read_config(Context *ctx, std::istream &in, chipconfig_t &config)
|
||||
expected = "5k";
|
||||
break;
|
||||
default:
|
||||
log_error("unsupported device type");
|
||||
log_error("unsupported device type\n");
|
||||
}
|
||||
if (expected != config_device)
|
||||
log_error("device type does not match");
|
||||
log_error("device type does not match\n");
|
||||
} else if (!strcmp(tok, ".io_tile") || !strcmp(tok, ".logic_tile") || !strcmp(tok, ".ramb_tile") ||
|
||||
!strcmp(tok, ".ramt_tile") || !strcmp(tok, ".ipcon_tile") || !strcmp(tok, ".dsp0_tile") ||
|
||||
!strcmp(tok, ".dsp1_tile") || !strcmp(tok, ".dsp2_tile") || !strcmp(tok, ".dsp3_tile")) {
|
||||
@ -574,7 +574,7 @@ void read_config(Context *ctx, std::istream &in, chipconfig_t &config)
|
||||
|
||||
TileType tile = tile_at(ctx, tile_x, tile_y);
|
||||
if (tok != tagTileType(tile))
|
||||
log_error("Wrong tile type for specified position");
|
||||
log_error("Wrong tile type for specified position\n");
|
||||
|
||||
} else if (!strcmp(tok, ".extra_bit")) {
|
||||
/*
|
||||
|
@ -66,6 +66,12 @@ void svg_dump_decal(const Context *ctx, const DecalXY &decal)
|
||||
}
|
||||
}
|
||||
|
||||
void conflicting_options(const boost::program_options::variables_map &vm, const char *opt1, const char *opt2)
|
||||
{
|
||||
if (vm.count(opt1) && !vm[opt1].defaulted() && vm.count(opt2) && !vm[opt2].defaulted())
|
||||
log_error((std::string("Conflicting options '") + opt1 + "' and '" + opt2 + "'.").c_str());
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
try {
|
||||
@ -122,13 +128,17 @@ int main(int argc, char *argv[])
|
||||
po::store(parsed, vm);
|
||||
|
||||
po::notify(vm);
|
||||
}
|
||||
|
||||
catch (std::exception &e) {
|
||||
} catch (std::exception &e) {
|
||||
std::cout << e.what() << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
conflicting_options(vm, "read", "json");
|
||||
#ifndef ICE40_HX1K_ONLY
|
||||
if ((vm.count("lp384") + vm.count("lp1k") + vm.count("lp8k") + vm.count("hx1k") + vm.count("hx8k") +
|
||||
vm.count("up5k")) > 1)
|
||||
log_error("Only one device type can be set\n");
|
||||
#endif
|
||||
if (vm.count("help") || argc == 1) {
|
||||
help:
|
||||
std::cout << boost::filesystem::basename(argv[0])
|
||||
|
Loading…
Reference in New Issue
Block a user