Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- But is initialising variable with non constant legal? --- Quote End --- I'm no aware of a limitation. In fact there's a simple solution for the problem, use an explicite assignment instead of the initial value expression, as in my code example. Personally, I'm preferring this style anyway. The initial value expression should give the same result, but it doesn't. The VHDL spec tells in chapter 4.3.1.3 Variable declarations: --- Quote Start --- If the variable declaration includes the assignment symbol followed by an expression, the expression specifies an initial value for the declared variable; the type of the expression must be that of the variable. Such an expression is said to be an initial value expression. If an initial value expression appears in the declaration of a variable, then the initial value of the variable is determined by that expression each time the variable declaration is elaborated. In the absence of an initial value expression, a default initial value applies. --- Quote End ---