(Created page with "An '''immediate value''' (or simply an '''immediate''' or '''imm''') is a piece of data that is stored as part of the instruction itself instead of being in a memory locat...") |
|||
Line 11: | Line 11: | ||
In the code above, the value <code>1</code> is an immediate value that gets encoded in the <code>add</code> instruction itself. | In the code above, the value <code>1</code> is an immediate value that gets encoded in the <code>add</code> instruction itself. | ||
+ | |||
+ | == Implementation restrictions == | ||
+ | Because the immediate value is packed into the instruction itself certain [[ISA]]s have a restricted range of values that can be used as an immediate value. For example in [[MIPS32]], an immediate value is limited to 16-bits. On some more complex architectures such as [[ARM]], some instructions may accept a 16-bit value, others might accepted a smaller range with a the ability to rate the bits as desired. | ||
+ | |||
+ | [[Category:microprocessor architecture]] | ||
+ | [[Category:Instruction set architecture]] |
Revision as of 20:40, 19 July 2014
An immediate value (or simply an immediate or imm) is a piece of data that is stored as part of the instruction itself instead of being in a memory location or a register. Immediate values are typically used in instructions that load a value or performs an arithmetic or a logical operation on a constant.
Overview
Under most instruction set architectures, various instructions can also perform operation on constant values. For example consider an ISA that can add two registers and store the result in a third register:
add r3, r2, r1 ; r3 = r2 + r1
The instruction set may also support the common case of adding a constant value (such as in the case of many programming languages that support ++var).
add r1, r1, 1 ; r1 = r1 + 1
In the code above, the value 1
is an immediate value that gets encoded in the add
instruction itself.
Implementation restrictions
Because the immediate value is packed into the instruction itself certain ISAs have a restricted range of values that can be used as an immediate value. For example in MIPS32, an immediate value is limited to 16-bits. On some more complex architectures such as ARM, some instructions may accept a 16-bit value, others might accepted a smaller range with a the ability to rate the bits as desired.