Specifications
Software exception handling depends on options selected in the BSP. If you have enabled unimplemented
instruction emulation, the software exception funnel first checks whether an unimplemented instruction
caused the exception. If so, it emulates the instruction. Otherwise, it handles traps and miscellaneous
exceptions.
Unimplemented Instructions
You can include a handler to emulate unimplemented instructions. The Nios II processor architecture
defines the following implementation-dependent instructions:
• mul
• muli
• mulxss
• mulxsu
• mulxuu
• div
• divu
For more information about unimplemented instructions, refer to “Unimplemented Instructions” in
the "Processor Architecture" chapter of the Nios II Processor Reference Handbook.
For more information about how unimplemented instructions are different from invalid instructions,
refer to the “Invalid Instructions” chapter.
Related Information
• Invalid Instructions on page 8-32
• Processor Architecture
When to Use the Unimplemented Instruction Handler
You do not normally need the unimplemented instruction handler, because the HAL includes software
emulation for unimplemented instructions from its run-time libraries if you are compiling for a Nios II
processor that does not support the instructions.
You might need the unimplemented instruction handler under the following circumstances:
• You are running a Nios II program on an implementation of the Nios II processor other than the one
you compiled for. The best solution is to build your program for the correct Nios II processor
implementation. Resort to the unimplemented instruction handler only if it is not possible to
determine the processor implementation at compile time.
• You have assembly language code that uses an implementation-dependent instruction.
If unimplemented instruction emulation is disabled, but the processor encounters an unimplemented
instruction, the software exception funnel treats the exception as a miscellaneous exception.
For more information about miscellaneous exceptions, refer to the “Miscellaneous Exceptions” chapter.
Otherwise, if instruction emulation is not enabled, this logic is omitted.
Related Information
Miscellaneous Exceptions on page 8-31
Using the Unimplemented Instruction Handler
To include the unimplemented instruction handler, turn on the hal.enable_mul_div_emulation BSP
property. The emulation routines occupy less than ¾ kilobyte(KB) of memory.
NII5V2
2015.05.14
Unimplemented Instructions
8-29
Exception Handling
Altera Corporation
Send Feedback