From: LIU Zhiwei <zhiwei_liu@c-sky.com> To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: peter.maydell@linaro.org, richard.henderson@linaro.org, wxy194768@alibaba-inc.com, chihmin.chao@sifive.com, wenmeng_zhang@c-sky.com, Alistair.Francis@wdc.com, alex.bennee@linaro.org, LIU Zhiwei <zhiwei_liu@c-sky.com> Subject: [PATCH 06/11] riscv: Add RV64C instructions description Date: Sun, 12 Jul 2020 00:16:50 +0800 [thread overview] Message-ID: <20200711161655.2856-7-zhiwei_liu@c-sky.com> (raw) In-Reply-To: <20200711161655.2856-1-zhiwei_liu@c-sky.com> Make it a separate file, so that we can get subarch to recgonize the instrcution length. Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com> --- rv64c.risu | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 rv64c.risu diff --git a/rv64c.risu b/rv64c.risu new file mode 100644 index 0000000..fdd8afb --- /dev/null +++ b/rv64c.risu @@ -0,0 +1,97 @@ +# Input file for risugen defining RISC-V instructions +.mode riscv.rv64c + +@RV64C + +# we borrow X11 to store stack register +C_LWSP RISCV 010 imm5:1 rd:5 imm2:3 imm6:2 10 \ +!constraints { greg($rd) && $rd != 0 && $rd != 11; } \ +!memory { align(4); stack_plus_imm($imm5 * 32 + $imm2 * 4 + $imm6 * 64, $rd); } + +C_LDSP RISCV 011 imm5:1 rd:5 imm3:2 imm6:3 10 \ +!constraints { greg($rd) && $rd != 0 && $rd != 11; } \ +!memory { align(8); stack_plus_imm($imm5 * 32 + $imm3 * 8 + $imm6 * 64, $rd); } + +C_FLDSP RISCV 001 imm5:1 rd:5 imm3:2 imm6:3 10 \ +!memory { align(8); stack_plus_imm($imm5 * 32 + $imm3 * 8 + $imm6 * 64); } + +C_SWSP RISCV 110 imm2:4 imm6:2 rs2:5 10 \ +!constraints { greg($rs2) && $rs2 != 11; } \ +!memory { align(4); stack_plus_imm($imm2 * 4 + $imm6 * 64); } + +C_SDSP RISCV 111 imm3:3 imm6:3 rs2:5 10 \ +!constraints { greg($rs2) && $rs2 != 11; } \ +!memory { align(8); stack_plus_imm($imm3 * 8 + $imm6 * 64); } + +C_FSDSP RISCV 101 imm3:3 imm6:3 rs2:5 10 \ +!memory { align(8); stack_plus_imm($imm3 * 8 + $imm6 * 64); } + +# encode x11 into 0b011 in CL format +C_LW RISCV 010 imm3:3 rs1:3 imm2:1 imm6:1 rd:3 00 \ +!memory { align(4); reg_plus_imm($rs1 + 8, $imm2 * 4 + $imm3 * 8 + $imm6 * 64, $rd + 8); } + +C_LD RISCV 011 imm3:3 rs1:3 imm6:2 rd:3 00 \ +!memory { align(8); reg_plus_imm($rs1 + 8, $imm3 * 8 + $imm6 * 64, $rd + 8); } + +C_FLD RISCV 001 imm3:3 rs1:3 imm6:2 rd:3 00 \ +!memory { align(8); reg_plus_imm($rs1 + 8, $imm3 * 8 + $imm6 * 64); } + +C_SW RISCV 110 imm3:3 rs1:3 imm2:1 imm6:1 rs2:3 00 \ +!constraints { $rs2 != $rs1; } \ +!memory { align(4); reg_plus_imm($rs1 + 8, $imm2 * 4 + $imm3 * 8 + $imm6 * 64); } + +C_SD RISCV 111 imm3:3 rs1:3 imm6:2 rs2:3 00 \ +!constraints { $rs2 != $rs1; } \ +!memory { align(8); reg_plus_imm($rs1 + 8, $imm3 * 8 + $imm6 * 64); } + +C_FSD RISCV 101 imm3:3 rs1:3 imm6:2 rs2:3 00 \ +!memory { align(8); reg_plus_imm($rs1 + 8, $imm3 * 8 + $imm6 * 64); } + +C_LI RISCV 010 imm5:1 rd:5 imm:5 01 \ +!constraints { gbase($rd); } + +C_LUI RISCV 011 imm17:1 rd:5 imm12:5 01 \ +!constraints { gbase($rd) && ($imm17 != 0 || $imm12 != 0); } + +C_ADDI RISCV 000 imm5:1 rd:5 imm:5 01 \ +!constraints { gbase($rd) && ($imm5 != 0 || $imm != 0); } + +C_ADDIW RISCV 001 imm5:1 rd:5 imm:5 01 \ +!constraints { gbase($rd); } + +# Todo C_ADDI16SP, as it need stack as destination +# Move sp to aother register through the memory address function. + +# C_ADDI4SPN RISCV 000 imm4:2 imm6:4 imm2:1 imm3:1 rd:3 00 \ +# !constraints { $imm4 != 0 || $imm6 != 0 || $imm2 != 0 || $imm3 != 0; } + +C_SLLI RISCV 000 shamt5:1 rd:5 shamt:5 10 \ +!constraints { gbase($rd) && ($shamt5 != 0 || $shamt != 0); } + +C_SRLI RISCV 100 shamt5:1 00 rd:3 shamt:5 01 \ +!constraints { ($shamt5 != 0 || $shamt != 0); } + +C_SRAI RISCV 100 shamt5:1 01 rd:3 shamt:5 01 \ +!constraints { ($shamt5 != 0 || $shamt != 0); } + +C_ANDI RISCV 100 imm5:1 10 rd:3 imm:5 01 + +C_MV RISCV 100 0 rd:5 rs2:5 10 \ +!constraints { gbase($rd) && gbase($rs2); } + +C_ADD RISCV 100 1 rd:5 rs2:5 10 \ +!constraints { gbase($rd) && gbase($rs2); } + +C_AND RISCV 100 0 11 rd:3 11 rs2:3 01 + +C_OR RISCV 100 0 11 rd:3 10 rs2:3 01 + +C_XOR RISCV 100 0 11 rd:3 01 rs2:3 01 + +C_SUB RISCV 100 0 11 rd:3 01 rs2:3 01 + +C_SUBW RISCV 100 1 11 rd:3 00 rs2:3 01 + +C_ADDW RISCV 100 1 11 rd:3 01 rs2:3 01 + +C_NOP RISCV 0000000000000001 -- 2.23.0
WARNING: multiple messages have this Message-ID (diff)
From: LIU Zhiwei <zhiwei_liu@c-sky.com> To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: richard.henderson@linaro.org, Alistair.Francis@wdc.com, chihmin.chao@sifive.com, alex.bennee@linaro.org, peter.maydell@linaro.org, wenmeng_zhang@c-sky.com, wxy194768@alibaba-inc.com, LIU Zhiwei <zhiwei_liu@c-sky.com> Subject: [PATCH 06/11] riscv: Add RV64C instructions description Date: Sun, 12 Jul 2020 00:16:50 +0800 [thread overview] Message-ID: <20200711161655.2856-7-zhiwei_liu@c-sky.com> (raw) In-Reply-To: <20200711161655.2856-1-zhiwei_liu@c-sky.com> Make it a separate file, so that we can get subarch to recgonize the instrcution length. Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com> --- rv64c.risu | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 rv64c.risu diff --git a/rv64c.risu b/rv64c.risu new file mode 100644 index 0000000..fdd8afb --- /dev/null +++ b/rv64c.risu @@ -0,0 +1,97 @@ +# Input file for risugen defining RISC-V instructions +.mode riscv.rv64c + +@RV64C + +# we borrow X11 to store stack register +C_LWSP RISCV 010 imm5:1 rd:5 imm2:3 imm6:2 10 \ +!constraints { greg($rd) && $rd != 0 && $rd != 11; } \ +!memory { align(4); stack_plus_imm($imm5 * 32 + $imm2 * 4 + $imm6 * 64, $rd); } + +C_LDSP RISCV 011 imm5:1 rd:5 imm3:2 imm6:3 10 \ +!constraints { greg($rd) && $rd != 0 && $rd != 11; } \ +!memory { align(8); stack_plus_imm($imm5 * 32 + $imm3 * 8 + $imm6 * 64, $rd); } + +C_FLDSP RISCV 001 imm5:1 rd:5 imm3:2 imm6:3 10 \ +!memory { align(8); stack_plus_imm($imm5 * 32 + $imm3 * 8 + $imm6 * 64); } + +C_SWSP RISCV 110 imm2:4 imm6:2 rs2:5 10 \ +!constraints { greg($rs2) && $rs2 != 11; } \ +!memory { align(4); stack_plus_imm($imm2 * 4 + $imm6 * 64); } + +C_SDSP RISCV 111 imm3:3 imm6:3 rs2:5 10 \ +!constraints { greg($rs2) && $rs2 != 11; } \ +!memory { align(8); stack_plus_imm($imm3 * 8 + $imm6 * 64); } + +C_FSDSP RISCV 101 imm3:3 imm6:3 rs2:5 10 \ +!memory { align(8); stack_plus_imm($imm3 * 8 + $imm6 * 64); } + +# encode x11 into 0b011 in CL format +C_LW RISCV 010 imm3:3 rs1:3 imm2:1 imm6:1 rd:3 00 \ +!memory { align(4); reg_plus_imm($rs1 + 8, $imm2 * 4 + $imm3 * 8 + $imm6 * 64, $rd + 8); } + +C_LD RISCV 011 imm3:3 rs1:3 imm6:2 rd:3 00 \ +!memory { align(8); reg_plus_imm($rs1 + 8, $imm3 * 8 + $imm6 * 64, $rd + 8); } + +C_FLD RISCV 001 imm3:3 rs1:3 imm6:2 rd:3 00 \ +!memory { align(8); reg_plus_imm($rs1 + 8, $imm3 * 8 + $imm6 * 64); } + +C_SW RISCV 110 imm3:3 rs1:3 imm2:1 imm6:1 rs2:3 00 \ +!constraints { $rs2 != $rs1; } \ +!memory { align(4); reg_plus_imm($rs1 + 8, $imm2 * 4 + $imm3 * 8 + $imm6 * 64); } + +C_SD RISCV 111 imm3:3 rs1:3 imm6:2 rs2:3 00 \ +!constraints { $rs2 != $rs1; } \ +!memory { align(8); reg_plus_imm($rs1 + 8, $imm3 * 8 + $imm6 * 64); } + +C_FSD RISCV 101 imm3:3 rs1:3 imm6:2 rs2:3 00 \ +!memory { align(8); reg_plus_imm($rs1 + 8, $imm3 * 8 + $imm6 * 64); } + +C_LI RISCV 010 imm5:1 rd:5 imm:5 01 \ +!constraints { gbase($rd); } + +C_LUI RISCV 011 imm17:1 rd:5 imm12:5 01 \ +!constraints { gbase($rd) && ($imm17 != 0 || $imm12 != 0); } + +C_ADDI RISCV 000 imm5:1 rd:5 imm:5 01 \ +!constraints { gbase($rd) && ($imm5 != 0 || $imm != 0); } + +C_ADDIW RISCV 001 imm5:1 rd:5 imm:5 01 \ +!constraints { gbase($rd); } + +# Todo C_ADDI16SP, as it need stack as destination +# Move sp to aother register through the memory address function. + +# C_ADDI4SPN RISCV 000 imm4:2 imm6:4 imm2:1 imm3:1 rd:3 00 \ +# !constraints { $imm4 != 0 || $imm6 != 0 || $imm2 != 0 || $imm3 != 0; } + +C_SLLI RISCV 000 shamt5:1 rd:5 shamt:5 10 \ +!constraints { gbase($rd) && ($shamt5 != 0 || $shamt != 0); } + +C_SRLI RISCV 100 shamt5:1 00 rd:3 shamt:5 01 \ +!constraints { ($shamt5 != 0 || $shamt != 0); } + +C_SRAI RISCV 100 shamt5:1 01 rd:3 shamt:5 01 \ +!constraints { ($shamt5 != 0 || $shamt != 0); } + +C_ANDI RISCV 100 imm5:1 10 rd:3 imm:5 01 + +C_MV RISCV 100 0 rd:5 rs2:5 10 \ +!constraints { gbase($rd) && gbase($rs2); } + +C_ADD RISCV 100 1 rd:5 rs2:5 10 \ +!constraints { gbase($rd) && gbase($rs2); } + +C_AND RISCV 100 0 11 rd:3 11 rs2:3 01 + +C_OR RISCV 100 0 11 rd:3 10 rs2:3 01 + +C_XOR RISCV 100 0 11 rd:3 01 rs2:3 01 + +C_SUB RISCV 100 0 11 rd:3 01 rs2:3 01 + +C_SUBW RISCV 100 1 11 rd:3 00 rs2:3 01 + +C_ADDW RISCV 100 1 11 rd:3 01 rs2:3 01 + +C_NOP RISCV 0000000000000001 -- 2.23.0
next prev parent reply other threads:[~2020-07-11 16:20 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-11 16:16 [PATCH 00/11] RISC-V risu porting LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` [PATCH 01/11] riscv: Add RV64I instructions description LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` [PATCH 02/11] riscv: Add RV64M " LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` [PATCH 03/11] riscv: Add RV64A " LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` [PATCH 04/11] riscv: Add RV64F " LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` [PATCH 05/11] riscv: Add RV64D " LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei [this message] 2020-07-11 16:16 ` [PATCH 06/11] riscv: Add RV64C " LIU Zhiwei 2020-07-11 16:16 ` [PATCH 07/11] riscv: Generate payload scripts LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` [PATCH 08/11] riscv: Add standard test case LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` [PATCH 09/11] riscv: Define riscv struct reginfo LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` [PATCH 10/11] riscv: Implement payload load interfaces LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-11 16:16 ` [PATCH 11/11] riscv: Add configure script LIU Zhiwei 2020-07-11 16:16 ` LIU Zhiwei 2020-07-22 2:50 ` [PATCH 00/11] RISC-V risu porting LIU Zhiwei 2020-07-22 2:50 ` LIU Zhiwei
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200711161655.2856-7-zhiwei_liu@c-sky.com \ --to=zhiwei_liu@c-sky.com \ --cc=Alistair.Francis@wdc.com \ --cc=alex.bennee@linaro.org \ --cc=chihmin.chao@sifive.com \ --cc=peter.maydell@linaro.org \ --cc=qemu-devel@nongnu.org \ --cc=qemu-riscv@nongnu.org \ --cc=richard.henderson@linaro.org \ --cc=wenmeng_zhang@c-sky.com \ --cc=wxy194768@alibaba-inc.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.