(no commit message)
[libreriscv.git] / openpower / sv_analysis.py
1 #!/usr/bin/env python2
2 #
3 # NOTE that this program is python2 compatible, please do not stop it
4 # from working by adding syntax that prevents that.
5 #
6 # Initial version written by lkcl Oct 2020
7 # This program analyses the Power 9 op codes and looks at in/out register uses
8 # The results are displayed:
9 # https://libre-soc.org/openpower/opcode_regs_deduped/
10 #
11 # It finds .csv files in the directory isatables/
12 # then goes through the categories and creates svp64 CSV augmentation
13 # tables on a per-opcode basis
14
15 import csv
16 import os
17 from os.path import dirname, join
18 from glob import glob
19 from collections import OrderedDict
20
21 # Return absolute path (ie $PWD) + isatables + name
22 def find_wiki_file(name):
23 filedir = os.path.dirname(os.path.abspath(__file__))
24 tabledir = join(filedir, 'isatables')
25 file_path = join(tabledir, name)
26 return file_path
27
28 # Return an array of dictionaries from the CSV file name:
29 def get_csv(name):
30 file_path = find_wiki_file(name)
31 with open(file_path, 'r') as csvfile:
32 reader = csv.DictReader(csvfile)
33 return list(reader)
34
35 # Write an array of dictionaries to the CSV file name:
36 def write_csv(name, items, headers):
37 file_path = find_wiki_file(name)
38 with open(file_path, 'wb') as csvfile:
39 writer = csv.DictWriter(csvfile, headers, lineterminator="\n")
40 writer.writeheader()
41 writer.writerows(items)
42
43 # This will return True if all values are true.
44 # Not sure what this is about
45 def blank_key(row):
46 #for v in row.values():
47 # if 'SPR' in v: # skip all SPRs
48 # return True
49 for v in row.values():
50 if v:
51 return False
52 return True
53
54 # General purpose registers have names like: RA, RT, R1, ...
55 # Floating point registers names like: FRT, FRA, FR1, ..., FRTp, ...
56 # Return True if field is a register
57 def isreg(field):
58 return (field.startswith('R') or field.startswith('FR') or
59 field == 'SPR')
60
61
62 # These are the attributes of the instructions,
63 # register names
64 keycolumns = ['unit', 'in1', 'in2', 'in3', 'out', 'CR in', 'CR out',
65 ] # don't think we need these: 'ldst len', 'rc', 'lk']
66
67 tablecols = ['unit', 'in', 'outcnt', 'CR in', 'CR out', 'imm'
68 ] # don't think we need these: 'ldst len', 'rc', 'lk']
69
70 def create_key(row):
71 res = OrderedDict()
72 #print ("row", row)
73 for key in keycolumns:
74 # registers IN - special-case: count number of regs RA/RB/RC/RS
75 if key in ['in1', 'in2', 'in3']:
76 if 'in' not in res:
77 res['in'] = 0
78 if isreg(row[key]):
79 res['in'] += 1
80
81 # registers OUT
82 if key == 'out':
83 # If upd is 1 then increment the count of outputs
84 if 'outcnt' not in res:
85 res['outcnt'] = 0
86 if isreg(row[key]):
87 res['outcnt'] += 1
88 if row['upd'] == '1':
89 res['outcnt'] += 1
90
91 # CRs (Condition Register) (CR0 .. CR7)
92 if key.startswith('CR'):
93 if row[key].startswith('NONE'):
94 res[key] = '0'
95 else:
96 res[key] = '1'
97 if row['comment'].startswith('cr'):
98 res['crop'] = '1'
99 # unit
100 if key == 'unit':
101 if row[key] == 'LDST': # we care about LDST units
102 res[key] = row[key]
103 else:
104 res[key] = 'OTHER'
105 # LDST len (LoadStore length)
106 if key.startswith('ldst'):
107 if row[key].startswith('NONE'):
108 res[key] = '0'
109 else:
110 res[key] = '1'
111 # rc, lk
112 if key in ['rc', 'lk']:
113 if row[key] == 'ONE':
114 res[key] = '1'
115 elif row[key] == 'NONE':
116 res[key] = '0'
117 else:
118 res[key] = 'R'
119 if key == 'lk':
120 res[key] = row[key]
121
122 # Convert the numerics 'in' & 'outcnt' to strings
123 res['in'] = str(res['in'])
124 res['outcnt'] = str(res['outcnt'])
125
126
127 # constants
128 if row['in2'].startswith('CONST_'):
129 res['imm'] = "1" # row['in2'].split("_")[1]
130 else:
131 res['imm'] = ''
132
133 return res
134
135 #
136 def dformat(d):
137 res = []
138 for k, v in d.items():
139 res.append("%s: %s" % (k, v))
140 return ' '.join(res)
141
142 def tformat(d):
143 return ' | '.join(d) + " |"
144
145 def keyname(row):
146 res = []
147 if row['unit'] != 'OTHER':
148 res.append(row['unit'])
149 if row['in'] != '0':
150 res.append('%sR' % row['in'])
151 if row['outcnt'] != '0':
152 res.append('%sW' % row['outcnt'])
153 if row['CR in'] == '1' and row['CR out'] == '1':
154 if 'crop' in row:
155 res.append("CR=2R1W")
156 else:
157 res.append("CRio")
158 elif row['CR in'] == '1':
159 res.append("CRi")
160 elif row['CR out'] == '1':
161 res.append("CRo")
162 elif 'imm' in row and row['imm']:
163 res.append("imm")
164 return '-'.join(res)
165
166
167 def process_csvs():
168 csvs = {}
169 bykey = {}
170 primarykeys = set()
171 dictkeys = OrderedDict()
172 immediates = {}
173 insns = {} # dictionary of CSV row, by instruction
174
175 print ("# OpenPOWER ISA register 'profile's")
176 print ('')
177 print ("this page is auto-generated, do not edit")
178 print ("created by http://libre-soc.org/openpower/sv_analysis.py")
179 print ('')
180
181 # Expand that (all .csv files)
182 pth = find_wiki_file("*.csv")
183
184 # Ignore those containing: valid test sprs
185 for fname in glob(pth):
186 if '-' in fname:
187 continue
188 if 'valid' in fname:
189 continue
190 if 'test' in fname:
191 continue
192 if fname.endswith('sprs.csv'):
193 continue
194 if fname.endswith('minor_19_valid.csv'):
195 continue
196 if 'RM' in fname:
197 continue
198 #print (fname)
199 csvname = os.path.split(fname)[1]
200 # csvname is something like: minor_59.csv, fname the whole path
201 csv = get_csv(fname)
202 csvs[fname] = csv
203 for row in csv:
204 if blank_key(row):
205 continue
206 insn_name = row['comment']
207 # skip instructions that are not suitable
208 if insn_name in ['mcrxr', 'mcrxrx', 'darn']:
209 continue
210 if insn_name.startswith('bc') or 'rfid' in insn_name:
211 continue
212 insns[insn_name] = row # accumulate csv data by instruction
213 dkey = create_key(row)
214 key = tuple(dkey.values())
215 # print("key=", key)
216 dictkeys[key] = dkey
217 primarykeys.add(key)
218 if key not in bykey:
219 bykey[key] = []
220 bykey[key].append((csvname, row['opcode'], insn_name,
221 row['form'].upper() + '-Form'))
222
223 # detect immediates, collate them (useful info)
224 if row['in2'].startswith('CONST_'):
225 imm = row['in2'].split("_")[1]
226 if key not in immediates:
227 immediates[key] = set()
228 immediates[key].add(imm)
229
230 primarykeys = list(primarykeys)
231 primarykeys.sort()
232
233 # mapping to old SVPrefix "Forms"
234 mapsto = {'3R-1W-CRio': 'RM-1P-3S1D',
235 '2R-1W-CRio': 'RM-1P-2S1D',
236 '2R-1W-CRi': 'RM-1P-3S1D',
237 '2R-1W-CRo': 'RM-1P-2S1D',
238 '2R': 'non-SV',
239 '2R-1W': 'RM-1P-2S1D',
240 '1R-CRio': 'RM-2P-2S1D',
241 '2R-CRio': 'RM-1P-2S1D',
242 '2R-CRo': 'RM-1P-2S1D',
243 '1R': 'non-SV',
244 '1R-1W-CRio': 'RM-2P-1S1D',
245 '1R-1W-CRo': 'RM-2P-1S1D',
246 '1R-1W': 'RM-2P-1S1D',
247 '1R-1W-imm': 'RM-2P-1S1D',
248 '1R-CRo': 'RM-2P-1S1D',
249 '1R-imm': 'non-SV',
250 '1W': 'non-SV',
251 '1W-CRi': 'RM-2P-1S1D',
252 'CRio': 'RM-2P-1S1D',
253 'CR=2R1W': 'RM-1P-2S1D',
254 'CRi': 'non-SV',
255 'imm': 'non-SV',
256 '': 'non-SV',
257 'LDST-2R-imm': 'LDSTRM-2P-2S',
258 'LDST-2R-1W-imm': 'LDSTRM-2P-2S1D',
259 'LDST-2R-1W': 'LDSTRM-2P-2S1D',
260 'LDST-2R-2W': 'LDSTRM-2P-2S1D',
261 'LDST-1R-1W-imm': 'LDSTRM-2P-1S1D',
262 'LDST-1R-2W-imm': 'LDSTRM-2P-1S2D',
263 'LDST-3R': 'LDSTRM-2P-3S',
264 'LDST-3R-CRo': 'LDSTRM-2P-3S', # st*x
265 'LDST-3R-1W': 'LDSTRM-2P-2S1D', # st*x
266 }
267 print ("# map to old SV Prefix")
268 print ('')
269 print ('[[!table data="""')
270 for key in primarykeys:
271 name = keyname(dictkeys[key])
272 value = mapsto.get(name, "-")
273 print (tformat([name, value+ " "]))
274 print ('"""]]')
275 print ('')
276
277 print ("# keys")
278 print ('')
279 print ('[[!table data="""')
280 print (tformat(tablecols) + " imms | name |")
281
282 # print out the keys and the table from which they're derived
283 for key in primarykeys:
284 name = keyname(dictkeys[key])
285 row = tformat(dictkeys[key].values())
286 imms = list(immediates.get(key, ""))
287 imms.sort()
288 row += " %s | " % ("/".join(imms))
289 row += " %s |" % name
290 print (row)
291 print ('"""]]')
292 print ('')
293
294 # print out, by remap name, all the instructions under that category
295 for key in primarykeys:
296 name = keyname(dictkeys[key])
297 value = mapsto.get(name, "-")
298 print ("## %s (%s)" % (name, value))
299 print ('')
300 print ('[[!table data="""')
301 print (tformat(['CSV', 'opcode', 'asm', 'form']))
302 rows = bykey[key]
303 rows.sort()
304 for row in rows:
305 print (tformat(row))
306 print ('"""]]')
307 print ('')
308
309 #for fname, csv in csvs.items():
310 # print (fname)
311
312 #for insn, row in insns.items():
313 # print (insn, row)
314
315 print ("# svp64 remaps")
316 svp64 = OrderedDict()
317 # create a CSV file, per category, with SV "augmentation" info
318 csvcols = ['insn', 'Ptype', 'Etype', '0', '1', '2', '3']
319 csvcols += ['in1', 'in2', 'in3', 'out', 'CR in', 'CR out'] # temporary
320 for key in primarykeys:
321 # get the decoded key containing row-analysis, and name/value
322 dkey = dictkeys[key]
323 name = keyname(dkey)
324 value = mapsto.get(name, "-")
325 if value == 'non-SV':
326 continue
327
328 # print out svp64 tables by category
329 print ("* **%s**: %s" % (name, value))
330
331 # store csv entries by svp64 RM category
332 if value not in svp64:
333 svp64[value] = []
334
335 rows = bykey[key]
336 rows.sort()
337
338 for row in rows:
339 #for idx in range(len(row)):
340 # if row[idx] == 'NONE':
341 # row[idx] = ''
342 # get the instruction
343 insn_name = row[2]
344 insn = insns[insn_name]
345 # start constructing svp64 CSV row
346 res = OrderedDict()
347 res['insn'] = insn_name
348 res['Ptype'] = value.split('-')[1] # predication type (RM-xN-xxx)
349 # get whether R_xxx_EXTRAn fields are 2-bit or 3-bit
350 res['Etype'] = 'EXTRA2'
351 # go through each register matching to Rxxxx_EXTRAx
352 for k in ['0', '1', '2', '3']:
353 res[k] = ''
354
355 # temporary useful info
356 regs = []
357 for k in ['in1', 'in2', 'in3', 'out', 'CR in', 'CR out']:
358 if insn[k].startswith('CONST'):
359 res[k] = ''
360 regs.append('')
361 else:
362 res[k] = insn[k]
363 if insn[k] == 'RA_OR_ZERO':
364 regs.append('RA')
365 elif insn[k] != 'NONE':
366 regs.append(insn[k])
367 else:
368 regs.append('')
369
370 # sigh now the fun begins. this isn't the sanest way to do it
371 # but the patterns are pretty regular.
372 if value == 'LDSTRM-2P-1S1D':
373 res['Etype'] = 'EXTRA3' # RM EXTRA3 type
374 res['0'] = 'd:RT' # RT: Rdest_EXTRA3
375 res['1'] = 's:RA' # RA: Rsrc1_EXTRA3
376
377 elif value == 'LDSTRM-2P-1S2D':
378 res['Etype'] = 'EXTRA2' # RM EXTRA2 type
379 res['0'] = 'd:RT' # RT: Rdest1_EXTRA2
380 res['1'] = 'd:RA' # RA: Rdest2_EXTRA2
381 res['2'] = 's:RA' # RA: Rsrc1_EXTRA2
382
383 elif value == 'LDSTRM-2P-2S':
384 res['Etype'] = 'EXTRA3' # RM EXTRA2 type
385 res['0'] = 'd:RS' # RT: Rdest1_EXTRA2
386 res['1'] = 's:RA' # RA: Rsrc1_EXTRA2
387
388 elif value == 'LDSTRM-2P-2S1D':
389 if 'st' in insn_name and 'x' not in insn_name: # stwu/stbu etc
390 res['Etype'] = 'EXTRA2' # RM EXTRA2 type
391 res['0'] = 'd:RA' # RA: Rdest1_EXTRA2
392 res['1'] = 's:RS' # RS: Rdsrc1_EXTRA2
393 res['2'] = 's:RA' # RA: Rsrc2_EXTRA2
394 elif 'st' in insn_name and 'x' in insn_name: # stwux
395 res['Etype'] = 'EXTRA2' # RM EXTRA2 type
396 res['0'] = 'd:RA' # RA: Rdest1_EXTRA2
397 res['1'] = 's:RS;s:RA' # RS: Rdest2_EXTRA2, RA: Rsrc1_EXTRA2
398 res['2'] = 's:RB' # RB: Rsrc2_EXTRA2
399 elif 'u' in insn_name: # ldux etc.
400 res['Etype'] = 'EXTRA2' # RM EXTRA2 type
401 res['0'] = 'd:RT' # RT: Rdest1_EXTRA2
402 res['1'] = 'd:RA' # RA: Rdest2_EXTRA2
403 res['2'] = 's:RB' # RB: Rsrc1_EXTRA2
404 else:
405 res['Etype'] = 'EXTRA2' # RM EXTRA2 type
406 res['0'] = 'd:RT' # RT: Rdest1_EXTRA2
407 res['1'] = 's:RA' # RA: Rsrc1_EXTRA2
408 res['2'] = 's:RB' # RB: Rsrc2_EXTRA2
409
410 elif value == 'LDSTRM-2P-3S':
411 res['Etype'] = 'EXTRA2' # RM EXTRA2 type
412 if 'cx' in insn_name:
413 res['0'] = 's:RS;d:CR0' # RS: Rsrc1_EXTRA2 CR0: dest
414 else:
415 res['0'] = 's:RS' # RS: Rsrc1_EXTRA2
416 res['1'] = 's:RA' # RA: Rsrc2_EXTRA2
417 res['2'] = 's:RB' # RA: Rsrc3_EXTRA2
418
419 elif value == 'RM-2P-1S1D':
420 res['Etype'] = 'EXTRA3' # RM EXTRA3 type
421 if insn_name == 'mtspr':
422 res['0'] = 'd:SPR' # SPR: Rdest1_EXTRA3
423 res['1'] = 's:RS' # RS: Rsrc1_EXTRA3
424 elif insn_name == 'mfspr':
425 res['0'] = 'd:RS' # RS: Rdest1_EXTRA3
426 res['1'] = 's:SPR' # SPR: Rsrc1_EXTRA3
427 elif name == 'CRio' and insn_name == 'mcrf':
428 res['0'] = 'd:BF' # BFA: Rdest1_EXTRA3
429 res['1'] = 's:BFA' # BFA: Rsrc1_EXTRA3
430 elif 'mfcr' in insn_name or 'mfocrf' in insn_name:
431 res['0'] = 'd:RT' # RT: Rdest1_EXTRA3
432 res['1'] = 's:CR' # CR: Rsrc1_EXTRA3
433 elif insn_name == 'setb':
434 res['0'] = 'd:RT' # RT: Rdest1_EXTRA3
435 res['1'] = 's:BFA' # BFA: Rsrc1_EXTRA3
436 elif insn_name.startswith('cmp'): # cmpi
437 res['0'] = 'd:BF' # BF: Rdest1_EXTRA3
438 res['1'] = 's:RA' # RA: Rsrc1_EXTRA3
439 elif regs == ['RA','','','RT','','']:
440 res['0'] = 'd:RT' # RT: Rdest1_EXTRA3
441 res['1'] = 's:RA' # RA: Rsrc1_EXTRA3
442 elif regs == ['RA','','','RT','','CR0']:
443 res['0'] = 'd:RT;d:CR0' # RT,CR0: Rdest1_EXTRA3
444 res['1'] = 's:RA' # RA: Rsrc1_EXTRA3
445 elif (regs == ['RS','','','RA','','CR0'] or
446 regs == ['','','RS','RA','','CR0']):
447 res['0'] = 'd:RA;d:CR0' # RA,CR0: Rdest1_EXTRA3
448 res['1'] = 's:RS' # RS: Rsrc1_EXTRA3
449 elif regs == ['RS','','','RA','','']:
450 res['0'] = 'd:RA' # RA: Rdest1_EXTRA3
451 res['1'] = 's:RS' # RS: Rsrc1_EXTRA3
452 elif regs == ['','FRB','','FRT','0','CR1']:
453 res['0'] = 'd:FRT;d:CR1' # FRT,CR1: Rdest1_EXTRA3
454 res['1'] = 's:FRA' # FRA: Rsrc1_EXTRA3
455 elif regs == ['','FRB','','','','CR1']:
456 res['0'] = 'd:CR1' # CR1: Rdest1_EXTRA3
457 res['1'] = 's:FRB' # FRA: Rsrc1_EXTRA3
458 elif regs == ['','FRB','','','','BF']:
459 res['0'] = 'd:BF' # BF: Rdest1_EXTRA3
460 res['1'] = 's:FRB' # FRA: Rsrc1_EXTRA3
461 elif regs == ['','FRB','','FRT','','CR1']:
462 res['0'] = 'd:FRT;d:CR1' # FRT,CR1: Rdest1_EXTRA3
463 res['1'] = 's:FRB' # FRB: Rsrc1_EXTRA3
464 else:
465 res['0'] = 'TODO'
466
467 elif value == 'RM-1P-2S1D':
468 res['Etype'] = 'EXTRA3' # RM EXTRA3 type
469 if insn_name.startswith('cr'):
470 res['0'] = 'd:BT' # BT: Rdest1_EXTRA3
471 res['1'] = 's:BA' # BA: Rsrc1_EXTRA3
472 res['2'] = 's:BB' # BB: Rsrc2_EXTRA3
473 elif regs == ['FRA','','FRC','FRT','','CR1']:
474 res['0'] = 'd:FRT;d:CR1' # FRT,CR1: Rdest1_EXTRA3
475 res['1'] = 's:FRA' # FRA: Rsrc1_EXTRA3
476 res['2'] = 's:FRC' # FRC: Rsrc1_EXTRA3
477 # should be for fcmp
478 elif regs == ['FRA','FRB','','','','BF']:
479 res['0'] = 'd:BF' # BF: Rdest1_EXTRA3
480 res['1'] = 's:FRA' # FRA: Rsrc1_EXTRA3
481 res['2'] = 's:FRB' # FRB: Rsrc1_EXTRA3
482 elif regs == ['FRA','FRB','','FRT','','']:
483 res['0'] = 'd:FRT' # FRT: Rdest1_EXTRA3
484 res['1'] = 's:FRA' # FRA: Rsrc1_EXTRA3
485 res['2'] = 's:FRB' # FRB: Rsrc1_EXTRA3
486 elif regs == ['FRA','FRB','','FRT','','CR1']:
487 res['0'] = 'd:FRT;d:CR1' # FRT,CR1: Rdest1_EXTRA3
488 res['1'] = 's:FRA' # FRA: Rsrc1_EXTRA3
489 res['2'] = 's:FRB' # FRB: Rsrc1_EXTRA3
490 elif name == '2R-1W' or insn_name == 'cmpb': # cmpb
491 if insn_name in ['bpermd', 'cmpb']:
492 res['0'] = 'd:RA' # RA: Rdest1_EXTRA3
493 res['1'] = 's:RS' # RS: Rsrc1_EXTRA3
494 else:
495 res['0'] = 'd:RT' # RT: Rdest1_EXTRA3
496 res['1'] = 's:RA' # RA: Rsrc1_EXTRA3
497 res['2'] = 's:RB' # RB: Rsrc1_EXTRA3
498 elif insn_name.startswith('cmp'): # cmp
499 res['0'] = 'd:BF' # BF: Rdest1_EXTRA3
500 res['1'] = 's:RA' # RA: Rsrc1_EXTRA3
501 res['2'] = 's:RB' # RB: Rsrc1_EXTRA3
502 elif (regs == ['','RB','RS','RA','','CR0'] or
503 regs == ['RS','RB','','RA','','CR0']):
504 res['0'] = 'd:RA;d:CR0' # RA,CR0: Rdest1_EXTRA3
505 res['1'] = 's:RB' # RB: Rsrc1_EXTRA3
506 res['2'] = 's:RS' # RS: Rsrc1_EXTRA3
507 elif regs == ['RA','RB','','RT','','CR0']:
508 res['0'] = 'd:RT;d:CR0' # RT,CR0: Rdest1_EXTRA3
509 res['1'] = 's:RA' # RA: Rsrc1_EXTRA3
510 res['2'] = 's:RB' # RB: Rsrc1_EXTRA3
511 elif regs == ['RA','','RS','RA','','CR0']:
512 res['0'] = 'd:RA;d:CR0' # RA,CR0: Rdest1_EXTRA3
513 res['1'] = 's:RA' # RA: Rsrc1_EXTRA3
514 res['2'] = 's:RS' # RS: Rsrc1_EXTRA3
515 else:
516 res['0'] = 'TODO'
517
518 elif value == 'RM-2P-2S1D':
519 res['Etype'] = 'EXTRA2' # RM EXTRA2 type
520 if insn_name.startswith('mt'): # mtcrf
521 res['0'] = 'd:CR' # CR: Rdest1_EXTRA2
522 res['1'] = 's:RS' # RS: Rsrc1_EXTRA2
523 res['2'] = 's:CR' # CR: Rsrc2_EXTRA2
524 else:
525 res['0'] = 'TODO'
526
527 elif value == 'RM-1P-3S1D':
528 res['Etype'] = 'EXTRA2' # RM EXTRA2 type
529 if insn_name == 'isel':
530 res['0'] = 'd:RT' # RT: Rdest1_EXTRA2
531 res['1'] = 's:RA' # RA: Rsrc1_EXTRA2
532 res['2'] = 's:RB' # RT: Rsrc2_EXTRA2
533 res['3'] = 's:BC' # BC: Rsrc3_EXTRA2
534 else:
535 res['0'] = 'd:FRT;d:CR1' # FRT, CR1: Rdest1_EXTRA2
536 res['1'] = 's:FRA' # FRA: Rsrc1_EXTRA2
537 res['2'] = 's:FRB' # FRB: Rsrc2_EXTRA2
538 res['3'] = 's:FRC' # FRC: Rsrc3_EXTRA2
539
540 # add to svp64 csvs
541 #for k in ['in1', 'in2', 'in3', 'out', 'CR in', 'CR out']:
542 # del res[k]
543 #if res['0'] != 'TODO':
544 for k in res:
545 if res[k] == 'NONE' or res[k] == '':
546 res[k] = '0'
547 svp64[value].append(res)
548
549 print ('')
550
551 # now write out the csv files
552 for value, csv in svp64.items():
553 # print out svp64 tables by category
554 print ("## %s" % value)
555 print ('')
556 print ('[[!table format=csv file="openpower/isatables/%s.csv"]]' % \
557 value)
558 print ('')
559
560 #csvcols = ['insn', 'Ptype', 'Etype', '0', '1', '2', '3']
561 write_csv("%s.csv" % value, csv, csvcols)
562
563 if __name__ == '__main__':
564 process_csvs()