dsp56800 Freescale Semiconductor, Inc, dsp56800 Datasheet - Page 109

no-image

dsp56800

Manufacturer Part Number
dsp56800
Description
16-bit Digital Signal Controllers
Manufacturer
Freescale Semiconductor, Inc
Datasheet
4.3.2.3
The address generation unit supports modulo arithmetic for the following address-register-indirect modes:
As noted in the preceding discussion, modulo arithmetic is only supported for the R0 and R1 address
registers.
4.3.2.4
Suppose a five-location circular buffer is needed for an application. The application locates this buffer at
X:$800 in memory. (This location is arbitrary — any location in an allowable data memory would suffice.)
In order to configure the AGU correctly to manage this circular buffer, the following two pieces of
information are needed:
Modulo addressing is enabled for the R0 pointer by writing the size minus one ($0004) to M01[13:0], and
00 to M01[15:14]. See Figure 4-17.
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 (eight
in this case). 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 4-1 shows the
initialization of the example buffer.
Freescale Semiconductor
The size of the buffer: five words
The location of the buffer: X:$0800 – X:$0804 (assume allowable memory locations)
MOVE
MOVE
Supported Memory Access Instructions
Simple Circular Buffer Example
#(5-1),M01
#$0800,R0
R0
(Rn)
(Rn)-
(Rn+N)
Figure 4-17. Simple Five-Location Circular Buffer
Example 4-1. Initializing the Circular 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
Circular
Buffer
Address Generation Unit
$0804
$0800
(Rn)+N
(Rn)+
(Rn+xxxx)
M01 Register = Size - 1 = 5 - 1 = $0004
AGU Address Arithmetic
4-29

Related parts for dsp56800