[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 02/61] target/riscv: implementation-defined constant parameter
From: |
LIU Zhiwei |
Subject: |
[PATCH v7 02/61] target/riscv: implementation-defined constant parameters |
Date: |
Mon, 30 Mar 2020 23:35:34 +0800 |
vlen is the vector register length in bits.
elen is the max element size in bits.
vext_spec is the vector specification version, default value is v0.7.1.
Signed-off-by: LIU Zhiwei <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
target/riscv/cpu.c | 7 +++++++
target/riscv/cpu.h | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 4e578239d3..077a32526e 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -106,6 +106,11 @@ static void set_priv_version(CPURISCVState *env, int
priv_ver)
env->priv_ver = priv_ver;
}
+static void set_vext_version(CPURISCVState *env, int vext_ver)
+{
+ env->vext_ver = vext_ver;
+}
+
static void set_feature(CPURISCVState *env, int feature)
{
env->features |= (1ULL << feature);
@@ -365,6 +370,7 @@ static void riscv_cpu_realize(DeviceState *dev, Error
**errp)
CPURISCVState *env = &cpu->env;
RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(dev);
int priv_version = PRIV_VERSION_1_11_0;
+ int vext_version = VEXT_VERSION_0_07_1;
target_ulong target_misa = 0;
Error *local_err = NULL;
@@ -390,6 +396,7 @@ static void riscv_cpu_realize(DeviceState *dev, Error
**errp)
}
set_priv_version(env, priv_version);
+ set_vext_version(env, vext_version);
set_resetvec(env, DEFAULT_RSTVEC);
if (cpu->cfg.mmu) {
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 6663ee8b8c..5c75734188 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -84,6 +84,8 @@ enum {
#define PRIV_VERSION_1_10_0 0x00011000
#define PRIV_VERSION_1_11_0 0x00011100
+#define VEXT_VERSION_0_07_1 0x00000701
+
#define TRANSLATE_PMP_FAIL 2
#define TRANSLATE_FAIL 1
#define TRANSLATE_SUCCESS 0
@@ -119,6 +121,7 @@ struct CPURISCVState {
target_ulong guest_phys_fault_addr;
target_ulong priv_ver;
+ target_ulong vext_ver;
target_ulong misa;
target_ulong misa_mask;
@@ -281,6 +284,8 @@ typedef struct RISCVCPU {
char *priv_spec;
char *user_spec;
+ uint16_t vlen;
+ uint16_t elen;
bool mmu;
bool pmp;
} cfg;
--
2.23.0
- [PATCH v7 00/61] target/riscv: support vector extension v0.7.1, LIU Zhiwei, 2020/03/30
- [PATCH v7 01/61] target/riscv: add vector extension field in CPURISCVState, LIU Zhiwei, 2020/03/30
- [PATCH v7 02/61] target/riscv: implementation-defined constant parameters,
LIU Zhiwei <=
- [PATCH v7 03/61] target/riscv: support vector extension csr, LIU Zhiwei, 2020/03/30
- [PATCH v7 04/61] target/riscv: add vector configure instruction, LIU Zhiwei, 2020/03/30
- [PATCH v7 05/61] target/riscv: add an internals.h header, LIU Zhiwei, 2020/03/30
- [PATCH v7 06/61] target/riscv: add vector stride load and store instructions, LIU Zhiwei, 2020/03/30
- [PATCH v7 07/61] target/riscv: add vector index load and store instructions, LIU Zhiwei, 2020/03/30
- [PATCH v7 08/61] target/riscv: add fault-only-first unit stride load, LIU Zhiwei, 2020/03/30
- [PATCH v7 09/61] target/riscv: add vector amo operations, LIU Zhiwei, 2020/03/30
- [PATCH v7 10/61] target/riscv: vector single-width integer add and subtract, LIU Zhiwei, 2020/03/30
- [PATCH v7 11/61] target/riscv: vector widening integer add and subtract, LIU Zhiwei, 2020/03/30
- [PATCH v7 12/61] target/riscv: vector integer add-with-carry / subtract-with-borrow instructions, LIU Zhiwei, 2020/03/30