ldrb
Load Register Byte (Immediate)
LDRB <Wt>, [<Xn|SP>, #<pimm>]
Loads a byte from memory (zero-extended) using immediate offset.
Details
Loads an unsigned byte from memory using immediate offset and zero-extends it to 32 bits, writing the result to a 32-bit register. No condition flags are affected. This is an AArch64 Base instruction that executes in all privilege levels.
Pseudocode Operation
address ← Xn + (pimm << 0);
Wt ← ZeroExtend(Mem[address, 1], 32);
Example
LDRB w3, [x1, #16]
Encoding
Binary Layout
00
111
0
01
01
imm12
Rn
Rt
Operands
-
Wt
Transfer 32-bit integer register (load/store) -
Xn
First source / base 64-bit integer register -
pimm
Positive immediate offset
Reference (Arm A64 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x38400400 | LDRB <Wt>, [<Xn|SP>], #<simm> | A64 | 00 | 111 | 0 | 00 | 01 | 0 | imm9 | 01 | Rn | Rt | ||
| 0x38400C00 | LDRB <Wt>, [<Xn|SP>, #<simm>]! | A64 | 00 | 111 | 0 | 00 | 01 | 0 | imm9 | 11 | Rn | Rt | ||
| 0x39400000 | LDRB <Wt>, [<Xn|SP>{, #<pimm>}] | A64 | 00 | 111 | 0 | 01 | 01 | imm12 | Rn | Rt | ||
| 0x38600800 | LDRB <Wt>, [<Xn|SP>, (<Wm>|<Xm>), <extend> {<amount>}] | A64 | 00 | 111 | 0 | 00 | 01 | 1 | Rm | option | S | 10 | Rn | Rt | ||
| 0x38606800 | LDRB <Wt>, [<Xn|SP>, <Xm>{, LSL <amount>}] | A64 | 00 | 111 | 0 | 00 | 01 | 1 | Rm | 011 | S | 10 | Rn | Rt |
Description
Load Register Byte (immediate) loads a byte from memory, zero-extends it, and writes the result to a register. The address that is used for the load is calculated from a base register and an immediate offset. For information about memory accesses, see Load/Store addressing modes.
Operation
bits(64) address;
bits(8) data;
boolean privileged = PSTATE.EL != EL0;
AccessDescriptor accdesc = CreateAccDescGPR(MemOp_LOAD, FALSE, privileged, tagchecked);
if n == 31 then
CheckSPAlignment();
address = SP[];
else
address = X[n, 64];
if !postindex then
address = GenerateAddress(address, offset, accdesc);
data = Mem[address, 1, accdesc];
X[t, 32] = ZeroExtend(data, 32);
if wback then
if wb_unknown then
address = bits(64) UNKNOWN;
elsif postindex then
address = GenerateAddress(address, offset, accdesc);
if n == 31 then
SP[] = address;
else
X[n, 64] = address;