target/riscv: add 'vlenb' field in cpu->cfg
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Mon, 22 Jan 2024 16:10:55 +0000 (13:10 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 9 Feb 2024 10:41:59 +0000 (20:41 +1000)
commit04eb30a03cfc4195161996746d18a715457e0b42
tree34ebdc990ed69de1af9ebe6e2a8bca629735076f
parent0c4e579aac30abd26818ebaec8e1b633eb9f3952
target/riscv: add 'vlenb' field in cpu->cfg

Our usage of 'vlenb' is overwhelming superior than the use of 'vlen'.
We're using 'vlenb' most of the time, having to do 'vlen >> 3' or
'vlen / 8' in every instance.

In hindsight we would be better if the 'vlenb' property  was introduced
instead of 'vlen'. That's not what happened, and now we can't easily get
rid of it due to user scripts all around. What we can do, however, is to
change our internal representation to use 'vlenb'.

Add a 'vlenb' field in cpu->cfg. It'll be set via the existing 'vlen'
property, i.e. setting 'vlen' will also set 'vlenb'.

We'll replace all 'vlen >> 3' code to use 'vlenb' directly. Start with
the single instance we have in target/riscv/cpu.c.

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-2-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/cpu.c
target/riscv/cpu_cfg.h