CHAPTER 3 CPU
Preliminary User’s Manual A14874EJ3V0UM
53
3.2.1 Program registers
The program registers include the general-purpose registers (r0 to r31) and the program counter (PC).
Table 3-1. List of Program Registers
Program Register
Name
Function
r0
Zero register (always holds zero)
r1
Assembler-reserved register (used as a working register for address generation)
r2
Address/data variable register (when this register is not used by the real-time OS)
r3
Stack pointer (used to generate a stack frame when a function is called)
r4
Global pointer (used to access a global variable of the data area)
r5
Text pointer (used as the register indicating the beginning of the text area (area for locating
program code))
r6 to r29
Registers for address/data variables
r30
Element pointer (used as the base pointer for address generation when accessing memory)
General-purpose
register
r31
Link pointer (used when the compiler calls a function)
Program counter
PC
Holds instruction address during program execution
Remark
For detailed explanations of r1, r3 to r5, and r31, which are used by the assembler or C compiler, refer
to the
C Compiler Package (CA850) User’s Manual
.
(1) General-purpose registers
The 32 registers r0 to r31 are provided as general-purpose registers. All of these registers can be used for data
variables or address variables.
However, take note of the following points when using the r0 to r5, r30, and r31 registers.
(a) r0, r30
These registers are implicitly used by instructions.
r0, which is a register that always holds 0, is used by operations that use 0, or in 0-offset addressing.
r30 is used as a base pointer when accessing memory by the SLD and SST instructions.
(b) r1, r3 to r5, r31
These registers are implicitly used by the assembler and C compiler.
The contents of these registers must be saved before they are used so that the contents are not destroyed,
and the original contents must be returned after use.
(c) r2
This register may be used by the real-time OS.
When not being used by the real-time OS, r2 can be used as an address variable or data variable register.