From fac998ddcb96164a8c8f403445db6180129c5e48 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 23 Sep 2019 15:51:05 +0100 Subject: ice40: Fix carry feed-out when we have to split the chain next Signed-off-by: David Shah --- ice40/chains.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'ice40') diff --git a/ice40/chains.cc b/ice40/chains.cc index c8e98900..1a042712 100644 --- a/ice40/chains.cc +++ b/ice40/chains.cc @@ -44,6 +44,8 @@ class ChainConstrainer auto curr_cell = carryc.cells.begin(); while (curr_cell != carryc.cells.end()) { CellInfo *cell = *curr_cell; + if (ctx->debug) + log_info(" processing cell %s\n", ctx->nameOf(cell)); if (tile.size() >= 8) { tile.clear(); } @@ -76,8 +78,23 @@ class ChainConstrainer (net_only_drives(ctx, carry_net, is_lc, ctx->id("I3"), false) != net_only_drives(ctx, carry_net, is_lc, ctx->id("CIN"), false)) || (at_end && !net_only_drives(ctx, carry_net, is_lc, ctx->id("I3"), true))) { - CellInfo *passout = make_carry_pass_out(cell->ports.at(ctx->id("COUT")), - at_end ? nullptr : *(curr_cell + 1)); + if (ctx->debug) + log_info(" inserting feed-%s\n", at_end ? "out" : "out-in"); + CellInfo *passout; + if (!at_end) { + // See if we need to split chain anyway + tile.push_back(*(curr_cell + 1)); + bool split_chain_next = (!ctx->logicCellsCompatible(tile.data(), tile.size())) || + (int(chains.back().cells.size()) > max_length); + tile.pop_back(); + if (split_chain_next) + start_of_chain = true; + passout = make_carry_pass_out(cell->ports.at(ctx->id("COUT")), + split_chain_next ? nullptr : *(curr_cell + 1)); + } else { + passout = make_carry_pass_out(cell->ports.at(ctx->id("COUT")), nullptr); + } + chains.back().cells.push_back(passout); tile.push_back(passout); ++feedio_lcs; -- cgit v1.2.3