Circular Addressing
6-24
Example 6–24. Circular Addressing
*AR0 ++ (5)%
;
AR0 = 0
(0
value)
*AR0 ++ (2)%
;
AR0 = 5
(1st
value)
*AR0 – – (3)%
;
AR0 = 1
(2nd
value)
*AR0++(6)%
;
AR0 = 4
(3rd value)
*AR0 – – %
;
AR0 = 4
(4th
value)
*AR0
;
AR0 = 3
(5th value)
Element 0
Element 1
Element 2
Element 3
Element 4
Element 5 (last element)
Last e 1
0
1
2
3
4
5
6
0
2nd
5th
4th, 3rd
1st
Value
Data
Address
→
→
→
→
→
Circular addressing is especially useful for the implementation of FIR filters.
Figure 6–8 shows one possible data structure for FIR filters. Note that the ini-
tial value of AR0 points to h(N –1), and the initial value of AR1 points to x(0).
Circular addressing is used in the ’C3x code for the FIR filter shown in
Example 6–25.
Figure 6–8. Data Structure for FIR Filters
h(N –1)
h(N – 2)
h(2)
h(1)
h(0)
x(N –1)
x(N – 2)
x(2)
x(1)
x(0)
AR0
AR1
Impulse response
Input samples
.
.
.
.
.
.
→
←