Академический Документы
Профессиональный Документы
Культура Документы
com
A property of MVG_OMALLOOR
Addressing
Addressing refers to means to specify location of
operands for instructions
types of addressing are called addressing modes
operands may be input operands for the operation as
Addressing Modes well as results of the operation
DSPs contain separate address generation units
(AGU)
arithmetic units dedicated for address calculation
ÂAnalog Devices refers to data address generator,
Lucent Technologies refers address arithmetic
unit
1 2
Memory-
Memory-Direct Addressing Register-
Register-Direct Addressing
absolute addressing The operand can be found from a specified
The address of operand is encoded into the register
instruction or can be found from a separate data ÂIn TMS320C3X, value in register R1 is subtracted
word following the instruction from value in register R2 and the result is stored
ÂIn ADSP-21xx, an operand in address 1000 is in R2 as follows:
loaded into register AX0 as follows: SUBF R1,R2
AX0 = DM(1000)
Small addresses can be encoded into the Important addressing mode in load-store
instruction word processors
Long addresses requires a separate data word
following the instruction code
5 6
Register-
Register-Indirect Addressing with
Register-
Register-Indirect Addressing Pre-
Pre- or Post-
Post-Increment
Operand is located in memory address stored in a register Many DSP algorithms access data arrays sequentially
address generation unit can increment the address value in address
Special group of registers can be used to store addresses register
(address registers) z before the memory access (pre-increment)
z after the memory access (post-increment)
Most important addressing mode in DSPs  DSP32xx:
Natural pointing mechanism when working with data arrays A0 = A0 + *R5++; post-increment by one
z Allows automatic modification of pointers A0 = A0 + *R5--; post-decrement by one
Efficient from instruction set point of view Some DSPs support address increment or decrement with a value in
another register (offset register, modifier register)
z Few bits are needed to indicate address of operand
 In DSP32xx address register R5 is post-incre-mented with value
 In Lucent DSP32C, value pointed by the contents of stored in register R17 as follows
register R5 is added to value in accumulator A0: A0 = A0 + *R5++R17;
A0 = A0 + *R5 Â In DSP5600x:
MOVE X:-(R0), A1; pre-decrement R0
Pre-increment operation requires typically extra instruction cycle
7 8
A property of MVG_OMALLOOR
Register-
Register-Indirect Addressing with Register-
Register-Indirect Addressing with
Indexing Indexing
effective address is obtained by adding value in address Compilers utilize indexed addressing Stack Frame Pointer
reg-ister and value in another register (index register) for passing parameters in stack
Address Register
together
A stack frame is created each time a
Values in registers are not modified like in previous addressing STACK
Register-
Register-Indirect Addressing with Register-
Register-Indirect Addressing with
Modulo Address Arithmetic Modulo Address Arithmetic
Data buffer management often needed in DSP applications modulo addressing (circular addressing) provides
In embedded systems, dynamic memory management is expensive hardware support for checking the end of the
Typically need for first-in-first-out (FIFO) buffer
Programmer maintains two pointers:
address registers are updated with pre- or post-
z Read pointer: address of memory location to be read next
z Write pointer: address of memory location where the next data value is
increment
to be written address generation performs modulo arithmetic on
each time read or write operation is computation
performed, the programmer needs to
Öprogrammer sees a circular buffer
check whether the end of buffer has
been reached X0 X1 X2 X3
ReadPointer X2 X3
in the end of buffer, the pointer is X1
buffer
11 12
A property of MVG_OMALLOOR
Register-
Register-Indirect Addressing with Register-
Register-Indirect Addressing with
Modulo Address Arithmetic Modulo Address Arithmetic
Implementation #1 Â DSP56001 and DSP96002 have address register triplets Rx, Nx, and Mx,
where x is 0 - 7. The address is stored into Rx, the increment used in
Programmer needs to store the length of circular buffer post-auto-increment addressing is stored into Nx, and the length of
into a special modifier or modulo register modulo-mode addressing buffer is in Mx. These register can be read and
written via the general data bus.
Each modifier register is associated with one or more address
registers  Auto-increment and modulo-mode arithmetic is performed at an
independent address ALU. Thus, it is possible to access two circular
Starting address or the buffer is not specified; buffers simultaneously.
address register must contain a valid value before usage
General data bus (24)
z circular buffers must begin at k-word boundaries, where k is smallest
N0 M0 R0 R4 M4 N4
power of two that is equal or greater than the size of buffer N1 M1 ADDRESS R1 R5 ADDRESS M5 N5
ALU ALU
z 48-word circular buffer must reside in 64-word boundary, i.e., starting N2 M2 LOW R2 R6 HIGH M6 N6
N3 M3 R3 R7 M7 N7
address may be 0, 64, 128, 192 etc.
This kind of mechanism can be found from TI TMS320C3X and 4X,
Motorola, NEC, and Analog Devices DSPs mux mux mux
13 14
Register-
Register-Indirect Addressing with
Modulo Address Arithmetic Modulo Arithmetic in Lucent DSP16xx
Implementation #2
alternative mechanism is to utilize start and end
registers data bus
15 16
A property of MVG_OMALLOOR
Register-
Register-Indirect Addressing with Register-
Register-Indirect Addressing with
Modulo Address Arithmetic Bit Reversal
Different DSP may support different number of Bit reversed addressing used mainly in FFT
simultaneous circular buffers Memory location
BEFORE permutation
Index mapping
decimal binary
ÂTI TMS320C5x supports two circular buffers and x0 0
X0 0 0 111 111
W80
1
Motorola DSP561xx four buffers. Motorola x1
W40
X1 1 4 001 100
2
DSP5600x and Analog Devices DSP support x2
W40 W82 3
X2 2 2 010 010
x3
eight circular buffers. W20
4
X3 3 6 011 110
x4 X4 4 1 100 001
W20 W81
5
x5 X5 5 5 101 101
W20 W41
x6 6 X6 6 3 110 011
0 1 3
W2 W4 W8
x7 7 7 7 111 111
X7
17 18
Register-
Register-Indirect Addressing with
Bit Reversal Short Addressing Modes
Hardware implementation may be Some addressing modes require several words in
Real bit reversal between address register and address program memory (instruction code and data word)
bus
Reverse-carry arithmetic in AGU Some DSPs offer short versions which require
 In TMS320C3X, bit-reversed addressing mode notation is only one instruction word
symbol "B". Let us suppose the data be stored in memory
starting from address 60h (= AR2) and the length of FFT is ÖShort versions set some restriction on usage
16 (IR0 contains 8, the half of the length of FFT):
Typical short addressing modes are:
*AR2++(IR0)B; AR2 = 0110 0000 = 60 (0. sample)
*AR2++(IR0)B; AR2 = 0110 1000 = 68 (1. sample) Short immediate
*AR2++(IR0)B; AR2 = 0110 0100 = 64 (2. sample)
*AR2++(IR0)B; AR2 = 0110 1100 = 6c (3. sample) Short memory-direct
*AR2++(IR0)B; AR2 = 0110 0010 = 62 (4. sample)
*AR2++(IR0)B; AR2 = 0110 1010 = 6a (5. sample) Paged memory-direct
*AR2++(IR0)B; AR2 = 0110 0110 = 66 (6. sample)
*AR2 ; AR2 = 0110 1110 = 6e (7. sample)
19 20
A property of MVG_OMALLOOR
Paged Memory-
Memory-Direct Addressing
Special page register is used to hold number of
page or section of memory to be accessed
When access outside this page is required, the page
register must be updated
23
A property of MVG_OMALLOOR
Instruction Set
Defines what are natural and efficient operations
on the processor
A processor with more instructions is not
necessarily better
Instruction Set and Execution Control Specialized instructions may require more silicon
area
Traditional instruction types
Multiplication and arithmetic
Logic operations
Shifting and rotation
Comparison
1 2
Looping Looping
DSP applications require repeated execution of ÂSoftware looping takes roughly three time longer
small number of arithmetic or multiplication to execute than hardware looping in the following:
instructions ;SW LOOPING
If number of instructions in inner loop is small, MOVE #16,B
overhead in looping lowers the performance LOOP: MAC (R0)+,(R4)+,A
Öall DSPs provide hardware looping instructions DEC B
(zero-overhead looping) JNE LOOP
repeat a single instruction or a block of instructions ;HW LOOPING
without the normal decrement-test-branch sequence RPT #16
loop counter increment, test against end condition, and MAC (R0)+,(R4)+,A
branching are done by hardware
3 4
A property of MVG_OMALLOOR
5 6
7 8
A property of MVG_OMALLOOR
11 12