DVP-ES2/EX2/SS2/SA2/SX2/SE&TP Operation Manual - Programming Program Example 1: The 16-bit value K100 in D0 is multiplied by the 16-bit value K200 in D10, and the product is stored in D20. Whether the product is a positive value or a negative value 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. X0 16-bit value 16-bit value 16-bit value D0 D10 D20 D0=K100, D10=K200, D20=K20,000 Program Example 2: The 32-bit value K10,000 in (D1, D0) is multiplied by the 32-bit value K20,000 in (D11, D10), and the product is stored in (D21, D20).
Whether the product is a positive value or a negative value depends on the leftmost bit (bit 31) in (D21, D20). If bit 31 in (D21, D20) is 0, the product stored in (D21, D20) is a positive value. If bit 31 in (D21, D20) is 1, the product stored in (D21, D20) is a negative value. X0 32-bit value 32-bit value 32-bit value (D1,D0) (D11,D10) (D21,D20) (D1,D0)=K10,000, (D11,D10)=K20,000, (D21, D20)=K200,000,000 Note: 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 value (K32767), only the low 16 bits of the product will be stored, and the carry flag M1022 will be ON.
If the product of a 16-bit multiplication is not a 16-bit signed value available, and is less than the minimum 16-bit negative value (K-32768), only the low 16 bits of the product will be stored, and the carry flag M1022 will be ON. 2. If users need a complete result of a 16-bit multiplication (a 32-bit value), they have to use API22 MUL/MULP. Please refer to the explanation of API22 MUL/MULP 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 value (K2147483647), only the low 32 bits of the product will be stored, and the carry flag M1022 will be ON.
If the product of a 32-bit multiplication is not a 32-bit signed value available, and is less than the minimum 32-bit negative value be ON. (K-2147483648), only the low 32 bits of the product will be stored, and the carry flag M1022 will 4. If users need a complete result of a 32-bit multiplication (a 64-bit value), they have to use API22 DMUL/DMULP. Please refer to the explanation of API22 DMUL/DMULP for more information. 3-320 0 MUL16 D0 D10 D20 0 MUL32 D0 D10 D20