Skip to content

Commit

Permalink
Merge pull request #34 from level2fast/wes237c-sdaniels
Browse files Browse the repository at this point in the history
fixed typo on section 2.6 page 38
  • Loading branch information
rck289 authored Oct 25, 2023
2 parents 75be280 + 6f555cf commit d9d7108
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fir.tex
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ \section{Code Hoisting}

The \lstinline{if/else} statement inside of the \lstinline{for} loop is inefficient. For every control structure in the code, the \VHLS tool creates logical hardware that checks if the condition is met, which is executed in every iteration of the loop. Furthermore, this conditional structure limits the execution of the statements in either the \lstinline{if} or \lstinline{else} branches; these statements can only be executed after the \lstinline{if} condition statement is resolved.

The \lstinline{if} statement checks when \lstinline{x == 0}, which happens only on the last iteration. Therefore, the statements within the \lstinline{if} branch can be ``hoisted'' out of the loop. That is we can execute these statements after the loop ends, and then remove the \lstinline{if/else} control flow in the loop. Finally, we must change the loop bounds from executing the ``0th'' iteration. This transform is shown in Figure \ref{fig:fir11_ifelse}. This shows just the changes that are required to the \lstinline{for} loop.
The \lstinline{if} statement checks when \lstinline{i == 0}, which happens only on the last iteration. Therefore, the statements within the \lstinline{if} branch can be ``hoisted'' out of the loop. That is we can execute these statements after the loop ends, and then remove the \lstinline{if/else} control flow in the loop. Finally, we must change the loop bounds from executing the ``0th'' iteration. This transform is shown in Figure \ref{fig:fir11_ifelse}. This shows just the changes that are required to the \lstinline{for} loop.

\begin{figure}
\lstinputlisting{examples/fir11_ifelse.c}
Expand Down

0 comments on commit d9d7108

Please sign in to comment.