87
Chapter 3
CPU Functions
User’s Manual U16580EE3V1UD00
3.2.1 Program
register
set
The program register set includes general-purpose registers and a program counter.
(1)
General-purpose registers (r0 to r31)
Thirty-two general-purpose registers, r0 to r31, are available. All of these registers can be used as
a data variable or address variable.
However, r0 and r30 are implicitly used by instructions and care must be exercised when using
these registers. r0 always holds 0 and is used for operations that use 0 or offset 0 addressing. r30
is used as a base pointer when performing memory access with the SLD and SST short
instructions.
Also, r1, r3 to r5, and r31 are implicitly used by the assembler and C compiler. Therefore, before
using these registers, their contents must be saved so that they are not lost, and they must be
restored to the registers after use. There are cases when r2 is used by the real-time OS. If r2 is not
used by the real-time OS, r2 can be used as a variable register.
(2)
Program counter (PC)
This register holds the address of the instruction under execution. The lower 26 bits of this register
are valid, and bits 31 to 26 are fixed to 0. If a carry occurs from bit 25 to bit 26, it is ignored.
Bit 0 is fixed to 0, and branching to an odd address cannot be performed.
Figure 3-2:
Program Counter (PC)
Table 3-1:
Program Registers
Name
Usage
Operation
r0
Zero register
Always holds 0
r1
Assembler-reserved register
Working register for generating 32-bit immediate
r2
Address/data variable register (when r2 is not used by the real-time OS to be used)
r3
Stack pointer
Used to generate stack frame when function is called
r4
Global pointer
Used to access global variable in data area
r5
Text pointer
Register to indicate the start of the text area (area for placing program
code)
r6 to r29
Address/data variable register
r30
Element pointer
Base pointer when memory is accessed
r31
Link pointer
Used by compiler when calling function
31
26 25
1 0
After reset
00000000H
PC
Fixed to 0
Instruction address under execution
0
Summary of Contents for V850E/PH2
Page 6: ...6 Preface User s Manual U16580EE3V1UD00...
Page 16: ...16 User s Manual U16580EE3V1UD00...
Page 28: ...28 User s Manual U16580EE3V1UD00...
Page 32: ...32 User s Manual U16580EE3V1UD00...
Page 84: ...84 Chapter 2 Pin Functions User s Manual U16580EE3V1UD00 MEMO...
Page 144: ...144 Chapter 3 CPU Functions User s Manual U16580EE3V1UD00 MEMO...
Page 192: ...192 Chapter 5 Memory Access Control Function PD70F3187 only User s Manual U16580EE3V1UD00 MEMO...
Page 312: ...312 Chapter 9 16 Bit Timer Event Counter P User s Manual U16580EE3V1UD00 MEMO...
Page 534: ...534 Chapter 11 16 bit Timer Event Counter T User s Manual U16580EE3V1UD00...
Page 969: ...969 Chapter 20 Port Functions User s Manual U16580EE3V1UD00 MEMO...
Page 970: ...970 Chapter 20 Port Functions User s Manual U16580EE3V1UD00...
Page 976: ...976 Chapter 22 Internal RAM Parity Check Function User s Manual U16580EE3V1UD00 MEMO...
Page 984: ...984 Chapter 23 On Chip Debug Function OCD User s Manual U16580EE3V1UD00 MEMO...
Page 1006: ...1006 Chapter 24 Flash Memory User s Manual U16580EE3V1UD00 MEMO...
Page 1036: ...1036 Chapter 27 Recommended Soldering Conditions User s Manual U16580EE3V1UD00 MEMO...
Page 1046: ...1046 Appendix A Index User s Manual U16580EE3V1UD00 MEMO...
Page 1052: ...1052 User s Manual U16580EE3V1UD00...
Page 1053: ......