English
Language : 

GMS30C2216 Datasheet, PDF (98/320 Pages) Hynix Semiconductor – 16/32 BIT RISC/DSP
3-36
CHAPTER 3
Format Notation
Operation
LL
FRAME Ld, Ls
FP := FP - Ls code;
FL := Ld code;
M := 0;
difference(6..0) := SP(8..2) + (64 - 10) - (FP + FL);
-- FL = 0 is treated as FL = 16
-- difference is signed, difference(6) = sign bit
-- 64 = number of local registers
-- 10 = number of reserve registers
if difference ≥ 0 then
continue at next instruction;
-- Frame is finished
else
temporary flag := SP ≥ UB;
repeat
memory SP^ := register SP(7..2)^;
-- local register ⇒ memory
SP := SP + 4;
difference := difference + 1;
until difference = 0;
if temporary flag = 1 then
trap ⇒ Frame Error;
Note: Ls also identifies the same source operand that must be denoted by the Return
instruction to address the saved return PC.
Ld (L0 is interpreted as L16) also identifies the register in which the return PC is being
saved by a Trap or Software instruction or by an exception; therefore only local registers
with a lower register code than the interpreted Ld-code of the Frame instruction may be
used after execution of a Frame instruction.
The reserve of 10 registers is to be used as follows:
• A Call, Trap or Software instruction uses six registers.
• A subsequent exception, occurring before a Frame instruction is executed, uses another
two registers.
• Two registers remain in reserve.
Note that the Frame instruction can write into the memory stack at address locations up to
37 words higher than indicated by the address in the UB. This is due to the fact that the
upper bound is checked before the execution of the Frame instruction.
Attention: The Frame instruction must always be the first instruction executed in a
function entered by a Call instruction, otherwise the Frame instruction could be separated
from the preceding Call instruction by an Interrupt, Parity Error, Extended Overflow or
Trace exception (see section 3.27. Call instruction).
_Main: FRAME L3, L0
; L0 = SP
MOVD L2, G10
RET
PC, L0
; L1 = SR