target/riscv: fix instructions count handling in icount mode
authorClément Léger <cleger@rivosinc.com>
Tue, 18 Jun 2024 11:26:45 +0000 (13:26 +0200)
committerAlistair Francis <alistair.francis@wdc.com>
Wed, 26 Jun 2024 13:04:11 +0000 (23:04 +1000)
commitc165408779ae3a5aceddc8603471b1c20e58fcae
treeeb5791e0e9506418ae68292ff386b240fbf96494
parent209b7c293585d0859396071ef00405c02aab5472
target/riscv: fix instructions count handling in icount mode

When icount is enabled, rather than returning the virtual CPU time, we
should return the instruction count itself. Add an instructions bool
parameter to get_ticks() to correctly return icount_get_raw() when
icount_enabled() == 1 and instruction count is queried. This will modify
the existing behavior which was returning an instructions count close to
the number of cycles (CPI ~= 1).

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Message-ID: <20240618112649.76683-1-cleger@rivosinc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/csr.c