32-Bit Instruction Set

SAVE

Save Caller’s Register Window

Operation:

Assembler Syntax: Example:

CWP CWP – 1

%sp %fp – (IMM8 × 4)

If (old-CWP = = LO_LIMIT) then TRAP #1

SAVE %sp,-IMM8

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

N

 

V

Z

C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

82

Altera Corporation

Page 94
Image 94
Excalibur electronic A-MNL-NIOSPROG-01.1 manual Save Caller’s Register Window, Save %sp,-IMM8