Arithmetic and Logical Expressions
|
Expressions in VHDL-AMS are similar to those of most high-level languages. Data elements must be of the same type, or subtypes of the same base type. Expressions perform arithmetic or logical computations by applying an operator to one or more operands. Operators specify the computation to perform, operands are the data for the computation. |
||
|
Logical |
AND | OR | NAND | NOR | XOR | XNOR | NOT |
|
|
Relational |
= | /=
< | <= | > | >= Relational operators include tests for equality (=), inequality (/=), and ordering of operands (<, <=, >, >=). The operands of each relational operator must be of the same type. The result type of each relational operator is the predefined type BOOLEAN. |
|
|
Shift |
sll | srl Shift left/right logical. sla | sra Shift left/right arithmetic. rol | ror Rotate left/right logical. Operators for any one-dimensional array type whose element type is either of the predefined types BIT or BOOLEAN (left operant) and predefined type INTEGER (right operand). The result type of each shift operator is the same as the left operand. |
|
|
Adding |
+ | -
& Concatenate, a & b makes one array For each of these adding operators, the operands and the result are of the same type. |
|
|
Multiplying |
* | /
mod | rem a mod b takes sign of b, a rem b takes sign of a For each of these multiplying operators, the operands and the result are of the same type. |
|
|
Miscellaneous |
abs absolute value ** a** is a² The exponential operator ** is predefined for each integer type and for each floating point type. |
|