fix annoying alu test_pipe_caller bug, missing asmcode
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 26 Sep 2020 19:55:10 +0000 (20:55 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 26 Sep 2020 19:55:22 +0000 (20:55 +0100)
src/soc/decoder/power_decoder2.py
src/soc/fu/alu/test/test_pipe_caller.py

index e24de8a30e2d2f766828b5b535a64bbeba442548..a596593af8f683d2f5ed7197e70b79aa2780012d 100644 (file)
@@ -617,6 +617,7 @@ record_names = {'insn_type': 'internal_op',
                 'ldst_mode': 'upd',
                 }
 
+
 class PowerDecodeSubset(Elaboratable):
     """PowerDecodeSubset: dynamic subset decoder
 
@@ -787,6 +788,7 @@ class PowerDecode2(PowerDecodeSubset):
     def get_col_subset(self, opkls):
         subset = super().get_col_subset(opkls)
         subset.add("in1_sel")
+        subset.add("asmcode")
         subset.add("in2_sel")
         subset.add("in3_sel")
         subset.add("out_sel")
@@ -936,6 +938,10 @@ class PowerDecode2(PowerDecodeSubset):
             comb += e_out.read_fast2.data.eq(FastRegs.SRR1)  # constant: SRR1
             comb += e_out.read_fast2.ok.eq(1)
 
+        # annoying simulator bug
+        if hasattr(e_out, "asmcode") and hasattr(self.dec.op, "asmcode"):
+            comb += e_out.asmcode.eq(self.dec.op.asmcode)
+
         return m
 
     def trap(self, m, traptype, trapaddr):
index 9b0c73308f6552ba8740acd78b49bd27befa95a8..b065118a8163752b3e73314fa435b96ff04df6bd 100644 (file)
@@ -352,6 +352,9 @@ class TestRunner(unittest.TestCase):
             yield instruction.eq(ins)          # raw binary instr.
             yield Settle()
             fn_unit = yield pdecode2.e.do.fn_unit
+            asmcode = yield pdecode2.e.asmcode
+            dec_asmcode = yield pdecode2.dec.op.asmcode
+            print ("asmcode", asmcode, dec_asmcode)
             self.assertEqual(fn_unit, Function.ALU.value)
             yield from set_alu_inputs(alu, pdecode2, sim)
 
@@ -382,7 +385,8 @@ class TestRunner(unittest.TestCase):
         fn_name = "ALU"
         opkls = ALUPipeSpec.opsubsetkls
 
-        m.submodules.pdecode2 = pdecode2 = PowerDecode2(None, opkls, fn_name)
+        pdecode = create_pdecode()
+        m.submodules.pdecode2 = pdecode2 = PowerDecode2(pdecode, opkls, fn_name)
         pdecode = pdecode2.dec
 
         pspec = ALUPipeSpec(id_wid=2)