[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 40/89] target/riscv: remove cpu->cfg.ext_f
|
From: |
Alistair Francis |
|
Subject: |
[PULL 40/89] target/riscv: remove cpu->cfg.ext_f |
|
Date: |
Fri, 5 May 2023 11:01:52 +1000 |
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Create a new "f" RISCVCPUMisaExtConfig property that will update
env->misa_ext* with RVF. Instances of cpu->cfg.ext_f and similar are
replaced with riscv_has_ext(env, RVF).
Remove the old "f" property and 'ext_f' from RISCVCPUConfig.
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230406180351.570807-9-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
target/riscv/cpu.h | 1 -
target/riscv/cpu.c | 26 +++++++++++++-------------
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index fba5e9a33c..e5680b0709 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -426,7 +426,6 @@ struct RISCVCPUConfig {
bool ext_e;
bool ext_g;
bool ext_m;
- bool ext_f;
bool ext_s;
bool ext_u;
bool ext_h;
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 5bb03e2ee5..715cbca1b3 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -819,12 +819,12 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU
*cpu, Error **errp)
/* Do some ISA extension error checking */
if (cpu->cfg.ext_g && !(cpu->cfg.ext_i && cpu->cfg.ext_m &&
riscv_has_ext(env, RVA) &&
- cpu->cfg.ext_f && riscv_has_ext(env, RVD) &&
+ riscv_has_ext(env, RVF) &&
+ riscv_has_ext(env, RVD) &&
cpu->cfg.ext_icsr && cpu->cfg.ext_ifencei)) {
warn_report("Setting G will also set IMAFD_Zicsr_Zifencei");
cpu->cfg.ext_i = true;
cpu->cfg.ext_m = true;
- cpu->cfg.ext_f = true;
cpu->cfg.ext_icsr = true;
cpu->cfg.ext_ifencei = true;
@@ -861,7 +861,7 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU
*cpu, Error **errp)
return;
}
- if (cpu->cfg.ext_f && !cpu->cfg.ext_icsr) {
+ if (riscv_has_ext(env, RVF) && !cpu->cfg.ext_icsr) {
error_setg(errp, "F extension requires Zicsr");
return;
}
@@ -875,12 +875,12 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU
*cpu, Error **errp)
cpu->cfg.ext_zfhmin = true;
}
- if (cpu->cfg.ext_zfhmin && !cpu->cfg.ext_f) {
+ if (cpu->cfg.ext_zfhmin && !riscv_has_ext(env, RVF)) {
error_setg(errp, "Zfh/Zfhmin extensions require F extension");
return;
}
- if (riscv_has_ext(env, RVD) && !cpu->cfg.ext_f) {
+ if (riscv_has_ext(env, RVD) && !riscv_has_ext(env, RVF)) {
error_setg(errp, "D extension requires F extension");
return;
}
@@ -905,7 +905,7 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU
*cpu, Error **errp)
return;
}
- if (cpu->cfg.ext_zve32f && !cpu->cfg.ext_f) {
+ if (cpu->cfg.ext_zve32f && !riscv_has_ext(env, RVF)) {
error_setg(errp, "Zve32f/Zve64f extensions require F extension");
return;
}
@@ -938,7 +938,7 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU
*cpu, Error **errp)
error_setg(errp, "Zfinx extension requires Zicsr");
return;
}
- if (cpu->cfg.ext_f) {
+ if (riscv_has_ext(env, RVF)) {
error_setg(errp,
"Zfinx cannot be supported together with F extension");
return;
@@ -950,14 +950,14 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU
*cpu, Error **errp)
cpu->cfg.ext_zcb = true;
cpu->cfg.ext_zcmp = true;
cpu->cfg.ext_zcmt = true;
- if (cpu->cfg.ext_f && env->misa_mxl_max == MXL_RV32) {
+ if (riscv_has_ext(env, RVF) && env->misa_mxl_max == MXL_RV32) {
cpu->cfg.ext_zcf = true;
}
}
if (riscv_has_ext(env, RVC)) {
cpu->cfg.ext_zca = true;
- if (cpu->cfg.ext_f && env->misa_mxl_max == MXL_RV32) {
+ if (riscv_has_ext(env, RVF) && env->misa_mxl_max == MXL_RV32) {
cpu->cfg.ext_zcf = true;
}
if (riscv_has_ext(env, RVD)) {
@@ -970,7 +970,7 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU
*cpu, Error **errp)
return;
}
- if (!cpu->cfg.ext_f && cpu->cfg.ext_zcf) {
+ if (!riscv_has_ext(env, RVF) && cpu->cfg.ext_zcf) {
error_setg(errp, "Zcf extension requires F extension");
return;
}
@@ -1160,7 +1160,7 @@ static void riscv_cpu_sync_misa_cfg(CPURISCVState *env)
if (riscv_has_ext(env, RVA)) {
ext |= RVA;
}
- if (riscv_cpu_cfg(env)->ext_f) {
+ if (riscv_has_ext(env, RVF)) {
ext |= RVF;
}
if (riscv_has_ext(env, RVD)) {
@@ -1500,6 +1500,8 @@ static const RISCVCPUMisaExtConfig misa_ext_cfgs[] = {
.misa_bit = RVC, .enabled = true},
{.name = "d", .description = "Double-precision float point",
.misa_bit = RVD, .enabled = true},
+ {.name = "f", .description = "Single-precision float point",
+ .misa_bit = RVF, .enabled = true},
};
static void riscv_cpu_add_misa_properties(Object *cpu_obj)
@@ -1526,7 +1528,6 @@ static Property riscv_cpu_extensions[] = {
DEFINE_PROP_BOOL("e", RISCVCPU, cfg.ext_e, false),
DEFINE_PROP_BOOL("g", RISCVCPU, cfg.ext_g, false),
DEFINE_PROP_BOOL("m", RISCVCPU, cfg.ext_m, true),
- DEFINE_PROP_BOOL("f", RISCVCPU, cfg.ext_f, true),
DEFINE_PROP_BOOL("s", RISCVCPU, cfg.ext_s, true),
DEFINE_PROP_BOOL("u", RISCVCPU, cfg.ext_u, true),
DEFINE_PROP_BOOL("v", RISCVCPU, cfg.ext_v, false),
@@ -1646,7 +1647,6 @@ static void register_cpu_props(Object *obj)
cpu->cfg.ext_i = misa_ext & RVI;
cpu->cfg.ext_e = misa_ext & RVE;
cpu->cfg.ext_m = misa_ext & RVM;
- cpu->cfg.ext_f = misa_ext & RVF;
cpu->cfg.ext_v = misa_ext & RVV;
cpu->cfg.ext_s = misa_ext & RVS;
cpu->cfg.ext_u = misa_ext & RVU;
--
2.40.0
- [PULL 29/89] target/riscv: Fix format for indentation, (continued)
- [PULL 29/89] target/riscv: Fix format for indentation, Alistair Francis, 2023/05/04
- [PULL 31/89] target/riscv: Fix lines with over 80 characters, Alistair Francis, 2023/05/04
- [PULL 30/89] target/riscv: Fix format for comments, Alistair Francis, 2023/05/04
- [PULL 32/89] hw/riscv: Add signature dump function for spike to run ACT tests, Alistair Francis, 2023/05/04
- [PULL 33/89] target/riscv: sync env->misa_ext* with cpu->cfg in realize(), Alistair Francis, 2023/05/04
- [PULL 34/89] target/riscv: remove MISA properties from isa_edata_arr[], Alistair Francis, 2023/05/04
- [PULL 35/89] target/riscv/cpu.c: remove 'multi_letter' from isa_ext_data, Alistair Francis, 2023/05/04
- [PULL 36/89] target/riscv: introduce riscv_cpu_add_misa_properties(), Alistair Francis, 2023/05/04
- [PULL 38/89] target/riscv: remove cpu->cfg.ext_c, Alistair Francis, 2023/05/04
- [PULL 39/89] target/riscv: remove cpu->cfg.ext_d, Alistair Francis, 2023/05/04
- [PULL 40/89] target/riscv: remove cpu->cfg.ext_f,
Alistair Francis <=
- [PULL 37/89] target/riscv: remove cpu->cfg.ext_a, Alistair Francis, 2023/05/04
- [PULL 42/89] target/riscv: remove cpu->cfg.ext_e, Alistair Francis, 2023/05/04
- Re: [PULL 00/89] riscv-to-apply queue, Alistair Francis, 2023/05/04
- [PULL 43/89] target/riscv: remove cpu->cfg.ext_m, Alistair Francis, 2023/05/04
- [PULL 41/89] target/riscv: remove cpu->cfg.ext_i, Alistair Francis, 2023/05/04
- [PULL 45/89] target/riscv: remove cpu->cfg.ext_u, Alistair Francis, 2023/05/04
- [PULL 44/89] target/riscv: remove cpu->cfg.ext_s, Alistair Francis, 2023/05/04
- [PULL 46/89] target/riscv: remove cpu->cfg.ext_h, Alistair Francis, 2023/05/04
- [PULL 48/89] target/riscv: remove cpu->cfg.ext_v, Alistair Francis, 2023/05/04