diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/util.h | 9 |
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 |