beautypg.com

Macd – Texas Instruments TMS320C2XX User Manual

Page 260

background image

Multiply and Accumulate With Data Move

MACD

7-107

Assembly Language Instructions

Status Bits

Affected by

Affects

PM and OVM

C and OV

Description

The MACD 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.

-

Copies the contents of the specified data-memory address to the next
higher data-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. If MACD addresses one of
the memory-mapped registers or external memory as a data-memory location,
the effect of the instruction is that of a MAC instruction; the data move will not
occur (see the DMOV instruction description).

When the MACD 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.

MACD functions in the same manner as MAC, with the addition of a data move
for on-chip RAM blocks. This feature makes MACD useful for applications
such as convolution and transversal filtering. When used with RPT, MACD be-
comes a single-cycle instruction once the RPT pipeline is started.

Words

2

Cycles

Cycles for a Single MACD Instruction

Operand

ROM

DARAM

SARAM

External

Operand 1: DARAM/
ROM
Operand 2: DARAM

3

3

3

3+2p

code

Operand 1: SARAM
Operand 2: DARAM

3

3

3

3+2p

code