Iteration statements, Section, Iteration statements” on – Altera Nios II C2H Compiler User Manual

Page 45

Advertising
background image

Altera Corporation

9.1

3–5

November 2009

Nios II C2H Compiler User Guide

C-to-Hardware Mapping Reference

Figure 3–1

shows the hardware that results from the following statement:

int foo = a * b + x;

Figure 3–2. Pipelined Multiplication Operator

Figure 3–2

shows the hardware that results from the following statement:

int bar = a * b * c + x;

Figure 3–3. Two Stages of Pipelined Multiplication Operators

Iteration Statements

An iteration statement (

do

,

for

, or

while

), also known as a loop

statement, translates to a finite state machine in hardware. The state
machine controls execution of all the statements inside the loop block. A
loop inhibits (stalls) its parent state machine. In other words, if a loop
exists within an outer loop, the state machine for the outer loop stalls each
iteration and waits for the inner loop state machine to complete.

Advertising