machxo2: Implement getBelLocation to stop std::out_of_range in place phase.

This commit is contained in:
William D. Jones 2020-12-06 21:50:04 -05:00 committed by gatecat
parent 52b424c385
commit 094233a4ab
2 changed files with 10 additions and 6 deletions

View File

@ -118,11 +118,6 @@ BelId Arch::getBelByName(IdString name) const
IdString Arch::getBelName(BelId bel) const { return IdString(); } IdString Arch::getBelName(BelId bel) const { return IdString(); }
Loc Arch::getBelLocation(BelId bel) const
{
return Loc();
}
BelId Arch::getBelByLocation(Loc loc) const BelId Arch::getBelByLocation(Loc loc) const
{ {
return BelId(); return BelId();

View File

@ -348,7 +348,16 @@ struct Arch : BaseCtx
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
{
NPNR_ASSERT(bel != BelId());
Loc loc;
loc.x = bel.location.x;
loc.y = bel.location.y;
loc.z = tileInfo(bel)->bel_data[bel.index].z;
return loc;
}
BelId getBelByLocation(Loc loc) const; BelId getBelByLocation(Loc loc) const;
const std::vector<BelId> &getBelsByTile(int x, int y) const; const std::vector<BelId> &getBelsByTile(int x, int y) const;
bool getBelGlobalBuf(BelId bel) const; bool getBelGlobalBuf(BelId bel) const;