aboutsummaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-11-26 22:59:15 +0000
committerGitHub <noreply@github.com>2019-11-26 22:59:15 +0000
commit2f7c7ccf80cb22f0f93fccb99667f4178bf989a5 (patch)
treed515703dced500570dc298f8f0ad85cb5a8d9344 /generic
parentb7079d159b0ca9db8c4cab350f2ee08ab65810b7 (diff)
parent4916eb9bb16b09a547e97e7aa18444660d44ddd8 (diff)
downloadnextpnr-2f7c7ccf80cb22f0f93fccb99667f4178bf989a5.tar.gz
nextpnr-2f7c7ccf80cb22f0f93fccb99667f4178bf989a5.tar.bz2
nextpnr-2f7c7ccf80cb22f0f93fccb99667f4178bf989a5.zip
Merge pull request #357 from YosysHQ/heap-fixes
HeAP: Support for region constraints, better error handling, default for all arches
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) {