Forum Discussion
Altera_Forum
Honored Contributor
12 years agoRemember, whether you use variables or signals, that it will result in combinatorial logic or registers. The less logic between registers will increase the fmax. Variables vs signals is mostly irrelavent, because its more a question of how you use those variables. Signal assignments in a clocked process will always produce a register. Variables in a clocked process can produce a register if used in the correct way, but they can also produce combinatorial logic if used another way. Variables have instant assignment, so if they are assigned a value and then "read" further down the same bit of code, they will produce logic:
--clocked process
a := ip0 and ip1;
op <= a;
variable a here will produce logic with the "op" assignment producing the register (latency 1). but if connected like this:
--clocked process
op <= a;
a := ip0 and ip1;
a will produce a register AND op will produce a register (latency 2), because a is read before it is updated. I notice in your code the "IC" variable is assigned a value and then put into a case statement. If IC was a signal assignemnt or assigned after the case statement, it would increase the pipelining. Its really difficult to tell without the rest of the code what else is happening, but generally, unless you know exactly what it's supposed to produce (ie. the underlying hardware) you're better off sticking with signals and avoiding variables.