put regs through to ISACaller
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 5 Apr 2020 20:51:16 +0000 (21:51 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 5 Apr 2020 20:51:16 +0000 (21:51 +0100)
src/soc/decoder/isa/caller.py
src/soc/decoder/pseudo/pywriter.py

index 5b6e158ef9c3df3eda4b574067151c5738959277..2199d731348e0453f744e64c65b9492ceda2e047 100644 (file)
@@ -135,7 +135,9 @@ class ISACaller:
             self.namespace[name] = SelectableInt(val, bits=signal.width)
 
     def call(self, name):
-        function, read_regs, uninit_regs, write_regs, op_fields, form \
+        # TODO, asmregs is from the spec, e.g. add RT,RA,RB
+        # see http://bugs.libre-riscv.org/show_bug.cgi?id=282
+        fn, read_regs, uninit_regs, write_regs, op_fields, asmregs, form \
             = self.instrs[name]
         yield from self.prep_namespace(form, op_fields)
 
@@ -150,7 +152,7 @@ class ISACaller:
             print('reading reg %d' % regnum)
             inputs.append(self.gpr(regnum))
         print(inputs)
-        results = function(self, *inputs)
+        results = fn(self, *inputs)
         print(results)
 
         if write_regs:
index 2afc2d3c937f603ce71f24331c92a579d982cf11..a8f9bdabfd4eadc075c297b08d3347374662f687 100644 (file)
@@ -26,6 +26,11 @@ class %s:
 
 """
 
+iinfo_template = """(%s, %s,
+                %s, %s,
+                %s, '%s',
+                %s)"""
+
 class PyISAWriter(ISA):
     def __init__(self):
         ISA.__init__(self)
@@ -66,11 +71,9 @@ class PyISAWriter(ISA):
                     f.write("\n")
                 # accumulate the instruction info
                 ops = repr(rused['op_fields'])
-                iinfo = """(%s, %s,
-                %s, %s,
-                %s, '%s')""" % (op_fname, rused['read_regs'],
+                iinfo = iinfo_template % (op_fname, rused['read_regs'],
                                 rused['uninit_regs'], rused['write_regs'],
-                                ops, d.form)
+                                ops, d.form, d.regs)
                 iinf += "    %s_instrs['%s'] = %s\n" % (pagename, page, iinfo)
             # write out initialisation of info, for ISACaller to use
             f.write("    %s_instrs = {}\n" % pagename)