add mapreduce "reverse gear" to PowerDecoder2. gets the reg num to
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 19 Jun 2021 12:13:33 +0000 (13:13 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 19 Jun 2021 12:13:33 +0000 (13:13 +0100)
swap direction instead of 0..VL-1 it is VL-1..0

src/openpower/decoder/isa/caller.py
src/openpower/decoder/power_decoder2.py

index 495bd173fc80c1f3b8fdc99dc3f91dbae9edfc17..b81aa99b8ae3d988d0bac7a29e4a7fecb5b1f82c 100644 (file)
@@ -123,8 +123,12 @@ class GPR(dict):
         """ XXX currently not used
         """
         rnum = self._get_regnum(attr)
+        # XXX TODO, this needs sorting! (1) reverse gear for mapreduce
+        # and (2) when doing element-width overrides.  used by
+        # GPR(x) or GPR[x] in pseudocode
         offs = self.svstate.srcstep
-        log("GPR getitem", attr, rnum, "srcoffs", offs)
+        log("GPR getitem TODO mapreduce reverse-gear", attr, rnum,
+             "srcoffs", offs)
         return self.regfile[rnum]
 
     def dump(self, printout=True):
index 3b854bdd0a98f8d736a9c8f8547de26c6a17738b..054de6505992215dfb077a536b355fd8eccde761 100644 (file)
@@ -1153,8 +1153,10 @@ class PowerDecode2(PowerDecodeSubset):
             comb += crin_svdec_o.idx.eq(op.sv_cr_out) # SVP64 CR out
 
             # get SVSTATE srcstep (TODO: elwidth etc.) needed below
+            vl = Signal.like(self.state.svstate.vl)
             srcstep = Signal.like(self.state.svstate.srcstep)
             dststep = Signal.like(self.state.svstate.dststep)
+            comb += vl.eq(self.state.svstate.vl)
             comb += srcstep.eq(self.state.svstate.srcstep)
             comb += dststep.eq(self.state.svstate.dststep)
 
@@ -1173,7 +1175,11 @@ class PowerDecode2(PowerDecodeSubset):
                 # to_reg is 7-bits, outs get dststep added, ins get srcstep
                 with m.If(svdec.isvec):
                     step = dststep if out else srcstep
-                    comb += to_reg.data.eq(step+svdec.reg_out)
+                    # reverse gear goes the opposite way
+                    with m.If(self.rm_dec.reverse_gear):
+                        comb += to_reg.data.eq(step+svdec.reg_out)
+                    with m.Else():
+                        comb += to_reg.data.eq(svdec.reg_out+(vl-1-step))
                 with m.Else():
                     comb += to_reg.data.eq(svdec.reg_out)