hdl.ast: fix ValueKey for Cat.

This commit is contained in:
whitequark 2019-01-26 23:25:34 +00:00
parent e844b0e095
commit bc5a127fd2

View file

@ -1122,7 +1122,7 @@ class ValueKey:
return hash((ValueKey(self.value.value), ValueKey(self.value.offset), return hash((ValueKey(self.value.value), ValueKey(self.value.offset),
self.value.width)) self.value.width))
elif isinstance(self.value, Cat): elif isinstance(self.value, Cat):
return hash(tuple(ValueKey(o) for o in self.value.operands)) return hash(tuple(ValueKey(o) for o in self.value.parts))
elif isinstance(self.value, ArrayProxy): elif isinstance(self.value, ArrayProxy):
return hash((ValueKey(self.value.index), return hash((ValueKey(self.value.index),
tuple(ValueKey(e) for e in self.value._iter_as_values()))) tuple(ValueKey(e) for e in self.value._iter_as_values())))
@ -1159,7 +1159,7 @@ class ValueKey:
self.value.width == other.value.width) self.value.width == other.value.width)
elif isinstance(self.value, Cat): elif isinstance(self.value, Cat):
return all(ValueKey(a) == ValueKey(b) return all(ValueKey(a) == ValueKey(b)
for a, b in zip(self.value.operands, other.value.operands)) for a, b in zip(self.value.parts, other.value.parts))
elif isinstance(self.value, ArrayProxy): elif isinstance(self.value, ArrayProxy):
return (ValueKey(self.value.index) == ValueKey(other.value.index) and return (ValueKey(self.value.index) == ValueKey(other.value.index) and
len(self.value.elems) == len(other.value.elems) and len(self.value.elems) == len(other.value.elems) and