From 4e346ecfba86880c2528e3463b9beb42932d8567 Mon Sep 17 00:00:00 2001 From: gatecat Date: Wed, 14 Apr 2021 10:14:51 +0100 Subject: Hash table refactoring Signed-off-by: gatecat --- common/timing_opt.cc | 45 ++++----------------------------------------- 1 file changed, 4 insertions(+), 41 deletions(-) (limited to 'common/timing_opt.cc') diff --git a/common/timing_opt.cc b/common/timing_opt.cc index fd2a3f83..dba96bf1 100644 --- a/common/timing_opt.cc +++ b/common/timing_opt.cc @@ -35,44 +35,7 @@ #include "timing.h" #include "util.h" -namespace std { - -template <> struct hash> -{ - std::size_t operator()( - const std::pair &idp) const noexcept - { - std::size_t seed = 0; - boost::hash_combine(seed, hash()(idp.first)); - boost::hash_combine(seed, hash()(idp.second)); - return seed; - } -}; - -template <> struct hash> -{ - std::size_t operator()(const std::pair &idp) const noexcept - { - std::size_t seed = 0; - boost::hash_combine(seed, hash()(idp.first)); - boost::hash_combine(seed, hash()(idp.second)); - return seed; - } -}; -#if !defined(ARCH_GOWIN) -template <> struct hash> -{ - std::size_t - operator()(const std::pair &idp) const noexcept - { - std::size_t seed = 0; - boost::hash_combine(seed, hash()(idp.first)); - boost::hash_combine(seed, hash()(idp.second)); - return seed; - } -}; -#endif -} // namespace std +#include "hash_table.h" NEXTPNR_NAMESPACE_BEGIN @@ -478,9 +441,9 @@ class TimingOptimiser // Actual BFS path optimisation algorithm std::unordered_map> cumul_costs; - std::unordered_map, std::pair> backtrace; + std::unordered_map, std::pair, PairHash> backtrace; std::queue> visit; - std::unordered_set> to_visit; + std::unordered_set, PairHash> to_visit; for (auto startbel : cell_neighbour_bels[path_cells.front()]) { // Swap for legality check @@ -609,7 +572,7 @@ class TimingOptimiser std::unordered_map> cell_neighbour_bels; std::unordered_map> bel_candidate_cells; // Map cell ports to net delay limit - std::unordered_map, delay_t> max_net_delay; + std::unordered_map, delay_t, PairHash> max_net_delay; Context *ctx; TimingOptCfg cfg; TimingAnalyser tmg; -- cgit v1.2.3