4.3.1. Writing the Custom Instruction HDL File
4.3.2. Opening the Component Editor
4.3.3. Specifying the Custom Instruction Component Type
4.3.4. Displaying the Custom Instruction Block Symbol
4.3.5. Adding the Custom Instruction HDL File
4.3.6. Configuring the Custom Instruction Parameter Type
4.3.7. Setting Up the Custom Instruction Interfaces
4.3.8. Saving and Adding the Custom Instruction
4.3.9. Generating and Compiling the Processor System
1.1. Implementing Custom Instruction
Nios® V processor custom instructions are custom logic blocks adjacent to the arithmetic logic unit (ALU) in the processor’s datapath.
Nios® V processor custom instructions are based on the RISC-V R-type instruction format, and provides support for four unique opcodes. Leveraging the funct7[6:4] in the custom instruction, each opcode is further associated with eight custom logic blocks. In total, you can have up to 32 custom logic blocks connected to a single Nios® V processor. Logic block connections on the Nios® V processor are exposed as Nios V Custom Instruction Manager interfaces, and are defined using the Custom Instructions Hardware Interfaces Table in the Nios® V processor IP parameterization.
Figure 2. Custom Logic Blocks
The following steps show how you can implement and use custom instructions with the Nios® V processor:
- When you implement the custom instructions in the Nios® V processor system, each custom operation must associate with its unique selector index (opcode and funct7[6:4]).
- The selector index allows the software to specify the desired operation from among up to 32 custom logic blocks.
- In the Platform Designer, you can define one or more selector index using the Custom Instructions Hardware Interfaces Table. Each defined selector index would be presented as a Nios V Custom Instruction Manager interface on the Nios® V processor.
- You can define custom instruction software C macros for software deployment in system.h using the Custom Instructions Hardware Interfaces Table in the Nios V IP parameterization. An accompanying GDB debug memonics file for the defined software C macros is generated by Platform Designer for use by the Ashling* RiscFree* IDE for Intel® FPGAs.
Note: You can have up to 128 custom instructions in a single custom logic block using the extended custom instructions. For example, if you instantiate all 32 logic blocks, you can have a maximum of 4096 custom instructions connected to a single Nios® V processor.