vhdl_reference_93:logic_operators

Logic operators

The logic operators AND , OR , NAND , NOR , XOR, XNOR and NOT are defined for the predefined data types bit and boolean . They can also be used for one-dimensional array-types ( Array ) whose elements are of the type bit or boolean . If the operators AND , OR , NAND , NOR , XOR and XNOR are to be used in this last case the following has to be taken into consideration:

  • Both arrays have to have the same length.
  • The operation is carried out with the corresponding elements of both arrays.
  • The result is a array which has the same field depth as the left operand.

Basically the same is valid for the operator NOT , however, the operation is carried out with every individual element of the array. All binary logic operators have the lowest priority. The unary operator NOT has top priority.

A B A AND B
F F F
T F F
F T F
T T T
A B A NAND B
F F T
T F T
F T T
T T F
A B A OR B
F F F
T F T
F T T
T T T
A B A NOR B
F F T
T F F
F T F
T T F
A B A XOR B
F F F
T F T
F T T
T T F
A B A XNOR B
F F T
T F F
F T F
T T T
A NOT A
F T
T F

T stands for true (type boolean ), '1' (type bit ).

F stands for false (type boolean ), '0' (type bit ).