aboutsummaryrefslogtreecommitdiffstats
path: root/json
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-04-19 09:27:34 -0700
committerEddie Hung <eddie@fpgeh.com>2019-04-19 09:27:34 -0700
commitd49eb2ba40a4c1eb429d67c811c5a5ebc1c22015 (patch)
treeced48d891206c5a30f311877aa37d191f7b5f85e /json
parent0be844e6a8d0a36a50815ec5331fd7480dd20db6 (diff)
downloadnextpnr-d49eb2ba40a4c1eb429d67c811c5a5ebc1c22015.tar.gz
nextpnr-d49eb2ba40a4c1eb429d67c811c5a5ebc1c22015.tar.bz2
nextpnr-d49eb2ba40a4c1eb429d67c811c5a5ebc1c22015.zip
Changes to cope with YosysHQ/yosys#943
Diffstat (limited to 'json')
-rw-r--r--json/jsonparse.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/json/jsonparse.cc b/json/jsonparse.cc
index a0479c2e..5d77c101 100644
--- a/json/jsonparse.cc
+++ b/json/jsonparse.cc
@@ -285,7 +285,7 @@ void vcc_net(Context *ctx, NetInfo *net)
// true, false otherwise
bool is_blackbox(JsonNode *node)
{
- JsonNode *attr_node, *bbox_node;
+ JsonNode *attr_node, *bbox_node = nullptr, *wbox_node = nullptr;
if (node->data_dict.count("attributes") == 0)
return false;
@@ -296,14 +296,19 @@ bool is_blackbox(JsonNode *node)
return false;
if (GetSize(attr_node->data_dict) == 0)
return false;
- if (attr_node->data_dict.count("blackbox") == 0)
+ if (attr_node->data_dict.count("blackbox"))
+ bbox_node = attr_node->data_dict.at("blackbox");
+ if (attr_node->data_dict.count("whitebox"))
+ wbox_node = attr_node->data_dict.at("whitebox");
+ if (bbox_node == NULL && wbox_node == NULL)
return false;
- bbox_node = attr_node->data_dict.at("blackbox");
- if (bbox_node == NULL)
+ if (bbox_node && bbox_node->type != 'N')
+ log_error("JSON module blackbox attribute value is not a number\n");
+ if (bbox_node && bbox_node->data_number == 0)
return false;
- if (bbox_node->type != 'N')
- log_error("JSON module blackbox is not a number\n");
- if (bbox_node->data_number == 0)
+ if (wbox_node && wbox_node->type != 'N')
+ log_error("JSON module whitebox attribute value is not a number\n");
+ if (wbox_node && wbox_node->data_number == 0)
return false;
return true;
}