AXI - Arithmetic Index Operation¶
Overview¶
Mnemonic: axi
Function: Arithmetic operation with index
Class: ARITHMETIC
Privilege: user
Format: t AXI <op1>, <op2>
Description¶
Performs arithmetic operation combining operand with index register. This instruction provides indexed arithmetic capabilities for array processing and pointer manipulation, enabling efficient address calculations in loops and data structure traversal.
Operation:
<operand1> + (<operand2> * element_size) → result
- Load base address/value from operand1
- Scale index (operand2) by element size
- Perform addition
- Store result or use for addressing
Key Characteristics:
- Single-instruction indexed arithmetic
- Automatic scaling by data type size (F/D/R)
- Eliminates separate multiply-add sequences
- Optimized for array and pointer calculations
- Supports floating-point, double, and register types
- 2-3 cycle execution (faster than separate operations)
- Common in loop-based array processing
Common Use Cases:
- Array element calculations with typed access
- Pointer arithmetic with automatic scaling
- Index-based computations in data structures
- Loop variable updates for multi-dimensional arrays
- Efficient address generation for typed data
Operands: 2 Variants: 8 opcodes
Variants¶
| Variant | Opcode | Data Type | Assembly |
|---|---|---|---|
| 1-8 | 0xFCC0-0xFCC7 | F/D/R | AXI |
Operands¶
Operand 1 (Source, Read):
- Addressing modes: LOCAL, RECORD, CONSTANT, REGISTER, PRE_INDEXED, ABSOLUTE
- Data type: Matches prefix
Operand 2 (Index, Read):
- Addressing modes: LOCAL, RECORD, CONSTANT, REGISTER, PRE_INDEXED, ABSOLUTE
- Data type: Word
Trap Conditions¶
- Addressing traps: Invalid address or protection violation
- Floating-point exceptions: For F/D types
Data Status Bits¶
- Z,S,C,V: Set based on result
Examples¶
Example 1: Array index arithmetic¶
F AXI ARRAY_BASE, I1
Example 2: Pointer calculation¶
W AXI PTR, OFFSET
Example 3: Loop variable¶
D AXI VALUE, STEP
Example 4: Index update¶
F AXI DATA(I2), I1
Example 5: Multi-dimensional array¶
W AXI MATRIX, ROW_INDEX
Performance Notes¶
- Execution: 2-3 cycles
- Optimized for indexed operations
Reference Manual¶
Section: §11.x Title: Arithmetic index operation