reversal of FXM mask for one-hot selection in OP_MTCR decode
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 30 Aug 2020 14:45:03 +0000 (15:45 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 30 Aug 2020 14:45:03 +0000 (15:45 +0100)
libreriscv
src/soc/decoder/power_decoder2.py
src/soc/fu/cr/test/test_pipe_caller.py
src/soc/simple/test/test_issuer.py

index 8976b9bf14aab4e7bff0eabfa1412744ed0fe832..2f9e449034fd6963965c76e727cc4e3cfa3df9c6 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 8976b9bf14aab4e7bff0eabfa1412744ed0fe832
+Subproject commit 2f9e449034fd6963965c76e727cc4e3cfa3df9c6
index b0142c15c670b2623fa5a5a6ad99d53ba090b808..1bdcd3ffc83a791e6b13905551e86f5209f19635 100644 (file)
@@ -557,7 +557,8 @@ class DecodeCROut(Elaboratable):
         m = Module()
         comb = m.d.comb
         op = self.dec.op
-        m.submodules.ppick = ppick = PriorityPicker(8)
+        m.submodules.ppick = ppick = PriorityPicker(8, reverse_i=True,
+                                                       reverse_o=True)
 
         comb += self.cr_bitfield.ok.eq(0)
         comb += self.whole_reg.ok.eq(0)
index b615c93f4da91f84bbaef5aac19e60203a5515a6..fe794f89083202ad0523b6462cdc706fdcb4af31 100644 (file)
@@ -110,6 +110,20 @@ class CRTestCase(TestAccumulatorBase):
         p.assembly = '\n'.join(dis)+'\n'
         self.add_case(p, initial_cr=cr)
 
+    def case_mtocrf_regression(self):
+        """microwatt 1.bin regression, same hack as above.
+           106b4:   21 d9 96 7d     .long 0x7d96d921   # mtocrf 12, 0b01101101
+        """
+        mask = 0b01101101
+        dis = [f"mtocrf 12, {mask}"]
+        lst = bytes([0x21, 0xd9, 0x96, 0x7d]) # 0x7d96d921
+        cr = 0x529e08fe
+        initial_regs = [0] * 32
+        initial_regs[12] = 0xffffffffffffffff
+        p = Program(lst, bigendian)
+        p.assembly = '\n'.join(dis)+'\n'
+        self.add_case(p, initial_regs=initial_regs, initial_cr=cr)
+
     def case_mfocrf_1(self):
         lst = [f"mfocrf 2, 1"]
         cr = 0x1234
index f81eef12f71c95630e5e5c1326be5610abbae332..91e68a71298a1be5f79e32a5651bd2b46005957a 100644 (file)
@@ -281,7 +281,7 @@ class TestRunner(FHDLTestCase):
                 cr = yield from get_dmi(dmi, DBGCore.CR)
                 print ("after test %s cr value %x" % (test.name, cr))
 
-                # get CR
+                # get XER
                 xer = yield from get_dmi(dmi, DBGCore.XER)
                 print ("after test %s XER value %x" % (test.name, xer))