From 02985b014ae54e4285b59a19e1a866c69f2b4644 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 27 Jan 2019 11:47:39 -0800 Subject: [PATCH] Add new Arch::getBelIOB(BelId) function --- docs/archapi.md | 4 ++++ ecp5/arch.h | 1 + generic/arch.cc | 1 + generic/arch.h | 1 + ice40/arch.h | 1 + 5 files changed, 8 insertions(+) diff --git a/docs/archapi.md b/docs/archapi.md index 3c938865..78b20532 100644 --- a/docs/archapi.md +++ b/docs/archapi.md @@ -115,6 +115,10 @@ Return a list of all bels at the give X/Y location. Returns true if the given bel is a global buffer. A global buffer does not "pull in" other cells it drives to be close to the location of the global buffer. +### bool getBelIOB(BelId bel) const + +Returns true if the given bel is a IO block. + ### uint32\_t getBelChecksum(BelId bel) const Return a (preferably unique) number that represents this bel. This is used in design state checksum calculations. diff --git a/ecp5/arch.h b/ecp5/arch.h index a68673f4..131e06bd 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -539,6 +539,7 @@ struct Arch : BaseCtx BelRange getBelsByTile(int x, int y) const; bool getBelGlobalBuf(BelId bel) const { return getBelType(bel) == id_DCCA; } + bool getBelIOB(BelId bel) const { return chip_info->bel_data[bel.index].type == ID_TRELLIS_IO; } bool checkBelAvail(BelId bel) const { diff --git a/generic/arch.cc b/generic/arch.cc index 77417d27..7065cc33 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -224,6 +224,7 @@ BelId Arch::getBelByLocation(Loc loc) const const std::vector &Arch::getBelsByTile(int x, int y) const { return bels_by_tile.at(x).at(y); } bool Arch::getBelGlobalBuf(BelId bel) const { return bels.at(bel).gb; } +bool Arch::getBelIOB(BelId bel) const { return /* TODO */ false; } uint32_t Arch::getBelChecksum(BelId bel) const { diff --git a/generic/arch.h b/generic/arch.h index dc4258cc..de1fca25 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -150,6 +150,7 @@ struct Arch : BaseCtx BelId getBelByLocation(Loc loc) const; const std::vector &getBelsByTile(int x, int y) const; bool getBelGlobalBuf(BelId bel) const; + bool getBelIOB(BelId bel) const; uint32_t getBelChecksum(BelId bel) const; void bindBel(BelId bel, CellInfo *cell, PlaceStrength strength); void unbindBel(BelId bel); diff --git a/ice40/arch.h b/ice40/arch.h index 2dd6b06c..a74528ae 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -513,6 +513,7 @@ struct Arch : BaseCtx BelRange getBelsByTile(int x, int y) const; bool getBelGlobalBuf(BelId bel) const { return chip_info->bel_data[bel.index].type == ID_SB_GB; } + bool getBelIOB(BelId bel) const { return chip_info->bel_data[bel.index].type == ID_SB_IO; } IdString getBelType(BelId bel) const {