3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-11 03:33:36 +00:00

failed trick with tag_dict to track which dict of consts takes up space

This commit is contained in:
Emil J. Tywoniak 2024-06-24 13:05:56 +02:00
parent 74a1dd99ac
commit 7532334875
2 changed files with 35 additions and 1 deletions

View file

@ -211,6 +211,7 @@ inline int hashtable_size(int min_size)
throw std::length_error("hash table exceeded maximum size.");
}
template<typename K, typename T, typename OPS = hash_ops<K>> class tag_dict;
template<typename K, typename T, typename OPS = hash_ops<K>> class dict;
template<typename K, int offset = 0, typename OPS = hash_ops<K>> class idict;
template<typename K, typename OPS = hash_ops<K>> class pool;
@ -671,6 +672,39 @@ public:
const_iterator end() const { return const_iterator(nullptr, -1); }
};
template<typename K, typename T, typename OPS>
class tag_dict : public dict<K, T, OPS> {
public:
tag_dict& operator = (const tag_dict& rhs) {
dict<K, T, OPS>::operator =(rhs);
return *this;
}
tag_dict& operator = (tag_dict&& rhs) {
dict<K, T, OPS>::operator =(rhs);
return *this;
}
constexpr tag_dict() : dict<K, T, OPS>()
{
}
tag_dict(const dict<K, T, OPS> &other) : dict<K, T, OPS>(other) { }
tag_dict(const tag_dict &other) : dict<K, T, OPS>(other) { }
// tag_dict(const tag_dict &other)
// {
// dict<K, T, OPS>(other);
// // entries = other.entries;
// // do_rehash();
// }
tag_dict(dict<K, T, OPS> &&other) : dict<K, T, OPS>(other) { }
tag_dict(tag_dict &&other) : dict<K, T, OPS>(other) { }
// tag_dict(tag_dict &&other)
// {
// dict<K, T, OPS>(other);
// // swap(other);
// }
};
template<typename K, typename OPS>
class pool
{

View file

@ -1565,7 +1565,7 @@ public:
RTLIL::IdString name;
RTLIL::IdString type;
dict<RTLIL::IdString, RTLIL::SigSpec> connections_;
dict<RTLIL::IdString, RTLIL::Const> parameters;
hashlib::tag_dict<RTLIL::IdString, RTLIL::Const> parameters;
// access cell ports
bool hasPort(const RTLIL::IdString &portname) const;