dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 225

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
The location of the buffer in memory is determined by the value of the R0 pointer when it is used to access
memory. The size of the memory buffer (five in this case) is rounded up to the nearest power of two, which
is eight. The value in R0 is then rounded down to the nearest multiple of eight. For the base address to be
X:$0800, the initial value of R0 must be in the range X:$0800–X:$0804. Note that the initial value of R0
does not have to be X:$0800 to establish this address as the lower bound of the buffer. However, it is often
convenient to set R0 to the beginning of the buffer. The source code in Example 6-10 shows the
initialization of the example buffer.
The buffer is used simply through being accessed with MOVE instructions. The effect of modulo address
arithmetic becomes apparent when the buffer is accessed multiple times, as in Example 6-11.
For the first several memory accesses, the buffer pointer is incremented as expected, from $0800 to $0801,
$0802, and so forth. When the pointer reaches the top of the buffer, rather than incrementing from $0804 to
$0805, the pointer value “wraps” back to $0800.
The behavior is similar when the buffer pointer register is incremented by a value greater than one.
Consider the source code in Example 6-12 on page 6-32, where R0 is post-incremented by three rather
than one. The pointer register correctly “wraps” from $0803 to $0801—the pointer does not have to land
exactly on the upper or lower bound of the buffer for the modulo arithmetic to wrap the value properly.
Freescale Semiconductor
MOVEU.W
MOVEU.W
MOVE.W
MOVE.W
MOVE.W
MOVE.W
MOVE.W
MOVE.W
MOVE.W
MOVE.W
R0
#(5-1),M01
#$0800,R0
X:(R0)+,X0
X:(R0)+,X0
X:(R0)+,X0
X:(R0)+,X0
X:(R0)+,X0
X:(R0)+,X0
X:(R0)+,X0
X:(R0)+,X0
Figure 6-9. Simple Five-Location Circular Buffer
Example 6-11. Accessing the Circular Buffer
Example 6-10. Initializing the Circular Buffer
Circular
Address Generation Unit
Buffer
; Initialize the buffer for five locations
; R0 can be initialized to any location
; within the buffer. For simplicity, R0
; is initialized to the value of the lower
; boundary
; First time accesses location $0800
; and bumps the pointer to location $0801
; Second accesses at location $0801
; Third accesses at location $0802
; Fourth accesses at location $0803
; Fifth accesses at location $0804
; and bumps the pointer to location $0800
; Sixth accesses at location $0800 <=== NOTE
; Seventh accesses at location $0801
; and so forth...
$0804
$0800
M01 Register = Size – 1 = 5 – 1 = $0004
Linear and Modulo Address Arithmetic
6-31

Related parts for dsp56800e