From 3d3846e9964e3e443fdc94cf52fdf9b77762859e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcelina=20Ko=C5=9Bcielnicka?= Date: Wed, 7 Jun 2023 17:17:44 +0200 Subject: [PATCH] hdl.ast: fix `ValueKey.__eq__`. --- amaranth/hdl/ast.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/amaranth/hdl/ast.py b/amaranth/hdl/ast.py index da55380..b1ba53e 100644 --- a/amaranth/hdl/ast.py +++ b/amaranth/hdl/ast.py @@ -1745,7 +1745,7 @@ class ValueKey: return False if isinstance(self.value, Const): - return self.value.value == other.value.value + return self.value.value == other.value.value and self.value.width == other.value.width elif isinstance(self.value, (Signal, AnyValue)): return self.value is other.value elif isinstance(self.value, (ClockSignal, ResetSignal)): @@ -1765,8 +1765,9 @@ class ValueKey: self.value.width == other.value.width and self.value.stride == other.value.stride) elif isinstance(self.value, Cat): - return all(ValueKey(a) == ValueKey(b) - for a, b in zip(self.value.parts, other.value.parts)) + return (len(self.value.parts) == len(other.value.parts) and + 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)