From 9479cddb3533123d698e3d0fdf3e848e20c09ae2 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 23 Sep 2021 23:31:41 +0100 Subject: [PATCH] add a new run_hdl parameter to TestRunner --- src/soc/simple/test/test_runner.py | 131 ++++++++++++++++------------- 1 file changed, 71 insertions(+), 60 deletions(-) diff --git a/src/soc/simple/test/test_runner.py b/src/soc/simple/test/test_runner.py index 045e9681..99b80378 100644 --- a/src/soc/simple/test/test_runner.py +++ b/src/soc/simple/test/test_runner.py @@ -255,12 +255,13 @@ def run_sim_state(dut, test, simdec2, instructions, gen, insncode): class TestRunner(FHDLTestCase): def __init__(self, tst_data, microwatt_mmu=False, rom=None, - svp64=True): + svp64=True, run_hdl=True): super().__init__("run_all") self.test_data = tst_data self.microwatt_mmu = microwatt_mmu self.rom = rom self.svp64 = svp64 + self.run_hdl = run_hdl def run_all(self): m = Module() @@ -288,13 +289,14 @@ class TestRunner(FHDLTestCase): svp64=self.svp64, mmu=self.microwatt_mmu, reg_wid=64) - #hard_reset = Signal(reset_less=True) - issuer = TestIssuerInternal(pspec) - # use DMI RESET command instead, this does actually work though - #issuer = ResetInserter({'coresync': hard_reset, - # 'sync': hard_reset})(issuer) - m.submodules.issuer = issuer - dmi = issuer.dbg.dmi + if self.run_hdl: + #hard_reset = Signal(reset_less=True) + issuer = TestIssuerInternal(pspec) + # use DMI RESET command instead, this does actually work though + #issuer = ResetInserter({'coresync': hard_reset, + # 'sync': hard_reset})(issuer) + m.submodules.issuer = issuer + dmi = issuer.dbg.dmi regreduce_en = pspec.regreduce_en == True simdec2 = PowerDecode2(None, regreduce_en=regreduce_en) @@ -304,8 +306,9 @@ class TestRunner(FHDLTestCase): intclk = ClockSignal("coresync") comb += intclk.eq(ClockSignal()) - comb += issuer.pc_i.data.eq(pc_i) - comb += issuer.svstate_i.data.eq(svstate_i) + if self.run_hdl: + comb += issuer.pc_i.data.eq(pc_i) + comb += issuer.svstate_i.data.eq(svstate_i) # nmigen Simulation sim = Simulator(m) @@ -313,22 +316,24 @@ class TestRunner(FHDLTestCase): def process(): - # start in stopped - yield from set_dmi(dmi, DBGCore.CTRL, 1<>>expected_data<<<) - - # get CR - cr = yield from get_dmi(dmi, DBGCore.CR) - print("after test %s cr value %x" % (test.name, cr)) - - # get XER - xer = yield from get_dmi(dmi, DBGCore.XER) - print("after test %s XER value %x" % (test.name, xer)) - - # test of dmi reg get - for int_reg in range(32): - yield from set_dmi(dmi, DBGCore.GSPR_IDX, int_reg) - value = yield from get_dmi(dmi, DBGCore.GSPR_DATA) - - print("after test %s reg %2d value %x" % - (test.name, int_reg, value)) - - # pull a reset - yield from set_dmi(dmi, DBGCore.CTRL, 1<>>expected_data<<<) + + # get CR + cr = yield from get_dmi(dmi, DBGCore.CR) + print("after test %s cr value %x" % (test.name, cr)) + + # get XER + xer = yield from get_dmi(dmi, DBGCore.XER) + print("after test %s XER value %x" % (test.name, xer)) + + # test of dmi reg get + for int_reg in range(32): + yield from set_dmi(dmi, DBGCore.GSPR_IDX, int_reg) + value = yield from get_dmi(dmi, DBGCore.GSPR_DATA) + + print("after test %s reg %2d value %x" % + (test.name, int_reg, value)) + + # pull a reset + yield from set_dmi(dmi, DBGCore.CTRL, 1<