Altera Nios II C2H Compiler Manuale Utente Pagina 50

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 138
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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;
Vedere la pagina 49
1 2 ... 45 46 47 48 49 50 51 52 53 54 55 ... 137 138

Commenti su questo manuale

Nessun commento