Skip to content

Commit 83b404f

Browse files
committed
Add support for VLEN configuration in Makefile
Modify Makefile to support `VLEN` configuration, via `make ENABLE_EXT_V=1 VLEN=<value>`. The default value for `VLEN` is set to 128. The current implementation only support `VLEN=128`
1 parent 1b86b84 commit 83b404f

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ $(call set-feature, EXT_C)
130130
# Vector extension instructions
131131
ENABLE_EXT_V ?= 1
132132
$(call set-feature, EXT_V)
133+
VLEN ?= 128 # Default VLEN is 128
134+
ifeq ($(call has, EXT_V), 1)
135+
CFLAGS += -DVLEN=$(VLEN)
136+
endif
133137

134138
# Control and Status Register (CSR)
135139
ENABLE_Zicsr ?= 1

src/riscv.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@ typedef uint32_t riscv_exception_t;
290290
typedef softfloat_float32_t riscv_float_t;
291291
#endif
292292
#if RV32_HAS(EXT_V)
293-
/* Fixme:Temporary set vl as 128 */
294-
typedef uint32_t vlen128[4];
293+
#ifndef VLEN
294+
#define VLEN 128
295+
#endif
296+
typedef uint32_t vreg_t[VLEN / 32];
295297
#endif
296298

297299
/* memory read handlers */

src/riscv_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ struct riscv_internal {
219219
#endif
220220

221221
#if RV32_HAS(EXT_V)
222-
vlen128 V[N_RV_REGS];
222+
vreg_t V[N_RV_REGS];
223223

224224
uint32_t csr_vstart; /* +Vector start position */
225225
uint32_t csr_vxsat; /* +Fixed-Point Saturate Flag */

0 commit comments

Comments
 (0)