An addressing mode specifies how an instruction obtains an operand or forms an effective memory address. Examples include immediate operands, processor register operands, base-plus-displacement memory access and scaled processor register indexing.
An immediate operand is a value encoded in an instruction rather than fetched from a processor register or a separate memory location. Its width and interpretation limit the available values; scaling an encoded field can trade address granularity for displacement range.
An instruction encoding that stores an eight-bit byte and a two-bit byte-position selector, expanding them to a 32-bit machine word as for . Four such values can construct any 32-bit constant using bitwise OR or addition modulo .
Widen an -bit binary representation to bits by retaining the original low positions and filling every new high position with zero. This preserves the unsigned interpretation. A MIPS instruction such as ori uses zero extension of its immediate operand, whereas addi uses sign extension.
Scaled index addressing forms a memory address from a base and index . For element size , a barrel shifter forms the displacement by a left bit shift before the arithmetic logic unit adds the base. This directly implements array indexing without a separate multiplication instruction.
SP-relative addressing adds an encoded displacement to the stack pointer. Scaling an immediate operand by a power of two reaches farther with the same field width but restricts the address grid. An eight-bit nonnegative field scaled by four reaches , whereas scaling it by sixteen reaches ; it does not provide every intervening byte address.

Articles by others on the same topic (0)

There are currently no matching articles.