diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2018-11-17 10:18:17 +0100 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2018-11-19 18:20:20 +0100 |
commit | b29165eeba41317f160af7e386739ff5a31a8bb9 (patch) | |
tree | 80ae9707158354cf008172746fb7dccdfe9f3201 | |
parent | 70e1fe423f663a3a02233e4f1c1f4f917d14c23c (diff) | |
download | nextpnr-b29165eeba41317f160af7e386739ff5a31a8bb9.tar.gz nextpnr-b29165eeba41317f160af7e386739ff5a31a8bb9.tar.bz2 nextpnr-b29165eeba41317f160af7e386739ff5a31a8bb9.zip |
ice40/arch: Add helper to check if a BEL is LOCKED or not
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r-- | ice40/arch.cc | 19 | ||||
-rw-r--r-- | ice40/arch.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc index 2a9e167b..995150ac 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -284,6 +284,25 @@ std::vector<IdString> Arch::getBelPins(BelId bel) const return ret; } +bool Arch::isBelLocked(BelId bel) const +{ + const BelConfigPOD *bel_config = nullptr; + for (int i = 0; i < chip_info->num_belcfgs; i++) { + if (chip_info->bel_config[i].bel_index == bel.index) { + bel_config = &chip_info->bel_config[i]; + break; + } + } + NPNR_ASSERT(bel_config != nullptr); + for (int i = 0; i < bel_config->num_entries; i++) { + if (strcmp("LOCKED", bel_config->entries[i].cbit_name.get())) + continue; + if ("LOCKED_" + archArgs().package == bel_config->entries[i].entry_name.get()) + return true; + } + return false; +} + // ----------------------------------------------------------------------- WireId Arch::getWireByName(IdString name) const diff --git a/ice40/arch.h b/ice40/arch.h index 836dc46e..b6f10c03 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -510,6 +510,8 @@ struct Arch : BaseCtx PortType getBelPinType(BelId bel, IdString pin) const; std::vector<IdString> getBelPins(BelId bel) const; + bool isBelLocked(BelId bel) const; + // ------------------------------------------------- WireId getWireByName(IdString name) const; |