From 63baa10032ecf301523e4cb1fca198d8a8b79e23 Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 22 Jun 2018 12:57:22 +0200 Subject: ice40: Make the packer deterministic Signed-off-by: David Shah --- common/util.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'common/util.h') diff --git a/common/util.h b/common/util.h index 34b2ed02..8151564f 100644 --- a/common/util.h +++ b/common/util.h @@ -21,6 +21,7 @@ #define UTIL_H #include +#include #include "nextpnr.h" NEXTPNR_NAMESPACE_BEGIN @@ -56,6 +57,13 @@ bool bool_or_default(const Container &ct, const KeyType &key, bool def = false) { return bool(int_or_default(ct, key, int(def))); }; + +// Wrap an unordered_map, and allow it to be iterated over sorted by key +template std::map sorted(const std::unordered_map &orig) { + return std::map(orig.begin(), orig.end()); +}; + + NEXTPNR_NAMESPACE_END #endif -- cgit v1.2.3 From ce4ad44fd1837242324ca110a9058182eef99dcd Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 22 Jun 2018 14:58:27 +0200 Subject: Print quasi-TNS statistic during placement Signed-off-by: David Shah --- common/util.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'common/util.h') diff --git a/common/util.h b/common/util.h index 8151564f..4c60292b 100644 --- a/common/util.h +++ b/common/util.h @@ -20,8 +20,8 @@ #ifndef UTIL_H #define UTIL_H -#include #include +#include #include "nextpnr.h" NEXTPNR_NAMESPACE_BEGIN @@ -59,11 +59,12 @@ bool bool_or_default(const Container &ct, const KeyType &key, bool def = false) }; // Wrap an unordered_map, and allow it to be iterated over sorted by key -template std::map sorted(const std::unordered_map &orig) { +template +std::map sorted(const std::unordered_map &orig) +{ return std::map(orig.begin(), orig.end()); }; - NEXTPNR_NAMESPACE_END #endif -- cgit v1.2.3