Forum Discussion
Altera_Forum
Honored Contributor
12 years agoc<=c+1; will always give you a synchronous counter, if it's in a synchronous process. Otheriwse you just get a logic loop (that the synthesisor wont like very much).
It really is not a compiler error. While loops do not convert well to hardware. And in your example, i has a range -2^31 to 2^31-1, so the compiler doesnt know what could happen to i. According to your code you never set it to 0 again, so technically it only ever adds 1 on the first clock edge and then never again, whereas the for loop resets i every time it enters the loop. AFAIK, the compilers do not do behavioural analysis, hence why it doesnt know i never goes past 16. It just converts it to a netlist using specific templates. If you had set the size of i as : variable i : integer range 1 to 16; It may have had an easier time.