357fd3d4990e7727d225c5f8107041f268f2cf7f
[riscv-tests.git] / env / pm / riscv_test.h
1 #ifndef _ENV_PHYSICAL_MULTI_CORE_H
2 #define _ENV_PHYSICAL_MULTI_CORE_H
3
4 //-----------------------------------------------------------------------
5 // Begin Macro
6 //-----------------------------------------------------------------------
7
8 #define RVTEST_RV64U \
9
10 #define RVTEST_RV64S \
11
12 #define RVTEST_FP_ENABLE \
13 setpcr cr0, 2; \
14 mfpcr a0, cr0; \
15 and a0, a0, 2; \
16 beqz a0, 1f; \
17 mtfsr x0; \
18 1:
19
20 #define RVTEST_VEC_ENABLE \
21 mfpcr a0, cr0; \
22 ori a0, a0, 4; \
23 mtpcr a0, cr0; \
24 li a0, 0xff; \
25 mtpcr a0, cr18; \
26
27 #define RVTEST_CODE_BEGIN \
28 .text; \
29 .align 4; \
30 .global _start; \
31 _start: \
32 RVTEST_FP_ENABLE \
33 RVTEST_VEC_ENABLE \
34
35 //-----------------------------------------------------------------------
36 // End Macro
37 //-----------------------------------------------------------------------
38
39 #define RVTEST_CODE_END \
40
41 //-----------------------------------------------------------------------
42 // Pass/Fail Macro
43 //-----------------------------------------------------------------------
44
45 #define RVTEST_FAIL \
46 fence; \
47 beqz x28, 1f; \
48 sll x28, x28, 1; \
49 or x28, x28, 1; \
50 mtpcr x28, cr30; \
51 1: b 1b; \
52
53 #define RVTEST_PASS \
54 fence; \
55 li x1, 1; \
56 mtpcr x1, cr30; \
57 1: b 1b; \
58
59 //-----------------------------------------------------------------------
60 // Data Section Macro
61 //-----------------------------------------------------------------------
62
63 #define RVTEST_DATA_BEGIN
64 #define RVTEST_DATA_END
65
66 //#define RVTEST_DATA_BEGIN .align 4; .global begin_signature; begin_signature:
67 //#define RVTEST_DATA_END .align 4; .global end_signature; end_signature:
68
69 #endif