File tree Expand file tree Collapse file tree 5 files changed +41
-2
lines changed Expand file tree Collapse file tree 5 files changed +41
-2
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_EXT_E ?= 0
132
+ $(call set-feature, EXT_E)
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_EXT_E
32
+ #define RV32_FEATURE_EXT_E 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 (EXT_E )
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
+ #if !RV32_HAS (EXT_E )
36
37
#define RV_REGS_LIST \
37
38
_(zero) /* hard-wired zero, ignoring any writes */ \
38
39
_ (ra ) /* return address */ \
@@ -66,6 +67,25 @@ extern "C" {
66
67
_ (t4 ) \
67
68
_ (t5 ) \
68
69
_ (t6 )
70
+ #else
71
+ #define RV_REGS_LIST \
72
+ _ (zero ) /* hard-wired zero, ignoring any writes */ \
73
+ _ (ra ) /* return address */ \
74
+ _ (sp ) /* stack pointer */ \
75
+ _ (gp ) /* global pointer */ \
76
+ _ (tp ) /* thread pointer */ \
77
+ _ (t0 ) /* temporary/alternate link register */ \
78
+ _ (t1 ) /* temporaries */ \
79
+ _ (t2 ) \
80
+ _ (s0 ) /* saved register/frame pointer */ \
81
+ _ (s1 ) \
82
+ _ (a0 ) /* function arguments / return values */ \
83
+ _ (a1 ) \
84
+ _ (a2 ) /* function arguments */ \
85
+ _ (a3 ) \
86
+ _ (a4 ) \
87
+ _ (a5 )
88
+ #endif
69
89
70
90
/* RISC-V registers (mnemonics, ABI names)
71
91
*
@@ -96,6 +116,7 @@ enum {
96
116
#define MISA_A (1 << ('A' - 'A'))
97
117
#define MISA_F (1 << ('F' - 'A'))
98
118
#define MISA_C (1 << ('C' - 'A'))
119
+ #define MISA_E (1 << ('E' - 'A'))
99
120
100
121
/* The mstatus register keeps track of and controls the hart’s current operating
101
122
* state */
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 (EXT_E )
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