参考文献:Nios II Processor Reference Handbook(page 20)
Nios II ALU
The Nios II ALU operates on data stored in general-purpose registers. ALU operations take one or two inputs from registers, and store a result back in a register. The ALU supports the data operations described in the table below. To implement any other operation, software computes the result by performing a combination of the fundamental operations.
Unimplemented Instructions
Some Nios II processor core implementations do not provide
hardware to support the
entire Nios II instruction set. In such a core, instructions without hardware
support
are known as unimplemented instructions.
The processor generates an exception whenever it issues an
unimplemented
instruction so your exception handler can call a routine that emulates the
operation in
software. Unimplemented instructions do not affect the programmer’s view of the
processor.
Custom Instructions
The Nios II architecture supports user-defined custom
instructions. The Nios II ALU
connects directly to custom instruction logic, enabling you to implement
operations in
hardware that are accessed and used exactly like native instructions.
Floating-Point Instructions
The
Nios II architecture supports single precision floating-point instructions
as
specified by the IEEE Std 754-1985. The basic set of floating-point
custom instructions
includes single precision floating-point addition, subtraction, and
multiplication.
Floating-point division is available as an extension to the basic instruction
set. These
floating-point instructions are implemented as custom instructions. Table 2–2
lists a
detailed description of the conformance to IEEE 754-1985.
Other Definition :single precision; double precision; NaN; Subnormal numbers;
Software Development Considerations
The best choice for your hardware design depends on a balance
among floating-point
usage, hardware resource usage, and performance. While the floating-point custom
instructions speed up floating-point arithmetic, they substantially add to the
size of
your hardware design. If resource usage is an issue, consider reworking your
algorithms to minimize floating-point arithmetic.
You can use #pragma directives in your software to compare hardware and
software
implementations of the floating-point instructions. The following #pragma
directives
instruct the Nios II compiler to ignore the floating-point instructions and
generate
software implementations. The scope of these #pragma directives is the entire C
file.