3. Instruction Set API 22 Operands: S 1 : Multiplicand S 2 : Multiplicator D : Product Explanations: 1. This instruction multiplies S 1 by S 2 in BIN format and stores the result in D . Care should be taken on positive/negative signs of S 1 , S 2 and D when doing 16-bit and 32-bit operations. 2. MSB = 0, positive; MSB = 1, negative. 3. If operands S 1 , S 2 use index F, then only 16-bit instruction is available. 4. If operand D use index E, then only 16-bit instruction is available. 5. 16-bit BIN multiplication S 1 D D S 2 +1 b15................ b00 b15................ b00 b31............
b16 b15.............b00 b15 is the sign bit b15 is the sign bit b31 is the sign bit(b15 of D+1) X = b15=0,S1 is a positive value B15=1,S1 is a negative value b15=0,S2 is a positive value b15=1,S2 is a negative value b31=0,D(D+1) is a positive value b31=1, is a negative value D(D+1) 16-bit value x 16-bit value = 32-bit value If D is specified with a bit device, it can designate K1 ~ K4 to store a 16-bit result. Users can use consecutive 2 16-bit registers to store 32-bit data. If the product of a 16-bit multiplication must be a 16-bit value (16-bit value x 16-bit value = 16-bit value), users have to use API 114 MUL16/MUL16P.
Please refer to the explanation of API 114 MUL16/MUL16P for more information. 6. 32-bit BIN multiplication +1 +1 +3 +2 +1 b31.. b16 b15.. b00 b31.. b16 b15.. b00 b63. b48 b47. b32 b31. b16 b15.
b00 X = B31=0,S1(S1+1) is a positive value b31=1,S1(S1+1) is a negative value b31=0,S2(S2+1) is a positive value b31=1,S2(S2+1) is a negative value b63=0, D~(D+3) is a positive value b63=1, D~(D+3) is a negative value b31 is the sign bit b31 is the sign bit b63 is the sign bit(b15 of D+3) 32-bit value x 32-bit value = 64-bit value 3-77 Mnemonic Operands Function Controllers D MUL P Multiplication ES2/EX2 SS2 SA2 SX2 SE Type OP Bit Devices Word devices Program Steps X Y M S K H KnX KnY KnM KnS T C D E F MUL, MULP: 7 steps DMUL, DMULP:
13 steps S 1 * * * * * * * * * * S 2 * * * * * * * * * * D * * * * * * * PULSE 16-bit 32-bit SA2 SX2 SS2 SA2 SA2 ES2/EX2 SS2 ES2/EX2 SX2 ES2/EX2 SS2 SX2 SE SE SE