diff options
author | gatecat <gatecat@ds0.me> | 2021-06-03 09:04:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 09:04:34 +0100 |
commit | a3d8b4f9d198226ec0903e34a8d290b376b45c0b (patch) | |
tree | ada2c6a5d48e766fa523e633aaa28179baea3273 /gowin/arch.h | |
parent | 589ca8ded5da2012e4388a3ec4c8fae74dff75e4 (diff) | |
parent | dcbb322447a7fb59cabe197ec1dd2307acfa3681 (diff) | |
download | nextpnr-a3d8b4f9d198226ec0903e34a8d290b376b45c0b.tar.gz nextpnr-a3d8b4f9d198226ec0903e34a8d290b376b45c0b.tar.bz2 nextpnr-a3d8b4f9d198226ec0903e34a8d290b376b45c0b.zip |
Merge pull request #718 from YosysHQ/gatecat/hashlib
Moving from unordered_{map, set} to hashlib
Diffstat (limited to 'gowin/arch.h')
-rw-r--r-- | gowin/arch.h | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/gowin/arch.h b/gowin/arch.h index 0f975f77..82fcb8c1 100644 --- a/gowin/arch.h +++ b/gowin/arch.h @@ -209,7 +209,7 @@ struct BelInfo IdString name, type; std::map<IdString, std::string> attrs; CellInfo *bound_cell; - std::unordered_map<IdString, PinInfo> pins; + dict<IdString, PinInfo> pins; DecalXY decalxy; int x, y, z; bool gb; @@ -229,27 +229,14 @@ struct CellDelayKey { IdString from, to; inline bool operator==(const CellDelayKey &other) const { return from == other.from && to == other.to; } + unsigned int hash() const { return mkhash(from.hash(), to.hash()); } }; -NEXTPNR_NAMESPACE_END -namespace std { -template <> struct hash<NEXTPNR_NAMESPACE_PREFIX CellDelayKey> -{ - std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX CellDelayKey &dk) const noexcept - { - std::size_t seed = std::hash<NEXTPNR_NAMESPACE_PREFIX IdString>()(dk.from); - seed ^= std::hash<NEXTPNR_NAMESPACE_PREFIX IdString>()(dk.to) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - return seed; - } -}; -} // namespace std -NEXTPNR_NAMESPACE_BEGIN - struct CellTiming { - std::unordered_map<IdString, TimingPortClass> portClasses; - std::unordered_map<CellDelayKey, DelayQuad> combDelays; - std::unordered_map<IdString, std::vector<TimingClockingInfo>> clockingInfo; + dict<IdString, TimingPortClass> portClasses; + dict<CellDelayKey, DelayQuad> combDelays; + dict<IdString, std::vector<TimingClockingInfo>> clockingInfo; }; struct ArchRanges : BaseArchRanges @@ -287,10 +274,10 @@ struct Arch : BaseArch<ArchRanges> const PackagePOD *package; const TimingGroupsPOD *speed; - std::unordered_map<IdString, WireInfo> wires; - std::unordered_map<IdString, PipInfo> pips; - std::unordered_map<IdString, BelInfo> bels; - std::unordered_map<GroupId, GroupInfo> groups; + dict<IdString, WireInfo> wires; + dict<IdString, PipInfo> pips; + dict<IdString, BelInfo> bels; + dict<GroupId, GroupInfo> groups; // These functions include useful errors if not found WireInfo &wire_info(IdString wire); @@ -299,16 +286,16 @@ struct Arch : BaseArch<ArchRanges> std::vector<IdString> bel_ids, wire_ids, pip_ids; - std::unordered_map<Loc, BelId> bel_by_loc; + dict<Loc, BelId> bel_by_loc; std::vector<std::vector<std::vector<BelId>>> bels_by_tile; - std::unordered_map<DecalId, std::vector<GraphicElement>> decal_graphics; + dict<DecalId, std::vector<GraphicElement>> decal_graphics; int gridDimX, gridDimY; std::vector<std::vector<int>> tileBelDimZ; std::vector<std::vector<int>> tilePipDimZ; - std::unordered_map<IdString, CellTiming> cellTiming; + dict<IdString, CellTiming> cellTiming; void addWire(IdString name, IdString type, int x, int y); void addPip(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayQuad delay, Loc loc); |