power_fields: allow comparing references
[openpower-isa.git] / src / openpower / decoder / power_fields.py
index f41b89e3db5feafdd9f6db1448f9ffa547b3d7e5..f168cab8f52a76301e5972cb5279ddf9bf259af0 100644 (file)
@@ -49,10 +49,9 @@ class Reference:
         span = dict.fromkeys(self.__class__.span).keys()
         lhs = _selectconcat(*(self.storage[bit] for bit in span))
 
-        if isinstance(other, Field):
-            bits = len(other.__class__)
-            value = int(other)
-            rhs = _SelectableInt(value=value, bits=bits)
+        if isinstance(other, Reference):
+            span = dict.fromkeys(other.__class__.span).keys()
+            rhs = _selectconcat(*(other.storage[bit] for bit in span))
         elif isinstance(other, int):
             bits = len(self.__class__)
             if other.bit_length() > bits: