AN 977: Nios® V Processor Custom Instruction

ID 773194
Date 4/14/2023
Public
Document Table of Contents

3.3.1. Selector and Extension Indexes

Both selector and extension indexes determine the custom instruction to execute. They are made up of the funct7, funct3 and opcode fields. When applying this feature, Intel recommends that you hardcode the indexes in the Platform Designer. The table below explains their differences.

The Nios® V processor supports up to 32 custom logic blocks (4 opcodes with 3-bit funct7[6:4]). Each custom logic block can implement a single instruction, or multiple instructions.

In the case of a simple (non-extended) custom instruction, the Nios® V processor can support up to 32 custom instructions. In extended custom instructions, the selector index is added with the extension index, results in a maximum supported custom instruction of 4096 instructions (4 opcodes with 10-bit funct7 and funct3).

Table 8.  Selector and Extension Indexes
Index Description Corresponding bit fields Required? Usability Maximum Custom Instructions Maximum Custom Logic Blocks
Selector Selects custom logic block that the instruction resides
  • opcode
Yes In every custom instruction

4 (1 per custom logic blocks)

4
  • funct7[6:4]
No Only when assigning more than four custom logic blocks.

32 (1 per custom logic blocks)

32
Extension Selects custom instruction in a single custom logic block
  • funct7[3:0]
  • funct3[2:0]
No Only in extended custom instructions

4096 (128 per custom logic blocks)

32
Note: Depends on the selector index.
Figure 9. Selector Index – opcode and funct7[6:4]
Figure 10. Extension Index - funct7[3:0] and funct3[2:0]