aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-29 12:02:34 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-29 12:02:34 +0200
commitc18b7b3f6ecb03cb264d83df6da4d85c16716737 (patch)
tree2b55e28328b18a4f8af31ea724163bf30b14da2d /common
parent960c65047877c72498d65ecc401371ab1552c82a (diff)
downloadnextpnr-c18b7b3f6ecb03cb264d83df6da4d85c16716737.tar.gz
nextpnr-c18b7b3f6ecb03cb264d83df6da4d85c16716737.tar.bz2
nextpnr-c18b7b3f6ecb03cb264d83df6da4d85c16716737.zip
ice40: Reworking placement legalisation to allow integration with SA placer
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'common')
-rw-r--r--common/util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/util.h b/common/util.h
index a9ad2172..60eb35af 100644
--- a/common/util.h
+++ b/common/util.h
@@ -75,6 +75,15 @@ template <typename K> std::set<K> sorted(const std::unordered_set<K> &orig)
return retVal;
};
+// Return a net if port exists, or nullptr
+inline const NetInfo *get_net_or_empty(const CellInfo *cell, const IdString port)
+{
+ auto found = cell->ports.find(port);
+ if (found != cell->ports.end())
+ return found->second.net;
+ else
+ return nullptr;
+};
NEXTPNR_NAMESPACE_END
#endif