File tree Expand file tree Collapse file tree 5 files changed +41
-18
lines changed Expand file tree Collapse file tree 5 files changed +41
-18
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,10 @@ endif
127
127
ENABLE_EXT_C ?= 1
128
128
$(call set-feature, EXT_C)
129
129
130
+ # RV32E Base Integer Instruction Set
131
+ ENABLE_RV32E ?= 0
132
+ $(call set-feature, RV32E)
133
+
130
134
# Control and Status Register (CSR)
131
135
ENABLE_Zicsr ?= 1
132
136
$(call set-feature, Zicsr)
Original file line number Diff line number Diff line change 27
27
#define RV32_FEATURE_EXT_C 1
28
28
#endif
29
29
30
+ /* RV32E Base Integer Instruction Set */
31
+ #ifndef RV32_FEATURE_RV32E
32
+ #define RV32_FEATURE_RV32E 0
33
+ #endif
34
+
30
35
/* Control and Status Register (CSR) */
31
36
#ifndef RV32_FEATURE_Zicsr
32
37
#define RV32_FEATURE_Zicsr 1
Original file line number Diff line number Diff line change @@ -769,10 +769,15 @@ void rv_reset(riscv_t *rv, riscv_word_t pc)
769
769
rv -> csr_mtvec = 0 ;
770
770
rv -> csr_cycle = 0 ;
771
771
rv -> csr_mstatus = 0 ;
772
- rv -> csr_misa |= MISA_SUPER | MISA_USER | MISA_I ;
772
+ rv -> csr_misa |= MISA_SUPER | MISA_USER ;
773
773
rv -> csr_mvendorid = RV_MVENDORID ;
774
774
rv -> csr_marchid = RV_MARCHID ;
775
775
rv -> csr_mimpid = RV_MIMPID ;
776
+ #if !RV32_HAS (RV32E )
777
+ rv -> csr_misa |= MISA_I ;
778
+ #else
779
+ rv -> csr_misa |= MISA_E ;
780
+ #endif
776
781
#if RV32_HAS (EXT_A )
777
782
rv -> csr_misa |= MISA_A ;
778
783
#endif
Original file line number Diff line number Diff line change 33
33
extern "C" {
34
34
#endif
35
35
36
+ /* clang-format off */
36
37
#define RV_REGS_LIST \
37
38
_(zero) /* hard-wired zero, ignoring any writes */ \
38
39
_ (ra ) /* return address */ \
@@ -50,22 +51,25 @@ extern "C" {
50
51
_ (a3 ) \
51
52
_ (a4 ) \
52
53
_ (a5 ) \
53
- _ (a6 ) \
54
- _ (a7 ) \
55
- _ (s2 ) /* saved register */ \
56
- _ (s3 ) \
57
- _ (s4 ) \
58
- _ (s5 ) \
59
- _ (s6 ) \
60
- _ (s7 ) \
61
- _ (s8 ) \
62
- _ (s9 ) \
63
- _ (s10 ) \
64
- _ (s11 ) \
65
- _ (t3 ) /* temporary register */ \
66
- _ (t4 ) \
67
- _ (t5 ) \
68
- _ (t6 )
54
+ IIF (RV32_HAS (RV32E ))(, \
55
+ _ (a6 ) \
56
+ _ (a7 ) \
57
+ _ (s2 ) /* saved register */ \
58
+ _ (s3 ) \
59
+ _ (s4 ) \
60
+ _ (s5 ) \
61
+ _ (s6 ) \
62
+ _ (s7 ) \
63
+ _ (s8 ) \
64
+ _ (s9 ) \
65
+ _ (s10 ) \
66
+ _ (s11 ) \
67
+ _ (t3 ) /* temporary register */ \
68
+ _ (t4 ) \
69
+ _ (t5 ) \
70
+ _ (t6 ) \
71
+ )
72
+ /* clang-format on */
69
73
70
74
/* RISC-V registers (mnemonics, ABI names)
71
75
*
@@ -117,6 +121,7 @@ enum SV32_PTE_PERM {
117
121
#define MISA_SUPER (1 << ('S' - 'A'))
118
122
#define MISA_USER (1 << ('U' - 'A'))
119
123
#define MISA_I (1 << ('I' - 'A'))
124
+ #define MISA_E (1 << ('E' - 'A'))
120
125
#define MISA_M (1 << ('M' - 'A'))
121
126
#define MISA_A (1 << ('A' - 'A'))
122
127
#define MISA_F (1 << ('F' - 'A'))
Original file line number Diff line number Diff line change @@ -466,8 +466,12 @@ static void syscall_sbi_rst(riscv_t *rv)
466
466
467
467
void syscall_handler (riscv_t * rv )
468
468
{
469
- /* get the syscall number */
469
+ /* get the syscall number */
470
+ #if !RV32_HAS (RV32E )
470
471
riscv_word_t syscall = rv_get_reg (rv , rv_reg_a7 );
472
+ #else
473
+ riscv_word_t syscall = rv_get_reg (rv , rv_reg_t0 );
474
+ #endif
471
475
472
476
switch (syscall ) { /* dispatch system call */
473
477
#define _ (name , number ) \
You can’t perform that action at this time.
0 commit comments