pycode = convert_to_pure_python(pcode)
f.write(pycode)
+ def write_isa_class(self):
+ isadir = get_isafn_src_dir()
+ fname = os.path.join(isadir, "all.py")
+
+ with open(fname, "w") as f:
+ helpers = []
+ f.write('# auto-generated by pyfnwriter.py: do not edit or commit\n')
+ f.write('from openpower.decoder.helpers import ISACallerHelper\n')
+ for page in self.pages_written:
+ module = 'openpower.decoder.isafunctions.' + page
+ helper = 'ISACallerFnHelper_' + page
+ helpers.append(helper)
+ f.write('from %s import ISACallerFnHelper as %s\n' % (module, helper))
+ f.write('\n')
+ f.write('\n')
+ f.write('class ISACallerFnHelper(%s):\n' % ', '.join(helpers + ['ISACallerHelper']))
+ f.write(' pass\n')
+
def pyfnwriter():
isa = PyISAFnWriter()
print ("sources", write_isa_class, sources)
for source in sources:
isa.write_pysource(source)
+ if write_isa_class:
+ isa.write_isa_class()
if __name__ == '__main__':
pyfnwriter()