Mitsubishi Electronics FX2C Home Theater Server User Manual


 
FX Series Programmable Controlers Applied Instructions 5
5-27
5.3.3 MUL (FNC 22)
Operation 1:
(Applicable to all units)
The contents of the two source devices (S1, S2)
are multiplied to
g
ether and the result is stored at
the destination device (D). Note the normal rules of
al
g
ebra appl
y
.
Points to note:
a) When operatin
g
the MUL instruction in 16bit mode, two 16 bit data sources are multiplied
to
g
ether. The
y
produce a 32 bit result. The device identified as the destination address is
the lower of the two devices used to store the 32 bit result. Usin
g
the above example with
some test data:
5 (D0)
×
7 (D2) = 35 - The value 35 is stored in (D4, D5) as a sin
g
le 32 bit word.
b) When operatin
g
the MUL instruction in 32 bit mode, two 32 bit data sources are multiplied
to
g
ether. The
y
produce a 64 bit result. The device identified as the destination address is
the lower of the four devices used to store the 64 bit result.
c) If the location of the destination device is smaller than the obtained result, then onl
y
the
portion of the result which directl
y
maps to the destination area will be written, i.e if a result
of 72 (decimal) is to be stored at K1Y4 then onl
y
Y7 would be active. In binar
y
terms this is
equivalent to a decimal value of 8, a lon
g
wa
y
short of the real result of 72!
Operation 2:
(Applicable units: FX
(2C)
)
This function is equivalent to FNC 122 EMUL.
When ‘floatin
g
point mode fla
g
’ M8023 is active,
i.e. ON, DMUL and DMULP instructions can be
used to perform floatin
g
point multiplications.
When M8023 is reset, i.e. OFF floatin
g
point
manipulation will not occur. Constants (K/H) and
floatin
g
point numbers (stored in double data
re
g
isters D) can be used in an
y
confi
g
uration. The constants (K/H) will automaticall
y
be
converted to the ‘floatin
g
point format’ for the operation. Answers for an operation are stored
(completel
y
) in one pair of double (32 bits) data re
g
isters and not 2 pairs (64 bits) as used in
‘Operation 1:’. The normal rules of al
g
ebra appl
y
to floatin
g
point multiplication.
Mnemonic Function
Operands
Program steps
S1 S2 D
MUL
FNC 22
(Multiplica
-tion)
Multiplies the two
source devices
to
g
ether the result
is stored in the
destination device
K, H, KnX, KnY, KnM, KnS,
T, C, D, V, Z
KnY,KnM,KnS,
T, C, D, Z(V)
Note: Z(V) ma
y
NOT
be used
for 32 bit oper-
ation
MUL, MULP:
7steps
DMUL,
DMULP:
13 steps
See pa
g
e 4-46 for more
details re
g
ardin
g
floatin
g
point format.
When usin
g
M8023 to subtract floatin
g
point
data, onl
y
double word (32 bit) data re
g
isters
(D) or constants (K/H) ma
y
be used.
X0
MUL D 0 D 2
[ S1 ] [ D ]
D 4
[ S2 ]
Viewin
g
64 bit numbers
It is currentl
y
impossible to monitor the contents of a 64 bit result. However, the result can
be monitored in two smaller,32 bit, blocks, i.e. a 64 bit result is made up of the followin
g
parts: (upper 32 bits)
×
2
32
+ (lower 32 bits).
X10
M8023
M8000
M8023
DMULP
D 0
K 40
[ S1 ] [ D ]
D 4
[ S2 ]