suppose if I have two signal declarations as follows
signal x:std_logic_vector(1 downto 0) := (others => '0');
signal y:std_logic_vector(1 downto 0);
does that mean x is static and y is non-static?
No. Values determined by evaluating signals in expressions are not static.
The difference between the declarations of
y is that
x has a default value expression provided that is different than
y. Both have default values, the value for
x is provided by a locally static aggregate expression depending on the locally static range of
others and the locally static value of the enumeration literal
From IEEE Std 1076-2008, 9 Expressions, 9.1 General:
An expression is a formula that defines the computation of a value.
From 9.4 Static expressions:
Certain expressions are said to be static. Similarly, certain discrete ranges are said to be static, and the type marks of certain subtypes are said to denote static subtypes.
There are two categories of static expression. Certain forms of expression can be evaluated during the analysis of the design unit in which they appear; such an expression is said to be locally static. Certain forms of expression can be evaluated as soon as the design hierarchy in which they appear is elaborated; such an expression is said to be globally static.
The expressions found in the two signal declarations are all locally static, derived from literals (
1 specifying locally static ranges, in
x providing the choice
others in the aggregate expression for it's default value, for every element in the index range for
'0' is provided as the default value.
Also does a vhdl function call fall into the category of a non-static expression?
See 4. Subprograms and packages, 4.1 General, paragraph 2:
There are two forms of subprograms: procedures and functions. A procedure call is a statement; a function call is an expression and returns a value. Certain functions, designated pure functions, return the same value each time they are called with the same values as actual parameters; the remainder, impure functions, may return a different value each time they are called, even when multiple calls have the same actual parameter values. ...
So a function call is an expression. An expression can be either locally static or globally static:
9.4.2 Locally static primaries
An expression is said to be locally static if and only if every operator in the expression denotes an implicitly defined operator or an operator defined in one of the packages STD_LOGIC_1164, NUMERIC_BIT, NUMERIC_STD, NUMERIC_BIT_UNSIGNED, or NUMERIC_STD_UNSIGNED in library IEEE, and if every primary in the expression is a locally static primary, where a locally static primary is defined to be one of the following:
e) A function call whose function name denotes an implicitly defined operation or an operation defined
in one of the packages STD_LOGIC_1164, NUMERIC_BIT, NUMERIC_STD, NUMERIC_BIT_UNSIGNED, or NUMERIC_STD_UNSIGNED in library IEEE and whose actual parameters are each locally static expressions
9.4.3 Globally static primaries
An expression is said to be globally static if and only if every operator in the expression denotes a pure function and every primary in the expression is a globally static primary, where a globally static primary is a primary that, if it denotes an object or a function, does not denote a dynamically elaborated named entity (see 14.6) and is one of the following:
i) A function call whose function name denotes a pure function and whose actual parameters are each globally static expressions
Essentially the parameters to a function call must be either locally static or globally static and the function must be a pure function for the expression determined by a function call to be static. (All predefined operators for predefined types are pure).
If these requirements are not met then the function call expression is not static. An easy example would be a parameter that is either a variable or a signal, both requiring evaluation during execution.