aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-06-01 16:12:57 +0100
committergatecat <gatecat@ds0.me>2021-06-02 14:27:56 +0100
commitff72454f8391ab4785fa8314f3efbbea96c30422 (patch)
treeec1606d83a643de5fab75998ecf086229376f92d /machxo2
parent76ef7688643ae777f670b2bb2fbab2ddbeed9196 (diff)
downloadnextpnr-ff72454f8391ab4785fa8314f3efbbea96c30422.tar.gz
nextpnr-ff72454f8391ab4785fa8314f3efbbea96c30422.tar.bz2
nextpnr-ff72454f8391ab4785fa8314f3efbbea96c30422.zip
Add hash() member functions
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'machxo2')
-rw-r--r--machxo2/archdefs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/machxo2/archdefs.h b/machxo2/archdefs.h
index 2d50dddb..afcc72aa 100644
--- a/machxo2/archdefs.h
+++ b/machxo2/archdefs.h
@@ -22,6 +22,7 @@
#define MACHXO2_ARCHDEFS_H
#include "base_clusterinfo.h"
+#include "hashlib.h"
#include "idstring.h"
#include "nextpnr_namespaces.h"
@@ -59,6 +60,7 @@ struct Location
bool operator==(const Location &other) const { return x == other.x && y == other.y; }
bool operator!=(const Location &other) const { return x != other.x || y != other.y; }
bool operator<(const Location &other) const { return y == other.y ? x < other.x : y < other.y; }
+ unsigned int hash() const { return mkhash(x, y); }
};
inline Location operator+(const Location &a, const Location &b) { return Location(a.x + b.x, a.y + b.y); }
@@ -74,6 +76,7 @@ struct BelId
{
return location == other.location ? index < other.index : location < other.location;
}
+ unsigned int hash() const { return mkhash(location.hash(), index); }
};
struct WireId
@@ -87,6 +90,7 @@ struct WireId
{
return location == other.location ? index < other.index : location < other.location;
}
+ unsigned int hash() const { return mkhash(location.hash(), index); }
};
struct PipId
@@ -100,6 +104,7 @@ struct PipId
{
return location == other.location ? index < other.index : location < other.location;
}
+ unsigned int hash() const { return mkhash(location.hash(), index); }
};
typedef IdString GroupId;