return ((a << 5) + a) + b;
}
+inline unsigned int mkhash_xorshift(unsigned int a) {
+ if (sizeof(a) == 4) {
+ a ^= a << 13;
+ a ^= a >> 17;
+ a ^= a << 5;
+ } else if (sizeof(a) == 8) {
+ a ^= a << 13;
+ a ^= a >> 7;
+ a ^= a << 17;
+ } else
+ throw std::runtime_error("mkhash_xorshift() only implemented for 32 bit and 64 bit ints");
+ return a;
+}
+
template<typename T> struct hash_ops {
bool cmp(const T &a, const T &b) const {
return a == b;
if (old_size < 250999999) return 250999999;
if (old_size < 503000009) return 503000009;
if (old_size < 1129999999) return 1129999999;
- throw std::length_error("hash table exceeded maximum size");
+
+ if (sizeof(old_size) == 4)
+ throw std::length_error("hash table exceeded maximum size. recompile with -mint64.");
+
+ return old_size * 2;
}
template<typename K, typename T, typename OPS = hash_ops<K>>
RTLIL::Design::Design()
{
- static unsigned int hashidx_count = 0;
- hashidx_ = hashidx_count++;
+ static unsigned int hashidx_count = 123456789;
+ hashidx_count = mkhash_xorshift(hashidx_count);
+ hashidx_ = hashidx_count;
refcount_modules_ = 0;
selection_stack.push_back(RTLIL::Selection());
RTLIL::Module::Module()
{
- static unsigned int hashidx_count = 0;
- hashidx_ = hashidx_count++;
+ static unsigned int hashidx_count = 123456789;
+ hashidx_count = mkhash_xorshift(hashidx_count);
+ hashidx_ = hashidx_count;
design = nullptr;
refcount_wires_ = 0;
RTLIL::Wire::Wire()
{
- static unsigned int hashidx_count = 0;
- hashidx_ = hashidx_count++;
+ static unsigned int hashidx_count = 123456789;
+ hashidx_count = mkhash_xorshift(hashidx_count);
+ hashidx_ = hashidx_count;
module = nullptr;
width = 1;
RTLIL::Memory::Memory()
{
- static unsigned int hashidx_count = 0;
- hashidx_ = hashidx_count++;
+ static unsigned int hashidx_count = 123456789;
+ hashidx_count = mkhash_xorshift(hashidx_count);
+ hashidx_ = hashidx_count;
width = 1;
size = 0;
RTLIL::Cell::Cell() : module(nullptr)
{
- static unsigned int hashidx_count = 0;
- hashidx_ = hashidx_count++;
+ static unsigned int hashidx_count = 123456789;
+ hashidx_count = mkhash_xorshift(hashidx_count);
+ hashidx_ = hashidx_count;
// log("#memtrace# %p\n", this);
memhasher();
unsigned int hash() const { return hashidx_; }
Monitor() {
- static unsigned int hashidx_count = 0;
- hashidx_ = hashidx_count++;
+ static unsigned int hashidx_count = 123456789;
+ hashidx_count = mkhash_xorshift(hashidx_count);
+ hashidx_ = hashidx_count;
}
virtual ~Monitor() { }