While less compact than do
-while
, VHDL does contain the loop
-exit
-end loop
construct that lets you exit a loop wherever you like. So you're not restricted to ending the loop before one pass or after one pass.
(Many or no lines can go in place of ...
in these examples.)
loop
...
exit when (cond);
...
end loop;
If your simulation testbench/model gets longer, it's often useful to label the loop so you can follow it more clearly. That also lets exit
come out of as many levels of a nested loop as you like.
Outer : loop
...
Inner : loop
...
exit Outer when (cond);
...
end loop Inner;
...
end loop Outer;