Arm Program Model
Arm Program Model
2. Describe ARM programmer's model in detail. [OR] Explain the various operating
modes programmers model in ARM processor. [Nov’16] [OR] Explain the ARM
programmer’s model in detail, with supporting diagram. [Apr’17] [OR] Draw and
explain the visible registers in an ARM processor. [Apr’18]
A processor's instruction set defines the operations that the programmer can use to
change the state of the system incorporating the processor.
This state usually comprises the values of the data items in the processor's visible
registers and the system's memory.
Each instruction can be viewed as performing a defined transformation from the state
before the instruction is executed to the state after it has completed.
The visible registers in an ARM processor are shown in Figure.
When writing user-level programs, only the 15 general-purpose 32-bit registers (r0 to
r14), the program counter (r15) and the current program status register (CPSR) need be
considered.
The remaining registers are used only for system-level programming and for handling
exceptions (for example, interrupts).
ARM's visible registers
N: Negative; the last ALU operation which changed the flags produced a negative
result (the top bit of the 32-bit result was a one).
Z: Zero; the last ALU operation which changed the flags produced a zero result
(every bit of the 32-bit result was zero).
C: Carry; the last ALU operation which changed the flags generated a carry-out,
either as a result of an arithmetic operation in the ALU or from the shifter.
V: Overflow; the last arithmetic ALU operation which changed the flags generated an
overflow into the sign bit.
Load-store architecture
In common with most RISC processors, ARM employs a load-store architecture.
This means that the instruction set will only process (add, subtract, and so on) values
which are in registers (or specified directly within the instruction itself), and will always
place the results of such processing into a register.
The only operations which apply to memory state are ones which copy memory values
into registers(load instructions) or copy register values into memory (store instructions).
CISC processors typically allow a value from memory to be added to a value in a
register, and sometimes allow a value in a register to be added to a value in memory.
ARM does not support such 'memory-to-memory' operations.
Therefore all ARM instructions fall into one of the following three categories:
Data processing instructions.
These use and change only register values.
For example, an instruction can add two registers and place the result in a
register.