Forum Discussion
Altera_Forum
Honored Contributor
12 years agoJderrick
If the variable i goes beyond 16, such that I need a huge inexplicable exit condition, then neither I nor the compiler knows what's going on and I'm going to get some abomination logic that swallows my whole CPLD :) FvM I'm looking to understand how the compiler works. I will not use WHILE but I still don't understand why the variable i would exceed 16. The compiler should so a simple ascii text expansion to yield the ascending terms of the counter before it analyzes and elaborates. WHILE fails and FOR works. My simple example demonstrates a compiler flaw and the rule with Altera is "do not use WHILE inside a process". It is interesting that "c=c+1" defaultas to a synchronous counter and that is, tentatively, the way to go. I like to write code that a) Will result in synthesizable logic that I intend. The less freedom I give the compiler the better. Easier to debug and do timing analysis. b) That is understandable to others since I don't work alone. The simplicity and elegant of "c=c+1" also hides the subtlety that might be missed. I would not it in a comment. I'll play around with the explicit code I have and c=c+1 and see what happens. Will I get a synchonous counter from c=c+1 with another compiler? (assume and try!). Thanks.