Generation of a hardware accelerator – Altera Nios II C2H Compiler User Manual

Page 16

Advertising
background image

1–10

9.1

Altera Corporation

Nios II C2H Compiler User Guide

November 2009

C2H Compiler Concepts

The accelerator's connections are managed by the C2H Compiler. You can
manually customize the connections using pragma directives in the
accelerated C code.

Chapter 6, Pragma Reference

, describes

C2H Compiler pragma usage. You cannot edit the accelerator's
connections in the SOPC Builder GUI.

Generation of a Hardware Accelerator

The C2H compilation flow shares commonalities with a conventional C
compiler, but the scheduling of statements, optimization, and object
generation is different. When generating a hardware accelerator, the
C2H Compiler does the following:

1.

Runs the GNU GCC preprocessor to evaluate macros, includes, and
other preprocessing directives.

2.

Parses code.

3.

Creates a graph of data dependencies.

4.

Performs some optimizations.

5.

Determines the best sequence in which to perform each operation.

6.

Generates an object file for the hardware accelerator. This object file
is a synthesizable HDL file.

7.

Generates a C wrapper function that isolates and hides the details of
how the Nios II processor interacts with the hardware accelerator.
The wrapper function is a C file that replaces the original C function
at software link time.

The generated accelerator logic includes the following:

One or more state machines that manage the sequence of operations
defined by the C function. On any clock cycle, an arbitrary number
of computations and memory accesses can happen simultaneously,
orchestrated by the state machines.

One or more Avalon Memory-Mapped (Avalon-MM) master ports,
which fetch and store data as required by the state machines.

An Avalon-MM slave port and a set of memory-mapped registers
that allow the processor to set up, start, and stop the accelerator.

Advertising