diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-07-23 12:19:54 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-07-23 12:19:54 +0200 |
commit | 27c523682601e7b504c924a00bec98743fd3477c (patch) | |
tree | 617aa81c34f9a211b83135dea01865560254a86b /generic | |
parent | 54d1b8adcee3d1a89bf86b87be281e683d1cea93 (diff) | |
download | nextpnr-27c523682601e7b504c924a00bec98743fd3477c.tar.gz nextpnr-27c523682601e7b504c924a00bec98743fd3477c.tar.bz2 nextpnr-27c523682601e7b504c924a00bec98743fd3477c.zip |
Add getGridDimX(), getGridDimY(), getTileDimZ() API
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'generic')
-rw-r--r-- | generic/arch.cc | 17 | ||||
-rw-r--r-- | generic/arch.h | 9 |
2 files changed, 25 insertions, 1 deletions
diff --git a/generic/arch.cc b/generic/arch.cc index 6f2bd5df..4fc07613 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -78,7 +78,24 @@ void Arch::addBel(IdString name, IdString type, Loc loc, bool gb) bel_ids_by_type[type].push_back(name); bel_by_loc[loc] = name; + + if (bels_by_tile.size() <= loc.x) + bels_by_tile.resize(loc.x + 1); + + if (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) + tileDimZ.resize(loc.x + 1); + + if (tileDimZ[loc.x].size() <= loc.y) + tileDimZ[loc.x].resize(loc.y + 1); + + gridDimX = std::max(gridDimX, loc.x + 1); + gridDimY = std::max(gridDimY, loc.x + 1); + tileDimZ[loc.x][loc.y] = std::max(tileDimZ[loc.x][loc.y], loc.z + 1); } void Arch::addBelInput(IdString bel, IdString name, IdString wire) diff --git a/generic/arch.h b/generic/arch.h index a77dca68..5f0df988 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -87,11 +87,14 @@ struct Arch : BaseCtx std::unordered_map<IdString, std::vector<IdString>> bel_ids_by_type; std::unordered_map<Loc, BelId> bel_by_loc; - std::unordered_map<int, std::unordered_map<int, std::vector<BelId>>> bels_by_tile; + std::vector<std::vector<std::vector<BelId>>> bels_by_tile; std::unordered_map<DecalId, std::vector<GraphicElement>> decal_graphics; DecalXY frame_decalxy; + int gridDimX, gridDimY; + std::vector<std::vector<int>> tileDimZ; + float grid_distance_to_delay; void addWire(IdString name, int x, int y); @@ -131,6 +134,10 @@ struct Arch : BaseCtx BelType belTypeFromId(IdString id) const { return id; } PortPin portPinFromId(IdString id) const { return id; } + int getGridDimX() const { return gridDimX; } + int getGridDimY() const { return gridDimY; } + int getTileDimZ(int x, int y) const { return tileDimZ[x][y]; } + BelId getBelByName(IdString name) const; IdString getBelName(BelId bel) const; Loc getBelLocation(BelId bel) const; |