contents.gifindex.gifprev1.gifnext0.gif

Sequence of Evaluation

Operators can act differently when used with sets depending on the types of its arguments. When a set is written

[a, b, c, d]

"a" is the MOST significant bit and "d" is the LEAST significant bit.

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 & signal a & b The expression is TRUE if both signals are TRUE.

signal & number a & 4 The number is converted to binary and the least significant
bit is used. The expression becomes a & 0, then is reduced to 0
(FALSE).

signal & set a & [x, y, z] The signal is distributed over the elements of the set to become
[a & x, a & y, a & z]

set & set [a, b] & [x, y] The sets are ANDed bit-wise resulting in: [a & x, b & y]. An error
is displayed if the set widths do not match.

set & number [a, b, c] & 5 The number is converted to binary and truncated or padded with
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]

number & number 9 & 5 The number is converted to binary and the least significant bit is
used, so this expression becomes 1 & 1, which is reduced to 1
(TRUE).

Some example equations:

select = [a15..a0] == ^H80FF

select (signal) is TRUE when the 16-bit address bus has the hex value 80FF. Relational operators always result in a single bit.

[sel1, sel0] = [a3..a0] >> 2

The width of the "sel" set and the "a" set are different, so the "2" is expanded to four bits (of binary) to match the size of the "a" set. Both sel1 and sel2 are true when the value of the four "a" lines (taken as a binary number) are greater than 2. The result of the comparison is a single-bit result which is distributed to both members of the set on the output side of the equation.

[out3..out0] = [in3..in0] & enab

If enable is TRUE, then the values on "in0" through "in3" are seen on the "out0" through "out3" outputs. If enable is FALSE, then the outputs are all FALSE.