Forum Discussion
Altera_Forum
Honored Contributor
13 years agoI hate variables because they're often unnecessary(you can do it just as easy with a signal) and it's hard to understand how something is going to get synthesized. I've seen them blow up due to misunderstandings. That being said, I knew an excellent hardware engineer who used variables all the time without problem. I think they're most dangerous when writing purely for the function you want with no understanding of what the actual hardware will look like.
Also, I have run into occasions where variables really were the best way to get the job done and made the most sense. When I looked at what was synthesized, the size and speed was pretty good, and better than I expected. As for integers, I think they're a nicety for readability. But I probably do the same thing, trying to code what the hardware looks like, rather than the algorithm.