ADDRESSING

ADDRESS POINTER

CIRCULAR

BUFFER

UPPER BOUNDARY

M = MODULUS

LOWER BOUNDARY

Figure 4-11 Circular Buffer

(base address), it will wrap around through the base address plus M–1 (upper boundary).

If an offset (Nn) is used in the address calculations, the 16-bit absolute value, Nn, must be less than or equal to M for proper modulo addressing in this range. If Nn>M, the result is data dependent and unpredictable, except for the special case where Nn=P x 2k, a mul- tiple of the block size where P is a positive integer. For this special case, when using the (Rn)+ Nn addressing mode, the pointer, Rn, will jump linearly to the same relative address in a new buffer, which is P blocks forward in memory (see Figure 4-12).

Similarly, for (Rn)–Nn, the pointer will jump P blocks backward in memory. This technique is useful in sequentially processing multiple tables or N-dimensional arrays. The range of values for Nn is –32,768 to + 32,767. The modulo arithmetic unit will automatically wrap around the address pointer by the required amount. This type of address modification is useful for creating circular buffers for FIFOs (queues), delay lines, and sample buffers up to 32,768 words long as well as for decimation, interpolation, and waveform generation. The special case of (Rn) ± Nn mod M with Nn=P x 2k is useful for performing the same algorithm on multiple blocks of data in memory — e.g., parallel infinite impulse response (IIR) filtering.

An example of address register indirect modulo addressing is shown in Figure 4-13.Start- ing at location 64, a circular buffer of 21 stages is created. The addresses generated are offset by 15 locations. The lower boundary = L x (2k) where 2k 21; therefore, k=5 and the lower address boundary must be a multiple of 32. The lower boundary may be chosen

MOTOROLA

ADDRESS GENERATION UNIT

4 - 19

Page 72
Image 72
Motorola DSP56000, 24-Bit Digital Signal Processor manual Circular Buffer