dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 222

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
Address Generation Unit
; Part 1 - Initialization
; Part 2 - INCORRECT - pointer/offset placement violates rules in Table 6-8
The solution to the above example would be to place $008000 into R0 and #-2 into N. Then the instruction
works correctly.
6.8.4.3
It is possible to use the ADDA instruction to add or subtract immediate offsets from a pointer when
modulo arithmetic is enabled.
6.8.4.3.1
In the case where a positive value is to be added to a pointer, the ADDA instruction can be used. If the
immediate offset satisfies the size restriction in Section 6.8.4.4, then simply use the instruction as shown in
the example below:
BUFF_SIZE EQU
6.8.4.3.2
In the case where a negative value is to be added to a pointer, this can also be accomplished using the
ADDA instruction. If the immediate offset satisfies the size restriction in Section 6.8.4.4, then modulo
operation works correctly if the following formula is used:
BUFF_SIZE EQU
6.8.4.4
Modulo addressing will work correctly with the post-update addressing mode, (Rn)+N, as long as it
satisfies the following condition:
6-28
Offset = Buffer_Size - Desired_Offset
If an offset N is used in the address calculations, the 16-bit absolute value |N| must be less than or
equal to M01 + 1 for proper modulo addressing. This is because only a single modulo wraparound
is detected.
MOVEU.W
MOVEU.W
MOVEU.W
MOVE.W
MOVEU.W
MOVE.L
ADDA
MOVEU.W
MOVE.L
ADDA
Special Case - ADDA Instructions in Modulo Arithmetic
Restrictions on the Offset Values
Case 2. Adding a Negative Immediate Offset to a Pointer
Case 1. Adding a Positive Immediate Offset to a Pointer
Example 6-6. Invalid Use of the Modulo Addressing Mode
Example 6-7. Adding Positive Offset to a Modulo Pointer
#$5-1,M01
#$008000,N
#-2,R0
X:(R0+N),X0
5
#$BUFF_SIZE-1,M01
#$008000,R0
#3,R0
5
#BUFF_SIZE-1,M01
#$008000,R0
#(BUFF_SIZE-2),R0
Example 6-8. Adding “
DSP56800E Core Reference Manual
; Modulo Enabled, buffer size = 5
; Base Pointer for modulo buffer
; NOTE: placed in N, NOT Rn
; Offset Value used in addressing mode
; NOTE: placed in Rn, NOT N
; Performs incorrect arithmetic
;
;
- base pointer in N
- offset value in R0
; Modulo Enabled, buffer size = 5
; Base Pointer for modulo buffer
; Update base pointer using positive value
; Modulo Enabled, buffer size = 5
; Base Pointer for modulo buffer
; Update base pointer by -2
2” to a Modulo Pointer
Freescale Semiconductor

Related parts for dsp56800e