X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fsoc%2Ffu%2Fcompunits%2Ftest%2Ftest_compunit.py;h=7885b9f74daea6bbb464ddec6e130f45edcbb225;hb=a575b24544aecbab9fbaa4e4ba5eb743ab4932c7;hp=9882a47ee1306cc59cbe382a2c77e44e054d71f1;hpb=f5dab88e08b9244356fa83f8dc814c462fb4cf00;p=soc.git diff --git a/src/soc/fu/compunits/test/test_compunit.py b/src/soc/fu/compunits/test/test_compunit.py index 9882a47e..7885b9f7 100644 --- a/src/soc/fu/compunits/test/test_compunit.py +++ b/src/soc/fu/compunits/test/test_compunit.py @@ -11,6 +11,7 @@ from openpower.decoder.power_decoder import create_pdecode from openpower.decoder.power_decoder2 import PowerDecode2, get_rdflags from openpower.decoder.power_enums import Function from openpower.decoder.isa.all import ISA +from openpower.decoder.isa.mem import Mem from soc.experiment.compalu_multi import find_ok # hack from soc.config.test.test_loadstore import TestMemPspec @@ -137,15 +138,17 @@ def get_l0_mem(l0): # BLECH! this is awful! hunting around through structures return mem.mem -def setup_tst_memory(l0, sim): +def setup_tst_memory(l0, test_mem): + # create independent Sim Mem from test values + sim_mem = Mem(initial_mem=test_mem) mem = get_l0_mem(l0) print("before, init mem", mem.depth, mem.width, mem) for i in range(mem.depth): - data = sim.mem.ld(i*8, 8, False) + data = sim_mem.ld(i*8, 8, False) print("init ", i, hex(data)) yield mem._array[i].eq(data) yield Settle() - for k, v in sim.mem.mem.items(): + for k, v in sim_mem.mem.items(): print(" %6x %016x" % (k, v)) print("before, nmigen mem dump") for i in range(mem.depth): @@ -199,7 +202,7 @@ class TestRunner(FHDLTestCase): # initialise memory if self.funit == Function.LDST: - yield from setup_tst_memory(l0, sim) + yield from setup_tst_memory(l0, test.mem) pc = sim.pc.CIA.value index = pc//4