vbcdadd

Vector BCD Add

vbcdadd vD, vA, vB, PS

Adds two BCD (Binary Coded Decimal) vectors.

Details

Adds two Binary Coded Decimal (BCD) vectors element-wise and stores the result in the destination vector. The PS field specifies the preferred sign convention for the result. This instruction requires the Vector Crypto extension and does not directly affect condition registers.

Pseudocode Operation

for i in 0 to 15 do
  BCD_digit_A ← vA[i*4:i*4+3]
  BCD_digit_B ← vB[i*4:i*4+3]
  sum ← BCD_digit_A + BCD_digit_B
  if sum > 9 then
    sum ← sum + 6
  vD[i*4:i*4+3] ← sum[3:0]
end
if PS then
  apply_sign_to_vD()
end

Example

vbcdadd vd, va, vb, 0

Encoding

Binary Layout
4
0
vD
6
vA
11
vB
16
1
21
 
Format VX-form
Opcode 0x10000001
Extension Vector Crypto

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B
  • PS
    Sign