fix <u and >u with int arguments
authorJacob Lifshay <programmerjake@gmail.com>
Fri, 28 Apr 2023 08:47:12 +0000 (01:47 -0700)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 2 Jun 2023 18:51:17 +0000 (19:51 +0100)
src/openpower/decoder/selectable_int.py

index e90b68f156bd727aa7fde8c32de025502b4ff469..37592fd0d2804725a81b3b3fb0c3fa06654955be 100644 (file)
@@ -528,17 +528,21 @@ def onebit(bit):
 def selectltu(lhs, rhs):
     """ less-than (unsigned)
     """
+    if isinstance(lhs, SelectableInt):
+        lhs = lhs.value
     if isinstance(rhs, SelectableInt):
         rhs = rhs.value
-    return onebit(lhs.value < rhs)
+    return onebit(lhs < rhs)
 
 
 def selectgtu(lhs, rhs):
     """ greater-than (unsigned)
     """
+    if isinstance(lhs, SelectableInt):
+        lhs = lhs.value
     if isinstance(rhs, SelectableInt):
         rhs = rhs.value
-    return onebit(lhs.value > rhs)
+    return onebit(lhs > rhs)
 
 
 # XXX this probably isn't needed...