Revision | 31961cfe505e11cc4ec4cfde52c851957e1bf605 (tree) |
---|---|
Time | 2022-01-21 14:52:57 |
Author | LIU Zhiwei <zhiwei_liu@c-sk...> |
Commiter | Alistair Francis |
target/riscv: Adjust vsetvl according to XLEN
Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220120122050.41546-17-zhiwei_liu@c-sky.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
@@ -491,6 +491,11 @@ static inline RISCVMXL cpu_recompute_xl(CPURISCVState *env) | ||
491 | 491 | } |
492 | 492 | #endif |
493 | 493 | |
494 | +static inline int riscv_cpu_xlen(CPURISCVState *env) | |
495 | +{ | |
496 | + return 16 << env->xl; | |
497 | +} | |
498 | + | |
494 | 499 | /* |
495 | 500 | * Encode LMUL to lmul as follows: |
496 | 501 | * LMUL vlmul lmul |
@@ -36,8 +36,11 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1, | ||
36 | 36 | uint64_t lmul = FIELD_EX64(s2, VTYPE, VLMUL); |
37 | 37 | uint16_t sew = 8 << FIELD_EX64(s2, VTYPE, VSEW); |
38 | 38 | uint8_t ediv = FIELD_EX64(s2, VTYPE, VEDIV); |
39 | - bool vill = FIELD_EX64(s2, VTYPE, VILL); | |
40 | - target_ulong reserved = FIELD_EX64(s2, VTYPE, RESERVED); | |
39 | + int xlen = riscv_cpu_xlen(env); | |
40 | + bool vill = (s2 >> (xlen - 1)) & 0x1; | |
41 | + target_ulong reserved = s2 & | |
42 | + MAKE_64BIT_MASK(R_VTYPE_RESERVED_SHIFT, | |
43 | + xlen - 1 - R_VTYPE_RESERVED_SHIFT); | |
41 | 44 | |
42 | 45 | if (lmul & 4) { |
43 | 46 | /* Fractional LMUL. */ |