aboutsummaryrefslogtreecommitdiffstats
path: root/common/nextpnr.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-02-23 21:53:00 +0000
committerGitHub <noreply@github.com>2021-02-23 21:53:00 +0000
commit85af066d4f5a189ccdc6c7d6bafabb319a946901 (patch)
treeeb49451604c28c4b5444370508983681edbfd1ae /common/nextpnr.cc
parent20f0ba9526abfb8c39fa16099f0eefd2c0555eac (diff)
parent162793aa87c1be7571ee27445205ce267f18c0c7 (diff)
downloadnextpnr-85af066d4f5a189ccdc6c7d6bafabb319a946901.tar.gz
nextpnr-85af066d4f5a189ccdc6c7d6bafabb319a946901.tar.bz2
nextpnr-85af066d4f5a189ccdc6c7d6bafabb319a946901.zip
Merge pull request #594 from YosysHQ/gatecat/heap-tidying
Tidying up HeAP
Diffstat (limited to 'common/nextpnr.cc')
-rw-r--r--common/nextpnr.cc22
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) {