diff options
author | David Shah <davey1576@gmail.com> | 2018-06-29 15:10:29 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-29 15:10:29 +0200 |
commit | 3b90f3698f9117e30d38d1f5ca1392be1ddfdc57 (patch) | |
tree | 5787f57318b4f2dd753cc44044fed7378d9e2a70 /ice40 | |
parent | 1aa4be770cf2162a617551bfbf76e371657cc8fe (diff) | |
download | nextpnr-3b90f3698f9117e30d38d1f5ca1392be1ddfdc57.tar.gz nextpnr-3b90f3698f9117e30d38d1f5ca1392be1ddfdc57.tar.bz2 nextpnr-3b90f3698f9117e30d38d1f5ca1392be1ddfdc57.zip |
ice40: Fix carry packing in some degenerate cases
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40')
-rw-r--r-- | ice40/pack.cc | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc index 38542f59..253e3fa8 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -188,30 +188,25 @@ static void pack_carries(Context *ctx) if (carry_ci_lc && carry_lcs.find(carry_ci_lc->name) != carry_lcs.end()) { carry_lc = carry_ci_lc; } else { - if (carry_lcs.empty()) { - // No LC to pack into matching I0/I1, insert a new one - std::unique_ptr<CellInfo> created_lc = - create_ice_cell(ctx, ctx->id("ICESTORM_LC"), cell.first.str(ctx) + "$CARRY"); - carry_lc = created_lc.get(); - created_lc->ports.at(ctx->id("I1")).net = i0_net; - if (i0_net) { - PortRef pr; - pr.cell = created_lc.get(); - pr.port = ctx->id("I1"); - i0_net->users.push_back(pr); - } - created_lc->ports.at(ctx->id("I2")).net = i1_net; - if (i1_net) { - PortRef pr; - pr.cell = created_lc.get(); - pr.port = ctx->id("I2"); - i1_net->users.push_back(pr); - } - new_cells.push_back(std::move(created_lc)); - - } else { - carry_lc = ctx->cells.at(*(carry_lcs.begin())).get(); + // No LC to pack into matching I0/I1, insert a new one + std::unique_ptr<CellInfo> created_lc = + create_ice_cell(ctx, ctx->id("ICESTORM_LC"), cell.first.str(ctx) + "$CARRY"); + carry_lc = created_lc.get(); + created_lc->ports.at(ctx->id("I1")).net = i0_net; + if (i0_net) { + PortRef pr; + pr.cell = created_lc.get(); + pr.port = ctx->id("I1"); + i0_net->users.push_back(pr); + } + created_lc->ports.at(ctx->id("I2")).net = i1_net; + if (i1_net) { + PortRef pr; + pr.cell = created_lc.get(); + pr.port = ctx->id("I2"); + i1_net->users.push_back(pr); } + new_cells.push_back(std::move(created_lc)); } carry_lc->params[ctx->id("CARRY_ENABLE")] = "1"; replace_port(ci, ctx->id("CI"), carry_lc, ctx->id("CIN")); |