target/riscv: FP extension requirements
QEMU allowed inconsistent configurations that made floating point arithmetic effectively unusable. This commit adds certain checks for consistent FP arithmetic: - F requires Zicsr - Zfinx requires Zicsr - Zfh/Zfhmin require F - D requires F - V requires D Because F/D/Zicsr are enabled by default (and an error will not occur unless we manually disable one or more of prerequisites), this commit just enforces the user to give consistent combinations. Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <00e7b1c6060dab32ac7d49813b1ca84d3eb63298.1652583332.git.research_trasio@irq.a4lg.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
9f6b7da5d2
commit
1086504c6f
@ -610,11 +610,36 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
|
||||
cpu->cfg.ext_ifencei = true;
|
||||
}
|
||||
|
||||
if (cpu->cfg.ext_f && !cpu->cfg.ext_icsr) {
|
||||
error_setg(errp, "F extension requires Zicsr");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((cpu->cfg.ext_zfh || cpu->cfg.ext_zfhmin) && !cpu->cfg.ext_f) {
|
||||
error_setg(errp, "Zfh/Zfhmin extensions require F extension");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpu->cfg.ext_d && !cpu->cfg.ext_f) {
|
||||
error_setg(errp, "D extension requires F extension");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpu->cfg.ext_v && !cpu->cfg.ext_d) {
|
||||
error_setg(errp, "V extension requires D extension");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinx ||
|
||||
cpu->cfg.ext_zhinxmin) {
|
||||
cpu->cfg.ext_zfinx = true;
|
||||
}
|
||||
|
||||
if (cpu->cfg.ext_zfinx && !cpu->cfg.ext_icsr) {
|
||||
error_setg(errp, "Zfinx extension requires Zicsr");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpu->cfg.ext_zk) {
|
||||
cpu->cfg.ext_zkn = true;
|
||||
cpu->cfg.ext_zkr = true;
|
||||
|
Loading…
Reference in New Issue
Block a user