Forum Discussion
Altera_Forum
Honored Contributor
17 years agoTo understand, why the compiler sees an endless loop here, you must consider what a for or while loop means in synthesizable code. It is basically a method to generate parallel logic, one instance for each iteration. This can only be done, if the number of iterations is finite. Quartus sets an arbitrary limit of 10000 iterations to break a possibly infinite iteration. In the present case, the iteration is effectively a NOP, cause nothing depends on the loop variable, but the limit is evaluated anyway.
When checking the range covered by the loop variable, Quartus apparently doesn't see, that it would have an effective upper limit. Probably the variable storage between two process cycles isn't included in the range evaluation. Regarding useful applications of a while loop, this isn't a problem, I think. If you intend a construct, where the range of an iteration is modified depending on another condition, you can use a for loop that spans the range and an if condition, thats selects the values to be used in processing.