Skip to content

Commit

Permalink
target/riscv/csr.c: use 'vlenb' instead of 'vlen'
Browse files Browse the repository at this point in the history
As a bonus, we're being more idiomatic using cpu->cfg.vlenb when
reading CSR_VLENB.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20240122161107.26737-3-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
danielhb authored and alistair23 committed Feb 9, 2024
1 parent 04eb30a commit 39b5efa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions target/riscv/csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ static RISCVException read_vl(CPURISCVState *env, int csrno,

static int read_vlenb(CPURISCVState *env, int csrno, target_ulong *val)
{
*val = riscv_cpu_cfg(env)->vlen >> 3;
*val = riscv_cpu_cfg(env)->vlenb;
return RISCV_EXCP_NONE;
}

Expand Down Expand Up @@ -738,7 +738,7 @@ static RISCVException write_vstart(CPURISCVState *env, int csrno,
* The vstart CSR is defined to have only enough writable bits
* to hold the largest element index, i.e. lg2(VLEN) bits.
*/
env->vstart = val & ~(~0ULL << ctzl(riscv_cpu_cfg(env)->vlen));
env->vstart = val & ~(~0ULL << ctzl(riscv_cpu_cfg(env)->vlenb << 3));
return RISCV_EXCP_NONE;
}

Expand Down

0 comments on commit 39b5efa

Please sign in to comment.