1
0
mirror of https://github.com/YosysHQ/nextpnr.git synced 2026-05-01 22:15:52 +00:00

nexus: IO pre-packing

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah
2020-10-12 11:41:26 +01:00
parent 69b449c875
commit 518ead2e2d
2 changed files with 67 additions and 0 deletions

View File

@@ -112,6 +112,15 @@ template <typename K, typename V> std::map<K, V *> sorted(const std::unordered_m
return retVal;
};
// Wrap an unordered_map, and allow it to be iterated over sorted by key
template <typename K, typename V> std::map<K, V &> sorted_ref(std::unordered_map<K, V> &orig)
{
std::map<K, 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)
{