4
Data Transfer
4 – 7
4.3
PROGRAMMING DATA ACCESSES
The ADSP-2100 Family Development Software supports the declaration
and use of a simple data structure: one-dimensional arrays, or buffers. The
array may contain a single value (a variable) or multiple values (an array).
In addition, the array may be used as a circular buffer. Here is a brief
discussion of each instance, with an example of how they are declared and
used in assembly language. Complete syntax for all assembler directives is
given in the ADSP-2100 Family Assembler Tools Manual.
4.3.1
Variables & Arrays
Arrays are the basic data structure of the ADSP-21xx. In our literature, the
word “array” and the expression “data buffer” (as well as “variable”) are
used interchangeably. Arrays are declared with assembler directives and
can be referenced indirectly and by name, can be initialized from
immediate values in a directive or from external data files, and can be
linear or circular with automatic wraparound.
An array is declared with a directive such as
.VAR/DM coefficients[128];
This declares an array of 128 16-bit values located in data memory (DM).
The special operators ^ and % reference the address and length,
respectively, of the array. It could be referenced as shown below:
I0=^coefficients; {point to address of buffer}
L0=0; {set L register to zero}
MX0=DM(I0,M0); {load MX0 from buffer}
These instructions load a value into MX0 from the beginning of the
coefficients buffer in data memory. With the automatic post-modify of the
DAGs, you could execute the second of these instructions in a loop and
continuously advance through the buffer.
Alternatively, when you only need to address the first location, you can
directly use the buffer name as a label in many circumstances such as
MX0=DM(coefficients);
The linker substitutes the actual address for the label.