arch-riscv: Fix immediate decoding for integer shift immediate instructions
authorIan Jiang <ianjiang.ict@gmail.com>
Mon, 25 Nov 2019 03:30:41 +0000 (11:30 +0800)
committerIan Jiang <ianjiang.ict@gmail.com>
Tue, 26 Nov 2019 03:38:22 +0000 (03:38 +0000)
commitca5e9c22708f6142c70d0c141a8d489bb345100a
treedd291e841f667560543a4622592dcc6cdedc01a7
parent390f7b917757887674ab441979f36bffeedb646a
arch-riscv: Fix immediate decoding for integer shift immediate instructions

The "shamt" in integer shift immediate instructions is an unsigned
immediate encoded in bits[25:20]. While the original Gem5 uses bits[31:20]
as an int64_t. This patch fixes the problem by:
- Adding a new parameter "imm_code" for format IOp and use the correct
bitfields SHAMT5 or SHAMT6 to assign "imm_code" for each instruction.
- Use uint64_t instead of default int64_t to assign parameter "imm_type"
of format IOp.

The instructions affected include:
- Shift Left Logical Immediate, slli
- Shift Right Logical Immediate, srli
- Shift Right Arithmetic Immediate, srai
- Shift Left Logical Word Immediate, slliw
- Shift Right Logical Word Immediate, srliw
- Shift Right Arithmetic Word Immediate, sraiw

Change-Id: Iad34ccd036c11630409f84f6de2b939224e100e6
Signed-off-by: Ian Jiang <ianjiang.ict@gmail.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22563
Reviewed-by: Alec Roelke <alec.roelke@gmail.com>
Maintainer: Alec Roelke <alec.roelke@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/riscv/isa/decoder.isa
src/arch/riscv/isa/formats/standard.isa