aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/cells.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-07-17 15:44:36 +0200
committerDavid Shah <davey1576@gmail.com>2018-07-17 15:44:36 +0200
commitb52269bc198eb8fcc647100d4891379b7fd7346a (patch)
tree2b5a6319a44e6b4903be310755c4bfd4983eb0ab /ecp5/cells.cc
parentc0567c0d30e2649d4f2b6d122caf43b28e0e80ce (diff)
downloadnextpnr-b52269bc198eb8fcc647100d4891379b7fd7346a.tar.gz
nextpnr-b52269bc198eb8fcc647100d4891379b7fd7346a.tar.bz2
nextpnr-b52269bc198eb8fcc647100d4891379b7fd7346a.zip
ecp5: LUT packer
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5/cells.cc')
-rw-r--r--ecp5/cells.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/ecp5/cells.cc b/ecp5/cells.cc
index 4beaabd2..4a20ce80 100644
--- a/ecp5/cells.cc
+++ b/ecp5/cells.cc
@@ -143,7 +143,7 @@ static void replace_port_safe(bool has_ff, CellInfo *ff, IdString ff_port, CellI
}
}
-void ff_to_lc(Context *ctx, CellInfo *ff, CellInfo *lc, int index, bool driven_by_lut)
+void ff_to_slice(Context *ctx, CellInfo *ff, CellInfo *lc, int index, bool driven_by_lut)
{
bool has_ff = lc->ports.at(ctx->id("Q0")).net != nullptr || lc->ports.at(ctx->id("Q1")).net != nullptr;
std::string reg = "REG" + std::to_string(index);
@@ -165,4 +165,14 @@ void ff_to_lc(Context *ctx, CellInfo *ff, CellInfo *lc, int index, bool driven_b
}
}
+void lut_to_slice(Context *ctx, CellInfo *lut, CellInfo *lc, int index)
+{
+ lc->params[ctx->id("LUT" + std::to_string(index) + "_INITVAL")] = str_or_default(lc->params, ctx->id("INIT"), "0");
+ replace_port(lut, ctx->id("A"), lc, ctx->id("A" + std::to_string(index)));
+ replace_port(lut, ctx->id("B"), lc, ctx->id("B" + std::to_string(index)));
+ replace_port(lut, ctx->id("C"), lc, ctx->id("C" + std::to_string(index)));
+ replace_port(lut, ctx->id("D"), lc, ctx->id("D" + std::to_string(index)));
+ replace_port(lut, ctx->id("Z"), lc, ctx->id("F" + std::to_string(index)));
+}
+
NEXTPNR_NAMESPACE_END