Nios® II C2H Compiler Image Rotate Design Example

The Nios II C-to-Hardware Acceleration Compiler (C2H Compiler) Image Rotate design example demonstrates how the Nios II C2H Compiler is used to accelerate an image rotation algorithm in hardware. The design example contains both hardware and software.

The hardware part of the example is created in SOPC Builder and contains the necessary peripherals to read a bitmap image from flash memory, rotate the image in RAM, then write the rotated image to a display frame buffer located in Synchronous SRAM. The hardware design also contains a performance counter to measure the speed of the rotation algorithm, and a JTAG UART to report the measurement results.

The software part of the example is a Nios II Integrated Development Environment (IDE) project written in C. The project contains a main loop which calls an image rotate function 360 times, incrementing the number of degrees to rotate the image once per iteration. The rotated output image can optionally be displayed on the KROS LCD daughter card for Nios II development boards.

Hardware Design Specifications

  • Board support: Nios Development Board, Cyclone® II edition
  • Nios II core: Nios II /f, debug-enabled, 4 Kbytes I-cache, 8 Kbytes d-cache
  • On-chip RAM: 12 Kbytes
  • Off-chip synchronous SRAM: 1 Mbyte
  • Common flash interface (CFI) flash memory interface: 8 Mbytes
  • Compact flash interface: 1
  • SDRAM controller: 32 Mbytes
  • JTAG UART - 1
  • Timer: 1
  • Color LCD controller: 1
  • System ID peripheral: 1
  • Performance counter: 1

Figure 1. Nios II C2H image rotate system block diagram.

C2H Acceleration Results

In this example, the C2H Compiler is able to accelerate the image rotate algorithm to run 57 times faster than software compiled with no optimization (-O0), running on the fastest Nios II embedded processor. Compared to software compiled with full optimization (-O3), the C2H Compiler accelerated algorithm runs 24 times faster.

Using This Design Example

Download the Nios II C2H image rotate design example (.zip file).

The use of this design is governed by, and subject to, the terms and conditions of the Intel® Design Example License Agreement.

The .zip file contains all the necessary hardware and software files to reproduce the example, as well as a readme.txt file. The readme.txt file contains instructions for re-building the design.