diff options
author | David Shah <dave@ds0.me> | 2019-05-10 18:51:45 +0100 |
---|---|---|
committer | David Shah <dave@ds0.me> | 2019-05-10 18:51:45 +0100 |
commit | 12f375a239a8695f027c80c8c01d5fb1dff6568d (patch) | |
tree | 84f1d7cd502055f28df4a8f055bf79538ec05a89 /common/design_utils.cc | |
parent | 5344bc3b65f4e06f983db781e9a82d30b3f1512b (diff) | |
download | nextpnr-12f375a239a8695f027c80c8c01d5fb1dff6568d.tar.gz nextpnr-12f375a239a8695f027c80c8c01d5fb1dff6568d.tar.bz2 nextpnr-12f375a239a8695f027c80c8c01d5fb1dff6568d.zip |
ecp5: Fix USRMCLK primitive
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'common/design_utils.cc')
-rw-r--r-- | common/design_utils.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/common/design_utils.cc b/common/design_utils.cc index da170030..bdf5ca5c 100644 --- a/common/design_utils.cc +++ b/common/design_utils.cc @@ -129,4 +129,21 @@ void connect_ports(Context *ctx, CellInfo *cell1, IdString port1_name, CellInfo connect_port(ctx, port1.net, cell2, port2_name); } +void rename_port(Context *ctx, CellInfo *cell, IdString old_name, IdString new_name) +{ + if (!cell->ports.count(old_name)) + return; + PortInfo pi = cell->ports.at(old_name); + if (pi.net != nullptr) { + if (pi.net->driver.cell == cell && pi.net->driver.port == old_name) + pi.net->driver.port = new_name; + for (auto &usr : pi.net->users) + if (usr.cell == cell && usr.port == old_name) + usr.port = new_name; + } + cell->ports.erase(old_name); + pi.name = new_name; + cell->ports[new_name] = pi; +} + NEXTPNR_NAMESPACE_END |