Assignments – Altera Nios II C2H Compiler User Manual
Page 42

3–2
9.1
Altera Corporation
Nios II C2H Compiler User Guide
November 2009
One-to-One C-to-Hardware Mapping
lists the equivalent hardware structures resulting from this
function.
Assignments
A C assignment operator stores the value of an expression to a variable.
As a general rule, every assignment operator in the C code, such as
=
,
translates to a registered signal in hardware. The value of an assignment's
expression is calculated in one clock cycle.
shows the
hardware that results from the following statement:
int sum = x + y;
Figure 3–1. Hardware Resulting from Assignment
Table 3–1. Hardware Structure for Arithmetic and Logical Operators
Line
C Element
Hardware Structure
while (len > 0) {
while
Finite state machine with
nominal control logic. Refer to
section
.
>
32-bit comparator
result += *a++ * *b++;
+=
64-bit adder
*
(pointer)
Avalon-MM master port to read
data (two total for
*a++
and
*b++
). Refer to section
“Indirection Operator (Pointer
Dereference)” on page 3–16
.
++
32-bit up-counter (two total for
*a++
and
*b++
)
*
(multiply)
32x32=64-bit multiplier
len--;
--
32-bit down-counter