dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 372

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
ALIGNSP
Operation:
If SP is odd:
else if SP is even:
SP → X:(SP)
SP + 2 → SP
Description: The ALIGNSP instruction aligns the stack pointer register (SP) correctly for a long-word value to be
Usage:
Example:
Explanation of Example:
Condition Codes Affected:
Instruction Fields:
Instruction Opcodes:
Timing:
Memory:
A-28
ALIGNSP
Operation
ALIGNSP
X:$1001
X:$1000
Before Execution
SP + 2 → SP
SP + 3 → SP
pushed onto the stack. The SP should point to the (odd) upper word address of the long word in order
for it to be pushed and popped properly. The ALIGNSP instruction guarantees that the SP points to an
odd word address and that at least 2 words are available to receive the long-word value. The value of
the SP previous to the alignment adjustment is placed on the stack (as a long word) so the stack can be
restored to its original state.
ALIGNSP should be used to align the stack prior to pushing a long-word value.
ALIGNSP
MOVE.L Y,X:(SP)+
The SP register initially has a value of $001001. Since the initial value of SP is odd, it is only incre-
mented by two, the original value is pushed onto the stack, and SP is updated. After ALIGNSP is ex-
ecuted, the SP has a new value of $001005. The MOVE.L instruction adds two to the SP (for the
post-increment) after pushing register Y onto the stack, setting the final SP value to $001007.
The condition codes are not affected by this instruction.
3 oscillator clock cycles
1 program word
Operands
5499
0000
C
3
DSP56800E Core Reference Manual
W
1
Align Stack Pointer
SP
15
1
Save SP to the stack and align SP for long memory accesses, pointing
to an empty location
1
1
Assembler Syntax:
12
0
; align the stack for a long word
; push long word on stack
X:$1007
X:$1006
X:$1005
X:$1004
X:$1003
X:$1002
X:$1001
X:$1000
11
0
After Execution
1
1
ALIGNSP(no parallel move)
0000
1001
5499
0000
Comments
1
8
‘Y1’
‘Y0’
7
0
0
Freescale Semiconductor
0
ALIGNSP
0
4
SP
0
3
1
0
0
0

Related parts for dsp56800e