From d8bdbaf38015178cb7c8fc9509574d192d60b5a3 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 23 Apr 2021 16:44:47 +0100 Subject: [PATCH] sort out sv_analysys.py moving to openpower-isa --- .../openpower/sv}/sv_analysis.py | 30 ++++++------------- 1 file changed, 9 insertions(+), 21 deletions(-) rename {openpower => src/openpower/sv}/sv_analysis.py (97%) diff --git a/openpower/sv_analysis.py b/src/openpower/sv/sv_analysis.py similarity index 97% rename from openpower/sv_analysis.py rename to src/openpower/sv/sv_analysis.py index 4e8ec186..836b27c8 100644 --- a/openpower/sv_analysis.py +++ b/src/openpower/sv/sv_analysis.py @@ -17,24 +17,10 @@ import os from os.path import dirname, join from glob import glob from collections import OrderedDict -from soc.decoder.power_svp64 import SVP64RM +from openpower.decoder.power_svp64 import SVP64RM +from openpower.decoder.power_enums import find_wiki_file, get_csv -# Return absolute path (ie $PWD) + isatables + name -def find_wiki_file(name): - filedir = os.path.dirname(os.path.abspath(__file__)) - tabledir = join(filedir, 'isatables') - file_path = join(tabledir, name) - print ("find wiki file", name, file_path) - return file_path - -# Return an array of dictionaries from the CSV file name: -def get_csv(name): - file_path = find_wiki_file(name) - with open(file_path, 'r') as csvfile: - reader = csv.DictReader(csvfile) - return list(reader) - # Write an array of dictionaries to the CSV file name: def write_csv(name, items, headers): file_path = find_wiki_file(name) @@ -188,7 +174,9 @@ def process_csvs(): # Ignore those containing: valid test sprs for fname in glob(pth): - if '-' in fname: + print ("sv analysis checking", fname) + _, name = os.path.split(fname) + if '-' in name: continue if 'valid' in fname: continue @@ -200,7 +188,6 @@ def process_csvs(): continue if 'RM' in fname: continue - #print (fname) csvname = os.path.split(fname)[1] csvname_ = csvname.split(".")[0] # csvname is something like: minor_59.csv, fname the whole path @@ -591,8 +578,9 @@ def process_csvs(): # Ignore those containing: valid test sprs for fname in glob(pth): - print ("checking", fname) - if '-' in fname: + print ("post-checking", fname) + _, name = os.path.split(fname) + if '-' in name: continue if 'valid' in fname: continue @@ -677,7 +665,7 @@ def process_csvs(): re = re.replace("1P", "P1") re = re.replace("2P", "P2") row.append(re) - print (sventry) + print ("sventry", sventry) for colname in sv_cols: if sventry is None: re = 'NONE' -- 2.30.2