aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-10-13 10:07:28 +0100
committerDavid Shah <dave@ds0.me>2020-11-30 08:45:27 +0000
commit1bb509897c77b7a8931f10b84dc1de98668c04bd (patch)
tree7f4780fbb09d23823d8c0c6422626ab33c2fd762 /common
parent0eb5c72cc5b95a7fb6b848e8d09ea9b235bce9b3 (diff)
downloadnextpnr-1bb509897c77b7a8931f10b84dc1de98668c04bd.tar.gz
nextpnr-1bb509897c77b7a8931f10b84dc1de98668c04bd.tar.bz2
nextpnr-1bb509897c77b7a8931f10b84dc1de98668c04bd.zip
nexus: More pin styles and FASM pinmux gen
Signed-off-by: David Shah <dave@ds0.me>
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 d82e984a..07ebac75 100644
--- a/common/util.h
+++ b/common/util.h
@@ -121,6 +121,15 @@ template <typename K, typename V> std::map<K, V &> sorted_ref(std::unordered_map
return retVal;
};
+// Wrap an unordered_map, and allow it to be iterated over sorted by key
+template <typename K, typename V> std::map<K, const V &> sorted_cref(const std::unordered_map<K, V> &orig)
+{
+ std::map<K, const V &> retVal;
+ for (auto &item : orig)
+ retVal.emplace(std::make_pair(item.first, std::ref(item.second)));
+ return retVal;
+};
+
// Wrap an unordered_set, and allow it to be iterated over sorted by key
template <typename K> std::set<K> sorted(const std::unordered_set<K> &orig)
{