From Rick C@21:1/5 to All on Tue Sep 29 10:13:29 2020
I typically don't use variables much, but I like the limited scope which means fewer "global" signals cluttering up the declaration portion of an entity. But they can be a bit tricky to use because of the nature of the assignments.
I was just sculpting a section of code that used a couple of down counters as variables and kept finding myself altering the value before I checked it. To work around that I had to do multiple assignments in multiple branches of IFs. Using a signal I
would have made one assignment at the top of the section of code, the default case, then one other assignment in a single branch of the IFs. Since the counter value was in the first conditional that could not be done with a variable as it would be
examining the updated value.
In the end I had to use three assignments instead of two more clear ones to avoid the signal declaration.
Signals are also easier to show in the waveform display during simulation as I can throw up everything in the entity in one click. The variables require a little more work.
Not sure I have a question, just a comment really.