Altera Nios II C2H Compiler Instrukcja Użytkownika Strona 41

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 138
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 40
Altera Corporation 9.1 3–1
November 2009
3. C-to-Hardware Mapping
Reference
This chapter describes how the Nios
®
II C-to-Hardware Acceleration
(C2H) Compiler translates ANSI C constructs into functional blocks in a
hardware accelerator. Understanding the C-to-hardware mappings
enables you to write C functions optimized for the C2H Compiler to
achieve higher performance and lower resource utilization.
One-to-One
C-to-Hardware
Mapping
The C2H Compiler translates each element of C syntax to an equivalent
hardware structure using straightforward mapping rules. The mapping
rules provide a one-to-one association between elements of C syntax and
their equivalent hardware structures. By learning the C-to-hardware
mappings, you can control the hardware structure of an accelerator, based
on the structure of the C code.
The C2H Compiler can perform resource-sharing optimizations which
reduce the resource utilization for an accelerator. In these cases, the result
is a better than one-to-one mapping.
Arithmetic and Logical Operators
Every arithmetic and logical operator in the C code translates to a
corresponding hardware block in the accelerator. Consider the function
MAC() shown in Example 3–1.
Example 3–1. Function with Arithmetic and Logical Operators
long long MAC (int* a, int* b, int len)
{
long long result = 0;
while (len > 0)
{
result += *a++ * *b++;
len--;
}
return result;
}
Przeglądanie stron 40
1 2 ... 36 37 38 39 40 41 42 43 44 45 46 ... 137 138

Komentarze do niniejszej Instrukcji

Brak uwag