diff options
author | David Shah <davey1576@gmail.com> | 2018-10-14 13:22:47 +0100 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-10-14 13:22:47 +0100 |
commit | 1fc2318c530f85e6c3fe93d7459646b4cfdff68f (patch) | |
tree | 2290d3a9d84a5137f161288f1be503841088708a | |
parent | bda94aa5a563bc16e4ed437fbc5443467c5a8db4 (diff) | |
download | nextpnr-1fc2318c530f85e6c3fe93d7459646b4cfdff68f.tar.gz nextpnr-1fc2318c530f85e6c3fe93d7459646b4cfdff68f.tar.bz2 nextpnr-1fc2318c530f85e6c3fe93d7459646b4cfdff68f.zip |
ecp5: Optimise DCC placement
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r-- | ecp5/globals.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ecp5/globals.cc b/ecp5/globals.cc index 364e4bca..5e5a2a01 100644 --- a/ecp5/globals.cc +++ b/ecp5/globals.cc @@ -24,7 +24,7 @@ #include "cells.h" #include "log.h" #include "nextpnr.h" - +#include "place_common.h" #define fmt_str(x) (static_cast<const std::ostringstream &>(std::ostringstream() << x).str()) NEXTPNR_NAMESPACE_BEGIN @@ -260,15 +260,24 @@ class Ecp5GlobalRouter // Attempt to place a DCC void place_dcc(CellInfo *dcc) { + BelId best_bel; + wirelen_t best_wirelen = 9999999; for (auto bel : ctx->getBels()) { if (ctx->getBelType(bel) == id_DCCA && ctx->checkBelAvail(bel)) { if (ctx->isValidBelForCell(dcc, bel)) { ctx->bindBel(bel, dcc, STRENGTH_LOCKED); - return; + float tns; + wirelen_t wirelen = get_net_metric(ctx, dcc->ports.at(id_CLKI).net, MetricType::WIRELENGTH, tns); + if (wirelen < best_wirelen) { + best_bel = bel; + best_wirelen = wirelen; + } + ctx->unbindBel(bel); } } } - NPNR_ASSERT_FALSE("failed to place dcca"); + NPNR_ASSERT(best_bel != BelId()); + ctx->bindBel(best_bel, dcc, STRENGTH_LOCKED); } // Insert a DCC into a net to promote it to a global |