diff options
author | gatecat <gatecat@ds0.me> | 2021-12-30 09:08:02 +0000 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-12-30 11:54:08 +0000 |
commit | 59874188a6800fbaa03ec21e3578160e963c2eb5 (patch) | |
tree | 28463b159ce424cdf7780174f1fffb421d04bf88 /generic/archdefs.h | |
parent | c272d28e575bde2675a6ae7090a0d5f0f4c9c88f (diff) | |
download | nextpnr-59874188a6800fbaa03ec21e3578160e963c2eb5.tar.gz nextpnr-59874188a6800fbaa03ec21e3578160e963c2eb5.tar.bz2 nextpnr-59874188a6800fbaa03ec21e3578160e963c2eb5.zip |
generic: Refactor for faster performance
This won't affect Python-built arches significantly; but will be useful
for the future 'viaduct' functionality where generic routing graphs can
be built on the C++ side; too.
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'generic/archdefs.h')
-rw-r--r-- | generic/archdefs.h | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/generic/archdefs.h b/generic/archdefs.h index c46fba93..2d46c0a2 100644 --- a/generic/archdefs.h +++ b/generic/archdefs.h @@ -27,9 +27,42 @@ NEXTPNR_NAMESPACE_BEGIN typedef float delay_t; -typedef IdStringList BelId; -typedef IdStringList WireId; -typedef IdStringList PipId; +struct BelId +{ + BelId() : index(-1){}; + explicit BelId(int32_t index) : index(index){}; + int32_t index = -1; + + bool operator==(const BelId &other) const { return index == other.index; } + bool operator!=(const BelId &other) const { return index != other.index; } + bool operator<(const BelId &other) const { return index < other.index; } + unsigned int hash() const { return index; } +}; + +struct WireId +{ + WireId() : index(-1){}; + explicit WireId(int32_t index) : index(index){}; + int32_t index = -1; + + bool operator==(const WireId &other) const { return index == other.index; } + bool operator!=(const WireId &other) const { return index != other.index; } + bool operator<(const WireId &other) const { return index < other.index; } + unsigned int hash() const { return index; } +}; + +struct PipId +{ + PipId() : index(-1){}; + explicit PipId(int32_t index) : index(index){}; + int32_t index = -1; + + bool operator==(const PipId &other) const { return index == other.index; } + bool operator!=(const PipId &other) const { return index != other.index; } + bool operator<(const PipId &other) const { return index < other.index; } + unsigned int hash() const { return index; } +}; + typedef IdStringList GroupId; typedef IdStringList DecalId; typedef IdString BelBucketId; |