<< Chapter < Page | Chapter >> Page > |
CDP indirect addressing uses the coefficient data pointer (CDP) to point to data. For accessing data memory/registers, the 16-bit CDP is combined with the 7-bit CDPH to generate a 23-bit address. When concatenated, they are called the XCDP. CDP indirect addressing can also be used to address a specific bit in the accumulators, auxiliary registers, and the temporary registers. Pre- and post-increment and decrement as well as an offset can be used with CDP. CDP can be used as an operand in place of Smem, Lmem, and Cmem.
MOV dbl(Lmem), Cmem
MOV dbl(*AR7), *CDP+ ; Values at XAR7 and XAR7 + 1 are read and stored at
; XCDP and XCDP +/- 1 depending on if XCDP was even or odd.
; CDP is incremented by 2 at the end.
Coefficient indirect addressing uses the same address generation process as CDP indirect addressing for data-space accesses. It is useful for instructions that need three memory operands per cycle. It can be used for finite impulse response filters, multiply [accumulate/subtract], and dual multiply [accumulate/subtract].
MPY Xmem, Cmem, ACx
:: MPY Ymem, Cmem, ACy ; Cmem must be in a different memory bank from Xmem/Ymem
; for this to work in a single cycle
MPY *AR1+, *CDP+, AC0
:: MPY *AR2+, *CDP+, AC1 ; The value at address XAR1 is multiplied by value at
; address XCDP and stored in AC0. At the same time,
; value at XAR2 is multiplied by value at address XCDP
; and stored in AC1. Then CDP is incremented.
AMAR *AR3+ ; increments AR3 by 1
amar
(modify auxiliary register) instruction
is unusual in the sense that it takes an
Smem
operand but does nothing with the data pointed to by the
ARx
register. Its purpose is to perform any
of the allowed register modifications discussed abovewithout having to do anything else. This is often handy
when you are using an
Xmem/Ymem
-type
instruction but need to do an
ARx
modification that is only allowed with an
Smem
-type operand.Circular addressing is useful when implementing circular buffers. Circular addressing needs to be enabled for the specific register that is being used to point to memory. This is done by setting the corresponding
ARnLC
register using
BSET ARnLC
. When circular addressing is not needed,
BCLR ARnLC
on the corresponding ARn will disable circular addressing. The circular addressing length will depend on the
BK03
,
BK47
, and
BKC
register values. If you are using
AR0
through
AR3
for the addressing, then
BK03
will be used.
BKC
is the buffer length for
CDP
. One thing to watch out for is the buffer start address registers (BSA01, BSA23, BSA45, BSA67, BSAC) are added to the auxiliary register or CDP register value whenever circular addressing is used. Be sure to re-initialize the BSA register when implementing multiple filters.
BSET AR1LC ; sets circular addressing for AR1
BCLR AR2LC ; normal addressing for AR2
MOV #13, BK03 ; set buffer length for AR0 through AR3
MACM *AR1+, *AR2+, AC0 ; AC0 = AC0 +
; (value at memory location AR1 + BSA01) x (value at memory location AR2)
; AR1 is incremented with circular addressing, length 13.
; AR2 is simply incremented by 1
Bit-reversed addressing is often needed with the fast-fourier transform (FFT). This helps to set up a pointer for the next iteration. Enable bit-reversing on an operand by adding a
B
after the increment value. When a bit-reverse operand is used, the auxiliary register can not be used for circular addressing. If circuluar address is enabled, the corresponding buffer start address value (BSAxx) will be added to ARn, but ARn is not modified to stay within the circular buffer.
MOV Smem, dst
MOV *(AR4 + T0B), T2 ; T2 = value at memory location XAR4
; AR4 is incremented with T0, using reverse carry propagation.
Notification Switch
Would you like to follow the 'Digital signal processing laboratory (ece 420 55x)' conversation and receive update notifications?