Altera Home Page
Literature Licensing
Buy On-Line Download

  Home   |   Products   |   Support   |   End Markets   |   Technology Center   |   Education & Events   |   Corporate   |   Buy On-Line  
  Knowledge Database   |   Devices   |   Design Software   |   Intellectual Property   |   Design Examples   |   mySupport   |   Reference Designs  

 Products
      MAX/MAX II
      Stratix/Stratix GX
      Nios II
  
 Functionality
      Arithmetic
      Memory
      Bus & I/O
      Logic
      Interfaces & Peripherals
      DSP
      Communications
      PLL & Clocking
  
 Design Entry
      Quartus II Project
      Tcl
      VHDL
      Verilog HDL
      C Code Examples
      DSP Builder
      TimeQuest
   On-Chip Debugging
  
 Simulation Tools
      Mentor Graphics ModelSim
      Cadence NCsim
      Synopsys VCS
  
 Legacy Examples
      Graphic Editor
      AHDL
  

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

Block Diagram

Figure 1. Nios II C2H Image Rotate System Block Diagram

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 .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.

 
Nios II Literature

Nios II Integrated Development Environment Tutorial

  Please Give Us Feedback