[comp.lang.vhdl] Use of the 'next' statement

petera@chook.adelaide.edu.au (Peter Ashenden) (06/20/91)

Here's a question for all you model writers out there.  In what
circumstances have you used the 'next' statement.  I'm having difficulty
thinking up a realistic example of 'nexting' an outer loop from within
an inner loop.

I can see how you could use a next statement in the case of a single
loop.  If you start with

	loop
	  ...
	  if condition then
	    ...
	  end if;
	end loop;

This is equivalent to

	loop
	  ...
	  next when not condition;
	  ...
	end loop;

So using the next statement is quite structured here (in the sense of
structured programming).  However, a pair of nested loops of the form

	outer : loop
	  ...
	  inner : loop
	    ...
	    next outer when condition;
	    ...
	  end loop inner;
	  ...
	end loop outer;

doesn't transform using the conventional structured programming repertoire.

My question is: Is this a realistic thing to want to do anyway?  What
are some examples?  Would the code be clearer if it was rewritten
somehow without the next statement?  Am I missing something obvious?

Responses gratefully received.  Thanks.

PA

----------------------------------------------------------------
Peter J. Ashenden
Dept. Computer Science, University of Adelaide, South Australia