Nios II Custom Instruction User Guide

ID 683242
Date 4/27/2020
Document Table of Contents
Give Feedback

4.2. Building the CRC Example Software

Next you create and build a new software project using the Nios II software build flow, and run the software that accesses the custom instruction.

Creating the Software Project

The downloadable design files include the software source files. The following table lists the CRC application software source files and their corresponding descriptions.

Table 7.  CRC Application Software Source Files
File Name Description
crc_main.c Main program that populates random test data, executes the CRC both in software and with the custom instruction, validates the output, and reports the processing time.
crc.c Software CRC algorithm run by the Nios II processor.
crc.h Header file for crc.c.
ci_crc.c Program that accesses CRC custom instruction.
ci_crc.h Header file for ci_crc.c.

To run the application software, you must create an Executable and Linking Format File (.elf) first. To create the .elf file, follow the instructions in the "Nios II Software Build Flow" section in the readme_qsys.txt file in the extracted design files.

The application program runs three implementations of the CRC algorithm on the same pseudo-random input data: an unoptimized software implementation, an optimized software implementation, and the custom instruction CRC. The program calculates the processing time and throughput for each of the versions, to demonstrate the improved efficiency of a custom instruction compared to a software implementation.