aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/arch.cc
diff options
context:
space:
mode:
authorEddie Hung <eddie.hung+gitlab@gmail.com>2018-07-21 19:03:35 +0000
committerEddie Hung <eddie.hung+gitlab@gmail.com>2018-07-21 19:03:35 +0000
commitf176ee48cdd6b508f6f26e7b2ccca97a680929cf (patch)
tree93d8b7f0baad5b504aff26acdba441ea6ba6d8c6 /ice40/arch.cc
parent3eecccc6f7f8c36994e9227adfc8ab1067ea287f (diff)
parent1f6897733b57f03cf7f5ccab46c27de811d42167 (diff)
downloadnextpnr-f176ee48cdd6b508f6f26e7b2ccca97a680929cf.tar.gz
nextpnr-f176ee48cdd6b508f6f26e7b2ccca97a680929cf.tar.bz2
nextpnr-f176ee48cdd6b508f6f26e7b2ccca97a680929cf.zip
Merge branch 'redist_slack' into 'redist_slack'
Redist slack See merge request eddiehung/nextpnr!5
Diffstat (limited to 'ice40/arch.cc')
-rw-r--r--ice40/arch.cc53
1 files changed, 51 insertions, 2 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc
index 1aa02294..e9a7d2b6 100644
--- a/ice40/arch.cc
+++ b/ice40/arch.cc
@@ -25,7 +25,7 @@
#include "placer1.h"
#include "router1.h"
#include "util.h"
-
+#include "cells.h"
NEXTPNR_NAMESPACE_BEGIN
// -----------------------------------------------------------------------
@@ -255,11 +255,52 @@ BelId Arch::getBelByName(IdString name) const
return ret;
}
+BelId Arch::getBelByLocation(Loc loc) const
+{
+ BelId bel;
+
+ if (bel_by_loc.empty()) {
+ for (int i = 0; i < chip_info->num_bels; i++) {
+ BelId b;
+ b.index = i;
+ bel_by_loc[getBelLocation(b)] = i;
+ }
+ }
+
+ auto it = bel_by_loc.find(loc);
+ if (it != bel_by_loc.end())
+ bel.index = it->second;
+
+ return bel;
+}
+
+BelRange Arch::getBelsByTile(int x, int y) const
+{
+ // In iCE40 chipdb bels at the same tile are consecutive and dense z ordinates are used
+ BelRange br;
+
+ Loc loc;
+ loc.x = x;
+ loc.y = y;
+ loc.z = 0;
+
+ br.b.cursor = Arch::getBelByLocation(loc).index;
+ br.e.cursor = br.b.cursor;
+
+ if (br.e.cursor != -1) {
+ while (br.e.cursor < chip_info->num_bels &&
+ chip_info->bel_data[br.e.cursor].x == x &&
+ chip_info->bel_data[br.e.cursor].y == y)
+ br.e.cursor++;
+ }
+
+ return br;
+}
+
BelRange Arch::getBelsAtSameTile(BelId bel) const
{
BelRange br;
NPNR_ASSERT(bel != BelId());
- // This requires Bels at the same tile are consecutive
int x = chip_info->bel_data[bel.index].x;
int y = chip_info->bel_data[bel.index].y;
int start = bel.index, end = bel.index;
@@ -704,6 +745,14 @@ void Arch::assignArchInfo()
NetInfo *ni = net.second.get();
if (isGlobalNet(ni))
ni->is_global = true;
+ ni->is_enable = false;
+ ni->is_reset = false;
+ for (auto usr : ni->users) {
+ if (is_enable_port(this, usr))
+ ni->is_enable = true;
+ if (is_reset_port(this, usr))
+ ni->is_reset = true;
+ }
}
for (auto &cell : getCtx()->cells) {
CellInfo *ci = cell.second.get();