diff options
Diffstat (limited to 'common/nextpnr.cc')
-rw-r--r-- | common/nextpnr.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/common/nextpnr.cc b/common/nextpnr.cc index 9a73affc..dd1ebc59 100644 --- a/common/nextpnr.cc +++ b/common/nextpnr.cc @@ -223,6 +223,28 @@ void CellInfo::unsetParam(IdString name) { params.erase(name); } void CellInfo::setAttr(IdString name, Property value) { attrs[name] = value; } void CellInfo::unsetAttr(IdString name) { attrs.erase(name); } +bool CellInfo::isConstrained(bool include_abs_z_constr) const +{ + return constr_parent != nullptr || !constr_children.empty() || (include_abs_z_constr && constr_abs_z); +} + +bool CellInfo::testRegion(BelId bel) const +{ + return region == nullptr || !region->constr_bels || region->bels.count(bel); +} +Loc CellInfo::getConstrainedLoc(Loc parent_loc) const +{ + NPNR_ASSERT(constr_parent != nullptr); + Loc cloc = parent_loc; + if (constr_x != UNCONSTR) + cloc.x += constr_x; + if (constr_y != UNCONSTR) + cloc.y += constr_y; + if (constr_z != UNCONSTR) + cloc.z = constr_abs_z ? constr_z : (parent_loc.z + constr_z); + return cloc; +} + std::string Property::to_string() const { if (is_string) { |