\subsection{\index{loop}loop}

\index{loop to r2 if r1 has not expired}
LOOP to r2 if r1 has not expired.


\begin{tabular}{l}
  {\bf loop r2, r1}
\end{tabular}

~~~~~~r1 = r1 - 1\\
~~~~~~// IF r1 != 0 THEN PC = r2

~~~~~~
LOOP parallelly decrements r1 and checks the old value for nullity.
If this old value was not zero, the CPU branches to [r2]. This is the
simplest and fastest way to loop, the latency is typically 1 cycle and
the operations overlap.

~~~~~~
The couple LOOPENTRY/LOOP can code a WHILE or DO/WHILE loop where the loop 
count is known in advance. An initial value of r1 yields r1+1 iteration in 
a DO/WHILE loop, and the final value is -1.

~~~~~~
The Size flag is not used, all registers are used in full length.

\begin{center}

\begin{tabular}{|l|l|l|l|l|}
 \hline
\multicolumn{1}{|r| }{size :
} & \multicolumn{1}{c| }{8
} & \multicolumn{1}{c| }{12
} & \multicolumn{1}{c| }{6
} & \multicolumn{1}{c| }{6
 } \\
 \hline
\multicolumn{1}{|r| }{bits :
} & {31 ~ ~ ~ ~ ~ ~ ~ ~ 24
} & {23 ~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~ 12
} & {11 ~ ~ ~ ~ ~ ~ 6
} & {5 ~ ~ ~ ~ ~ ~ 0
 } \\
 \hline
\multicolumn{1}{|r| }{function :
} & \multicolumn{1}{c| }{OP\_LOOP
} & \multicolumn{1}{c| }{0
} & \multicolumn{1}{c| }{Reg 2
} & \multicolumn{1}{c| }{Reg 1
}
\\ \hline

\end{tabular}

{\bf Performance (FC0 only) :}
\end{center}

{\em Execution Unit :} Inc Unit (or Add/Sub Unit when unavailable)\\
{\em Latency :} 1 cycle\\
{\em Throughput :} 1 per cycle.\\

~

\pagebreak


