diff options
author | David Shah <davey1576@gmail.com> | 2019-02-28 15:01:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-28 15:01:42 +0000 |
commit | 0279f6371082a5a95f0613418e03bf7daf921412 (patch) | |
tree | 82e654943d743ac9a60514213124729373c4fd24 /ecp5/main.cc | |
parent | 9aadfef8c124127f6c9292e34cb4d3b6b61ff0fd (diff) | |
parent | 8744c46ea0fb5c6428927867447dbe491f340f5b (diff) | |
download | nextpnr-0279f6371082a5a95f0613418e03bf7daf921412.tar.gz nextpnr-0279f6371082a5a95f0613418e03bf7daf921412.tar.bz2 nextpnr-0279f6371082a5a95f0613418e03bf7daf921412.zip |
Merge pull request #243 from YosysHQ/ecp5lpf
ecp5: Improve constraint-related error handling
Diffstat (limited to 'ecp5/main.cc')
-rw-r--r-- | ecp5/main.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/ecp5/main.cc b/ecp5/main.cc index 4f9ac3da..15027a5a 100644 --- a/ecp5/main.cc +++ b/ecp5/main.cc @@ -25,6 +25,7 @@ #include "design_utils.h" #include "log.h" #include "timing.h" +#include "util.h" USING_NEXTPNR_NAMESPACE @@ -68,6 +69,7 @@ po::options_description ECP5CommandHandler::getArchOptions() specific.add_options()("textcfg", po::value<std::string>(), "textual configuration in Trellis format to write"); specific.add_options()("lpf", po::value<std::vector<std::string>>(), "LPF pin constraint file(s)"); + specific.add_options()("lpf-allow-unconstrained", "don't require LPF file(s) to constrain all IO"); return specific; } @@ -157,7 +159,26 @@ void ECP5CommandHandler::customAfterLoad(Context *ctx) std::vector<std::string> files = vm["lpf"].as<std::vector<std::string>>(); for (const auto &filename : files) { std::ifstream in(filename); - ctx->applyLPF(filename, in); + if (!in) + log_error("failed to open LPF file '%s'\n", filename.c_str()); + if (!ctx->applyLPF(filename, in)) + log_error("failed to parse LPF file '%s'\n", filename.c_str()); + } + + for (auto cell : sorted(ctx->cells)) { + CellInfo *ci = cell.second; + if (ci->type == ctx->id("$nextpnr_ibuf") || ci->type == ctx->id("$nextpnr_obuf") || + ci->type == ctx->id("$nextpnr_iobuf")) { + if (!ci->attrs.count(ctx->id("LOC"))) { + if (vm.count("lpf-allow-unconstrained")) + log_warning("IO '%s' is unconstrained in LPF and will be automatically placed\n", + cell.first.c_str(ctx)); + else + log_error("IO '%s' is unconstrained in LPF (override this error with " + "--lpf-allow-unconstrained)\n", + cell.first.c_str(ctx)); + } + } } } } |