change @inject to take no parameters
authorMichael Nolan <mtnolan2640@gmail.com>
Sat, 4 Apr 2020 20:33:25 +0000 (16:33 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Sat, 4 Apr 2020 20:35:49 +0000 (16:35 -0400)
There are issues with using decorators with class variables (see
https://stackoverflow.com/questions/11731136/class-method-decorator-with-self-arguments)
so it was changed to take no variables and access the class internally

src/soc/decoder/pseudo/pywriter.py

index a9f58acd536f094c67f3ec6c7e67970ca3301cb3..049a1f3981fff254b073b2f5d7fca0cb18039142 100644 (file)
@@ -51,7 +51,7 @@ class PyISAWriter(ISA):
                 # write out function.  pre-pend "op_" because some instrs are
                 # also python keywords (cmp).  also replace "." with "_"
                 op_fname ="op_%s" % page.replace(".", "_")
-                f.write("    @inject(self.namespace)\n")
+                f.write("    @inject()\n")
                 f.write("    def %s(%s):\n" % (op_fname, args))
                 pycode = pycode.split("\n")
                 pycode = '\n'.join(map(lambda x: "        %s" % x, pycode))