Altera Nios II C2H Compiler Instrukcja Użytkownika Strona 50

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 138
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 49
3–10 9.1 Altera Corporation
Nios II C2H Compiler User Guide November 2009
One-to-One C-to-Hardware Mapping
Table 3–4 shows an example of a switch statement converted to
equivalent if-else statements.
Figure 3–7 shows the logic that results of translating the if-else code
from Table 3–4.
Table 3–4. switch Statement Converted to if-else Statements
switch Implementation if-else Implementation
switch (byte_select)
{
case 1:
out = in & 0x0000ff00;
break;
case 2:
out = in & 0x00ff0000;
break;
case 3:
out = in & 0xff000000;
break;
default:
out = in & 0x000000ff;
}
if (byte_select == 1)
out = in & 0x0000ff00;
else
if (byte_select == 2)
out = in & 0x00ff0000;
else
if (byte_select == 3)
out = in & 0xff000000;
else
out = in & 0x000000ff;
Przeglądanie stron 49
1 2 ... 45 46 47 48 49 50 51 52 53 54 55 ... 137 138

Komentarze do niniejszej Instrukcji

Brak uwag