User Stack Pointer (Usp) And System Stack Pointer (Ssp) - Fujitsu F2MC-16LX Hardware Manual

Mb90470 series 16-bit microcontroller
Hide thumbs Also See for F2MC-16LX:
Table of Contents

Advertisement

CHAPTER 2 CPU
2.3.2

User Stack Pointer (USP) and System Stack Pointer (SSP)

This section explains the functions of the user stack pointer (USP) and system stack
pointer (SSP).
I User stack pointer (USP) and system stack pointer (SSP)
The user stack pointer (USP) and system stack pointer (SSP) are 16-bit registers indicating the
push/pop instruction or the memory address to which data is saved or restored at subroutine
execution. The USP register and SSP register are used in stack-type instructions. If the S-flag
in the processor status register is set to "0", the USP register is enabled. If the S-flag is set to
"1", SSP register is enabled (see Figure 2.3-1 "Configuration of dedicated registers"). If an
interrupt is accepted, the S-flag is set and then the register value is saved in the memory area
indicated by SSP in interrupt processing. SSP is used to execute stack processing of interrupt
routines, and USP is used to execute stack processing other than interrupt routines. Only SSP
is used if stack space is not divided.
In stack processing, the address of upper 8 bits is indicated with SSP -> SSB and USP -> USB.
Resetting USP and SSP does not initialize them, but each then has an undefined value.
Figure 2.3-5 "Relationship between stack operation instructions and stack pointer" shows the
relationship between stack operation instructions and the stack pointer where the S-flag is set to
"0" and "1".
Figure 2.3-5 Relationship between stack operation instructions and stack pointer
Example 1: PUCHW A where S-flag is set to "0"
Before
AL
execution
S-flag
Before
AL
execution
S-flag
Example 2: PUCHW A where S-flag is set to "1"
Before
execution
S-flag
Before
execution
S-flag
Note:
Use an even-numbered address for a stack pointer, in principle.
30
USB
A624
C6
H
H
0
SSB
56
H
USB
C6
A624
H
H
0
SSB
56
H
USB
AL
A624
C6
H
H
1
56
SSB
H
USB
AL
A624
C6
H
H
1
56
SSB
H
MSB
USP
F328
C6F326
H
H
SSP
1234
H
Use of user stack because
USP
F328
H
S-flag is set to "0"
1234
SSP
C6F326
H
H
USP
F328
561232
H
H
1234
SSP
H
USP
F328
561232
H
H
Use of system stack because
1232
SSP
H
S-flag is set to "1"
LSB
XX
XX
A6
24
H
H
XX
XX
A6
24
H
H

Advertisement

Table of Contents
loading

Table of Contents