aboutsummaryrefslogtreecommitdiffstats
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/frontend_base.h9
-rw-r--r--frontend/json_frontend.cc4
2 files changed, 12 insertions, 1 deletions
diff --git a/frontend/frontend_base.h b/frontend/frontend_base.h
index 3484b5b4..40d03863 100644
--- a/frontend/frontend_base.h
+++ b/frontend/frontend_base.h
@@ -104,6 +104,7 @@
#include "design_utils.h"
#include "log.h"
#include "nextpnr.h"
+#include "util.h"
NEXTPNR_NAMESPACE_BEGIN
namespace {
@@ -193,8 +194,14 @@ template <typename FrontendType> struct GenericFrontend
for (auto &mod : mods)
for (auto &c : mod.second.instantiated_celltypes)
candidate_top.erase(c);
- if (candidate_top.size() != 1)
+ if (candidate_top.size() != 1) {
+ if (candidate_top.size() == 0)
+ log_info("No candidate top level modules.\n");
+ else
+ for (auto ctp : sorted(candidate_top))
+ log_info("Candidate top module: '%s'\n", ctx->nameOf(ctp));
log_error("Failed to autodetect top module, please specify using --top.\n");
+ }
top = *(candidate_top.begin());
}
diff --git a/frontend/json_frontend.cc b/frontend/json_frontend.cc
index 37c1dabd..2eb0a39b 100644
--- a/frontend/json_frontend.cc
+++ b/frontend/json_frontend.cc
@@ -181,6 +181,10 @@ bool parse_json(std::istream &in, const std::string &filename, Context *ctx)
root = Json::parse(json_str, error, JsonParse::COMMENTS);
if (root.is_null())
log_error("Failed to parse JSON file '%s': %s.\n", filename.c_str(), error.c_str());
+ root = root["modules"];
+ if (root.is_null())
+ log_error("JSON file '%s' doesn't look like a netlist (doesn't contain \"modules\" key)\n",
+ filename.c_str());
}
GenericFrontend<JsonFrontendImpl>(ctx, JsonFrontendImpl(root))();
return true;