aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/chains.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-09-23 15:51:05 +0100
committerDavid Shah <dave@ds0.me>2019-09-23 15:51:05 +0100
commitfac998ddcb96164a8c8f403445db6180129c5e48 (patch)
tree70faa1e5360ec63291dd8ac3923f6090f581ca3e /ice40/chains.cc
parentcb71b488ecaf34ea2d55bb2bfe5b1b6ebfd06a6e (diff)
downloadnextpnr-fac998ddcb96164a8c8f403445db6180129c5e48.tar.gz
nextpnr-fac998ddcb96164a8c8f403445db6180129c5e48.tar.bz2
nextpnr-fac998ddcb96164a8c8f403445db6180129c5e48.zip
ice40: Fix carry feed-out when we have to split the chain next
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'ice40/chains.cc')
-rw-r--r--ice40/chains.cc21
1 files changed, 19 insertions, 2 deletions
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;