aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-27 16:24:44 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-27 16:24:44 +0200
commitc0724a7e97f024a1d113038272fa3233366a36fb (patch)
tree1f929c46c3d221b3e16f7e04ad4c8474b85c2bb0 /ice40
parent28e851cf456bc0211cd9bf866f0049b14e6cab68 (diff)
downloadnextpnr-c0724a7e97f024a1d113038272fa3233366a36fb.tar.gz
nextpnr-c0724a7e97f024a1d113038272fa3233366a36fb.tar.bz2
nextpnr-c0724a7e97f024a1d113038272fa3233366a36fb.zip
ice40: Only pack up to one SB_CARRY into a LC
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/pack.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc
index 9191255d..38542f59 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -128,7 +128,7 @@ static bool net_is_constant(const Context *ctx, NetInfo *net, bool &value)
static void pack_carries(Context *ctx)
{
log_info("Packing carries..\n");
-
+ std::unordered_set<IdString> exhausted_cells;
std::unordered_set<IdString> packed_cells;
std::vector<std::unique_ptr<CellInfo>> new_cells;
@@ -153,7 +153,8 @@ static void pack_carries(Context *ctx)
if (i0_net) {
for (auto usr : i0_net->users) {
if (is_lc(ctx, usr.cell) && usr.port == ctx->id("I1")) {
- if (ctx->cells.find(usr.cell->name) != ctx->cells.end()) {
+ if (ctx->cells.find(usr.cell->name) != ctx->cells.end() &&
+ exhausted_cells.find(usr.cell->name) == exhausted_cells.end()) {
// This clause stops us double-packing cells
i0_matches.insert(usr.cell->name);
if (!i1_net) {
@@ -161,14 +162,14 @@ static void pack_carries(Context *ctx)
i1_matches.insert(usr.cell->name);
}
}
-
}
}
}
if (i1_net) {
for (auto usr : i1_net->users) {
if (is_lc(ctx, usr.cell) && usr.port == ctx->id("I2")) {
- if (ctx->cells.find(usr.cell->name) != ctx->cells.end()) {
+ if (ctx->cells.find(usr.cell->name) != ctx->cells.end() &&
+ exhausted_cells.find(usr.cell->name) == exhausted_cells.end()) {
// This clause stops us double-packing cells
i1_matches.insert(usr.cell->name);
if (!i0_net) {
@@ -242,6 +243,7 @@ static void pack_carries(Context *ctx)
}));
}
}
+ exhausted_cells.insert(carry_lc->name);
}
}
for (auto pcell : packed_cells) {
@@ -381,7 +383,6 @@ static void pack_io(Context *ctx)
{
std::unordered_set<IdString> packed_cells;
std::vector<std::unique_ptr<CellInfo>> new_cells;
-
log_info("Packing IOs..\n");
for (auto cell : sorted(ctx->cells)) {