
Altera Corporation 9.1 3–3
November 2009 Nios II C2H Compiler User Guide
C-to-Hardware Mapping Reference
There are two types of exceptions to this rule:
■ Assignments that require zero logic elements in hardware
■ Assignments that use multiple registers to pipeline complex
arithmetic operations
The following sections discuss these exceptions.
Unregistered Operations and Assignments
Certain logical and bit-wise operations involving constants are trivial and
require no logic. In hardware, they are performed simply by
manipulating wires. Table 3–2 lists the applicable operators and
conditions. If an assignment consists solely of such operations, then its
result is not registered.
The following assignment is an example of a zero logic-element
operation.
int masked_data = data_in & 0x000fffff;
The C2H Compiler generates no register for the variable masked_data,
because its value is represented simply by concatenating 12 bits of zeroes
with the lower 20 bits of data_in.
Additional examples of unregistered assignments:
shift_by_constant = data_in << 3;
or_with_constant = data_in | 0xf0f0f0f0;
invert_shift_and_consts = (~data_in & 0xff) << 8;
Table 3–2. Operators That Can Result in Unregistered Assignments
Operator Description Required Condition
>>
Right bit-wise shift Right-hand side is constant
<<
Left bit-wise shift Right-hand side is constant
&
bit-wise AND Either operand is constant
|
bit-wise inclusive OR Either operand is constant
^
bit-wise exclusive OR Either operand is constant
~
bit-wise inversion Right-hand side is unregistered
)
Type cast Right-hand side is unregistered
Commentaires sur ces manuels