Sequence of Evaluation
The result, when most operators are applied to a set, will be another set. The
result of the relational operators (==, !=, >>, >>=, <<, <<=) is a value: TRUE
(all ones) or FALSE (all zeros), which is truncated or padded to as many bits
as needed. The width of the result is determined by the context of the
relational operator, not by the width of the arguments. See examples below.
The different contexts of the AND (&) operator and the semantics of each usage
are described below.
& Expression Example Result
signal & number a & 4 The number is converted to binary and the least significant
signal & set a & [x, y, z] The signal is distributed over the elements of the set to become
set & set [a, b] & [x, y] The sets are ANDed bit-wise resulting in: [a & x, b & y]. An error
set & number [a, b, c] & 5 The number is converted to binary and truncated or padded with
number & number 9 & 5 The number is converted to binary and the least significant bit is
Some example equations:
signal & signal a & b The expression is TRUE if both signals are TRUE.
bit is used. The expression becomes a & 0, then is reduced to 0
(FALSE).
[a & x, a & y, a & z]
is displayed if the set widths do not match.
zeros as needed to match the width of the set. The sequence of
transformations is
[a, b, c] & [1, 0, 1]
[a & 1, b & 0, c & 1]
[a, 0, c]
used, so this expression becomes 1 & 1, which is reduced to 1
(TRUE).