x : array 0..3 of boolean;and suppose y is an expression involving a signal (i.e., not a constant expression). Then the statement:
next(x[y]) := expr;is treated as an abbreviation for the array of assignments:
if(y=0) next(x[0]) := expr; if(y=1) next(x[1]) := expr; if(y=2) next(x[2]) := expr; if(y=3) next(x[3]) := expr;This syntactic interpretation has two important consequences. First, although the ``next'' value of x is assigned, the subscript y is evaluated at the ``current'' time. This is in accordance with what we would expect to occur in a procedural language. Second, this statement effectively assigns all of the elements of the array. This means that, for example, the following is a violation of the single assignment rule:
x[0] := foo; x[count + 1] := bar;This makes sense, since it is not possible to determine statically whether 0 and count +1 refer to the same element of the array.
A practical note: if you want to make two assignments to variable indices in the same array, you can use use the ``default'' construct (described below). That is, the following is legal:
default next(x[i]) := foo; in next(x[j]) := bar;In the case where i = j, the second assignment takes precedence, and thus there are no simultaneous assignments.