Visible to Intel only — GUID: fmc1675823085414
Ixiasoft
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
Visible to Intel only — GUID: fmc1675823085414
Ixiasoft
4.2.2. Software C-Macro Table
Unlike the Hardware Interfaces Table, the Software C-Macro Table configures the custom instruction software C Macro for software development. Note that, any assignment made need to correlates to the earlier assignments in Hardware Interfaces Table.
Select the symbol + to add new assignment, and - to delete it. Each assignment results in a single Nios® V processor custom instruction Software C Macro in the system.h file.
Parameter | Description |
---|---|
Opcode |
|
funct7[6:4] |
|
funct7[3:0] |
|
funct3[2:0] |
|
mnemonic |
|
Figure 16. Example Assignments in Software C-Macro Table
C Macros in system.h
#define CUSTOM_0_000(VAL_1, VAL_2) ({ \
int output; \
asm volatile (".insn r 0x0B, 0x0, 0x0, %[out], %[input1], %[input2]" \
: [out] "=r" (output) \
: [input1] "r" (VAL_1), [input2] "r" (VAL_2)); \
output; \
})
#define CUSTOM_0_111(VAL_1, VAL_2) ({ \
int output; \
asm volatile (".insn r 0x0B, 0x0, 0x70, %[out], %[input1], %[input2]" \
: [out] "=r" (output) \
: [input1] "r" (VAL_1), [input2] "r" (VAL_2)); \
output; \
})
#define CUSTOM_1_XXX(VAL_1, VAL_2, F3, F7) ({ \
int output; \
asm volatile (".insn r 0x2B, %[FUNCT3], (0x0 | (%[FUNCT7]<<0)), %[out], %[input1], %[input2]" \
: [out] "=r" (output) \
: [input1] "r" (VAL_1), [input2] "r" (VAL_2), [FUNCT3] "i" (F3), [FUNCT7] "i" (F7)); \
output; \
})
#define CUSTOM_2_0XX(VAL_1, VAL_2, F3, F7) ({ \
int output; \
asm volatile (".insn r 0x5B, %[FUNCT3], (0x10 | (%[FUNCT7]<<0)), %[out], %[input1], %[input2]" \
: [out] "=r" (output) \
: [input1] "r" (VAL_1), [input2] "r" (VAL_2), [FUNCT3] "i" (F3), [FUNCT7] "i" (F7)); \
output; \
})
#define CUSTOM_3_10X(VAL_1, VAL_2) ({ \
int output; \
asm volatile (".insn r 0x7B, 0x0, 0x50, %[out], %[input1], %[input2]" \
: [out] "=r" (output) \
: [input1] "r" (VAL_1), [input2] "r" (VAL_2)); \
output; \
})