From: Tobias Platen Date: Sat, 20 Nov 2021 15:16:37 +0000 (+0100) Subject: fix pi_ld testcase X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c4cdfbd31015f9fc2177bc2a2930854db36ec33e;p=soc.git fix pi_ld testcase --- diff --git a/src/soc/config/test/test_pi2ls.py b/src/soc/config/test/test_pi2ls.py index b68e2b93..f29515f3 100644 --- a/src/soc/config/test/test_pi2ls.py +++ b/src/soc/config/test/test_pi2ls.py @@ -88,6 +88,13 @@ def pi_ld(port1, addr, datalen, msr_pr=0): yield port1.addr.ok.eq(1) # set ok yield Settle() yield from wait_addr(port1) # wait until addr ok + exc_happened = yield port1.exc_o.happened + if exc_happened: + print("print fast exception happened") + yield port1.is_ld_i.eq(0) # end + yield port1.addr.ok.eq(0) # set !ok + return 0, "fast" + yield yield from wait_ldok(port1) # wait until ld ok data = yield port1.ld.data @@ -97,11 +104,11 @@ def pi_ld(port1, addr, datalen, msr_pr=0): yield port1.is_ld_i.eq(0) # end yield port1.addr.ok.eq(0) # set !ok if exc_happened: - return 0 + return 0, "slow" yield from wait_busy(port1,debug="pi_ld_E") # wait while busy - return data + return data, None def pi_ldst(arg, dut, msr_pr=0): diff --git a/src/soc/experiment/test/test_loadstore1.py b/src/soc/experiment/test/test_loadstore1.py index b4cf3f80..062256c2 100644 --- a/src/soc/experiment/test/test_loadstore1.py +++ b/src/soc/experiment/test/test_loadstore1.py @@ -115,40 +115,44 @@ def _test_loadstore1(dut, mem): yield from pi_st(pi, addr, data, 8, msr_pr=1) yield - ld_data = yield from pi_ld(pi, addr, 8, msr_pr=1) + ld_data, exc = yield from pi_ld(pi, addr, 8, msr_pr=1) assert ld_data == 0xf553b658ba7e1f51 - ld_data = yield from pi_ld(pi, addr, 8, msr_pr=1) + assert exc is None + ld_data, exc = yield from pi_ld(pi, addr, 8, msr_pr=1) assert ld_data == 0xf553b658ba7e1f51 + assert exc is None print("do_dcbz ===============") yield from pi_st(pi, addr, data, 8, msr_pr=1, is_dcbz=1) print("done_dcbz ===============") yield - ld_data = yield from pi_ld(pi, addr, 8, msr_pr=1) + ld_data, exc = yield from pi_ld(pi, addr, 8, msr_pr=1) print("ld_data after dcbz") print(ld_data) assert ld_data == 0 + assert exc is None if test_exceptions: - # causes next test to hang print("=== alignment error ===") addr = 0xFF100e0FF - ld_data = yield from pi_ld(pi, addr, 8, msr_pr=1) + ld_data, exc = yield from pi_ld(pi, addr, 8, msr_pr=1) alignment = yield pi.exc_o.alignment happened = yield pi.exc_o.happened dar = yield pi.dar_o assert(happened==1) assert(alignment==1) assert(dar==addr) + assert(exc=="fast") yield from wait_busy(pi, debug="pi_ld_E_alignment_error") # wait is only needed in case of in exception here print("=== alignment error test passed ===") + print("=== next ld test ===") addr = 0xFF100e000 - ld_data = yield from pi_ld(pi, addr, 8, msr_pr=1) - - yield + ld_data, exc = yield from pi_ld(pi, addr, 8, msr_pr=1) + print("ld_data",ld_data,exc) + print("=== done ===") stop = True def test_loadstore1():