1 # See LICENSE for license details.
3 #*****************************************************************************
5 #-----------------------------------------------------------------------------
7 # Test misaligned fetch trap.
10 #include "riscv_test.h"
11 #include "test_macros.h"
17 #define sscratch mscratch
18 #define sstatus mstatus
20 #define sbadaddr mbadaddr
23 #define stvec_handler mtvec_handler
28 # Without RVC, the jalr should trap, and the handler will skip ahead.
29 # With RVC, the jalr should not trap, and "j fail" should get skipped.
43 // This test should pass, since JALR ignores the target LSB
65 # Like test 2, but with jal instead of jalr.
80 # Like test 2, but with a taken branch instead of jalr.
95 # Not-taken branches should not trap, even without RVC.
114 # tests 2, 4, 5, and 6 should trap
126 # verify that return address was not written
130 li a1, CAUSE_MISALIGNED_FETCH
134 # verify that epc == &jalr (== t0 - 4)
139 # verify that badaddr == 0 or badaddr == t0+2.