power_fields: allow comparing references
authorDmitry Selyutin <ghostmansd@gmail.com>
Thu, 1 Sep 2022 12:32:06 +0000 (15:32 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Fri, 2 Sep 2022 08:44:11 +0000 (11:44 +0300)
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: