From c0f1af87f6c1c6843e536a87ef88e39fa3428c5b Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 17 Jul 2018 17:03:44 +0200 Subject: [PATCH] Add Loc struct for x/y/z bel locations Signed-off-by: Clifford Wolf --- common/nextpnr.h | 9 +++++++++ ice40/arch.h | 31 +++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/common/nextpnr.h b/common/nextpnr.h index 50465869..375e1cd7 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -157,6 +157,11 @@ struct GraphicElement std::string text; }; +struct Loc +{ + int x = -1, y = -1, z = -1; +}; + NEXTPNR_NAMESPACE_END #include "archdefs.h" @@ -310,6 +315,10 @@ struct Context : Arch Context(ArchArgs args) : Arch(args) {} + BelId getBelByLocation(Loc loc) const { + return getBelByLocation(loc.x, loc.y, loc.z); + } + // -------------------------------------------------------------- // provided by router1.cc diff --git a/ice40/arch.h b/ice40/arch.h index 5dab414b..d840c6ea 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -424,7 +424,34 @@ struct Arch : BaseCtx return range; } - BelRange getBelsAtSameTile(BelId bel) const; + Loc getBelLocation(BelId bel) const + { + Loc loc; + loc.x = chip_info->bel_data[bel.index].x; + loc.y = chip_info->bel_data[bel.index].y; + loc.z = chip_info->bel_data[bel.index].z; + return loc; + } + + BelId getBelByLocation(int x, int y, int z) const + { + // FIXME + return BelId(); + } + + BelRange getBelsByTile(int x, int y) const + { + BelRange range; + // FIXME + return range; + } + + bool getBelGlobalBuf(BelId bel) const + { + return chip_info->bel_data[bel.index].type == TYPE_SB_GB; + } + + BelRange getBelsAtSameTile(BelId bel) const NPNR_DEPRECATED; BelType getBelType(BelId bel) const { @@ -655,7 +682,7 @@ struct Arch : BaseCtx // ------------------------------------------------- - void estimatePosition(BelId bel, int &x, int &y, bool &gb) const; + void estimatePosition(BelId bel, int &x, int &y, bool &gb) const NPNR_DEPRECATED; delay_t estimateDelay(WireId src, WireId dst) const; delay_t getDelayEpsilon() const { return 20; } delay_t getRipupDelayPenalty() const { return 200; }