7 DETAILS OF INSTRUCTIONS
S1C17 FAMILY S1C17 CORE MANUAL
EPSON
7-79
ld.b %rd, [%sp + imm7]
Function
Signed byte data transfer
Standard)
rd
(7:0)
← B[sp + imm7], rd(15:8) ← B[sp + imm7](7), rd(23:16) ← 0
Extension 1) rd(7:0)
← B[sp + imm20], rd(15:8) ← B[sp + imm20](7), rd(23:16) ← 0
Extension 2) rd(7:0)
← B[sp + imm24], rd(15:8) ← B[sp + imm24](7), rd(23:16) ← 0
Code
15 14 13 12 11 10
9
8
7
6
5
4
3
2
1
0
1 1 1 0 0 0
r d
imm7
|
Flag
IL IE
C
V
Z
N
– – – – – –
|
Mode
Src:Register indirect with displacement
Dst:Register direct %rd = %r0 to %r7
CLK
Two cycles
Description (1) Standard
ld.b
%rd,[%sp + imm7]
; memory address = sp + imm7
The byte data in the specified memory location is transferred to the rd register after being sign-
extended to 16 bits. The content of the current SP with the 7-bit immediate imm7 added as
displacement comprises the memory address to be accessed. The eight high-order bits of the rd
register are set to 0.
(2) Extension 1
ext
imm13
; = imm20(19:7)
ld.b
%rd,[%sp + imm7]
; memory address = sp + imm20,
; imm7 = imm20(6:0)
The ext instruction extends the displacement to a 20-bit quantity. As a result, the content of
the SP with the 20-bit immediate imm20 added comprises the memory address, the byte data in
which is transferred to the rd register after being sign-extended to 16 bits. The eight high-order
bits of the rd register are set to 0.
(3) Extension 2
ext
imm13
; = imm24(31:19)
ext
imm13
; = imm24(18:6)
ld.b
%rd,[%sp + imm7]
; memory address = sp + imm24,
; imm7
← imm24(5:0)
The two ext instructions extend the displacement to a 24-bit quantity. As a result, the content
of the SP with the 24-bit immediate imm24 added comprises the memory address, the byte data
in which is transferred to the rd register after being sign-extended to 16 bits. The eight high-
order bits of the rd register are set to 0.
(4) Delayed slot instruction
This instruction may be executed as a delayed slot instruction by writing it directly after
a branch instruction with the “d” bit. In this case, extension of the immediate by the ext
instruction cannot be performed.
Example
ext
0x1
ld.b
%r0,[%sp + 0x1]
; r0
← [sp + 0x81] sign-extended