sv_binutils: sort entries by name
authorDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Sun, 9 Jan 2022 16:52:22 +0000 (16:52 +0000)
committerDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Sun, 9 Jan 2022 16:52:22 +0000 (16:52 +0000)
src/openpower/sv/sv_binutils.py

index e29a01c18fa476bb3a506eab0e794039af68d1f7..719475c801087f7575d3779a5166b05bea3e4723 100644 (file)
@@ -187,6 +187,11 @@ class Entry:
     sv_cr_in: SVEXTRA
     sv_cr_out: SVEXTRA
 
+    def __lt__(self, other):
+        if not isinstance(other, self.__class__):
+            return NotImplemented
+        return self.name < other.name
+
     @classmethod
     def c_decl(cls):
         bits_all = 0
@@ -366,6 +371,7 @@ def main(codegen):
     }
     for (path, opcode_cls) in table.items():
         entries.extend(parse(path, opcode_cls))
+    entries = sorted(entries)
 
     for line in codegen.generate(entries):
         print(line)