Call Sign10; Call.d Sign10 - Epson S1C17 Series Manual

Cmos 16-bit single chip microcontroller
Hide thumbs Also See for S1C17 Series:
Table of Contents

Advertisement

call
sign10

call.d sign10

Function
PC relative subroutine call
Standard)
Extension 1) call:
Extension 2) Unusable
15 14 13 12 11 10
Code
0
0
0
|
|
0
0
0
|
|
IL
IE
C
Flag
|
|
Mode
Signed PC relative
CLK
call
call.d
Description
(1) Standard
call
Stores the address of the following instruction into the stack, then doubles the signed 10-bit
immediate sign10 and adds it to the PC (PC + 2) for calling the subroutine that starts from
the address. The sign10 specifies a word address in 16-bit units. When the ret instruction is
executed in the subroutine, the program flow returns to the instruction following the call
instruction.
The sign10 (×2) allows branches within the range of PC - 1,022 to PC + 1,024.
(2) Extension 1
ext
call
The ext instruction extends the displacement into 24 bits using its 13-bit immediate imm13.
The 24-bit displacement is added to the PC.
The sign24 allows branches within the range of PC - 8,388,606 to PC + 8,388,608.
(3) Delayed branch (d bit (bit 10) = 1)
call.d
When call.d sign10 is specified, the d bit (bit 10) in the instruction code is set and
the following instruction becomes a delayed slot instruction. The delayed slot instruction is
executed before branching to the subroutine. Therefore the address (PC + 4) of the instruction
that follows the delayed slot instruction is stored into the stack as the return address.
When the call.d instruction is executed, interrupts cannot occur because they are masked
between the call.d and delayed slot instructions.
Example
ext
0x1fff
call
0x0
Caution
When the call.d instruction (delayed branch) is used, be careful to ensure that the next
instruction is limited to those that can be used as a delayed slot instruction. If any other instruction
is executed, the program may operate indeterminately. For the usable instructions, refer to the
instruction list in the Appendix.
S1C17 CORE MANUAL
(Rev. 1.2)
sp ← sp - 4, A[sp] ← pc + 2, pc ← pc + 2 + sign10 × 2
call:
call.d: sp ← sp - 4, A[sp] ← pc + 4, pc ← pc + 2 + sign10 × 2
sp ← sp - 4, A[sp] ← pc + 2, pc ← pc + 2 + sign24
call.d: sp ← sp - 4, A[sp] ← pc + 4, pc ← pc + 2 + sign24
9
8
7
6
|
1
1
0
|
|
|
|
|
|
|
1
1
1
|
|
|
|
|
|
V
Z
N
|
|
|
Four cycles
Three cycles (when a one-cycle delayed slot instruction follows), Four cycles (other)
sign10 ; = "call sign11"
; sign10 = sign11(10:1), sign11(0) = 0
imm13
; = sign24(23:11)
sign10 ; = "call sign24"
; sign10 = sign24(10:1), sign24(0) = 0
sign10
; Calls the subroutine that starts from the
; address specified by pc + 2 - 0x800.
Seiko Epson Corporation
5
4
3
2
1
0
sign10
|
|
|
|
|
|
sign10
|
|
|
|
|
|
7 DETAILS OF INSTRUCTIONS
call
call.d
7-15

Advertisement

Table of Contents
loading

Table of Contents