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 /ecp5/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 'ecp5/arch.h')
-rw-r--r-- | ecp5/arch.h | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/ecp5/arch.h b/ecp5/arch.h index 063a3df6..be1a44d8 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -419,23 +419,9 @@ struct DelayKey { return celltype == other.celltype && from == other.from && to == other.to; } + unsigned int hash() const { return mkhash(celltype.hash(), mkhash(from.hash(), to.hash())); } }; -NEXTPNR_NAMESPACE_END -namespace std { -template <> struct hash<NEXTPNR_NAMESPACE_PREFIX DelayKey> -{ - std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX DelayKey &dk) const noexcept - { - std::size_t seed = std::hash<NEXTPNR_NAMESPACE_PREFIX IdString>()(dk.celltype); - seed ^= std::hash<NEXTPNR_NAMESPACE_PREFIX IdString>()(dk.from) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= std::hash<NEXTPNR_NAMESPACE_PREFIX IdString>()(dk.to) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - return seed; - } -}; -} // namespace std -NEXTPNR_NAMESPACE_BEGIN - struct ArchRanges : BaseArchRanges { using ArchArgsT = ArchArgs; @@ -458,15 +444,15 @@ struct Arch : BaseArch<ArchRanges> const PackageInfoPOD *package_info; const SpeedGradePOD *speed_grade; - mutable std::unordered_map<IdStringList, PipId> pip_by_name; + mutable dict<IdStringList, PipId> pip_by_name; std::vector<CellInfo *> bel_to_cell; - std::unordered_map<WireId, int> wire_fanout; + dict<WireId, int> wire_fanout; // fast access to X and Y IdStrings for building object names std::vector<IdString> x_ids, y_ids; // inverse of the above for name->object mapping - std::unordered_map<IdString, int> id_to_x, id_to_y; + dict<IdString, int> id_to_x, id_to_y; ArchArgs args; Arch(ArchArgs args); @@ -914,10 +900,10 @@ struct Arch : BaseArch<ArchRanges> // Improves directivity of routing to DSP inputs, avoids issues // with different routes to the same physical reset wire causing // conflicts and slow routing - std::unordered_map<WireId, std::pair<int, int>> wire_loc_overrides; + dict<WireId, std::pair<int, int>> wire_loc_overrides; void setup_wire_locations(); - mutable std::unordered_map<DelayKey, std::pair<bool, DelayQuad>> celldelay_cache; + mutable dict<DelayKey, std::pair<bool, DelayQuad>> celldelay_cache; static const std::string defaultPlacer; static const std::vector<std::string> availablePlacers; |