Altera Nios II C2H Compiler Bedienungsanleitung Seite 99

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 138
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 98
Altera Corporation 9.1 4–5
November 2009 Nios II C2H Compiler User Guide
Understanding the C2H View
Example 4–1. Vector Power Calculation
#pragma altera_accelerate connect_variable power_calculation/voltage to onchipRAM1
#pragma altera_accelerate connect_variable power_calculation/current to onchipRAM1
#pragma altera_accelerate connect_variable power_calculation/power to onchipRAM2
void power_calculation ( short * __restrict__ voltage,
short * __restrict__ current,
short * __restrict__ power,
short downscale,
int length)
{
int i;
for(i = 0; i < length; i++)
{
*power++ = (*voltage++ * *current++) >> downscale;
}
}
Example 4–1 requires Avalon-MM read and write master ports to
perform memory accesses. It also requires a multiplier and a barrel shifter
to perform the right shift operation. The pragma statements inform the
C2H Compiler that the input data is stored in a memory called
onchipRAM1 and the output data is to be stored in onchipRAM2. When
the C2H Compiler compiles this function, the Nios II IDE generates a
build report as shown in Figure 4–1.
Seitenansicht 98
1 2 ... 94 95 96 97 98 99 100 101 102 103 104 ... 137 138

Kommentare zu diesen Handbüchern

Keine Kommentare