ARM programmer’s model
M. Anbuselvi
ASP/ECE
2 v 1.1
Session Objective
• To understand ARM programmer’s model
– Register set
– Memory system
– Exceptions
3 v 1.1
ARM programmer’s model
• 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.
• Note that although a processor will typically have many invisible
registers involved in executing an instruction,
• The values of these registers before and after the instruction is
executed are not significant;
• Only the values in the visible registers have any significance.
4 v 1.1
ARM programmer’s model
• 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)
• The remaining registers are used only for system-level programming
and for handling exceptions (for example, interrupts).
5 v 1.1
ARM programmer’s model
6 v 1.1
ARM programmer’s model
• Modes of ARM processor
• User mode  Non-Privileged mode
• Supervisor mode
• Abort mode
• Interrupt mode
• Fast interrupt mode
• Undefined mode
Privileged mode
7 v 1.1
ARM programmer’s model
• CPSR
8 v 1.1
ARM programmer’s model
• Memory system
9 v 1.1
ARM programmer’s model
• Exceptions:
• The current state is saved by copying the PC into r14_exc and the
CPSR into SPSR_exc (where exc stands for the exception type).
• The processor operating mode is changed to the appropriate
exception mode.
• The PC is forced to a value between 0016 and 1C16, the particular
value depending on the type of exception.
10 v 1.1
ARM programmer’s model
• The instruction at the location the PC is forced to (the vector
address) will usually contain a branch to the exception handler.
• The exception handler will use r13_exc, which will normally have
been initialized to point to a dedicated stack in memory, to save
some user registers for use as work registers.
• The return to the user program is achieved by restoring the user
registers and then using an instruction to restore the PC and the
CPSR atomically.
• This may involve some adjustment of the PC value saved in r14_exc
to compensate for the state of the pipeline when the exception arose
11 v 1.1
ARM development tools
• Cross- development
12 v 1.1
Summary
• Learnt the ARM programmer’s model
13 v 1.1
Test Your Understanding
• How many modes are there in ARM processor and what
are privileged modes?
• What are exceptions? What are the registers involved in
handling the exceptions?
14
References
• Steve Furber, ‘’ARM System - On - Chip architecture”
Addision Wesley, 2000.
15 v 1.1
Thank you

ARM programmer's model.pdf

  • 1.
    ARM programmer’s model M.Anbuselvi ASP/ECE
  • 2.
    2 v 1.1 SessionObjective • To understand ARM programmer’s model – Register set – Memory system – Exceptions
  • 3.
    3 v 1.1 ARMprogrammer’s model • 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. • Note that although a processor will typically have many invisible registers involved in executing an instruction, • The values of these registers before and after the instruction is executed are not significant; • Only the values in the visible registers have any significance.
  • 4.
    4 v 1.1 ARMprogrammer’s model • 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) • The remaining registers are used only for system-level programming and for handling exceptions (for example, interrupts).
  • 5.
    5 v 1.1 ARMprogrammer’s model
  • 6.
    6 v 1.1 ARMprogrammer’s model • Modes of ARM processor • User mode  Non-Privileged mode • Supervisor mode • Abort mode • Interrupt mode • Fast interrupt mode • Undefined mode Privileged mode
  • 7.
    7 v 1.1 ARMprogrammer’s model • CPSR
  • 8.
    8 v 1.1 ARMprogrammer’s model • Memory system
  • 9.
    9 v 1.1 ARMprogrammer’s model • Exceptions: • The current state is saved by copying the PC into r14_exc and the CPSR into SPSR_exc (where exc stands for the exception type). • The processor operating mode is changed to the appropriate exception mode. • The PC is forced to a value between 0016 and 1C16, the particular value depending on the type of exception.
  • 10.
    10 v 1.1 ARMprogrammer’s model • The instruction at the location the PC is forced to (the vector address) will usually contain a branch to the exception handler. • The exception handler will use r13_exc, which will normally have been initialized to point to a dedicated stack in memory, to save some user registers for use as work registers. • The return to the user program is achieved by restoring the user registers and then using an instruction to restore the PC and the CPSR atomically. • This may involve some adjustment of the PC value saved in r14_exc to compensate for the state of the pipeline when the exception arose
  • 11.
    11 v 1.1 ARMdevelopment tools • Cross- development
  • 12.
    12 v 1.1 Summary •Learnt the ARM programmer’s model
  • 13.
    13 v 1.1 TestYour Understanding • How many modes are there in ARM processor and what are privileged modes? • What are exceptions? What are the registers involved in handling the exceptions?
  • 14.
    14 References • Steve Furber,‘’ARM System - On - Chip architecture” Addision Wesley, 2000.
  • 15.