Texas Instruments TMS320C3x 사용자 설명서

다운로드
페이지 757
Circular Addressing
6-23
Addressing Modes
In circular addressing, 
index refers to the K LSBs (from the K-bit boundary criteria)
of the auxiliary register selected, and 
step is the quantity being added to or
subtracted from the auxiliary register. Follow these two rules when you use cir-
cular addressing:
-
The step used must be less than or equal to the block size. The step size
is treated as an unsigned integer. If an index register (IR) is used as a step
increment or decrement, it is also treated as an unsigned integer.
-
The first time the circular queue is addressed, the auxiliary register must
be pointing to an element in the circular queue.
The algorithm for circular addressing is as follows:
If 0 
 index + step < BK:
index = index + step.
Else if index + step 
BK:
index = index + step – BK.
Else if index + step < 0:
index = index + step + BK.
Figure 6–7 shows how the circular buffer is implemented and illustrates the
relationship of the quantities generated and the elements in the circular buffer.
Figure 6–7. Circular Buffer Implementation
Top of circular buffer
H . . . H
0 . . . 0
H . . . H
H . . . H
L . . . L
LSBs BK
Element 0
Element 1
Element (K LSBs of AR
n
)
Last element
Last element + 1
31
K K – 1
0
31
0
31
0
Effective base (EB)
Auxiliary register (AR
n
)
Address
Data
MSBs of AR
n
MSBs of AR
n
LSBs of AR
n
MSBs of AR
n
K K – 1
K K – 1
Example 6–24 shows circular addressing operation. Assuming that all ARs
are four bits, let AR0  =  0000 and BK  =   0110 (block size of 6). Example 6–24
shows a sequence of modifications and the resulting value of AR0.
Example 6–24 also shows how the pointer steps through the circular queue
with a variety of step sizes (both incrementing and decrementing).