From 79dc910b40b082c9d74d010557b7939fb18535fe Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 19 Jul 2018 14:32:30 +0200 Subject: [PATCH] ice40: Trim DSP inputs that are constant where appropriate Signed-off-by: David Shah --- generic/archdefs.h | 8 ++++++-- ice40/pack.cc | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/generic/archdefs.h b/generic/archdefs.h index f5999776..06d4ec6e 100644 --- a/generic/archdefs.h +++ b/generic/archdefs.h @@ -52,7 +52,11 @@ typedef IdString PipId; typedef IdString GroupId; typedef IdString DecalId; -struct ArchNetInfo { }; -struct ArchCellInfo { }; +struct ArchNetInfo +{ +}; +struct ArchCellInfo +{ +}; NEXTPNR_NAMESPACE_END diff --git a/ice40/pack.cc b/ice40/pack.cc index 78df00f6..7e2e389c 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -307,6 +307,10 @@ static void set_net_constant(const Context *ctx, NetInfo *orig, NetInfo *constne if ((is_lut(ctx, uc) || is_lc(ctx, uc) || is_carry(ctx, uc)) && (user.port.str(ctx).at(0) == 'I') && !constval) { uc->ports[user.port].net = nullptr; + } else if ((is_sb_mac16(ctx, uc) || uc->type == ctx->id("ICESTORM_DSP")) && + (user.port != ctx->id("CLK") && + ((constval && user.port == ctx->id("CE")) || (!constval && user.port != ctx->id("CE"))))) { + uc->ports[user.port].net = nullptr; } else { uc->ports[user.port].net = constnet; constnet->users.push_back(user);