aboutsummaryrefslogtreecommitdiff
path: root/target/riscv/insn16.decode
diff options
context:
space:
mode:
authorWeiwei Li <liweiwei@iscas.ac.cn>2023-03-07 16:13:58 +0800
committerAlistair Francis <alistair.francis@wdc.com>2023-05-05 10:49:50 +1000
commite0a3054f18e20602768d328b0cb7d5910253a327 (patch)
treee7970e260b57f9f0e3141a9c81e3768dd88b3c82 /target/riscv/insn16.decode
parentc4935b58422d4692bae6f37069a5cbb748656b29 (diff)
target/riscv: add support for Zcb extension
Add encode and trans* functions support for Zcb instructions. Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn> Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20230307081403.61950-6-liweiwei@iscas.ac.cn> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv/insn16.decode')
-rw-r--r--target/riscv/insn16.decode23
1 files changed, 23 insertions, 0 deletions
diff --git a/target/riscv/insn16.decode b/target/riscv/insn16.decode
index b62664b6af..ab780fa46a 100644
--- a/target/riscv/insn16.decode
+++ b/target/riscv/insn16.decode
@@ -43,6 +43,8 @@
%imm_addi16sp 12:s1 3:2 5:1 2:1 6:1 !function=ex_shift_4
%imm_lui 12:s1 2:5 !function=ex_shift_12
+%uimm_cl_b 5:1 6:1
+%uimm_cl_h 5:1 !function=ex_shift_1
# Argument sets imported from insn32.decode:
&empty !extern
@@ -53,6 +55,7 @@
&b imm rs2 rs1 !extern
&u imm rd !extern
&shift shamt rs1 rd !extern
+&r2 rd rs1 !extern
# Formats 16:
@@ -89,6 +92,12 @@
@c_andi ... . .. ... ..... .. &i imm=%imm_ci rs1=%rs1_3 rd=%rs1_3
+@cu ... ... ... .. ... .. &r2 rs1=%rs1_3 rd=%rs1_3
+@cl_b ... . .. ... .. ... .. &i imm=%uimm_cl_b rs1=%rs1_3 rd=%rs2_3
+@cl_h ... . .. ... .. ... .. &i imm=%uimm_cl_h rs1=%rs1_3 rd=%rs2_3
+@cs_b ... . .. ... .. ... .. &s imm=%uimm_cl_b rs1=%rs1_3 rs2=%rs2_3
+@cs_h ... . .. ... .. ... .. &s imm=%uimm_cl_h rs1=%rs1_3 rs2=%rs2_3
+
# *** RV32/64C Standard Extension (Quadrant 0) ***
{
# Opcode of all zeros is illegal; rd != 0, nzuimm == 0 is reserved.
@@ -180,3 +189,17 @@ sw 110 . ..... ..... 10 @c_swsp
sd 111 . ..... ..... 10 @c_sdsp
c_fsw 111 . ..... ..... 10 @c_swsp
}
+
+# *** RV64 and RV32 Zcb Extension ***
+c_zext_b 100 111 ... 11 000 01 @cu
+c_sext_b 100 111 ... 11 001 01 @cu
+c_zext_h 100 111 ... 11 010 01 @cu
+c_sext_h 100 111 ... 11 011 01 @cu
+c_zext_w 100 111 ... 11 100 01 @cu
+c_not 100 111 ... 11 101 01 @cu
+c_mul 100 111 ... 10 ... 01 @cs_2
+c_lbu 100 000 ... .. ... 00 @cl_b
+c_lhu 100 001 ... 0. ... 00 @cl_h
+c_lh 100 001 ... 1. ... 00 @cl_h
+c_sb 100 010 ... .. ... 00 @cs_b
+c_sh 100 011 ... 0. ... 00 @cs_h