AHDL

Arithmetic Operators in Boolean Expressions



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:

NOTE
  1. When you add two groups together on the right of a Boolean equation with the + operator, you can place a 0 on the left of each group to sign-extend the width of the group. This method provides an extra bit of information to the group on the left of the equation that can be used as a carry-out signal. Example

  2. You can name Boolean operators and comparators in AHDL files to make it easy to enter resource assignments and to interpret the Equations Section of the Text-Format Report File (.rpt) or HTML-Format Report File (.htm). For more information, go to Naming a Boolean Operator or Comparator.

  3. The arithmetic operators that are supported in Boolean expressions are a subset of the arithmetic operators supported in arithmetic expressions.


Back to Top

- PLDWorld -

 

Created by chm2web html help conversion utility.