diff options
author | Marcin KoĆcielnicki <mwk@0x04.net> | 2020-02-01 17:23:05 +0100 |
---|---|---|
committer | Marcin KoĆcielnicki <mwk@0x04.net> | 2020-02-01 17:23:05 +0100 |
commit | 24e3f8417e861321d1f934d52fd33535e08d9817 (patch) | |
tree | 8f7fee3c63dd8054deb2ee68d1968b581a43099f /json | |
parent | 85f4452b0a3bd47ccb25be023859542ffef888f7 (diff) | |
download | nextpnr-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 'json')
-rw-r--r-- | json/jsonwrite.cc | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/json/jsonwrite.cc b/json/jsonwrite.cc index 477bfca5..d4a62a5a 100644 --- a/json/jsonwrite.cc +++ b/json/jsonwrite.cc @@ -45,15 +45,6 @@ std::string get_string(std::string str) std::string get_name(IdString name, Context *ctx) { return get_string(name.c_str(ctx)); } -void write_parameter_value(std::ostream &f, const Property &value) -{ - if (value.size() == 32 && value.is_fully_def()) { - f << stringf("%d", value.as_int64()); - } else { - f << get_string(value.to_string()); - } -} - void write_parameters(std::ostream &f, Context *ctx, const std::unordered_map<IdString, Property> ¶meters, bool for_module = false) { @@ -61,7 +52,7 @@ void write_parameters(std::ostream &f, Context *ctx, const std::unordered_map<Id for (auto ¶m : parameters) { f << stringf("%s\n", first ? "" : ","); f << stringf(" %s%s: ", for_module ? "" : " ", get_name(param.first, ctx).c_str()); - write_parameter_value(f, param.second); + f << get_string(param.second.to_string()); first = false; } } |