aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/pack.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-12-20 18:50:34 +0000
committerDavid Shah <davey1576@gmail.com>2018-12-20 18:50:34 +0000
commit75335d4e1a66f10be81a17e4728e7312b36e59bd (patch)
treec493eb34fe3d5d562295229a83f69f283db7d830 /ice40/pack.cc
parentc46a22cb7ff3449464a60c3bc62b22dded78d306 (diff)
downloadnextpnr-75335d4e1a66f10be81a17e4728e7312b36e59bd.tar.gz
nextpnr-75335d4e1a66f10be81a17e4728e7312b36e59bd.tar.bz2
nextpnr-75335d4e1a66f10be81a17e4728e7312b36e59bd.zip
ice40: Fix LOCK feedthrough insertion with carry or >8 LUTs
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40/pack.cc')
-rw-r--r--ice40/pack.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc
index 242f8ceb..536b1b16 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -1181,20 +1181,26 @@ static void pack_special(Context *ctx)
log_info(" PLL '%s' has LOCK output, need to pass all outputs via LUT\n", ci->name.c_str(ctx));
bool found_lut = false;
bool all_luts = true;
+ bool found_carry = false;
unsigned int lut_count = 0;
for (const auto &user : port.net->users) {
NPNR_ASSERT(user.cell != nullptr);
if (user.cell->type == ctx->id("ICESTORM_LC")) {
- found_lut = true;
- lut_count++;
+ if (bool_or_default(user.cell->params, ctx->id("CARRY_ENABLE"), false)) {
+ found_carry = true;
+ all_luts = false;
+ } else {
+ found_lut = true;
+ lut_count++;
+ }
} else {
all_luts = false;
}
}
- if (found_lut && all_luts) {
+ if (found_lut && all_luts && lut_count < 8) {
// Every user is a LUT, carry on now.
- } else if (found_lut && !all_luts && lut_count < 8) {
+ } else if (found_lut && !all_luts && !found_carry && lut_count < 8) {
// Strategy: create a pass-through LUT, move all non-LUT users behind it.
log_info(" LUT strategy for %s: move non-LUT users to new LUT\n", port.name.c_str(ctx));
auto pt = spliceLUT(ctx, packed.get(), port.name, true);