Excalibur electronic A-MNL-NIOSPROG-01.1 用户手册

下载
页码 122
82
Altera Corporation
32-Bit Instruction Set
SAVE
Save Caller’s Register Window
Operation:
CWP
← CWP – 1
%sp
← %fp – (IMM8 × 4)
If (old-CWP = = LO_LIMIT)
then TRAP #1
Assembler Syntax:
SAVE %sp,-IMM8
Example:
SAVE %sp,-23 ; start subroutine with new regs
             ; first operand can only be %sp
Description:
Moves CWP down by one position in the register file. If CWP is equal to LO_LIMIT 
(from the WVALID register) before the SAVE instruction, then a window-
underflow trap (TRAP #1) is generated.
%sp (in the newly opened register window) is loaded with the value of %fp minus 
IMM8 times 4. %fp in the new window is the same as %sp in the old (caller’s) 
window.
SAVE is conventionally used upon entry to subroutines to open up a new, 
disposable set of registers for the subroutine and simultaneously open up a stack-
frame.
Condition Codes:
Flags: Unaffected
Instruction Format:
i8v
Instruction Fields:
IMM8 = 8-bit immediate value
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
0
1
1
1
1
0
0
0
IMM8
N
V
Z
C