From 427c82fcbc9e40caa8b22543cb728ff720e64887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20L=C3=B6her?= Date: Tue, 17 Jan 2023 00:16:37 +0100 Subject: [PATCH] hdl.ast: handle `Repl` in `ValueKey`. Fixes #735. --- amaranth/hdl/ast.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/amaranth/hdl/ast.py b/amaranth/hdl/ast.py index abba9ab..60141a3 100644 --- a/amaranth/hdl/ast.py +++ b/amaranth/hdl/ast.py @@ -1691,6 +1691,8 @@ class ValueKey: tuple(ValueKey(e) for e in self.value._iter_as_values()))) elif isinstance(self.value, Sample): self._hash = hash((ValueKey(self.value.value), self.value.clocks, self.value.domain)) + elif isinstance(self.value, Repl): + self._hash = hash((ValueKey(self.value.value), self.value.count)) elif isinstance(self.value, Initial): self._hash = 0 else: # :nocov: @@ -1729,6 +1731,9 @@ class ValueKey: elif isinstance(self.value, Cat): return all(ValueKey(a) == ValueKey(b) for a, b in zip(self.value.parts, other.value.parts)) + elif isinstance(self.value, Repl): + return (ValueKey(self.value.value) == ValueKey(other.value.value) and + self.value.count == other.value.count) elif isinstance(self.value, ArrayProxy): return (ValueKey(self.value.index) == ValueKey(other.value.index) and len(self.value.elems) == len(other.value.elems) and