From 5c283bf9dc0f49cb6c5add84aed902a896d04e7e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 26 Sep 2020 20:55:10 +0100 Subject: [PATCH] fix annoying alu test_pipe_caller bug, missing asmcode --- src/soc/decoder/power_decoder2.py | 6 ++++++ src/soc/fu/alu/test/test_pipe_caller.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/soc/decoder/power_decoder2.py b/src/soc/decoder/power_decoder2.py index e24de8a3..a596593a 100644 --- a/src/soc/decoder/power_decoder2.py +++ b/src/soc/decoder/power_decoder2.py @@ -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): diff --git a/src/soc/fu/alu/test/test_pipe_caller.py b/src/soc/fu/alu/test/test_pipe_caller.py index 9b0c7330..b065118a 100644 --- a/src/soc/fu/alu/test/test_pipe_caller.py +++ b/src/soc/fu/alu/test/test_pipe_caller.py @@ -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) -- 2.30.2