aboutsummaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-11-26 10:10:26 +0000
committerDavid Shah <dave@ds0.me>2019-11-26 10:10:26 +0000
commitdefafcf5fee8a6dac4a4d147751823aae7c2288b (patch)
tree89c9511acfcbc8ebcd8630aff5aa6b731f74d060 /generic
parentff9d6b4f89c6b2d92326ce821d045cb1875a7999 (diff)
downloadnextpnr-defafcf5fee8a6dac4a4d147751823aae7c2288b.tar.gz
nextpnr-defafcf5fee8a6dac4a4d147751823aae7c2288b.tar.bz2
nextpnr-defafcf5fee8a6dac4a4d147751823aae7c2288b.zip
generic: Use HeAP as placer where possible
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'generic')
-rw-r--r--generic/arch.cc36
1 files changed, 33 insertions, 3 deletions
diff --git a/generic/arch.cc b/generic/arch.cc
index 9e59540e..14d15115 100644
--- a/generic/arch.cc
+++ b/generic/arch.cc
@@ -21,6 +21,7 @@
#include <math.h>
#include "nextpnr.h"
#include "placer1.h"
+#include "placer_heap.h"
#include "router1.h"
#include "util.h"
@@ -494,8 +495,29 @@ bool Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay
bool Arch::place()
{
std::string placer = str_or_default(settings, id("placer"), defaultPlacer);
- // FIXME: No HeAP because it needs a list of IO buffers
- if (placer == "sa") {
+ if (placer == "heap") {
+ bool have_iobuf_or_constr = false;
+ for (auto cell : sorted(cells)) {
+ CellInfo *ci = cell.second;
+ if (ci->type == id("GENERIC_IOB") || ci->bel != BelId() || ci->attrs.count(id("BEL"))) {
+ have_iobuf_or_constr = true;
+ break;
+ }
+ }
+ bool retVal;
+ if (!have_iobuf_or_constr) {
+ log_warning("Unable to use HeAP due to a lack of IO buffers or constrained cells as anchors; reverting to "
+ "SA.\n");
+ retVal = placer1(getCtx(), Placer1Cfg(getCtx()));
+ } else {
+ PlacerHeapCfg cfg(getCtx());
+ cfg.ioBufTypes.insert(id("GENERIC_IOB"));
+ retVal = placer_heap(getCtx(), cfg);
+ }
+ getCtx()->settings[getCtx()->id("place")] = 1;
+ archInfoToAttributes();
+ return retVal;
+ } else if (placer == "sa") {
bool retVal = placer1(getCtx(), Placer1Cfg(getCtx()));
getCtx()->settings[getCtx()->id("place")] = 1;
archInfoToAttributes();
@@ -596,9 +618,17 @@ bool Arch::isBelLocationValid(BelId bel) const
return cellsCompatible(cells.data(), int(cells.size()));
}
+#ifdef WITH_HEAP
+const std::string Arch::defaultPlacer = "heap";
+#else
const std::string Arch::defaultPlacer = "sa";
-const std::vector<std::string> Arch::availablePlacers = {"sa"};
+#endif
+const std::vector<std::string> Arch::availablePlacers = {"sa",
+#ifdef WITH_HEAP
+ "heap"
+#endif
+};
void Arch::assignArchInfo()
{
for (auto &cell : getCtx()->cells) {