From: Luke Kenneth Casson Leighton Date: Thu, 23 Jun 2022 09:39:21 +0000 (+0100) Subject: add comment-stripping to get_csv() X-Git-Tag: sv_maxu_works-initial~360 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86f0c748efb10c84e014583cc400dee29564f7a7;p=openpower-isa.git add comment-stripping to get_csv() there have been a lot of situations where comments are needed including review of new instructions --- diff --git a/openpower/isatables/minor_22.csv b/openpower/isatables/minor_22.csv index 1129ce3a..e966df6a 100644 --- a/openpower/isatables/minor_22.csv +++ b/openpower/isatables/minor_22.csv @@ -1,3 +1,4 @@ +# comment opcode,unit,internal op,in1,in2,in3,out,CR in,CR out,inv A,inv out,cry in,cry out,ldst len,BR,sgn ext,upd,rsrv,32b,sgn,rc,lk,sgl pipe,comment,form,CONDITIONS,unofficial,comment2 -----11011-,VL,OP_SETVL,RA_OR_ZERO,NONE,NONE,RT_OR_ZERO,NONE,CR0,0,0,ZERO,0,NONE,0,0,0,0,0,0,RC,0,0,setvl,SVL,,1,unofficial until submitted and approved/renumbered by the opf isa wg -----011001,VL,OP_SVSHAPE,NONE,NONE,NONE,NONE,NONE,NONE,0,0,ZERO,0,NONE,0,0,0,0,0,0,NONE,0,0,svshape,SVM,,1,unofficial until submitted and approved/renumbered by the opf isa wg diff --git a/src/openpower/decoder/power_enums.py b/src/openpower/decoder/power_enums.py index 995806c8..5b9c888a 100644 --- a/src/openpower/decoder/power_enums.py +++ b/src/openpower/decoder/power_enums.py @@ -35,8 +35,11 @@ def find_wiki_file(name): def get_csv(name): + """gets a not-entirely-csv-file-formatted database, which allows comments + """ file_path = find_wiki_file(name) with open(file_path, 'r') as csvfile: + csvfile = filter(lambda row: row[0] !='#', csvfile) # strip "#..." reader = csv.DictReader(csvfile) return list(reader)