Multiply and Accumulate
MAC
7-103
Assembly Language Instructions
Description
The MAC instruction:
-
Adds the previous product, shifted as defined by the PM status bits, to the
accumulator. The carry bit is set (C = 1) if the result of the addition gener-
ates a carry and is cleared (C = 0) if it does not generate a carry.
-
Loads the TREG with the content of the specified data-memory address.
-
Multiplies the data-memory value in the TREG by the contents of the spe-
cified program-memory address.
The data and program memory locations on the ’C2xx may be any nonre-
served on-chip or off-chip memory locations. If the program memory is block
B0 of on-chip RAM, the CNF bit must be set to 1.
When the MAC instruction is repeated, the program-memory address con-
tained in the PC is incremented by 1 during each repetition. This makes it pos-
sible to access a series of operands in program memory. If you use indirect
addressing to specify the data-memory address, a new data-memory address
can be accessed during each repetition. If you use the direct addressing mode,
the specified data-memory address is a constant; it will not be modified during
each repetition.
MAC is useful for long sum-of-products operations because, when repeated,
it becomes a single-cycle instruction once the RPT pipeline is started.
Words
2