aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2018-11-19 01:59:53 +0100
committerSylvain Munaut <tnt@246tNt.com>2018-11-19 18:20:20 +0100
commit271cc7be115fc28ffe82a1bade235e41a3b43896 (patch)
treec4237118666a155c9a084f9b5d2a603292dd7be9 /ice40
parent519d4e2af8d8e7d8e2d1d873b9cd9681ef83cc62 (diff)
downloadnextpnr-271cc7be115fc28ffe82a1bade235e41a3b43896.tar.gz
nextpnr-271cc7be115fc28ffe82a1bade235e41a3b43896.tar.bz2
nextpnr-271cc7be115fc28ffe82a1bade235e41a3b43896.zip
ice40/pack: Add helper to constain cells that are unique in the FPGA
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/pack.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc
index a40f0878..255dc75f 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -695,6 +695,22 @@ static std::unique_ptr<CellInfo> spliceLUT(Context *ctx, CellInfo *ci, IdString
return pt;
}
+// Force placement for cells that are unique anyway
+static BelId cell_place_unique(Context *ctx, CellInfo *ci)
+{
+ for (auto bel : ctx->getBels()) {
+ if (ctx->getBelType(bel) != ci->type)
+ continue;
+ if (ctx->isBelLocked(bel))
+ continue;
+ IdString bel_name = ctx->getBelName(bel);
+ ci->attrs[ctx->id("BEL")] = bel_name.str(ctx);
+ log_info(" constrained %s '%s' to %s\n", ci->type.c_str(ctx), ci->name.c_str(ctx), bel_name.c_str(ctx));
+ return bel;
+ }
+ log_error("Unable to place cell '%s' of type '%s'\n", ci->name.c_str(ctx), ci->type.c_str(ctx));
+}
+
// Pack special functions
static void pack_special(Context *ctx)
{