provide "merger" of SVP64 RM info into v3.0B CSV files
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 27 Jan 2021 12:49:05 +0000 (12:49 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 28 Jan 2021 15:07:58 +0000 (15:07 +0000)
src/soc/decoder/power_svp64.py

index b7c7cde1ef1ed37f2837a0723818f75f87e88dcf..df496d242fb1d2cc5025d0382c2398e744223691 100644 (file)
@@ -16,4 +16,33 @@ class SVP64RM:
                     self.instrs[entry['insn']] = entry
 
 
+    def get_svp64_csv(self, fname):
+        # first get the v3.0B entries
+        v30b = get_csv(fname)
 
+        # now add the RM fields (for each instruction)
+        for entry in v30b:
+            # dummy (blank) fields, first
+            entry.update({'EXTRA0': '0', 'EXTRA1': '0', 'EXTRA2': '0',
+                          'EXTRA3': '0',
+                          'SV_Ptype': 'NONE', 'SV_Etype': 'NONE'})
+
+            # is this SVP64-augmented?
+            asmcode = entry['comment']
+            if asmcode not in self.instrs:
+                continue
+
+            # start updating the fields, merge relevant info
+            svp64 = self.instrs[asmcode]
+            for k, v in {'EXTRA0': '0', 'EXTRA1': '1', 'EXTRA2': '2',
+                          'EXTRA3': '3',
+                          'SV_Ptype': 'Ptype', 'SV_Etype': 'Etype'}.items():
+                entry[k] = svp64[v]
+
+        return v30b
+
+if __name__ == '__main__':
+    isa = SVP64RM()
+    minor_30 = isa.get_svp64_csv("minor_30.csv")
+    for entry in minor_30:
+        print (entry)