aboutsummaryrefslogtreecommitdiffstats
path: root/json
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-08-07 18:48:06 +0100
committerDavid Shah <dave@ds0.me>2019-08-07 18:48:06 +0100
commitbb0b6e85ce713012cd90cd18882c7873888648a1 (patch)
treecbe279b2a938767cbbc15f57d6ff9d940b12dd55 /json
parentfba7c2caef79668341882404f2c6a1655df23548 (diff)
downloadnextpnr-bb0b6e85ce713012cd90cd18882c7873888648a1.tar.gz
nextpnr-bb0b6e85ce713012cd90cd18882c7873888648a1.tar.bz2
nextpnr-bb0b6e85ce713012cd90cd18882c7873888648a1.zip
json: Fix import/export of ports driven by the same net
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'json')
-rw-r--r--json/jsonparse.cc4
-rw-r--r--json/jsonwrite.cc2
2 files changed, 3 insertions, 3 deletions
diff --git a/json/jsonparse.cc b/json/jsonparse.cc
index b3bb491b..ad21daf2 100644
--- a/json/jsonparse.cc
+++ b/json/jsonparse.cc
@@ -733,10 +733,10 @@ static void insert_iobuf(Context *ctx, NetInfo *net, PortType type, const string
}
PortInfo pinfo;
- pinfo.name = net->name;
+ pinfo.name = ctx->id(name);
pinfo.net = net;
pinfo.type = type;
- ctx->ports[net->name] = pinfo;
+ ctx->ports[pinfo.name] = pinfo;
}
void json_import_toplevel_port(Context *ctx, const string &modname, const std::vector<IdString> &netnames,
diff --git a/json/jsonwrite.cc b/json/jsonwrite.cc
index 1229957b..3d3b70e4 100644
--- a/json/jsonwrite.cc
+++ b/json/jsonwrite.cc
@@ -95,7 +95,7 @@ std::vector<PortGroup> group_ports(Context *ctx)
if (int(grp.bits.size()) <= index)
grp.bits.resize(index + 1, -1);
NPNR_ASSERT(grp.bits.at(index) == -1);
- grp.bits.at(index) = pair.first.index;
+ grp.bits.at(index) = pair.second.net ? pair.second.net->name.index : pair.first.index;
}
}
return groups;