Altera Nios II C2H Compiler Manual de usuario Pagina 50

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 138
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de 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;
Vista de pagina 49
1 2 ... 45 46 47 48 49 50 51 52 53 54 55 ... 137 138

Comentarios a estos manuales

Sin comentarios