X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fsoc%2Fsimple%2Ftest%2Ftest_runner.py;h=fd3f15c386045150ee738df9de6a9003be1de575;hb=9f88e4ba914452edca81ceca48ad6504df204e92;hp=60f049ee6d979cebce6e833c81f53155c3cc65c5;hpb=46398376637a23f363eddb0cd9656bfb6eda7f72;p=soc.git diff --git a/src/soc/simple/test/test_runner.py b/src/soc/simple/test/test_runner.py index 60f049ee..fd3f15c3 100644 --- a/src/soc/simple/test/test_runner.py +++ b/src/soc/simple/test/test_runner.py @@ -5,6 +5,7 @@ related bugs: * https://bugs.libre-soc.org/show_bug.cgi?id=363 """ from nmigen import Module, Signal, Cat, ClockSignal +from nmigen.hdl.xfrm import ResetInserter # NOTE: to use cxxsim, export NMIGEN_SIM_MODE=cxxsim from the shell # Also, check out the cxxsim nmigen branch, and latest yosys from git @@ -13,12 +14,12 @@ from nmutil.sim_tmp_alternative import Simulator, Settle from nmutil.formaltest import FHDLTestCase from nmutil.gtkw import write_gtkw from nmigen.cli import rtlil -from soc.decoder.isa.caller import special_sprs, SVP64State -from soc.decoder.isa.all import ISA -from soc.config.endian import bigendian +from openpower.decoder.isa.caller import special_sprs, SVP64State +from openpower.decoder.isa.all import ISA +from openpower.endian import bigendian -from soc.decoder.power_decoder import create_pdecode -from soc.decoder.power_decoder2 import PowerDecode2 +from openpower.decoder.power_decoder import create_pdecode +from openpower.decoder.power_decoder2 import PowerDecode2 from soc.regfile.regfiles import StateRegs from soc.simple.issuer import TestIssuerInternal @@ -27,9 +28,11 @@ from soc.config.test.test_loadstore import TestMemPspec from soc.simple.test.test_core import (setup_regs, check_regs, wait_for_busy_clear, wait_for_busy_hi) -from soc.fu.compunits.test.test_compunit import (setup_test_memory, +from soc.fu.compunits.test.test_compunit import (setup_tst_memory, check_sim_memory) from soc.debug.dmi import DBGCore, DBGCtrl, DBGStat +from nmutil.util import wrap +from soc.experiment.test.test_mmu_dcache import wb_get def setup_i_memory(imem, startaddr, instructions): @@ -119,19 +122,28 @@ def get_dmi(dmi, addr): class TestRunner(FHDLTestCase): - def __init__(self, tst_data, microwatt_mmu=False, rom=None): + def __init__(self, tst_data, microwatt_mmu=False, rom=None, + svp64=True): super().__init__("run_all") self.test_data = tst_data self.microwatt_mmu = microwatt_mmu self.rom = rom + self.svp64 = svp64 def run_all(self): m = Module() comb = m.d.comb pc_i = Signal(32) + svstate_i = Signal(64) - pspec = TestMemPspec(ldst_ifacetype='test_bare_wb', - imem_ifacetype='test_bare_wb', + if self.microwatt_mmu: + ldst_ifacetype = 'test_mmu_cache_wb' + else: + ldst_ifacetype = 'test_bare_wb' + imem_ifacetype = 'test_bare_wb' + + pspec = TestMemPspec(ldst_ifacetype=ldst_ifacetype, + imem_ifacetype=imem_ifacetype, addr_wid=48, mask_wid=8, imem_reg_wid=64, @@ -140,18 +152,25 @@ class TestRunner(FHDLTestCase): nocore=False, xics=False, gpio=False, + regreduce=True, + svp64=self.svp64, mmu=self.microwatt_mmu, reg_wid=64) - m.submodules.issuer = issuer = TestIssuerInternal(pspec) + #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 imem = issuer.imem._get_memory() core = issuer.core dmi = issuer.dbg.dmi pdecode2 = issuer.pdecode2 l0 = core.l0 + regreduce_en = pspec.regreduce_en == True - # copy of the decoder for simulator - simdec = create_pdecode() - simdec2 = PowerDecode2(simdec) + #simdec = create_pdecode() + simdec2 = PowerDecode2(None, regreduce_en=regreduce_en) m.submodules.simdec2 = simdec2 # pain in the neck # run core clock at same rate as test clock @@ -159,6 +178,7 @@ class TestRunner(FHDLTestCase): comb += intclk.eq(ClockSignal()) comb += issuer.pc_i.data.eq(pc_i) + comb += issuer.svstate_i.data.eq(svstate_i) # nmigen Simulation sim = Simulator(m) @@ -169,15 +189,11 @@ class TestRunner(FHDLTestCase): # start in stopped yield from set_dmi(dmi, DBGCore.CTRL, 1<= len(instructions): - print ("index over, send dmi stop") - # stop at end - yield from set_dmi(dmi, DBGCore.CTRL, 1<= len(instructions): + print ("index over, send dmi stop") + # stop at end + yield from set_dmi(dmi, DBGCore.CTRL, + 1<