add comment-stripping to get_csv()
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 23 Jun 2022 09:39:21 +0000 (10:39 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 23 Jun 2022 09:39:21 +0000 (10:39 +0100)
there have been a lot of situations where comments are needed
including review of new instructions

openpower/isatables/minor_22.csv
src/openpower/decoder/power_enums.py

index 1129ce3a73cbe3f936543abff6fcf5c5d2537aac..e966df6a1152cf47913f3699070c33c0ff909675 100644 (file)
@@ -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
index 995806c8874a4f1365e25afaf02af800fbab370b..5b9c888a25f9e8a1d888f856a11d6e94eae8c9df 100644 (file)
@@ -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)