【RISC-V 指令集】RISC-V DSP 扩展指令集介绍(二)

前言:

本笔记是基于对RISC-V  DSP扩展指令集文档总结的,《P-ext-proposal.pdf》文档的关键内容如下:
主要介绍了RISC-V的P扩展指令集及其相关细节。

首先,对P扩展指令进行了概述,并列出了其与其他扩展重复的指令。

接着,详细描述了P扩展的子集,包括Zbpbo扩展和Zpn扩展(适用于RV32和RV64)的指令。

此外,还提供了仅适用于RV64的详细指令描述。
文档还介绍了新的用户控制和状态寄存器,并提供了指令编码表。最后,列出了因RVB重叠而被移除的指令。
这份文档为RISC-V的P扩展指令集提供了全面而详细的信息,包括指令的描述、编码、以及与其他扩展的关系。这对于理解、开发和优化基于RISC-V架构的系统非常有价值。同时,文档也提醒了开发者在使用P扩展时需要注意的兼容性和优化问题。

【RISC-V 指令集】RISC-V DSP 扩展指令集介绍(一)-CSDN博客

3.2. 部分SIMD数据处理指令

3.2.1. 16位组包指令

Table 12. 16-bit Packing Instructions

序号指令说明
1PKBB16 rd, rs1, rs2Pack two 16-bit data from Bottoms
2PKBT16 rd, rs1, rs2Pack two 16-bit data Bottom & Top
3PKTB16 rd, rs1, rs2Pack two 16-bit data Top & Bottom
4PKTT16 rd, rs1, rs2Pack two 16-bit data from Tops

3.2.2.  最高有效字“32x32”乘法和加法指令

Table 13. Signed MSW 32x32 Multiply and Add Instructions

序号指令说明
1SMMUL rd, rs1, rs2MSW “32 x 32” Signed Multiplication (MSW 32 = 32x32)
2SMMUL.u rd, rs1, rs2MSW “32 x 32” Signed Multiplication with Rounding (MSW 32 = 32x32)
3KMMAC rd, rs1, rs2MSW “32 x 32” Signed Multiplication and Saturating Addition (MSW 32 = 32 + 32x32)
4KMMAC.u rd, rs1, rs2MSW “32 x 32” Signed Multiplication and Saturating Addition with Rounding (MSW 32 = 32 + 32x32)
5KMMSB rd, rs1, rs2MSW “32 x 32” Signed Multiplication and Saturating Subtraction (MSW 32 = 32 - 32x32)
6KMMSB.u rd, rs1, rs2MSW “32 x 32” Signed Multiplication and Saturating Subtraction with Rounding (MSW 32 = 32 - 32x32)
7KWMMUL rd, rs1, rs2MSW “32 x 32” Signed Multiplication & Double (MSW 32 = 32x32 << 1)
8KWMMUL.u rd, rs1, rs2MSW “32 x 32” Signed Multiplication & Double with Rounding (MSW 32 = 32x32 << 1)

3.2.3.  最高有效字“32x16”乘法和加法指令

Table 14. Signed MSW 32x16 Multiply and Add Instructions

序号指令说明
1SMMWB rd, rs1, rs2MSW “32 x Bottom 16” Signed Multiplication (MSW 32 = 32x16)
2SMMWB.u rd, rs1, rs2MSW “32 x Bottom 16” Signed Multiplication with Rounding (MSW 32 = 32x16)
3SMMWT rd, rs1, rs2MSW “32 x Top 16” Signed Multiplication (MSW 32 = 32x16)
4SMMWT.u rd, rs1, rs2MSW “32 x Top 16” Signed Multiplication with Rounding (MSW 32 = 32x16)
5KMMAWB rd, rs1, rs2MSW “32 x Bottom 16” Signed Multiplication and Saturating Addition (MSW 32 = 32 + 32x16)
6KMMAWB.u rd, rs1, rs2MSW “32 x Bottom 16” Signed Multiplication and Saturating Addition with Rounding (MSW 32 = 32 + 32x16)
7KMMAWT rd, rs1, rs2MSW “32 x Top 16” Signed Multiplication and Saturating Addition (MSW 32 = 32 + 32x16)
8KMMAWT.u rd, rs1, rs2MSW “32 x Top 16” Signed Multiplication and Saturating Addition with Rounding (MSW 32 = 32 + 32x16)
9KMMWB2 rd, rs1, rs2MSW “32 x Bottom 16” Saturating Signed Multiplication and double (MSW 32 = (32x16) << 1)
10KMMWB2.u rd, rs1, rs2MSW “32 x Bottom 16” Saturating Signed Multiplication and double with Rounding (MSW 32 = (32x16) << 1)
11KMMWT2 rd, rs1, rs2MSW “32 x Top 16” Saturating Signed Multiplication and double (MSW 32 = (32x16) << 1)
12KMMWT2.u rd, rs1, rs2MSW “32 x Top 16” Saturating Signed Multiplication and double with Rounding (MSW 32 = (32x16) << 1)
13KMMAWB2 rd, rs1, rs2MSW “32 x Bottom 16” Signed Multiplication & double and Saturating Addition (MSW 32 = 32 + (32x16)<<1)
14KMMAWB2.u rd, rs1, rs2MSW “32 x Bottom 16” Signed Multiplication & double and Saturating Addition with Rounding (MSW 32 = 32 + (32x16)<<1)
15KMMAWT2 rd, rs1, rs2MSW “32 x Top 16” Signed Multiplication & double and Saturating Addition (MSW 32 = 32 + (32x16)<<1)
16KMMAWT2.u rd, rs1, rs2MSW “32 x Top 16” Signed Multiplication & double and Saturating Addition with Rounding (MSW 32 = 32 + (32x16)<<1)

3.2.4. 带32位加/减法的有符号16位乘法指令

Table 15. Signed 16-bit Multiply 32-bit Add/Subtract Instructions

序号指令说明
1SMBB16 rd, rs1, rs2Signed Multiply Bottom 16 & Bottom 16 (32 = 16x16)
2SMBT16 rd, rs1, rs2Signed Multiply Bottom 16 & Top 16 (32 = 16x16)
3SMTT16 rd, rs1, rs2Signed Multiply Top 16 & Top 16 (32 = 16x16)
4KMDA rd, rs1, rs2Two “16x16” and Signed Addition (32 = 16x16 + 16x16)
5KMXDA rd, rs1, rs2Two Crossed “16x16” and Signed Addition (32 = 16x16 + 16x16)
6SMDS rd, rs1, rs2Two “16x16” and Signed Subtraction (32 = 16x16 - 16x16)
7SMDRS rd, rs1, rs2Two “16x16” and Signed Reversed Subtraction (32 = 16x16 - 16x16)
8SMXDS rd, rs1, rs2Two Crossed “16x16” and Signed Subtraction (32 = 16x16 - 16x16)
9KMABB rd, rs1, rs2“Bottom 16 x Bottom 16” with 32-bit Signed Addition (32 = 32 + 16x16)
10KMABT rd, rs1, rs2“Bottom 16 x Top 16” with 32-bit Signed Addition (32 = 32 + 16x16)
11KMATT rd, rs1, rs2“Top 16 x Top 16” with 32-bit Signed Addition (32 = 32 + 16x16)
12KMADA rd, rs1, rs2Two “16x16” with 32-bit Signed Double Addition (32 = 32 + 16x16 + 16x16)
13KMAXDA rd, rs1, rs2Two Crossed “16x16” with 32-bit Signed Double Addition (32 = 32 + 16x16 + 16x16)
14KMADS rd, rs1, rs2Two “16x16” with 32-bit Signed Addition and Subtraction (32 = 32 + 16x16 - 16x16)
15KMADRS rd, rs1, rs2Two “16x16” with 32-bit Signed Addition and Reversed Subtraction (32 = 32 + 16x16 - 16x16)
16KMAXDS rd, rs1, rs2Two Crossed “16x16” with 32-bit Signed Addition and Subtraction (32 = 32 + 16x16 - 16x16)
17KMSDA rd, rs1, rs2Two “16x16” with 32-bit Signed Double Subtraction (32 = 32 - 16x16 - 16x16)
18KMSXDA rd, rs1, rs2Two Crossed “16x16” with 32-bit Signed Double Subtraction (32 = 32 - 16x16 - 16x16)

3.2.5. 带64位加/减法的有符号16位乘法指令

Table 16. Signed 16-bit Multiply 64-bit Add/Subtract Instructions

序号指令说明
1SMAL rd, rs1, rs2“16 x 16” with 64-bit Signed Addition (64 = 64 + 16x16)

3.2.6. 其他指令

Table 17. Partial-SIMD Miscellaneous Instructions

序号指令说明
1SCLIP32 rd, rs1, imm5uSigned Clip Value
2UCLIP32 rd, rs1, imm5uUnsigned Clip Value
3CLRS32 rd, rs132-bit Count Leading Redundant Sign
4CLZ32 rd, rs132-bit Count Leading Zero
5PBSAD rd, rs1, rs2Parallel Byte Sum of Absolute Difference
6PBSADA rd, rs1, rs2Parallel Byte Sum of Absolute Difference Accumulation

3.2.7. 带32位加法的8位乘法指令

Table 18. 8-bit Multiply with 32-bit Add Instructions

序号指令说明
1SMAQA rd, rs1, rs2Four signed “8x8” with 32-bit Signed Addition (32 = 32 + 8x8 + 8x8 + 8x8 + 8x8)
2UMAQA rd, rs1, rs2Four unsigned “8x8” with 32-bit Unsigned Addition (32 = 32 + 8x8 + 8x8 + 8x8 + 8x8)
3SMAQA.SU rd, rs1, rs2Four “signed 8 x unsigned 8” with 32- bit Signed Addition (32 = 32 + 8x8 + 8x8 + 8x8 + 8x8)

3.3 64位数据计算指令

3.3.1 64位加减指令

Table 19. 64-bit Add/Subtract Instructions

序号指令说明
1ADD64 rd, rs1, rs264-bit Addition
2RADD64 rd, rs1, rs264-bit Signed Halving Addition
3URADD64 rd, rs1, rs264-bit Unsigned Halving Addition
4KADD64 rd, rs1, rs264-bit Signed Saturating Addition
5UKADD64 rd, rs1, rs264-bit Unsigned Saturating Addition
6SUB64 rd, rs1, rs264-bit Subtraction
7RSUB64 rd, rs1, rs264-bit Signed Halving Subtraction
8URSUB64 rd, rs1, rs264-bit Unsigned Halving Subtraction
9KSUB64 rd, rs1, rs264-bit Signed Saturating Subtraction
10UKSUB64 rd, rs1, rs264-bit Unsigned Saturating Subtraction

3.3.2 32位乘法与64位加减指令

Table 20. 32-bit Multiply 64-bit Add/Subtract Instructions

序号指令说明
1SMAR64 rd, rs1, rs232x32 with 64-bit Signed Addition
2SMSR64 rd, rs1, rs232x32 with 64-bit Signed Subtraction
3UMAR64 rd, rs1, rs232x32 with 64-bit Unsigned Addition
4UMSR64 rd, rs1, rs232x32 with 64-bit Unsigned Subtraction
5KMAR64 rd, rs1, rs232x32 with Saturating 64-bit Signed Addition
6KMSR64 rd, rs1, rs232x32 with Saturating 64-bit Signed Subtraction
7UKMAR64 rd, rs1, rs232x32 with Saturating 64-bit Unsigned Addition
8UKMSR64 rd, rs1, rs232x32 with Saturating 64-bit Unsigned Subtraction

3.3.3 带符号16位乘法与64位加减指令

Table 21. Signed 16-bit Multiply 64-bit Add/Subtract Instructions

序号指令说明
1SMALBB rd, rs1, rs2“Bottom 16 x Bottom 16” with 64-bit Signed Addition (64 = 64 + 16x16)
2SMALBT rd, rs1, rs2“Bottom 16 x Top 16” with 64-bit Signed Addition (64 = 64 + 16x16)
3SMALTT rd, rs1, rs2“Top 16 x Top 16” with 64-bit Signed Addition (64 = 64 + 16x16)
4SMALDA rd, rs1, rs2Two “16x16” with 64-bit Signed Double Addition (64 = 64 + 16x16 + 16x16)
5SMALXDA rd, rs1, rs2Two Crossed “16x16” with 64-bit Signed Double Addition (64 = 64 + 16x16 + 16x16)
6SMALDS rd, rs1, rs2Two “16x16” with 64-bit Signed Addition and Subtraction (64 = 64 + 16x16 - 16x16)
7SMALDRS rd, rs1, rs2Two “16x16” with 64-bit Signed Addition and Reversed Subtraction (64 = 64 + 16x16 - 16x16)
8SMALXDS rd, rs1, rs2Two Crossed “16x16” with 64-bit Signed Addition and Subtraction (64 = 64 + 16x16 - 16x16)
9SMSLDA rd, rs1, rs2Two “16x16” with 64-bit Signed Double Subtraction (64 = 64 - 16x16 - 16x16)
10SMSLXDA rd, rs1, rs2Two Crossed “16x16” with 64-bit Signed Double Subtraction (64 = 64 - 16x16 - 16x16)

3.4 非SIMD指令

3.4.1 Q15饱和说明

Table 22. Non-SIMD Q15 saturation ALU Instructions

序号指令说明
1KADDH rd, rs1, rs2Add with Q15 saturation
2KSUBH rd, rs1, rs2Subtract with Q15 saturation
3KHMBB rd, rs1, rs2Multiply the first 16- bit Q15 elements of two registers and transform the Q30 result into a saturated Q15 number.
4KHMBT rd, rs1, rs2Multiply the first 16- bit Q15 element of one register with the second 16-bit Q15 element of another register and transform the Q30 result into a saturated Q15 number.
5KHMTT rd, rs1, rs2Multiply the second 16-bit Q15 elements of two registers and transform the Q30 result into a saturated Q15 number.
6UKADDH rd, rs1, rs2Add with I16 saturation
7UKSUBH rd, rs1, rs2Subtract with I16 saturation

3.4.2 Q31饱和指令

Table 23. Non-SIMD Q31 saturation ALU Instructions

序号指令说明
1KADDW rd, rs1, rs2Add with Q31 saturation
2UKADDW rd, rs1, rs2Unsigned Add with U32 saturation
3KSUBW rd, rs1, rs2Subtract with Q31 saturation
4UKSUBW rd, rs1, rs2Unsigned Subtract with U32 saturation
5KDMBB rd, rs1, rs2Multiply the first 16- bit Q15 elements of two registers and transform the Q30 result into a saturated Q31 number.
6KDMBT rd, rs1, rs2Multiply the first 16- bit Q15 element of one register with the second 16-bit Q15 element of another register and transform the Q30 result into a saturated Q31 number.
7KDMTT rd, rs1, rs2Multiply the second 16-bit Q15 elements of two registers and transform the Q30 result into a saturated Q31 number.
8KSLRAW rd, rs1, rs2Shift Left Logical with Q31 Saturation or Shift Right Arithmetic
9KSLRAW.u rd, rs1, rs2Shift Left Logical with Q31 Saturation or Rounding Shift Right Arithmetic
10KSLLW rd, rs1, rs2Saturating Shift Left Logical for 32-bit Word
11KSLLIW rd, rs1, imm5uSaturating Shift Left Logical Immediate for 32-bit Word
12KDMABB rd, rs1, rs2Multiply the first 16- bit Q15 elements of two registers and transform the Q30 result into a saturated Q31 number. Add the Q31 number with a 32-bit accumulator.
13KDMABT rd, rs1, rs2Multiply the first 16- bit Q15 element of one register with the second 16-bit Q15 element of another register and transform the Q30 result into a saturated Q31 number. Add the Q31 number with a 32-bit accumulator.
14KDMATT rd, rs1, rs2Multiply the second 16-bit Q15 elements of two registers and transform the Q30 result into a saturated Q31 number. Add the Q31 number with a 32-bit accumulator.
15KABSW rd, rs132-bit Absolute Value (scalar version)

3.4.3 32位计算指令

Table 24. 32-bit Computation Instructions

序号指令说明
1RADDW rd, rs1, rs232-bit Signed Halving Addition
2URADDW rd, rs1, rs232-bit Unsigned Halving Addition
3RSUBW rd, rs1, rs232-bit Signed Halving Subtraction
4URSUBW rd, rs1, rs232-bit Unsigned Halving Subtraction
5MULR64 rd, rs1, rs2Multiply Word Unsigned to 64-bit data
6MULSR64 rd, rs1, rs2Multiply Word Signed to 64-bit data
7MSUBR32 rd, rs1, rs2Multiply and Subtract from 32-bit Word

3.4.4 溢流/饱和状态操作说明

Table 25. OV (Overflow) flag Set/Clear Instructions

序号指令说明
1RDOV rdRead vxsat.OV to rd.
2CLROVClear vsat.OV flag

3.4.5 其他指令

Table 22. Non-SIMD Q15 saturation ALU Instructions

序号指令说明
1AVE rd, rs1, rs2Average with rounding
2SRA.u rd, rs1, rs2Rounding Shift Right Arithmetic
3SRAI.u rd, rs1, imm5u/imm6uRounding Shift Right Arithmetic Immediate
4BITREV rd, rs1, rs2Bit Reverse
5BITREVI rd, rs1, imm5u/imm6uBit Reverse Immediate
6WEXT rd, rs1, rs2Extract 32-bit from a 64-bit value
7WEXTI rd, rs1, imm5uExtract 32-bit from a 64-bit value Immediate
8CMIX rd, rs2, rs1, rs3Conditional Mix
9INSB rd, rs1, imm2u/imm3uInsert Byte
10MADDR32 rd, rs1, tbMultiply and Add to 32-bit Word
11MSUBR32 rd, rs1, tbMultiply and Subtract from 32-bit Word
12MAX rd, rs1, rs2Signed Word Maximum
13MIN rd, rs1, rs2Signed Word Minimum

 RISC-V  DSP扩展指令集文档:

https://download.csdn.net/download/u011376987/88898800

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值