Example 6–23. examples of formula – Texas Instruments TMS320C3x User Manual

Page 175

Advertising
background image

Circular Addressing

6-22

Figure 6–6. Logical and Physical Representation of Circular Buffer after Writing Eight Values

Start

End

a) Logical representation

value6

value7

value2

value6

value2

value7

b) Physical representation

value5

value3

value4

value3

value4

value5

Start

End

To implement a circular buffer in the ’C3x, the following criteria must be satis-
fied (more than one circular buffer can be implemented on the ’C3x as long as
the size of the buffers are identical):

-

Specify the size of the circular buffer (R) by storing the length of the buffer
in the block-size register (BK). The size of the buffer must be less than or
equal to 64K (16 bits).

-

Align the start of the buffer to a K-bit boundary (that is, the K LSBs of the
starting address of the circular buffer must be 0) by satisfying the following
formula:

2

K

> R

where:

R = length of circular buffer
K = number of 0s in the LSBs of the circular buffer starting address

Example 6–23. Examples of Formula

2

K

> R

Length of Buffer

BK Register Value

Starting Address of Buffer

31

31

XXXXXXXXXXXXXXXXXXX00000

2

32

32

XXXXXXXXXXXXXXXXXX000000

2

1024

1024

XXXXXXXXXXXXX00000000000

2

Advertising