power_enum: tune SVExtra representation
authorDmitry Selyutin <ghostmansd@gmail.com>
Mon, 5 Sep 2022 17:58:13 +0000 (20:58 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 6 Sep 2022 11:44:56 +0000 (14:44 +0300)
src/openpower/decoder/power_enums.py

index 29faffb15031eb1d88294f6dabed9c0bbc7c3696..cf08672a66cfcc354618ab053af65d4f98d9f958 100644 (file)
@@ -209,6 +209,16 @@ class SVExtra(Enum):
     Idx3 = 4
     Idx_1_2 = 5  # due to weird BA/BB for crops
 
+    def __repr__(self):
+        return {
+            SVExtra.NONE: "NONE",
+            SVExtra.Idx0: "[0]",
+            SVExtra.Idx1: "[1]",
+            SVExtra.Idx2: "[2]",
+            SVExtra.Idx3: "[3]",
+            SVExtra.Idx_1_2: "[1:2]",
+        }[self]
+
 # Backward compatibility
 SVEXTRA = SVExtra