From 458aa20161504c06dbfc282be3dd7717a575a31e Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 16 Nov 2018 17:36:34 +0000 Subject: [PATCH] ecp5: More optimal LUT6 placement Signed-off-by: David Shah --- ecp5/arch_place.cc | 6 ++++++ ecp5/archdefs.h | 1 + ecp5/pack.cc | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ecp5/arch_place.cc b/ecp5/arch_place.cc index 41f87cb8..ff70bb5a 100644 --- a/ecp5/arch_place.cc +++ b/ecp5/arch_place.cc @@ -75,6 +75,8 @@ bool Arch::isBelLocationValid(BelId bel) const bel_cells.push_back(cell_other); } } + if (getBoundBelCell(bel) != nullptr && getBoundBelCell(bel)->sliceInfo.has_l6mux && ((bel_loc.z % 2) == 1)) + return false; return slicesCompatible(bel_cells); } else { CellInfo *cell = getBoundBelCell(bel); @@ -92,6 +94,10 @@ bool Arch::isValidBelForCell(CellInfo *cell, BelId bel) const std::vector bel_cells; Loc bel_loc = getBelLocation(bel); + + if (cell->sliceInfo.has_l6mux && ((bel_loc.z % 2) == 1)) + return false; + for (auto bel_other : getBelsByTile(bel_loc.x, bel_loc.y)) { CellInfo *cell_other = getBoundBelCell(bel_other); if (cell_other != nullptr && bel_other != bel) { diff --git a/ecp5/archdefs.h b/ecp5/archdefs.h index 9428960c..bfc5769b 100644 --- a/ecp5/archdefs.h +++ b/ecp5/archdefs.h @@ -158,6 +158,7 @@ struct ArchCellInfo struct { bool using_dff; + bool has_l6mux; IdString clk_sig, lsr_sig, clkmux, lsrmux, srmode; } sliceInfo; }; diff --git a/ecp5/pack.cc b/ecp5/pack.cc index b3f19327..08969f87 100644 --- a/ecp5/pack.cc +++ b/ecp5/pack.cc @@ -435,7 +435,6 @@ class Ecp5Packer replace_port(ci, ctx->id("SD"), slice1, id_M1); replace_port(ci, ctx->id("Z"), slice1, id_OFX1); slice0->constr_z = 1; - slice0->constr_abs_z = true; slice0->constr_x = 0; slice0->constr_y = 0; slice0->constr_parent = slice1; @@ -1294,6 +1293,10 @@ void Arch::assignArchInfo() ci->sliceInfo.clkmux = id(str_or_default(ci->params, id_CLKMUX, "CLK")); ci->sliceInfo.lsrmux = id(str_or_default(ci->params, id_LSRMUX, "LSR")); ci->sliceInfo.srmode = id(str_or_default(ci->params, id_SRMODE, "LSR_OVER_CE")); + ci->sliceInfo.has_l6mux = false; + if (ci->ports.count(id_FXA) && ci->ports[id_FXA].net != nullptr && + ci->ports[id_FXA].net->driver.port == id_OFX0) + ci->sliceInfo.has_l6mux = true; } } }