aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-26 15:06:59 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-26 15:06:59 +0200
commit6f12f2b7e8c58a0b14c6f1f3df2112b8860a6e4f (patch)
treeb8617ab8460f4b59c8d074660b6572fb4a84ba26 /common
parent29df577f14c8e6f870c4dfbd633effc664219252 (diff)
downloadnextpnr-6f12f2b7e8c58a0b14c6f1f3df2112b8860a6e4f.tar.gz
nextpnr-6f12f2b7e8c58a0b14c6f1f3df2112b8860a6e4f.tar.bz2
nextpnr-6f12f2b7e8c58a0b14c6f1f3df2112b8860a6e4f.zip
Working on debugging the carry legaliser
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'common')
-rw-r--r--common/util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/util.h b/common/util.h
index c888c8b8..a9ad2172 100644
--- a/common/util.h
+++ b/common/util.h
@@ -21,6 +21,7 @@
#define UTIL_H
#include <map>
+#include <set>
#include <string>
#include "nextpnr.h"
@@ -65,6 +66,15 @@ template <typename K, typename V> std::map<K, V *> sorted(const std::unordered_m
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)
+{
+ std::set<K> retVal;
+ for (auto &item : orig)
+ retVal.insert(item);
+ return retVal;
+};
+
NEXTPNR_NAMESPACE_END
#endif