diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-06-06 14:01:37 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-06-06 14:14:32 +0200 |
commit | 77ba5a18973bd02b461ab96047acfcc3fb62cf7b (patch) | |
tree | 573afedb6a3a14c91224e16724fa21ba3a939de2 /tests/jal.S | |
download | picorv32-77ba5a18973bd02b461ab96047acfcc3fb62cf7b.tar.gz picorv32-77ba5a18973bd02b461ab96047acfcc3fb62cf7b.zip |
Initial import
Diffstat (limited to 'tests/jal.S')
-rw-r--r-- | tests/jal.S | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/jal.S b/tests/jal.S new file mode 100644 index 0000000..742abac --- /dev/null +++ b/tests/jal.S @@ -0,0 +1,60 @@ +# See LICENSE for license details. + +#***************************************************************************** +# jal.S +#----------------------------------------------------------------------------- +# +# Test jal instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Test 2: Basic test + #------------------------------------------------------------- + +test_2: + li TESTNUM, 2 + li ra, 0 + +linkaddr_2: + jal target_2 + nop + nop + + j fail + +target_2: + la x2, linkaddr_2 + addi x2, x2, 4 + bne x2, ra, fail + + #------------------------------------------------------------- + # Test delay slot instructions not executed nor bypassed + #------------------------------------------------------------- + + TEST_CASE( 3, x2, 3, \ + li x2, 1; \ + jal 1f; \ + addi x2, x2, 1; \ + addi x2, x2, 1; \ + addi x2, x2, 1; \ + addi x2, x2, 1; \ +1: addi x2, x2, 1; \ + addi x2, x2, 1; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END |