English
Language : 

S3C3410X Datasheet, PDF (123/314 Pages) Samsung semiconductor – 16-Bit CMOS Microcontrollers
S3C3410X RISC MICROPROCESSOR
FORMAT 13: ADD OFFSET TO STACK POINTER
ARM INSTRUCTION SET
15 14 13 12 11 10 9 8 7 6
0
1 0 1 1 0 0 0 0S
SWord 7
[6:0] 7-bit Immediate Value
[7] Sign Flag
0 = Offset is positive
1 = Offset is negative
Figure 3-42. Format 13
OPERATION
This instruction adds a 9-bit signed constant to the stack pointer. The following table shows the THUMB
assembler syntax.
Table 3-20. The ADD SP Instruction
L
THUMB assembler
0 ADD SP, #Imm
1 ADD SP, # -Imm
ARM equivalent
ADD R13, R13, #Imm
SUB R13, R13, #Imm
Action
Add #Imm to the stack pointer (SP).
Add #-Imm to the stack pointer (SP).
NOTE: The offset specified by #Imm can be up to –/+ 508, but must be word-aligned (ie with bits 1:0 set to 0)
since the assembler converts #Imm to an 8-bit sign + magnitude number before placing it in field SWord7.
The condition codes are not set by this instruction.
INSTRUCTION CYCLE TIMES
All instructions in this format have an equivalent ARM instruction as shown in Table 3-20. The instruction cycle
times for the THUMB instruction are identical to that of the equivalent ARM instruction.
EXAMPLES
ADD
ADD
SP, #268
SP, #–104
; SP (R13) := SP + 268, but don't set the condition codes.
; Note that the THUMB opcode will
; contain 67 as the Word7 value and S=0.
; SP (R13) := SP – 104, but don't set the condition codes.
; Note that the THUMB opcode will contain
; 26 as the Word7 value and S=1.
3-85