From d98b57cad875525ed8e15a54d56ae95203cf5f35 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 4 Dec 2021 18:37:58 +0000 Subject: [PATCH] remove yet another duplicated copy of wb_get and add some better testing in misaligned mmu test --- .../experiment/test/test_ldst_pi_misalign.py | 87 ++++++++----------- 1 file changed, 38 insertions(+), 49 deletions(-) diff --git a/src/soc/experiment/test/test_ldst_pi_misalign.py b/src/soc/experiment/test/test_ldst_pi_misalign.py index df679977..10b98d66 100644 --- a/src/soc/experiment/test/test_ldst_pi_misalign.py +++ b/src/soc/experiment/test/test_ldst_pi_misalign.py @@ -24,59 +24,16 @@ from soc.fu.ldst.loadstore import LoadStore1 from soc.experiment.mmu import MMU from nmigen.compat.sim import run_simulation +from openpower.test.wb_get import wb_get +from openpower.test import wb_get as wbget -stop = False +wbget.stop = False def b(x): # byte-reverse function return int.from_bytes(x.to_bytes(8, byteorder='little'), byteorder='big', signed=False) -def wb_get(wb, mem): - """simulator process for getting memory load requests - """ - - global stop - - while not stop: - while True: # wait for dc_valid - if stop: - return - cyc = yield (wb.cyc) - stb = yield (wb.stb) - if cyc and stb: - break - yield - addr = (yield wb.adr) << 3 - if addr not in mem: - print (" WB LOOKUP NO entry @ %x, returning zero" % (addr)) - - # read or write? - we = (yield wb.we) - if we: - store = (yield wb.dat_w) - sel = (yield wb.sel) - data = mem.get(addr, 0) - # note we assume 8-bit sel, here - res = 0 - for i in range(8): - mask = 0xff << (i*8) - if sel & (1<