SX Users Manual Rev. 3.1
46
© 2000 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com
Chapter 2 Architecture
The stack is not memory-mapped and there are no push or pop instructions in the instruction set.
Therefore, the program stack is not directly accessible to the program and is not used for any purpose
other than to save and restore program memory addresses, which is done implicitly by call and
return instructions.
There is no stack pointer for this stack. Instead, the device simply moves all the data words down or
up the stack for each call or return instruction executed, as indicated in Figures 2-5 and 2-6.
For a call instruction, the device copies the contents of the whole program counter to the top stack
location, and existing words in the stack are moved down by one stack location. Any data word in the
bottom stack location is lost.
For any type of return-from-subroutine instruction (RET, RETP, or RETW lit), the device copies the
contents of the top-level stack location into the program counter, and existing words in the stack are
moved up by one stack location. The bottom stack location is left unchanged.
Figure 2-5 Stack Operation for a Call Instruction
Figure 2-6 Stack Operation for a Return Instruction
PROGRAM COUNTER (11:0)
STACK 8 CONTENTS
ARE DISCARDED
STACK 1
STACK 2
STACK 3
STACK 4
STACK 5
STACK 6
STACK 7
STACK 8
PROGRAM COUNTER (11:0)
STACK 8 CONTENTS
ARE LEFT UNCHANGED
STACK 1
STACK 2
STACK 3
STACK 4
STACK 5
STACK 6
STACK 7
STACK 8