This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ms of these instructions: the lowest register is transferred to or from the lowest address, and then the other registers are transferred in order of register number to or from consecutive word addresses above the first. However there are several variations on how the first address is formed, and auto-indexing is also available (again by adding a '!' after the base register). Stack addressing The addressing variations stem from the fact that one use of these instructions is to implement stacks within memory. A stack is a form of last-in-first-out store which supports simple dynamic memory allocation, that is, memory allocation where the address to be used to store a data value is not known at the time the program is compiled or assembled. An example would be a recursive function, where the depth of recursion depends on the value of the argument. A stack is usually implemented as a linear data structure which grows up (an ascending stack) or down (a descending stack) memory as data is added to it and shrinks back as data is removed. A stack pointer holds the address of the current top of the stack, either by pointing to the last valid data item pushed onto the stack (a full stack), or by pointing to the vacant slot where the next data item will be placed (an empty stack). The above description suggests that there are four variations on a stack, representing all the combinations of ascending and descending full and empty stacks. The ARM multiple register transfer instructions support all four forms of stack: Full ascending: the stack grows up through increasing memory addresses and the base register points to the highest address containing a valid item. Data transfer instructions 61 Empty ascending: the stack grows up through increasing memory addresses and the base register points to the first empty location above the stack. Full descending: the stack grows down through decreasing memory addresses and the base register points to the lowest address containing a valid item. Empty descending: the stack grows down through decreasing memor...
View Full Document
- Spring '09