messy resolution of sv.bc testing, early-out detection.
[openpower-isa.git] / src / openpower / decoder / pseudo / pywriter.py
index 8cf2ed9bfdd0fd4ab308b093eaa6af8020e0e98e..8cde6d1964e3c7e0098154d9f0172919fdaf0dfb 100644 (file)
@@ -93,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', 'cond_ok', 'ctr_ok']:
+                    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()