|
Arithmetic operators are used to perform arithmetic addition and subtraction operations on groups and numbers in AHDL Boolean expressions. The following arithmetic operators are used in Boolean expressions:
Operator: | Example: | Description: |
---|---|---|
+ (unary) |
+1 |
positive |
- (unary) |
-a[4..1] |
negative |
+ |
count[7..0] + delta[7..0] |
addition |
- |
rightmost_x[] - leftmost_x[] |
subtraction |
The unary plus (+
) and minus (-
) are prefix operators. The +
operator does not
affect its operand, but you may use it for documentation purposes (that is, to indicate
a positive number). The -
operator interprets its operand as a binary representation
of a number if it is not already a number. It then performs a two's complement
unary-minus operation on the operand.
The following rules apply to the other arithmetic operators:
Operations are performed between two operands, which must be groups of nodes or numbers.
If both operands are groups of nodes, the groups must be the same size.
If both operands are numbers, the shorter number is sign-extended to match the size of the other operand.
If one operand is a number and the other is a group of nodes, the number is truncated or sign-extended to match the size of the group. If any significant bits are truncated, the Compiler generates an error message.
|
- PLDWorld - |
|
Created by chm2web html help conversion utility. |