NMSIS-Core  Version 1.2.0
NMSIS-Core support for Nuclei processor-based devices
(RV64 Only) 32-bit Multiply & Add Instructions

(RV64 Only) 32-bit Multiply & Add Instructions More...

Functions

__STATIC_FORCEINLINE long __RV_KMABB32 (long t, unsigned long a, unsigned long b)
 KMABB32 (Saturating Signed Multiply Bottom Words & Add) More...
 
__STATIC_FORCEINLINE long __RV_KMABT32 (long t, unsigned long a, unsigned long b)
 KMABT32 (Saturating Signed Multiply Bottom & Top Words & Add) More...
 
__STATIC_FORCEINLINE long __RV_KMATT32 (long t, unsigned long a, unsigned long b)
 KMATT32 (Saturating Signed Multiply Top Words & Add) More...
 

Detailed Description

(RV64 Only) 32-bit Multiply & Add Instructions

there are 3 (RV64 Only) 32-bit Multiply & Add Instructions

Function Documentation

◆ __RV_KMABB32()

__STATIC_FORCEINLINE long __RV_KMABB32 ( long  t,
unsigned long  a,
unsigned long  b 
)

KMABB32 (Saturating Signed Multiply Bottom Words & Add)

Type: DSP (RV64 Only)

Syntax:

KMABB32 Rd, Rs1, Rs2
KMABT32 Rd, Rs1, Rs2
KMATT32 Rd, Rs1, Rs2

Purpose:
Multiply the signed 32-bit element in a register with the 32-bit element in another register and add the result to the content of 64-bit data in the third register. The addition result may be saturated and is written to the third register.

  • KMABB32: rd + bottom*bottom
  • KMABT32: rd + bottom*top
  • KMATT32: rd + top*top

Description:
For the KMABB32 instruction, it multiplies the bottom 32-bit element in Rs1 with the bottom 32-bit element in Rs2. For the KMABT32 instruction, it multiplies the bottom 32-bit element in Rs1 with the top 32-bit element in Rs2. For the KMATT32 instruction, it multiplies the top 32-bit element in Rs1 with the top 32-bit element in Rs2. The multiplication result is added to the content of 64-bit data in Rd. If the addition result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set to 1. The result after saturation is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.

Operations:

res = Rd + (Rs1.W[0] * Rs2.W[0]); // KMABB32
res = Rd + (Rs1.W[0] * Rs2.W[1]); // KMABT32
res = Rd + (Rs1.W[1] * Rs2.W[1]); // KMATT32
if (res > (2^63)-1) {
res = (2^63)-1;
OV = 1;
} else if (res < -2^63) {
res = -2^63;
OV = 1;
}
Rd = res;
*Exceptions:* None
Parameters
[in]tlong type of value stored in t
[in]aunsigned long type of value stored in a
[in]bunsigned long type of value stored in b
Returns
value stored in long type

Definition at line 14674 of file core_feature_dsp.h.

14675 {
14676  __ASM volatile("kmabb32 %0, %1, %2" : "+r"(t) : "r"(a), "r"(b));
14677  return t;
14678 }

References __ASM.

◆ __RV_KMABT32()

__STATIC_FORCEINLINE long __RV_KMABT32 ( long  t,
unsigned long  a,
unsigned long  b 
)

KMABT32 (Saturating Signed Multiply Bottom & Top Words & Add)

Type: DSP (RV64 Only)

Syntax:

KMABB32 Rd, Rs1, Rs2
KMABT32 Rd, Rs1, Rs2
KMATT32 Rd, Rs1, Rs2

Purpose:
Multiply the signed 32-bit element in a register with the 32-bit element in another register and add the result to the content of 64-bit data in the third register. The addition result may be saturated and is written to the third register.

  • KMABB32: rd + bottom*bottom
  • KMABT32: rd + bottom*top
  • KMATT32: rd + top*top

Description:
For the KMABB32 instruction, it multiplies the bottom 32-bit element in Rs1 with the bottom 32-bit element in Rs2. For the KMABT32 instruction, it multiplies the bottom 32-bit element in Rs1 with the top 32-bit element in Rs2. For the KMATT32 instruction, it multiplies the top 32-bit element in Rs1 with the top 32-bit element in Rs2. The multiplication result is added to the content of 64-bit data in Rd. If the addition result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set to 1. The result after saturation is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.

Operations:

res = Rd + (Rs1.W[0] * Rs2.W[0]); // KMABB32
res = Rd + (Rs1.W[0] * Rs2.W[1]); // KMABT32
res = Rd + (Rs1.W[1] * Rs2.W[1]); // KMATT32
if (res > (2^63)-1) {
res = (2^63)-1;
OV = 1;
} else if (res < -2^63) {
res = -2^63;
OV = 1;
}
Rd = res;
*Exceptions:* None
Parameters
[in]tlong type of value stored in t
[in]aunsigned long type of value stored in a
[in]bunsigned long type of value stored in b
Returns
value stored in long type

Definition at line 14736 of file core_feature_dsp.h.

14737 {
14738  __ASM volatile("kmabt32 %0, %1, %2" : "+r"(t) : "r"(a), "r"(b));
14739  return t;
14740 }

References __ASM.

◆ __RV_KMATT32()

__STATIC_FORCEINLINE long __RV_KMATT32 ( long  t,
unsigned long  a,
unsigned long  b 
)

KMATT32 (Saturating Signed Multiply Top Words & Add)

Type: DSP (RV64 Only)

Syntax:

KMABB32 Rd, Rs1, Rs2
KMABT32 Rd, Rs1, Rs2
KMATT32 Rd, Rs1, Rs2

Purpose:
Multiply the signed 32-bit element in a register with the 32-bit element in another register and add the result to the content of 64-bit data in the third register. The addition result may be saturated and is written to the third register.

  • KMABB32: rd + bottom*bottom
  • KMABT32: rd + bottom*top
  • KMATT32: rd + top*top

Description:
For the KMABB32 instruction, it multiplies the bottom 32-bit element in Rs1 with the bottom 32-bit element in Rs2. For the KMABT32 instruction, it multiplies the bottom 32-bit element in Rs1 with the top 32-bit element in Rs2. For the KMATT32 instruction, it multiplies the top 32-bit element in Rs1 with the top 32-bit element in Rs2. The multiplication result is added to the content of 64-bit data in Rd. If the addition result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set to 1. The result after saturation is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.

Operations:

res = Rd + (Rs1.W[0] * Rs2.W[0]); // KMABB32
res = Rd + (Rs1.W[0] * Rs2.W[1]); // KMABT32
res = Rd + (Rs1.W[1] * Rs2.W[1]); // KMATT32
if (res > (2^63)-1) {
res = (2^63)-1;
OV = 1;
} else if (res < -2^63) {
res = -2^63;
OV = 1;
}
Rd = res;
*Exceptions:* None
Parameters
[in]tlong type of value stored in t
[in]aunsigned long type of value stored in a
[in]bunsigned long type of value stored in b
Returns
value stored in long type

Definition at line 14798 of file core_feature_dsp.h.

14799 {
14800  __ASM volatile("kmatt32 %0, %1, %2" : "+r"(t) : "r"(a), "r"(b));
14801  return t;
14802 }

References __ASM.

__ASM
#define __ASM
Pass information from the compiler to the assembler.
Definition: nmsis_gcc.h:55