diff options
author | David Shah <davey1576@gmail.com> | 2019-03-21 12:36:11 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-21 12:36:11 +0000 |
commit | 0d064c05f91b548638530e6e159ca9f8aa0fa352 (patch) | |
tree | 98cd8f35fd28dfc7c7dbcd17cb1b439fab892d35 /json | |
parent | 85bff663932db051a4f7760e9a02bfd20e471108 (diff) | |
parent | 997a66791e13c8e983fcd01473d51a66cbb971b7 (diff) | |
download | nextpnr-0d064c05f91b548638530e6e159ca9f8aa0fa352.tar.gz nextpnr-0d064c05f91b548638530e6e159ca9f8aa0fa352.tar.bz2 nextpnr-0d064c05f91b548638530e6e159ca9f8aa0fa352.zip |
Merge pull request #252 from YosysHQ/tristate_json
json: Fix inputs directly driving inouts
Diffstat (limited to 'json')
-rw-r--r-- | json/jsonparse.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/json/jsonparse.cc b/json/jsonparse.cc index 5f4df0a2..a0479c2e 100644 --- a/json/jsonparse.cc +++ b/json/jsonparse.cc @@ -758,11 +758,26 @@ void json_import(Context *ctx, string modname, JsonNode *node) // N.B. ports must be imported after cells for tristate behaviour // to be correct - // Loop through all ports + // Loop through all ports, first non-tristate then tristate to handle + // interconnected ports correctly for (int portid = 0; portid < GetSize(ports_parent->data_dict_keys); portid++) { JsonNode *here; here = ports_parent->data_dict.at(ports_parent->data_dict_keys[portid]); + JsonNode *dir_node = here->data_dict.at("direction"); + NPNR_ASSERT(dir_node->type == 'S'); + if (dir_node->data_string == "inout") + continue; + json_import_toplevel_port(ctx, modname, netids, ports_parent->data_dict_keys[portid], here); + } + for (int portid = 0; portid < GetSize(ports_parent->data_dict_keys); portid++) { + JsonNode *here; + + here = ports_parent->data_dict.at(ports_parent->data_dict_keys[portid]); + JsonNode *dir_node = here->data_dict.at("direction"); + NPNR_ASSERT(dir_node->type == 'S'); + if (dir_node->data_string != "inout") + continue; json_import_toplevel_port(ctx, modname, netids, ports_parent->data_dict_keys[portid], here); } } |