ST10 FAMILY PROGRAMMING MANUAL
CoMAC(R/-)
Group
Syntax
Operation
Syntax
Operation
Syntax
Operation
Syntax
Operation
Syntax
Operation
Data Types
Result
Description
Multiplies the two signed 16-bit source operands "op1" and "op2". The obtained signed 32-bit product is first
sign-extended, then the condition MP flag is set, it is one-bit left shifted, then it is optionally negated prior
being added/subtracted to/from the 40-bit ACC register content. Finally, the obtained result is optionally
rounded before being stored in the 40-bit ACC register. The "-" option is used to negate the specified product,
the "R" option is used to negate the accumulator content, and finally the "rnd" option is used to round the
result using two's complement rounding. The default sign option is "+" and the default round option is "no
round". When "rnd" option is used, MAL register is automatically cleared. Note that "rnd" and "-" are exclusive
as well as "-" and "R". This instruction might be repeated and allows up to two parallel memory reads.
134/172
Multiply-Accumulate & Optional Round
Multiply/Multiply-Accumulate Instructions
CoMAC
op1, op2
IF (MP = 1) THEN
(tmp) <-- ((op1) * (op2)) << 1
(ACC) <-- (ACC) + (tmp)
ELSE
(tmp) <-- (op1) * (op2)
(ACC) <-- (ACC) + (tmp)
END IF
CoMAC op1, op2, rnd
IF (MP = 1) THEN
(tmp) <-- ((op1) * (op2)) << 1
(ACC) <-- (ACC) + (tmp) + 00 0000 8000
ELSE
(tmp) <-- (op1) * (op2)
(ACC) <-- (ACC) + (tmp) + 00 0000 8000
END IF
(MAL) <-- 0
CoMAC- op1, op2
IF (MP = 1) THEN
(tmp) <-- ((op1) * (op2)) << 1
(ACC) <-- (ACC) - (tmp)
ELSE
(tmp) <-- (op1) * (op2)
(ACC) <-- (ACC) - (tmp)
END IF
CoMACR op1, op2
IF (MP = 1) THEN
(tmp) <-- ((op1) * (op2)) << 1
(ACC) <-- (tmp) - (ACC)
ELSE
(tmp) <-- (op1) * (op2)
(ACC) <-- (tmp) - (ACC)
END IF
CoMACRop1, op2, rnd
IF (MP = 1) THEN
(tmp) <-- ((op1) * (op2)) << 1
(ACC) <-- (tmp) - (ACC) + 00 0000 8000
ELSE
(tmp) <-- (op1) * (op2)
(ACC) <-- (tmp) - (ACC) + 00 0000 8000
END IF
(MAL) <-- 0
DOUBLE WORD
40-bit signed value
h
h
h
h
Need help?
Do you have a question about the ST10 Series and is the answer not in the manual?
Questions and answers