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

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

Advertisement

2.3.2

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

Functions of the user stack pointer (USP) and the system stack pointer (SSP) are
described here.
User Stack Pointer (USP) and System Stack Pointer (SSP)
The user stack pointer (USP) and the system stack pointer (SSP) are 16-bit registers indicating the memory
addresses for data saving or restoring at execution of a push or pop instruction or a subroutine. The USP
and SSP registers are used for a stack-related instruction. When the S flag in the processor status register is
"0" and "1", the USP and SSP registers are enabled, respectively (see Figure 2.3-5). In addition, when an
interrupt is accepted, the S flag is set and the register value is always saved in the memory area indicated by
the SSP during the interrupt process. The SSP and USP registers are used for the stack processes in the
interrupt routine and other than interrupt routine, respectively. When the stack space is not divided, only
SSP is used.
The upper eight bits of address during the stack process are indicated by SSP → SSB and USP → USB.
The USP and SSP values are not initialized by reset and are undefined.
Figure 2.3-5 shows the relation between the stack manipulation instruction and the stack pointer when the S
flag is "0" and "1".
Example 1 PUSHWA when S flag is "0"
Before
the execution
After
the execution
Example 2 PUSHWA when S flag is "1"
Before
the execution
After
the execution
Note:
Basically use an even address for the stack pointer.
If it is set to an odd address, word accesses are performed in two steps, which degrades processing
efficiency.
Figure 2.3-5 Stack Operation Instruction and Stack Pointers
A624
C6
USB
AL
H
H
0
SSB
S flag
56
H
A624
C6
AL
USB
H
H
S flag
SSB
0
56
H
AL
USB
A624
C6
H
H
S flag
1
56
SSB
H
A624
AL
USB
C6
H
H
S flag
SSB
56
1
H
MSB
C6F326
F328
USP
H
H
1234
SSP
H
USP
F328
Using user stack, because of S flag = 0.
H
1234
C6F326
SSP
H
H
561232
F328
USP
H
H
SSP
1234
H
F328
USP
561232
H
H
1232
Using user stack, because of S flag = 1.
SSP
H
CHAPTER 2 CPU
LSB
XX
XX
H
H
A6
24
H
H
XX
XX
H
H
A6
24
H
H
35

Advertisement

Table of Contents
loading

Table of Contents