diff options
author | David Shah <davey1576@gmail.com> | 2019-04-11 13:32:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 13:32:01 +0100 |
commit | db7e850ee85aa395aaa98ef4cc736378303f635a (patch) | |
tree | 4a384f2521e868d2e1f08af70f8fa88ac057e77c /ice40 | |
parent | 22da6c8a65d43f91db254851da6135f0e9e801a0 (diff) | |
parent | 6cb4e2e83bcf6173e646df10a4a14e32b8128ccb (diff) | |
download | nextpnr-db7e850ee85aa395aaa98ef4cc736378303f635a.tar.gz nextpnr-db7e850ee85aa395aaa98ef4cc736378303f635a.tar.bz2 nextpnr-db7e850ee85aa395aaa98ef4cc736378303f635a.zip |
Merge pull request #264 from smunaut/fix_sb_unused_in
ice40/pack: During IO packing, remove any unused input connection
Diffstat (limited to 'ice40')
-rw-r--r-- | ice40/pack.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc index b1efe5b2..98cacad3 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -502,6 +502,19 @@ static void pack_io(Context *ctx) // Make it a normal SB_IO with global marker ci->type = ctx->id("SB_IO"); ci->attrs[ctx->id("GLOBAL")] = "1"; + } else if (is_sb_io(ctx, ci)) { + // Disconnect unused inputs + NetInfo *net_in0 = ci->ports.count(id_D_IN_0) ? ci->ports[id_D_IN_0].net : nullptr; + NetInfo *net_in1 = ci->ports.count(id_D_IN_1) ? ci->ports[id_D_IN_1].net : nullptr; + + if (net_in0 != nullptr && net_in0->users.size() == 0) { + delete_nets.insert(net_in0->name); + ci->ports[id_D_IN_0].net = nullptr; + } + if (net_in1 != nullptr && net_in1->users.size() == 0) { + delete_nets.insert(net_in1->name); + ci->ports[id_D_IN_1].net = nullptr; + } } } for (auto pcell : packed_cells) { |