Chapter 6 Applied Instructions 4. 32-bit binary multiplication: S 1 S 1 +1 D +1 D 2 S 2 S +1 b31...b16 b15...b0 b31...b16 b15...b0 b31...b16 b15...b0 Bit 31 is a sign bit. * = Bit 31 is a sign bit. Bit 31 is a sign bit. The product is a 32-bit value stored in ( D , D +1 ) which is a 32-bit register. If b31 in D is 0, the product stored in ( D , D +1 ) is a positive value. If b31 in D is 1, the product stored in ( D , D +1 ) is a negative value. Example The instruction multiplies the 16-bit value in D0 by the 16-bit value in D10, and stores the product in D20. The sign of the product (positive or negative) depends on the leftmost bit (bit 15) in D20.
If bit 15 in D20 is 0, the product stored in D20 is a positive value. If bit 15 in D20 is 1, the product stored in D20 is a negative value. D0 Ч D10 = D20 6_ 16-bit value Ч 16-bit value = 16-bit value Additional remarks 1. If the product of a 16-bit multiplication is not a 16-bit signed value available, and is greater than the maximum 16-bit positive number K32767, or less than the minimum negative number K-32768, the carry flag SM602 is ON, and only the low 16 bits are written. 2. If you need the complete result of a 16-bit multiplication (a 32-bit value), use the */*P instruction (API 0102). Refer to the explanation for the * instruction (API 0102) for more information. 3.
If the product of a 32-bit multiplication is not a 32-bit signed value available, and is greater than the maximum 32-bit positive number K2147483647, or less than the minimum negative number K-2147483648, the carry flag SM602 is ON, and only the low 32 bits are written. 4. If you need the complete result of a 32-bit multiplication (a 64-bit value), use API 0102 D*/D*P. Refer to the explanation for the * instruction (API 0102) for more information. 6-75