Visible to Intel only — GUID: bwq1505428899926
Ixiasoft
1. Nios II Custom Instruction Overview
2. Custom Instruction Hardware Interface
3. Custom Instruction Software Interface
4. Design Example: Cyclic Redundancy Check
5. Introduction to Nios® II Floating Point Custom Instructions
6. Nios II Floating Point Hardware 2 Component
7. Nios® II Floating Point Hardware (FPH1) Component
8. Document Revision History for Nios II Custom Instruction User Guide
4.1.1. Setting up the Environment for the CRC Example Design
4.1.2. Opening the Component Editor
4.1.3. Specifying the Custom Instruction Component Type
4.1.4. Displaying the Custom Instruction Block Symbol
4.1.5. Adding the CRC Custom Instruction HDL Files
4.1.6. Configuring the Custom Instruction Parameter Type
4.1.7. Setting Up the CRC Custom Instruction Interfaces
4.1.8. Configuring the Custom Instruction Signal Type
4.1.9. Saving and Adding the CRC Custom Instruction
4.1.10. Generating and Compiling the CRC Example System
6.1. Overview of the Floating Point Hardware 2 Component
6.2. Floating Point Hardware 2 IEEE 754 Compliance
6.3. IEEE 754 Exception Conditions with FPH2
6.4. Floating Point Hardware 2 Operations
6.5. Building the FPH2 Example Hardware
6.6. Building the FPH2 Example Software
6.7. FPH2 Implementation of GCC Options
6.8. Nios II FPH2 and the Newlib Library
6.9. C Macros for round(), fmins(), and fmaxs()
Visible to Intel only — GUID: bwq1505428899926
Ixiasoft
7.3.2. Running and Analyzing the FPH1 Example Software
Perform the following steps to analyze the results of the software project:
- Build the software project. The Nios II SBT for Eclipse detects the presence of the FPH1 custom instructions at build time, and uses them for all single precision floating point arithmetic.
- Run the software on your Nios II target design. The program runs four tests, one each for the add, subtract, multiply, and divide operations. In each test, the program carries out the floating point operation on 1000 pairs of random operands. It executes both the FPH1 custom instruction and the equivalent software implementation. Using the performance counter component, the software compares the hardware and software execution times.
The following program output shows the results:
--Performance Counter Report-- Total Time: 0.01222420 seconds (611210 clock-cycles) +---------------+-----+-----------+---------------+-----------+ | Section | % | Time (sec)| Time (clocks)|Occurrences| +---------------+-----+-----------+---------------+-----------+ |FP CI ADD | 2.29| 0.00030| 14000| 1000| +---------------+-----+-----------+---------------+-----------+ |FP SW ADD | 50.2| 0.00610| 306640| 1000| +---------------+-----+-----------+---------------+-----------+ --Performance Counter Report-- Total Time: 0.00987798 seconds (493899 clock-cycles) +---------------+-----+-----------+---------------+-----------+ | Section | % | Time (sec)| Time (clocks)|Occurrences| +---------------+-----+-----------+---------------+-----------+ |FP CI SUBTRACT | 2.83| 0.00028| 14000| 1000| +---------------+-----+-----------+---------------+-----------+ |FP SW SUBTRACT | 50.8| 0.00502| 250975| 1000| +---------------+-----+-----------+---------------+-----------+ --Performance Counter Report-- Total Time: 0.0110131 seconds (550654 clock-cycles) +---------------+-----+-----------+---------------+-----------+ | Section | % | Time (sec)| Time (clocks)|Occurrences| +---------------+-----+-----------+---------------+-----------+ |FP CI MULTIPLY | 2.18| 0.00024| 12000| 1000| +---------------+-----+-----------+---------------+-----------+ |FP SW MULTIPLY | 59| 0.00650| 325076| 1000| +---------------+-----+-----------+---------------+-----------+ --Performance Counter Report-- Total Time: 0.0142152 seconds (710758 clock-cycles) +---------------+-----+-----------+---------------+-----------+ | Section | % | Time (sec)| Time (clocks)|Occurrences| +---------------+-----+-----------+---------------+-----------+ |FP CI DIVIDE | 4.5| 0.00064| 32000| 1000| +---------------+-----+-----------+---------------+-----------+ |FP SW DIVIDE | 67.8| 0.00963| 481698| 1000| +---------------+-----+-----------+---------------+-----------+
- Analyze the results report for each test. In each report, the FP CI <instruction> entry lists the performance of the custom instruction, and the FP SW <instruction> entry lists the performance of the software implementation. The Time (sec) and Time (clock) columns represent the aggregate time spent executing the floating point operations, in seconds and in Nios II clock cycles. Total Time represents the duration of the test, expressed both in seconds and in Nios II clock cycles. The % column represents the time spent executing the floating point operation, as a percentage of the test total.
Note: You might have different speed results, depending on your target hardware and on the actual values of the random operands.
The software uses the Nios II performance counter component to collect timing information on the floating point operations. For more information, refer to the Performance Counter Core chapter in volume 5 of the Intel® Quartus® Prime Handbook.
Related Information