A variable assignment statement
replaces the current value of a variable with a new value specified
by an expression.
variable_name := expression ;
The variable assignment statement modifies the value of the variable.
The new value of the variable is obtained by assigning an expression
to this variable. In order to distinguish variable assignment from signal
assignment, the variable assignment symbol is different (:=).
The expression assigned to a variable must give results of the same
type as the variable. The target at the left-hand side of the
assignment can be either a name of a variable or an aggregate.
In the first case, the target can be in the form of simple name,
selected name, indexed name or slice name (Example 1).
In case of aggregate as the target of the assignment, the type of the
aggregate must be determinable from the context, including the fact
that the type must be of the composite type. Each element of the
aggregate must be in the form of the locally static name, which
represents variable (Example 2).
The element association of aggregate, similarly to names, may have
forms that are more complex: selected name, indexed name or slice
name (Example 3).
variable X, Y : REAL;
variable A, B : BIT_VECTOR
(0 to 7);
type BIT_RECORD is record
bitfield : BIT;
intfield : Integer;
variable C, D : BIT_RECORD;
X := 1000.0;
A := B;
A := "11111111";
A (3 to 6) := ('1','1','1','1');
A (0 to 5) := B (2 to 7);
A (7) := '0';
B (0) := A (6);
C.bitfield := '1';
D.intfield := C.intfield;
The above examples of variable assignments are grouped in the
following way: after the declarations the first group is a group of
assignments with simple names as targets, then slice names, indexed
names and finally selected names.
variable E : BIT;
variable I : INTEGER;
(E, I) := C;
The aggregate used above as a target for a variable assignment could
be used for the variable C declared in such a way as in the Example
1. E will be assigned the value of C.bitfield and I - C.intfield.
type BIT_VECTOR_RECORD is record
a: BIT_VECTOR(0 to 7);
variable G, H : BIT_VECTOR_RECORD;
(C.bitfield, C.intfield) := D; -- aggregate with selected name
(G.a(0 to 7), K) := H; --
aggregate with sliced name
(G.a(0), K) := D; -- aggregate with indexed name
Aggregates can use different forms of names.
Variable assignment can be labeled.
Variable assignment takes effect immediately.
Variable assignment can not be specified with a delay.