mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 22:23:23 +00:00
hashlib: redo interface for flexibility
This commit is contained in:
parent
7a362f1f74
commit
d071489ab1
35 changed files with 542 additions and 386 deletions
|
@ -29,7 +29,11 @@ struct SigPool
|
|||
struct bitDef_t : public std::pair<RTLIL::Wire*, int> {
|
||||
bitDef_t() : std::pair<RTLIL::Wire*, int>(NULL, 0) { }
|
||||
bitDef_t(const RTLIL::SigBit &bit) : std::pair<RTLIL::Wire*, int>(bit.wire, bit.offset) { }
|
||||
unsigned int hash() const { return first->name.hash() + second; }
|
||||
Hasher hash_acc(Hasher h) const {
|
||||
h.acc(first->name);
|
||||
h.acc(second);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
pool<bitDef_t> bits;
|
||||
|
@ -143,7 +147,11 @@ struct SigSet
|
|||
struct bitDef_t : public std::pair<RTLIL::Wire*, int> {
|
||||
bitDef_t() : std::pair<RTLIL::Wire*, int>(NULL, 0) { }
|
||||
bitDef_t(const RTLIL::SigBit &bit) : std::pair<RTLIL::Wire*, int>(bit.wire, bit.offset) { }
|
||||
unsigned int hash() const { return first->name.hash() + second; }
|
||||
Hasher hash_acc(Hasher h) const {
|
||||
h.acc(first->name);
|
||||
h.acc(second);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
dict<bitDef_t, std::set<T, Compare>> bits;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue