From 57ce728f7db0c2b05d429471f94becf6302735c0 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Wed, 25 May 2022 14:25:37 -0700 Subject: [PATCH 1/2] Address trigger has higher priority than alignment Used this test to confirm that https://github.com/riscv-software-src/riscv-isa-sim/pull/1013 works right. --- isa/rv64mi/breakpoint.S | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/isa/rv64mi/breakpoint.S b/isa/rv64mi/breakpoint.S index 252a696ef..4cf51a487 100644 --- a/isa/rv64mi/breakpoint.S +++ b/isa/rv64mi/breakpoint.S @@ -97,6 +97,51 @@ RVTEST_CODE_BEGIN lw a2, (a2) bnez a2, fail +2: + # Test that address breakpoints have higher priority than unaligned loads. + li TESTNUM, 12 + li a0, (2 << (__riscv_xlen - 4)) | MCONTROL_M | MCONTROL_LOAD | MCONTROL_STORE + csrw tdata1, a0 + # Skip if breakpoint type is unsupported. + csrr a1, tdata1 + bne a0, a1, 2f + la a2, data1 + 1 + la a3, data3 + csrw tdata2, a2 + + # Slow path because CSR was *just* written. (This is spike-specific.) + lw a2, (a2) + beqz a2, fail + + # Normal aligned load, so that the next time we'll hit the fast path. + li TESTNUM, 13 + lw a0, (a3) + + # Fast path + li TESTNUM, 14 + lw a2, (a2) + beqz a2, fail + + # Test that address breakpoints have higher priority than unaligned stores. + li TESTNUM, 16 + + la a2, data1 + 1 + csrw tdata2, a2 + + # Slow path because CSR was *just* written. (This is spike-specific.) + sw x0, (a2) + beqz a2, fail + + # Normal aligned store, so that the next time we'll hit the fast path. + li TESTNUM, 17 + sw x0, (a3) + + # Fast path + li TESTNUM, 18 + sw x0, (a2) + beqz a2, fail + + 2: TEST_PASSFAIL @@ -125,5 +170,6 @@ RVTEST_DATA_BEGIN data1: .word 0 data2: .word 0 +data3: .word 0 RVTEST_DATA_END From e9de81960f81ea8ad9143f06b5f82efc7abd1b19 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 27 May 2022 12:57:03 -0700 Subject: [PATCH 2/2] Remove ineffective tests. --- isa/rv64mi/breakpoint.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/isa/rv64mi/breakpoint.S b/isa/rv64mi/breakpoint.S index 4cf51a487..c00ecaec3 100644 --- a/isa/rv64mi/breakpoint.S +++ b/isa/rv64mi/breakpoint.S @@ -130,7 +130,6 @@ RVTEST_CODE_BEGIN # Slow path because CSR was *just* written. (This is spike-specific.) sw x0, (a2) - beqz a2, fail # Normal aligned store, so that the next time we'll hit the fast path. li TESTNUM, 17 @@ -139,7 +138,6 @@ RVTEST_CODE_BEGIN # Fast path li TESTNUM, 18 sw x0, (a2) - beqz a2, fail 2: