Hi,
When I read ARM Thumb2 instruction manual, I find a problem on STMIA / STMEA.
It said: "Store Multiple Increment After (Store Multiple Empty Ascending) stores multiple registers to consecutive memory locations using an address from a base register."
Does that mean STMIA is equivalent to STMEA?
Then, when I try to find the answer online, I have more questions on this topic. Below the dot line is from Keil website. Although it gives more explanation, I don't understand it, especially Table 4.5 and 4.6.
For example, on Table 4.5, there is one row has content:
FD (Full Descending stack) DB (Decrement Before) IA (Increment After)
I don't see the relationship between 'DB' and 'IA'. Could you explain it to me a little more?
Thanks in advance.
...............
The load and store multiple instructions can update the base register. For stack operations, the base register is usually the stack pointer, SP. This means that you can use these instructions to implement push and pop operati ons for any number of registers in a single instruction. The load and store multiple instructions can be used with several types of stack: Descending or ascending The stack grows downwards, starting with a high address and progressing to a lower one (a descending stack), or upwards, starting from a low address a nd progressing to a higher address (an ascending stack). Full or empty The stack pointer can either point to the last item in the stack (a full st ack), or the next free space on the stack (an empty stack). To make it easier for the programmer, stack-oriented suffixes can be used i nstead of the increment or decrement, and before or after suffixes. The fol lowing table shows the stack-oriented suffixes and their equivalent address ing mode suffixes for load and store instructions: Table 4-5 Stack-oriented suffixes and equivalent addressing mode suffixes
Stack-oriented suffix For store or push instructions For load or pop instru ctions FD (Full Descending stack) DB (Decrement Before) IA (Increment After) FA (Full Ascending stack) IB (Increment Before) DA (Decrement After) ED (Empty Descending stack) DA (Decrement After) IB (Increment Before) EA (Empty Ascending stack) IA (Increment After) DB (Decrement Before) The following table shows the load and store multiple instructions with the stack-oriented suffixes for the various stack types: Table 4-6 Suffixes for load and store multiple instructions
Stack type Store Load Full descending STMFD (STMDB, Decrement Before) LDMFD (LDM, increment after ) Full ascending STMFA (STMIB, Increment Before) LDMFA (LDMDA, Decrement Afte r) Empty descending STMED (STMDA, Decrement After) LDMED (LDMIB, Increment Bef ore) Empty ascending STMEA (STM, increment after) LDMEA (LDMDB, Decrement Before ) For example: STMFD sp!, {r0-r5} ; Push onto a Full Descending Stack LDMFD sp!, {r0-r5} ; Pop from a Full Descending Stack