aboutsummaryrefslogtreecommitdiffstats
path: root/generic/arch.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-07-24 16:38:45 +0200
committerDavid Shah <davey1576@gmail.com>2018-07-24 16:38:45 +0200
commitc57463e87b4976f63f04eff133c554af7e8d59d3 (patch)
tree2d54b495760a7363769beb93ba8f26b9149abaf6 /generic/arch.cc
parent3931c84fedc568e24c7e7e98132ec5757cdb29ab (diff)
parenta82a8840d2c3995a1b746020a54315acd7fba7b8 (diff)
downloadnextpnr-c57463e87b4976f63f04eff133c554af7e8d59d3.tar.gz
nextpnr-c57463e87b4976f63f04eff133c554af7e8d59d3.tar.bz2
nextpnr-c57463e87b4976f63f04eff133c554af7e8d59d3.zip
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
Diffstat (limited to 'generic/arch.cc')
-rw-r--r--generic/arch.cc33
1 files changed, 29 insertions, 4 deletions
diff --git a/generic/arch.cc b/generic/arch.cc
index af245a4b..ac79ebea 100644
--- a/generic/arch.cc
+++ b/generic/arch.cc
@@ -77,18 +77,18 @@ void Arch::addBel(IdString name, IdString type, Loc loc, bool gb)
bel_ids.push_back(name);
bel_by_loc[loc] = name;
- if (bels_by_tile.size() <= loc.x)
+ if (int(bels_by_tile.size()) <= loc.x)
bels_by_tile.resize(loc.x + 1);
- if (bels_by_tile[loc.x].size() <= loc.y)
+ if (int(bels_by_tile[loc.x].size()) <= loc.y)
bels_by_tile[loc.x].resize(loc.y + 1);
bels_by_tile[loc.x][loc.y].push_back(name);
- if (tileDimZ.size() <= loc.x)
+ if (int(tileDimZ.size()) <= loc.x)
tileDimZ.resize(loc.x + 1);
- if (tileDimZ[loc.x].size() <= loc.y)
+ if (int(tileDimZ[loc.x].size()) <= loc.y)
tileDimZ[loc.x].resize(loc.y + 1);
gridDimX = std::max(gridDimX, loc.x + 1);
@@ -193,6 +193,30 @@ BelId Arch::getBelByName(IdString name) const
IdString Arch::getBelName(BelId bel) const { return bel; }
+Loc Arch::getBelLocation(BelId bel) const
+{
+ auto &info = bels.at(bel);
+ return Loc(info.x, info.y, info.z);
+}
+
+BelId Arch::getBelByLocation(Loc loc) const
+{
+ auto it = bel_by_loc.find(loc);
+ if (it != bel_by_loc.end())
+ return it->second;
+ return BelId();
+}
+
+const std::vector<BelId> &Arch::getBelsByTile(int x, int y) const
+{
+ return bels_by_tile.at(x).at(y);
+}
+
+bool Arch::getBelGlobalBuf(BelId bel) const
+{
+ return bels.at(bel).gb;
+}
+
uint32_t Arch::getBelChecksum(BelId bel) const
{
// FIXME
@@ -234,6 +258,7 @@ std::vector<PortPin> Arch::getBelPins(BelId bel) const
std::vector<PortPin> ret;
for (auto &it : bels.at(bel).pins)
ret.push_back(it.first);
+ return ret;
}
// ---------------------------------------------------------------