aboutsummaryrefslogtreecommitdiffstats
path: root/common/design_utils.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-11-18 14:28:40 +0000
committerGitHub <noreply@github.com>2019-11-18 14:28:40 +0000
commitd08e2ade889b709af124d4332a60c6b504a120a2 (patch)
treee30b28b2d5f6a1925d8912c80badbcc34d291bba /common/design_utils.cc
parente270fcd1dbc0e7d81a6775aca3472689ef39e7ef (diff)
parentf2b9cc6d2311c437d740873111e806e9e5078736 (diff)
downloadnextpnr-d08e2ade889b709af124d4332a60c6b504a120a2.tar.gz
nextpnr-d08e2ade889b709af124d4332a60c6b504a120a2.tar.bz2
nextpnr-d08e2ade889b709af124d4332a60c6b504a120a2.zip
Merge pull request #345 from YosysHQ/dave/sdf
Improve handling of top level IO and add SDF support
Diffstat (limited to 'common/design_utils.cc')
-rw-r--r--common/design_utils.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/design_utils.cc b/common/design_utils.cc
index bdf5ca5c..10212a03 100644
--- a/common/design_utils.cc
+++ b/common/design_utils.cc
@@ -88,7 +88,7 @@ void connect_port(const Context *ctx, NetInfo *net, CellInfo *cell, IdString por
NPNR_ASSERT(net->driver.cell == nullptr);
net->driver.cell = cell;
net->driver.port = port_name;
- } else if (port.type == PORT_IN) {
+ } else if (port.type == PORT_IN || port.type == PORT_INOUT) {
PortRef user;
user.cell = cell;
user.port = port_name;
@@ -146,4 +146,14 @@ void rename_port(Context *ctx, CellInfo *cell, IdString old_name, IdString new_n
cell->ports[new_name] = pi;
}
+void rename_net(Context *ctx, NetInfo *net, IdString new_name)
+{
+ if (net == nullptr)
+ return;
+ NPNR_ASSERT(!ctx->nets.count(new_name));
+ std::swap(ctx->nets[net->name], ctx->nets[new_name]);
+ ctx->nets.erase(net->name);
+ net->name = new_name;
+}
+
NEXTPNR_NAMESPACE_END