no python files to be committed in isafunctions
[openpower-isa.git] / src / openpower / decoder / pseudo / pywriter.py
index 58b290522dd61ec59553d7337d080a2c2bac4051..efca91c9094a0c473affb50f666901fc968d45a7 100644 (file)
@@ -25,23 +25,25 @@ from openpower.decoder.helpers import (EXTS, EXTS64, EXTZ64, ROTL64, ROTL32,
                                  ne, eq, gt, ge, lt, le, ltu, gtu, length,
                                  trunc_divs, trunc_rems, MULS, DIVS, MODS,
                                  EXTS128, undefined,
-                                 bitrev,
+                                 bitrev, SHL64,
                                 )
 from openpower.decoder.selectable_int import SelectableInt
 from openpower.decoder.selectable_int import selectconcat as concat
 from openpower.decoder.orderedset import OrderedSet
+from openpower.decoder.isafunctions.bcd import BCD_TO_DPD, DPD_TO_BCD
 
 """
 
 fpheader = """
 from openpower.decoder.helpers import (
-                                 DOUBLE, SINGLE,
+                                 SINGLE,
                                  FPADD32, FPSUB32, FPMUL32, FPDIV32,
                                  FPADD64, FPSUB64, FPMUL64, FPDIV64,
                                  FPMULADD32,
+                                 FPSIN32, FPCOS32,
                                 )
 from openpower.decoder.isafunctions.fpfromint import INT2FP
-
+from openpower.decoder.isafunctions.double2single import DOUBLE
 
 """
 
@@ -67,7 +69,8 @@ class PyISAWriter(ISA):
             iinf = ''
             # write headers: FP gets extra imports
             f.write(header)  # write out header
-            if pagename.startswith("fp"):
+            if (pagename.startswith("fp") or
+                pagename.startswith("svfp")):
                 f.write(fpheader)
             f.write("class %s:\n" % pagename)
 
@@ -90,8 +93,12 @@ class PyISAWriter(ISA):
                 op_fname = "op_%s" % page.replace(".", "_")
                 f.write("    @inject()\n")
                 f.write("    def %s(%s):\n" % (op_fname, args))
-                if 'NIA' in pycode:  # HACK - TODO fix
-                    f.write("        global NIA\n")
+                # blech! this works in combination with ISACaller
+                # @inject decorator, which works by injecting
+                # global variables into the function namespace.
+                for blech in ['NIA', 'end_loop']:
+                    if blech in pycode:  # HACK - TODO fix
+                        f.write("        global %s\n" % blech)
                 pycode = pycode.split("\n")
                 pycode = '\n'.join(map(lambda x: "        %s" % x, pycode))
                 pycode = pycode.rstrip()