From 65f0d016f3d4c1cc0e8b52c081ec9ba4b0764744 Mon Sep 17 00:00:00 2001 From: Tobias Platen Date: Wed, 4 Nov 2020 18:49:31 +0100 Subject: [PATCH] MMU: begin test case for 'dcbz' --- src/soc/fu/mmu/test/test_pipe_caller.py | 37 +++++++++++++++++++------ 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/soc/fu/mmu/test/test_pipe_caller.py b/src/soc/fu/mmu/test/test_pipe_caller.py index cbc648fd..6d3dc0d9 100644 --- a/src/soc/fu/mmu/test/test_pipe_caller.py +++ b/src/soc/fu/mmu/test/test_pipe_caller.py @@ -28,6 +28,10 @@ import random from soc.fu.div.test.helper import (log_rand, get_cu_inputs, set_alu_inputs, DivTestHelper) +import power_instruction_analyzer as pia + +debughang = 0 + def set_fsm_inputs(alu, dec2, sim): # TODO: see https://bugs.libre-soc.org/show_bug.cgi?id=305#c43 # detect the immediate here (with m.If(self.i.ctx.op.imm_data.imm_ok)) @@ -41,21 +45,35 @@ def set_fsm_inputs(alu, dec2, sim): # TODO set spr register # yield from ALUHelpers.set_spr_spr1(alu, dec2, inp) + overflow = None + a=None + b=None + # TODO + if 'xer_so' in inp: + print("xer_so::::::::::::::::::::::::::::::::::::::::::::::::") + so = inp['xer_so'] + print(so) + overflow = pia.OverflowFlags(so=bool(so), + ov=False, + ov32=False) + if 'ra' in inp: + a = inp['ra'] + if 'rb' in inp: + b = inp['rb'] + print(inp) + return pia.InstructionInput(ra=a, rb=b, overflow=overflow) + def check_fsm_outputs(fsm, pdecode2, sim, code): # check that MMUOutputData is correct return None #TODO #incomplete test - connect fsm inputs first -class MMUTestCase(TestAccumulatorBase): +class MMUTestCase(TestAccumulatorBase): def case_1_mmu(self): # test case for MTSPR, MFSPR, DCBZ and TLBIE. - lst = [#"dcbz 1, 1", - "mfspr 1, 26", # SRR0 - "mfspr 2, 27", # SRR1 - "mfspr 3, 8", # LR - "mfspr 4, 1", ] # XER + lst = ["dcbz 2,3"] initial_regs = [0] * 32 initial_sprs = {'SRR0': 0x12345678, 'SRR1': 0x5678, 'LR': 0x1234, 'XER': 0xe00c0000} @@ -114,8 +132,11 @@ class TestRunner(unittest.TestCase): print("dec2 spr/fast in", fast_out, spr_out) fn_unit = yield pdecode2.e.do.fn_unit - self.assertEqual(fn_unit, Function.SPR.value) + #FIXME this fails -- self.assertEqual(fn_unit, Function.SPR.value) fsm_o_unused = yield from set_fsm_inputs(fsm, pdecode2, sim) + print("set_fsm_inputs") + print(fsm_o_unused) + print("cut here ---------------------------------------------") yield opname = code.split(' ')[0] yield from sim.call(opname) @@ -127,7 +148,7 @@ class TestRunner(unittest.TestCase): vld = yield fsm.n.valid_o #fsm while not vld: yield - print("not valid -- hang") + if debughang: print("not valid -- hang") vld = yield fsm.n.valid_o yield -- 2.30.2