Resizing data, Figure 7, Mapping of register to memory bytes – Zilog Z16F2810 User Manual
Page 47: For more information, see the, Ribed in the
![background image](https://www.manualsdir.com/files/771158/content/doc047.png)
UM018809-0611
Operand Addressing
ZNEO
®
CPU Core
User Manual
31
Resizing Data
When an 8-bit or 16-bit memory location is written, the value from the source register is
truncated, so only the least-significant 8 or 16 bits of the register value are written, respec-
tively. The source register itself is not changed. When an 8-bit or 16-bit memory location
is read, the value from memory must be extended to a full 32 bits before it is used or stored
in a register.
One of the following two kinds of data extension must be used:
Unsigned (Zero) Extension.
The upper bits of the new 32-bit value are filled with zeroes.
Unsigned extension is invoked by including a ‘U’ in the mnemonic suffix. For example,
the following instruction loads the byte at
FFFF_7002H
into R10[7:0] and fills R10[31:8]
with zeroes:
LD.UB R10,7002H
Signed Extension.
The upper bits of the new 32-bit value are filled with ones or zeroes,
depending on the source value’s most-significant (sign) bit, to preserve the sign of the
loaded value. Signed extension is invoked by including an ‘S’ in the mnemonic suffix.
For example, the following instruction loads the byte at address
FFFF_7002H
into register
bits R10[7:0] and copies bit 7 of that byte into each bit of R10[31:8].
Figure 7. Mapping of Register to Memory Bytes
ALU Registers
Memory Space
7:0
15:8
23:16
31:24
Bits:
FFFF_7005H
(Effective Address)
FFFF_7006H
FFFF_7007H
FFFF_7004H
7:0
15:8
23:16
31:24
Bits:
FFFF_7009H
(Effective Address)
FFFF_7008H
7:0
15:8
23:16
31:24
Bits:
FFFF_700AH
(Effective Address)
8-Bit
16-Bit
32-Bit