From 094233a4ab49245d8fbdbae83f3241ff3c6585b0 Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Sun, 6 Dec 2020 21:50:04 -0500 Subject: [PATCH] machxo2: Implement getBelLocation to stop std::out_of_range in place phase. --- machxo2/arch.cc | 5 ----- machxo2/arch.h | 11 ++++++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/machxo2/arch.cc b/machxo2/arch.cc index 431fcc88..dccbcb87 100644 --- a/machxo2/arch.cc +++ b/machxo2/arch.cc @@ -118,11 +118,6 @@ BelId Arch::getBelByName(IdString name) const IdString Arch::getBelName(BelId bel) const { return IdString(); } -Loc Arch::getBelLocation(BelId bel) const -{ - return Loc(); -} - BelId Arch::getBelByLocation(Loc loc) const { return BelId(); diff --git a/machxo2/arch.h b/machxo2/arch.h index 1cf24892..527c6572 100644 --- a/machxo2/arch.h +++ b/machxo2/arch.h @@ -348,7 +348,16 @@ struct Arch : BaseCtx BelId getBelByName(IdString name) 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; const std::vector &getBelsByTile(int x, int y) const; bool getBelGlobalBuf(BelId bel) const;