split cav reading into separate function
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 6 Aug 2022 12:58:11 +0000 (13:58 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 6 Aug 2022 12:58:11 +0000 (13:58 +0100)
src/openpower/sv/sv_analysis.py

index 0fa0d7b3f871e46649e9ec9e937bcdfab9bc73c4..95364aa8cda49ad5ad3f7baf3879ed96d75026bf 100644 (file)
@@ -271,7 +271,7 @@ class Format(enum.Enum):
         }[self](lines)
 
 
-def process_csvs(format):
+def read_csvs():
     csvs = {}
     csvs_svp64 = {}
     bykey = {}
@@ -281,12 +281,6 @@ def process_csvs(format):
     insns = {}  # dictionary of CSV row, by instruction
     insn_to_csv = {}
 
-    print("# Draft SVP64 Power 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")
 
@@ -352,6 +346,21 @@ def process_csvs(format):
     primarykeys = list(primarykeys)
     primarykeys.sort()
 
+    return (csvs, csvs_svp64, primarykeys, bykey, insn_to_csv, insns,
+           dictkeys, immediates)
+
+
+def process_csvs(format):
+
+    print("# Draft SVP64 Power 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('')
+
+    (csvs, csvs_svp64, primarykeys, bykey, insn_to_csv, insns,
+           dictkeys, immediates) = read_csvs()
+
     # mapping to old SVPrefix "Forms"
     mapsto = {'3R-1W-CRo': 'RM-1P-3S1D',
               '2R-1W-CRio': 'RM-1P-2S1D',