Calla Imm7; Calla.d Imm7 - Epson S1C17 Series Manual

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

Advertisement

calla
imm7

calla.d imm7

Function
PC absolute subroutine call
Standard)
Extension 1) calla:
Extension 2) calla:
15 14 13 12 11 10
Code
0
0
0
|
|
0
0
0
|
|
IL
IE
C
Flag
|
|
Mode
PC absolute
CLK
calla
calla.d
Description
(1) Standard
calla
Stores the address of the following instruction into the stack, then sets the 7-bit immediate
imm7 to the PC for calling the subroutine that starts from the address set to the PC. The LSB
of the imm7 is invalid and is always handled as 0. When the ret instruction is executed in the
subroutine, the program flow returns to the instruction following the calla instruction.
(2) Extension 1
ext
call
The ext instruction extends the destination address into 20 bits using its 13-bit immediate
imm13. The 20-bit destination address is set to the PC.
(3) Extension 2
ext
ext
call
The 24-bit destination address is set to the PC.
(4) Delayed branch (d bit (bit 7) = 1)
calla.d
When calla.d is specified, the d bit (bit 7) 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 calla.d instruction is executed, interrupts cannot occur because they are masked
between the calla.d and delayed slot instructions.
Example
ext
calla
Caution
When the calla.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 ← imm7
calla:
calla.d: sp ← sp - 4, A[sp] ← pc + 4, pc ← imm7
sp ← sp - 4, A[sp] ← pc + 2, pc ← imm20
calla.d: sp ← sp - 4, A[sp] ← pc + 4, pc ← imm20
sp ← sp - 4, A[sp] ← pc + 2, pc ← imm24
calla.d: sp ← sp - 4, A[sp] ← pc + 4, pc ← imm24
9
8
7
|
0
0
1
0
1
0
|
|
|
|
|
|
|
0
0
1
0
1
1
|
|
|
|
|
|
V
Z
N
|
|
|
Four cycles
Three cycles (when a one-cycle delayed slot instruction follows), Four cycles (other)
imm7
imm13
; = imm20(19:7)
imm7
; = "call imm20", imm7 = imm20(6:0)
imm4
; imm4(3:0) = imm24(23:20)
imm13
; = imm24(19:7)
imm7
; = "call imm24", imm7 = imm24(6:0)
imm7
0x1fff
0x0
; Calls the subroutine that starts from
; address 0xfff80.
Seiko Epson Corporation
6
5
4
3
2
1
0
imm7
|
|
|
|
|
|
imm7
|
|
|
|
|
|
7 DETAILS OF INSTRUCTIONS
calla
calla.d
7-17

Advertisement

Table of Contents
loading

Table of Contents