1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# See LICENSE for license details.
#*****************************************************************************
# zicntr.S
#-----------------------------------------------------------------------------
#
# Test if Zicntr is implemented correctly
#
#include "riscv_test.h"
#include "test_macros.h"
RVTEST_RV64M
RVTEST_CODE_BEGIN
# Make sure reading the cycle counter in four ways doesn't trap.
TEST_CASE( 2, x0, 0, csrrc x0, cycle, x0);
TEST_CASE( 3, x0, 0, csrrs x0, cycle, x0);
TEST_CASE( 4, x0, 0, csrrci x0, cycle, 0);
TEST_CASE( 5, x0, 0, csrrsi x0, cycle, 0);
TEST_CASE( 6, x0, 0, csrrc x0, instret, x0);
TEST_CASE( 7, x0, 0, csrrs x0, instret, x0);
TEST_CASE( 8, x0, 0, csrrci x0, instret, 0);
TEST_CASE( 9, x0, 0, csrrsi x0, instret, 0);
#if __riscv_xlen == 32
TEST_CASE(12, x0, 0, csrrc x0, cycleh, x0);
TEST_CASE(13, x0, 0, csrrs x0, cycleh, x0);
TEST_CASE(14, x0, 0, csrrci x0, cycleh, 0);
TEST_CASE(15, x0, 0, csrrsi x0, cycleh, 0);
TEST_CASE(16, x0, 0, csrrc x0, instreth, x0);
TEST_CASE(17, x0, 0, csrrs x0, instreth, x0);
TEST_CASE(18, x0, 0, csrrci x0, instreth, 0);
TEST_CASE(19, x0, 0, csrrsi x0, instreth, 0);
#endif
2:
TEST_PASSFAIL
.align 2
.global mtvec_handler
mtvec_handler:
j fail
RVTEST_CODE_END
.data
RVTEST_DATA_BEGIN
TEST_DATA
RVTEST_DATA_END
|