VHDL Operators

Operator: abs

An absolute value operator which can be applied to any numeric type in an expression.

Example: Delta <= abs(A-B)

LRM: 7.2

Operator: xnor

The logical "both or neither" (equality) operator which can be used in an expression. The expression "A xnor B" returns True only when (1) A is true and B is true, or (2) A is false and B is false.

LRM: 7.2

Operator: and

The logical "and" operator which can be used in an expression. The expression "A and B" returns true only if both A and B are true.

LRM: 7.2

Operator: mod

The modulus operator which can be applied to integer types. The result of the expression "A mod B" is an integer type and is defined to be the value such that:

(1) the sign of (A mod B) is the same as the sign of B, and

(2) abs (A mod B) < abs (B), and

(3) (A mod B) = (A * (B - N)) for some integer N.

LRM: 7.2

Operator: nand

The logical "not and" operator which can be used in an expression. It produces the opposite of the logical "and" operator. The expression "A nand B" returns True only when (1) A is false, or (2) B is false, or (3) both A and B are false.

LRM: 7.2

Operator: nor

The logical "not or" operator which can be used in an expression. It produces the opposite of the logical "or" operator. The expression "A nor B" returns True only when both A and B are false.

LRM: 7.2

Operator: not

The logical "not" operator which can be used in an expression. The expression "not A" returns True if A is false and returns False if A is true.

LRM: 7.2

Operator: or

The logical "or" operator which can be used in an expression. The expression "A or B" returns True if (1) A is true, or (2) B is true, or (3) both A and B are true.

LRM: 7.2

Operator: rem

The remainder operator which can be applied to integer types. The result of the expression "A rem B" is an integer type and is defined to be the value such that:

(1) the sign of (A rem B) is the same as the sign of A, and

(2) abs (A rem B) < abs (B), and

(3) (A rem B) = (A - (A / B) * B).

LRM: 7.2

Operator: rol

Rotate left operator.

Example: Sreg <= Sreg rol 2;

LRM: 7.2.3

Operator: ror

Rotate right operator.

Example: Sreg <= Sreg ror 2;

LRM: 7.2.3

Operator: sla

Shift left arithmetic operator.

Example: Addr <= Addr sla 8;

LRM: 7.2.3

Operator: sll

Shift left logical operator.

Example: Addr <= Addr sll 8;

LRM: 7.2.3

Operator: sra

Shift right arithmetic operator.

Example: Addr <= Addr sra 8;

LRM: 7.2.3

Operator: srl

Shift right logical operator.

Example: Addr <= Addr srl 8;

LRM: 7.2.3

Operator: xor

The logical "one or the other but not both" (inequality) operator which can be used in an expression. The expression "A xor B" returns True only when (1) A is true and B is false, or (2) A is false and B is true.

LRM: 7.2

Operator: =

The equality operator which can be used in an expression on any type except file types. The resulting type of an expression using this operator is Boolean (that is, True or False). The expression "A = B" returns True only if A and B are equal.

LRM: 7.2

Operator: /=

The inequality operator which can be used in an expression on any type except file types. The resulting type of an expression using this operator is Boolean (that is, True or False). The expression "A /= B" returns True only if A and B are not equal.

LRM: 7.2

Operator: :=

The assignment operator for a variable. The expression "TEST_VAR := 1" means that the variable TEST_VAR is assigned the value 1.

LRM: 8.5

Operator: <

The "less than" operator which can be used in an expression on scalar types and discrete array types. The resulting type of an expression using this operator is Boolean (that is, True or False). The expression "A < B" returns True only if A is less than B.

LRM: 7.2

Operator: <=

This symbol has two purposes. When used in an expression on scalar types and discrete array types, it is the "less than or equal to" operator. The resulting type of an expression using this operator in this context is Boolean (that is, True or False). In this context, the expression "A <= B" returns True only if A is less than or equal to B.

Example: LE := ‘1’ when A <= B else ‘0’;

In a signal assignment statement, the symbol "<=" is the assignment operator. Thus, the expression "TEST_SIGNAL <= 5" means that the signal TEST_SIGNAL is assigned the value 5.

Example: DataBUS <= 0x"E800";

LRM: 7.2, 8.4

Operator: >

The "greater than" operator which can be used in an expression on scalar types and discrete array types. The resulting type of an expression using this operator is Boolean (that is, True or False). The expression "A > B" returns True only if A is greater than B.

LRM: 7.2

Operator: >=

The "greater than or equal to" operator which can be used in an expression on scalar types and discrete array types. The resulting type of an expression using this operator is Boolean (that is, True or False). The expression "A >= B" returns True only if A is greater than or equal to B.

LRM: 7.2

Operator: +

The addition operator. Both operands must be numeric and of the same type. The result is also of the same numeric type. Thus, if A = 2 and B = 3, the result of the expression "A + B" is 5.

This operator may also be used as a unary operator representing the identity function. Thus, the expression "+A" would be equal to A.

LRM: 7.2

Operator: -

The subtraction operator. Both operands must be numeric and of the same type. The result is also of the same numeric type. Thus, if A = 5 and B = 3, the result of the expression "A - B" is 2.

This operator may also be used as a unary operator representing the negative function. Thus, the expression "-A" would be equal to the negative of A.

LRM: 7.2

Operator: &

The concatenation operator. Each operand must be either an element type or a 1-dimensional array type. The result is a 1-dimensional array type.

LRM: 7.2

Operator: *

The multiplication operator. Both operands must be of the same integer or floating point type.

The multiplication operator can also be used where one operand is of a physical type and the other is of an integer or real type. In these cases, the result is of a physical type.

LRM: 7.2

Operator: /

The division operator. Both operands must be of the same integer or floating point type.

The division operator can also be used where a physical type is being divided by either an integer type or a real type. In these cases, the result is of a physical type. Also, a physical type can be divided by another physical type, in which case the result is an integer.

LRM: 7.2

Operator: **

The exponentiation operator. The left operand must be of an integer type or a floating point type, and the right operand (the exponent) must be of an integer type. The result is of the same type as the left operand.

LRM: 7.2