Skip to content

Commit

Permalink
Revert changes to celltypes.h. Use dict instead of std::unordered_map…
Browse files Browse the repository at this point in the history
… and most hash function for uint64_t to hashlib.h to support this.
  • Loading branch information
rmlarsen committed Oct 3, 2023
1 parent 7b454d4 commit 8e0308b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 6 additions & 0 deletions kernel/hashlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ template<> struct hash_ops<uint32_t> : hash_int_ops
return a;
}
};
template<> struct hash_ops<uint64_t> : hash_int_ops
{
static inline unsigned int hash(uint64_t a) {
return mkhash((unsigned int)(a), (unsigned int)(a >> 32));
}
};

template<> struct hash_ops<std::string> {
static inline bool cmp(const std::string &a, const std::string &b) {
Expand Down
2 changes: 1 addition & 1 deletion passes/opt/opt_merge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ struct OptMergeWorker
}

did_something = false;
std::unordered_map<FingerPrint, RTLIL::Cell*> sharemap;
dict<FingerPrint, RTLIL::Cell*> sharemap;
for (auto cell : cells)
{
if ((!mode_share_all && !ct.cell_known(cell->type)) || !cell->known())
Expand Down
9 changes: 1 addition & 8 deletions passes/sat/recover_names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@

USING_YOSYS_NAMESPACE

template<> struct hashlib::hash_ops<uint64_t> : 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
Expand Down Expand Up @@ -453,7 +446,7 @@ struct RecoverNamesWorker {
pool<IdString> comb_whiteboxes, buffer_types;

// class -> (gold, (gate, inverted))
dict<equiv_cls_t, std::pair<pool<IdBit>, dict<IdBit, bool>>> cls2bits;
dict<equiv_cls_t, std::pair<pool<IdBit>, dict<IdBit, bool>>> cls2bits;

void analyse_boxes()
{
Expand Down

0 comments on commit 8e0308b

Please sign in to comment.