Add getGridDimX(), getGridDimY(), getTileDimZ() API

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-07-23 12:19:54 +02:00
parent 54d1b8adce
commit 27c5236826
3 changed files with 31 additions and 1 deletions

View File

@ -78,7 +78,24 @@ void Arch::addBel(IdString name, IdString type, Loc loc, bool gb)
bel_ids_by_type[type].push_back(name); bel_ids_by_type[type].push_back(name);
bel_by_loc[loc] = 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); 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) void Arch::addBelInput(IdString bel, IdString name, IdString wire)

View File

@ -87,11 +87,14 @@ struct Arch : BaseCtx
std::unordered_map<IdString, std::vector<IdString>> bel_ids_by_type; std::unordered_map<IdString, std::vector<IdString>> bel_ids_by_type;
std::unordered_map<Loc, BelId> bel_by_loc; 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; std::unordered_map<DecalId, std::vector<GraphicElement>> decal_graphics;
DecalXY frame_decalxy; DecalXY frame_decalxy;
int gridDimX, gridDimY;
std::vector<std::vector<int>> tileDimZ;
float grid_distance_to_delay; float grid_distance_to_delay;
void addWire(IdString name, int x, int y); void addWire(IdString name, int x, int y);
@ -131,6 +134,10 @@ struct Arch : BaseCtx
BelType belTypeFromId(IdString id) const { return id; } BelType belTypeFromId(IdString id) const { return id; }
PortPin portPinFromId(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; BelId getBelByName(IdString name) const;
IdString getBelName(BelId bel) const; IdString getBelName(BelId bel) const;
Loc getBelLocation(BelId bel) const; Loc getBelLocation(BelId bel) const;

View File

@ -377,6 +377,12 @@ struct Arch : BaseCtx
// ------------------------------------------------- // -------------------------------------------------
int getGridDimX() const { return 34; }
int getGridDimY() const { return 34; }
int getTileDimZ(int, int) const { return 8; }
// -------------------------------------------------
BelId getBelByName(IdString name) const; BelId getBelByName(IdString name) const;
IdString getBelName(BelId bel) const IdString getBelName(BelId bel) const