diff options
author | gatecat <gatecat@ds0.me> | 2021-06-01 16:12:57 +0100 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-06-02 14:27:56 +0100 |
commit | ff72454f8391ab4785fa8314f3efbbea96c30422 (patch) | |
tree | ec1606d83a643de5fab75998ecf086229376f92d /mistral/archdefs.h | |
parent | 76ef7688643ae777f670b2bb2fbab2ddbeed9196 (diff) | |
download | nextpnr-ff72454f8391ab4785fa8314f3efbbea96c30422.tar.gz nextpnr-ff72454f8391ab4785fa8314f3efbbea96c30422.tar.bz2 nextpnr-ff72454f8391ab4785fa8314f3efbbea96c30422.zip |
Add hash() member functions
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'mistral/archdefs.h')
-rw-r--r-- | mistral/archdefs.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mistral/archdefs.h b/mistral/archdefs.h index 60bdcfeb..9d953223 100644 --- a/mistral/archdefs.h +++ b/mistral/archdefs.h @@ -25,6 +25,7 @@ #include "base_clusterinfo.h" #include "cyclonev.h" +#include "hashlib.h" #include "idstring.h" #include "nextpnr_assertions.h" #include "nextpnr_namespaces.h" @@ -84,6 +85,7 @@ struct BelId bool operator==(const BelId &other) const { return pos == other.pos && z == other.z; } bool operator!=(const BelId &other) const { return pos != other.pos || z != other.z; } bool operator<(const BelId &other) const { return pos < other.pos || (pos == other.pos && z < other.z); } + unsigned int hash() const { return mkhash(pos, z); } }; static constexpr auto invalid_rnode = std::numeric_limits<CycloneV::rnode_t>::max(); @@ -104,6 +106,7 @@ struct WireId bool operator==(const WireId &other) const { return node == other.node; } bool operator!=(const WireId &other) const { return node != other.node; } bool operator<(const WireId &other) const { return node < other.node; } + unsigned int hash() const { return unsigned(node); } }; struct PipId @@ -115,6 +118,7 @@ struct PipId bool operator==(const PipId &other) const { return src == other.src && dst == other.dst; } bool operator!=(const PipId &other) const { return src != other.src || dst != other.dst; } bool operator<(const PipId &other) const { return dst < other.dst || (dst == other.dst && src < other.src); } + unsigned int hash() const { return mkhash(src, dst); } }; typedef IdString DecalId; |