From 8e0308b5e7b0c0bbe10c072123d2e7b945f4b6b0 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Tue, 3 Oct 2023 14:25:59 -0700 Subject: [PATCH] Revert changes to celltypes.h. Use dict instead of std::unordered_map and most hash function for uint64_t to hashlib.h to support this. --- kernel/hashlib.h | 6 ++++++ passes/opt/opt_merge.cc | 2 +- passes/sat/recover_names.cc | 9 +-------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/kernel/hashlib.h b/kernel/hashlib.h index be759fdf0a4..9cf43da6ca5 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -90,6 +90,12 @@ template<> struct hash_ops : hash_int_ops return a; } }; +template<> struct hash_ops : hash_int_ops +{ + static inline unsigned int hash(uint64_t a) { + return mkhash((unsigned int)(a), (unsigned int)(a >> 32)); + } +}; template<> struct hash_ops { static inline bool cmp(const std::string &a, const std::string &b) { diff --git a/passes/opt/opt_merge.cc b/passes/opt/opt_merge.cc index 4bcd5a18947..87ad01f00ec 100644 --- a/passes/opt/opt_merge.cc +++ b/passes/opt/opt_merge.cc @@ -267,7 +267,7 @@ struct OptMergeWorker } did_something = false; - std::unordered_map sharemap; + dict sharemap; for (auto cell : cells) { if ((!mode_share_all && !ct.cell_known(cell->type)) || !cell->known()) diff --git a/passes/sat/recover_names.cc b/passes/sat/recover_names.cc index 2d7e7f01cfa..4c30a363202 100644 --- a/passes/sat/recover_names.cc +++ b/passes/sat/recover_names.cc @@ -29,13 +29,6 @@ USING_YOSYS_NAMESPACE -template<> struct hashlib::hash_ops : hashlib::hash_int_ops -{ - static inline unsigned int hash(uint64_t a) { - return mkhash((unsigned int)(a), (unsigned int)(a >> 32)); - } -}; - PRIVATE_NAMESPACE_BEGIN // xorshift128 params @@ -453,7 +446,7 @@ struct RecoverNamesWorker { pool comb_whiteboxes, buffer_types; // class -> (gold, (gate, inverted)) - dict, dict>> cls2bits; + dict, dict>> cls2bits; void analyse_boxes() {