ice40/arch: Add helper to check if a BEL is LOCKED or not
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
parent
70e1fe423f
commit
b29165eeba
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user