4 multiple wrap-around modulo addressing mode, Multiple wrap-around modulo addressing mode -47 – Freescale Semiconductor StarCore SC140 User Manual

Page 79

Advertising
background image

Address Generation Unit

SC140 DSP Core Reference Manual

2-47

Table 2-21 describes the modulo register values and the corresponding address calculation.

2.3.4.4 Multiple Wrap-Around Modulo Addressing Mode

Multiple wrap-around addressing is useful for decimation, interpolation, and waveform generation. The
multiple wrap-around capability can be used for argument reduction. In multiple wrap-around modulo
addressing mode, the modulus M is a power of 2 in the range of 2

1

to 2

31

. The value M-1 is stored in the

modifier register (Mj). The B registers B0 to B7 are not used for multiple wrap-around modulo addressing;
therefore, their corresponding R8–R15 registers can be used for linear addressing.

The lower and upper boundaries are derived from the contents of Mj. The lower boundary (base address)
value has zeros in the k LSBs where M = 2

k

and therefore must be a multiple of M. The Rn register

involved in the memory access is used to set the MSBs of the base address. The base address is set so that
the initial value in the Rn register is within the lower and upper boundaries. The upper boundary is the
lower boundary plus the modulo size minus one (base address + M–1).

The size of the modulo buffer must be aligned to (be a multiple of) the access width. If the modulus is less
than the access width, the data accessed as well as the address calculations are undefined.

If an offset Ni is used in the address calculations, it is not required to be less than or equal to M for proper
modulo addressing. The multiple wrap-around modulo addressing mode supports unlimited boundary
wraps.

When using the (Rn)+ and (Rn)- addressing modes with a modulus 2

k

≥ 8, there is no functional difference

between the multiple wrap-around and normal modulo modes since the address can only be wrapped
around once.

As an example, consider the instruction

move.w (r0 + $0042),d0

. If the mctl is set to $000c, and m0

is set to $000f, then M0 = 16. If r0 is initially $24 (36), the lower boundary is $20 (32) and the upper
boundary is $2f (47). The memory access is done from address $26 (38), calculated by 36 + 66 = 102,
102–48=54, 54–3x16=6, 6+32=38.

Table 2-21. Modulo Register Values for Modulo Addressing Mode

Modifier Mj

Address Calculation Arithmetic

$0000 0000

Unused

$0000 0001

Modulo 1

$0000 0002

Modulo 2

$7FFF FFFE

Modulo 2

31

-2

$7FFF FFFF

Modulo 2

31

-1

Advertising