(no commit message)
[libreriscv.git] / openpower / sv_analysis.py
index 1713872e52c51431ddab96891ec7d9cfa8fb4218..9464ddfd4a1ede816c6740e825d557a7a18cbbb9 100644 (file)
@@ -151,6 +151,13 @@ def process_csvs():
     bykey = {}
     primarykeys = set()
     dictkeys = OrderedDict()
+    immediates = {}
+
+    print ("# OpenPOWER ISA register 'profile's")
+    print ('')
+    print ("this page is auto-generated, do not edit")
+    print ("created by http://libre-soc.org/openpower/sv_analysis.py")
+    print ('')
 
     # Expand that (all .csv files)
     pth = find_wiki_file("*.csv")
@@ -182,6 +189,13 @@ def process_csvs():
             bykey[key].append((csvname, row['opcode'], row['comment'],
                                row['form'].upper() + '-Form'))
 
+            # detect immediates, collate them (useful info)
+            if row['in2'].startswith('CONST_'):
+                imm = row['in2'].split("_")[1]
+                if key not in immediates:
+                    immediates[key] = set()
+                immediates[key].add(imm)
+
     primarykeys = list(primarykeys)
     primarykeys.sort()
 
@@ -192,9 +206,10 @@ def process_csvs():
               '2R-1W-CRo': 'R',
               '2R': 'non-SV',
               '2R-1W': 'R',
-              '1R-CRio': 'TBD',
+              '1R-CRio': 'TBD - need close inspection',
               '2R-CRio': 'R',
               '2R-CRo': 'R',
+              '1R': 'non-SV',
               '1R-1W-CRio': 'R',
               '1R-1W-CRo': 'R',
               '1R-1W': 'R',
@@ -202,15 +217,20 @@ def process_csvs():
               '1R-CRo': 'I',
               '1R-imm': 'non-SV',
               '1W': 'non-SV',
-              '1W-CRi': 'TBD',
-              'CRio': 'R/TBD',
+              '1W-CRi': 'TBD - needs close inspection',
+              'CRio': 'R/TBD - needs subdivision (cr ops)',
               'CRi': 'non-SV',
               'imm': 'non-SV',
               '': 'non-SV',
               'LDST-2R-imm': 'S',
               'LDST-2R-1W-imm': 'S',
+              'LDST-2R-1W': 'I',
+              'LDST-2R-2W': 'I',
               'LDST-1R-1W-imm': 'I',
               'LDST-1R-2W-imm': 'I',
+              'LDST-3R': 'R/TBD - st*x',     # these are st*x
+              'LDST-3R-CRo': 'R/TBD - st*x', # st*x
+              'LDST-3R-1W': 'R/TBD - st*x',  # st*x
               }
     print ("# map to old SV Prefix")
     print ('')
@@ -225,11 +245,14 @@ def process_csvs():
     print ("# keys")
     print ('')
     print ('[[!table  data="""')
-    print (tformat(tablecols) + " name |")
+    print (tformat(tablecols) + " imms | name |")
 
     for key in primarykeys:
         name = keyname(dictkeys[key])
-        print (tformat(dictkeys[key].values()) + " %s |" % name)
+        row = tformat(dictkeys[key].values())
+        row += " %s | " % ("/".join(list(immediates.get(key, ""))))
+        row += " %s |" % name
+        print (row)
     print ('"""]]')
     print ('')