aboutsummaryrefslogtreecommitdiffstats
path: root/frontend
diff options
context:
space:
mode:
authorMarcin Koƛcielnicki <mwk@0x04.net>2020-02-01 17:23:05 +0100
committerMarcin Koƛcielnicki <mwk@0x04.net>2020-02-01 17:23:05 +0100
commit24e3f8417e861321d1f934d52fd33535e08d9817 (patch)
tree8f7fee3c63dd8054deb2ee68d1968b581a43099f /frontend
parent85f4452b0a3bd47ccb25be023859542ffef888f7 (diff)
downloadnextpnr-24e3f8417e861321d1f934d52fd33535e08d9817.tar.gz
nextpnr-24e3f8417e861321d1f934d52fd33535e08d9817.tar.bz2
nextpnr-24e3f8417e861321d1f934d52fd33535e08d9817.zip
json: fix handling of 32-bit parameters
See YosysHQ/yosys#1671 for rationale. Also, added some validation to our parser, so that out-of-range values are reported and the user knows they should update yosys.
Diffstat (limited to 'frontend')
-rw-r--r--frontend/json_frontend.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/frontend/json_frontend.cc b/frontend/json_frontend.cc
index f1310e71..136786fc 100644
--- a/frontend/json_frontend.cc
+++ b/frontend/json_frontend.cc
@@ -105,10 +105,14 @@ struct JsonFrontendImpl
Property parse_property(const Json &val) const
{
- if (val.is_number())
+ if (val.is_number()) {
+ if (val.int_value() != val.number_value())
+ log_error("Found an out-of-range integer parameter in the JSON file.\n"
+ "Please regenerate the input file with an up-to-date version of yosys.\n");
return Property(val.int_value(), 32);
- else
+ } else {
return Property::from_string(val.string_value());
+ }
}
template <typename TFunc> void foreach_attr(const Json &obj, TFunc Func) const