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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#ifndef _ENV_PHYSICAL_SINGLE_CORE_H
#define _ENV_PHYSICAL_SINGLE_CORE_H
#include "../encoding.h"
#include "../hwacha_xcpt.h"
//-----------------------------------------------------------------------
// Begin Macro
//-----------------------------------------------------------------------
#define RVTEST_RV64U \
.macro init; \
.endm
#define RVTEST_RV64UF \
.macro init; \
RVTEST_FP_ENABLE; \
.endm
#define RVTEST_RV64UV \
.macro init; \
RVTEST_FP_ENABLE; \
RVTEST_VEC_ENABLE; \
.endm
#define RVTEST_RV32U \
.macro init; \
RVTEST_32_ENABLE; \
.endm
#define RVTEST_RV32UF \
.macro init; \
RVTEST_32_ENABLE; \
RVTEST_FP_ENABLE; \
.endm
#define RVTEST_RV32UV \
.macro init; \
RVTEST_32_ENABLE; \
RVTEST_FP_ENABLE; \
RVTEST_VEC_ENABLE; \
.endm
#define RVTEST_RV64S \
.macro init; \
.endm
#define RVTEST_32_ENABLE \
li a0, SR_S64; \
csrc status, a0; \
#define RVTEST_FP_ENABLE \
li a0, SR_EF; \
csrs status, a0; \
csrr a1, status; \
and a0, a0, a1; \
bnez a0, 2f; \
RVTEST_PASS; \
2:fssr x0; \
#define RVTEST_VEC_ENABLE \
li a0, SR_EA; \
csrs status, a0; \
csrr a1, status; \
and a0, a0, a1; \
bnez a0, 2f; \
RVTEST_PASS; \
2: \
#define RISCV_MULTICORE_DISABLE \
csrr a0, hartid; \
1: bnez a0, 1b; \
#define EXTRA_INIT
#define RVTEST_CODE_BEGIN \
.text; \
.align 4; \
.global _start; \
_start: \
RISCV_MULTICORE_DISABLE; \
init; \
EXTRA_INIT; \
//-----------------------------------------------------------------------
// End Macro
//-----------------------------------------------------------------------
#define RVTEST_CODE_END \
//-----------------------------------------------------------------------
// Pass/Fail Macro
//-----------------------------------------------------------------------
#define RVTEST_PASS \
fence; \
csrw tohost, 1; \
1: b 1b; \
#define RVTEST_FAIL \
fence; \
beqz x28, 1f; \
sll x28, x28, 1; \
or x28, x28, 1; \
csrw tohost, x28; \
1: b 1b; \
//-----------------------------------------------------------------------
// Data Section Macro
//-----------------------------------------------------------------------
//#define RVTEST_DATA_BEGIN EXTRA_DATA
//#define RVTEST_DATA_END
#define EXTRA_DATA
#define RVTEST_DATA_BEGIN EXTRA_DATA .align 4; .global begin_signature; begin_signature:
#define RVTEST_DATA_END .align 4; .global end_signature; end_signature:
#endif
|