aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/json
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-19 20:43:52 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-19 20:43:52 +0200
commit1d3450793767ced2003b6d3fb4b7ea2f49f0d1ca (patch)
tree96707190e5a47c0c230791bfc1cc6338107dd8a2 /frontend/json
parent10785bd1cc31091efde02b86795ff20f47bf5fed (diff)
downloadnextpnr-1d3450793767ced2003b6d3fb4b7ea2f49f0d1ca.tar.gz
nextpnr-1d3450793767ced2003b6d3fb4b7ea2f49f0d1ca.tar.bz2
nextpnr-1d3450793767ced2003b6d3fb4b7ea2f49f0d1ca.zip
json: Make the JSON parser deterministic
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'frontend/json')
-rw-r--r--frontend/json/jsonparse.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/frontend/json/jsonparse.cc b/frontend/json/jsonparse.cc
index cfe2739c..afd126fd 100644
--- a/frontend/json/jsonparse.cc
+++ b/frontend/json/jsonparse.cc
@@ -27,6 +27,7 @@
#include <iostream>
#include <log.h>
#include <string>
+#include <map>
#include "nextpnr.h"
NEXTPNR_NAMESPACE_BEGIN
@@ -47,7 +48,7 @@ struct JsonNode
string data_string;
int data_number;
std::vector<JsonNode *> data_array;
- std::unordered_map<string, JsonNode *> data_dict;
+ std::map<string, JsonNode *> data_dict;
std::vector<string> data_dict_keys;
JsonNode(std::istream &f)
@@ -748,11 +749,12 @@ void json_import(Context *ctx, string modname, JsonNode *node)
int netid = bits->data_array.at(i)->data_number;
if (netid >= netnames.size())
netnames.resize(netid + 1);
- netnames.at(netid) = ctx->id(
- basename +
- (num_bits == 1 ? "" : std::string("[") +
- std::to_string(i) +
- std::string("]")));
+ netnames.at(netid) =
+ ctx->id(basename +
+ (num_bits == 1 ? ""
+ : std::string("[") +
+ std::to_string(i) +
+ std::string("]")));
}
}
}