aboutsummaryrefslogtreecommitdiffstats
path: root/common/nextpnr.h
diff options
context:
space:
mode:
authorEddie Hung <eddie.hung+gitlab@gmail.com>2018-07-21 19:03:35 +0000
committerEddie Hung <eddie.hung+gitlab@gmail.com>2018-07-21 19:03:35 +0000
commitf176ee48cdd6b508f6f26e7b2ccca97a680929cf (patch)
tree93d8b7f0baad5b504aff26acdba441ea6ba6d8c6 /common/nextpnr.h
parent3eecccc6f7f8c36994e9227adfc8ab1067ea287f (diff)
parent1f6897733b57f03cf7f5ccab46c27de811d42167 (diff)
downloadnextpnr-f176ee48cdd6b508f6f26e7b2ccca97a680929cf.tar.gz
nextpnr-f176ee48cdd6b508f6f26e7b2ccca97a680929cf.tar.bz2
nextpnr-f176ee48cdd6b508f6f26e7b2ccca97a680929cf.zip
Merge branch 'redist_slack' into 'redist_slack'
Redist slack See merge request eddiehung/nextpnr!5
Diffstat (limited to 'common/nextpnr.h')
-rw-r--r--common/nextpnr.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h
index bc64adb5..40fd3d13 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -27,6 +27,8 @@
#include <unordered_set>
#include <vector>
+#include <boost/functional/hash.hpp>
+
#ifndef NEXTPNR_H
#define NEXTPNR_H
@@ -158,8 +160,30 @@ struct GraphicElement
std::string text;
};
+struct Loc
+{
+ int x = -1, y = -1, z = -1;
+
+ bool operator==(const Loc &other) const { return (x == other.x) && (y == other.y) && (z == other.z); }
+ bool operator!=(const Loc &other) const { return (x != other.x) || (y != other.y) || (z == other.z); }
+};
+
NEXTPNR_NAMESPACE_END
+namespace std {
+template <> struct hash<NEXTPNR_NAMESPACE_PREFIX Loc>
+{
+ std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX Loc &obj) const noexcept
+ {
+ std::size_t seed = 0;
+ boost::hash_combine(seed, hash<int>()(obj.x));
+ boost::hash_combine(seed, hash<int>()(obj.y));
+ boost::hash_combine(seed, hash<int>()(obj.z));
+ return seed;
+ }
+};
+} // namespace std
+
#include "archdefs.h"
NEXTPNR_NAMESPACE_BEGIN