From 271cc7be115fc28ffe82a1bade235e41a3b43896 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Mon, 19 Nov 2018 01:59:53 +0100 Subject: ice40/pack: Add helper to constain cells that are unique in the FPGA Signed-off-by: Sylvain Munaut --- ice40/pack.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ice40/pack.cc') 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 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) { -- cgit v1.2.3