sv_binutils: consider opcode whenever names match
authorDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Sun, 23 Jan 2022 18:22:42 +0000 (18:22 +0000)
committerDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Sun, 23 Jan 2022 18:22:42 +0000 (18:22 +0000)
src/openpower/sv/sv_binutils.py

index 1f0761475af2c7615970989c2ba1769447a45f35..8e7239a737c7c9622b08eeff65614448ad81fbe3 100644 (file)
@@ -102,6 +102,12 @@ class Opcode(CType):
         fmt = f"{{value:0{self.bits}b}}:{{mask:0{self.bits}b}}"
         return fmt.format(value=self.value, mask=self.mask)
 
+    def __lt__(self, other):
+        if not isinstance(other, self.__class__):
+            return NotImplemented
+
+        return self.__value < other.__value
+
     @classmethod
     def c_decl(cls):
         yield f"struct svp64_opcode {{"
@@ -186,6 +192,10 @@ class Entry(CType):
     def __lt__(self, other):
         if not isinstance(other, self.__class__):
             return NotImplemented
+
+        if self.name == other.name:
+            return self.opcode < other.opcode
+
         return self.name < other.name
 
     @classmethod