Program Register Set - NEC V854 UPD703006 User Manual

32/16-bit single-chip microcontroller hardware
Table of Contents

Advertisement

3.2.1 Program register set

The program register set includes general registers and a program counter.
(1) General registers
Thirty-two general registers, r0 to r31, are available. Any 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.
Also, r1 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. The contents must be restored to the registers
after the registers have been used.
Name
r0
Zero register
r1
Assembler-reserved register
r2
Interrupt stack pointer
r3
Stack pointer
r4
Global pointer
r5
Text pointer
r6 to r29
r30
Element pointer
r31
Link pointer
PC
Program counter
Note Area in which program code is mapped.
(2) Program counter
This register holds the address of the instruction under execution. The lower 24 bits of this register are valid,
and bits 31 to 24 are fixed to 0. If a carry occurs from bit 23 to 24, it is ignored.
Bit 0 is fixed to 0, and branching to an odd address cannot be performed.
31
PC
Fixed to 0
CHAPTER 3 CPU FUNCTIONS
Table 3-1. Program Registers
Usage
Always holds 0
Working register for generating immediate
Stack pointer for interrupt handler
Used to generate stack frame when function is called
Used to access global variable in data area
Register to indicate the start of the text area
Address/data variable registers
Base pointer register when memory is accessed
Used by compiler when calling function
Holds instruction address during program execution
Figure 3-1. Program Counter (PC)
24 23
Instruction address under execution
User's Manual U11969EJ3V0UM00
Operation
Note
1 0
After reset
0
00000000H
51

Advertisement

Table of Contents
loading

Table of Contents