Immediate Addressing in ARM: Definition and Usage
immediate addressing means using a constant value directly within an instruction instead of a memory address or register. This allows the CPU to use fixed numbers quickly without extra memory access.How It Works
Immediate addressing in ARM means the instruction contains the actual number (constant) to be used, not a location where the number is stored. Think of it like telling a friend exactly what number to use instead of telling them where to find it.
For example, if you want to add 5 to a number, the instruction can include the number 5 right inside it. This saves time because the CPU doesn't have to look up the number in memory or a register first.
This method is fast and simple but limited to certain sizes and formats of numbers that the instruction can hold directly.
Example
This example shows an ARM assembly instruction using immediate addressing to add the number 10 directly to a register.
ADD R0, R1, #10When to Use
Use immediate addressing when you need to work with fixed numbers quickly, like adding a small constant or setting a register to a known value. It is common in initializing variables, counters, or simple calculations.
Because immediate values are part of the instruction, this method reduces memory access and speeds up execution, which is helpful in performance-critical code like embedded systems or real-time applications.
Key Points
- Immediate addressing uses constant values inside instructions.
- It avoids extra memory or register lookups.
- Limited by the size and format of constants allowed in instructions.
- Speeds up simple arithmetic and initialization tasks.