Comparator modules compare the magnitude of two values, their equality, or both their magnitude and equality. There are two types of comparators: those that compare the values applied to the symbol's two bus-pins, and those that compare a constant against the value applied to the A bus-pin.
Figure 4.6 The Comparator Module |
The following comparisons are available and can be used in any combination.
Equality | Magnitude | |
---|---|---|
A=B | A<B | A>B |
AB | A<=B | A>=B |
The data on the A input port is compared to the data on the B input port.
Connections: A is a required input.
BThe data on the B input port is compared to the data on the A input port.
Connections: The B input is present if a Constant value is not specified. If you set the Constant Value attribute, you generate a schematic symbol with a Constant input instead of the B input bus.
At least one of the following outputs must be specified:
A = B (A_EQ_B)This output is an active High output when the data on the A input port equals the data on the B input port.
A <> B (A_NE_B)This output is an active High output when the data on the A input port does not equal the data on the B input port.
A < B (A_LT_B)This output is an active High output when the value on the A input port is less than the value on the B input port.
A > B (A_GT_B)This output is an active High output when the value on the A input port is greater than the value on the B input port.
A <= B (A_LE_B)This output is an active High output when the value on the A input port is less than or equal to the value on the B input port.
A >= B (A_GE_B)This output is an active High output when the value on the A input port is greater than or equal to the value on the B input port.
Use the Constant Value attribute to replace the B input port with a constant. If you do not define this attribute, the B pin is present.
Style (STYLE)Style defines the implementation style (area or speed preference).
Usage: Setting Style to Edge Decode or Wired AND causes all of the outputs to disappear except A = B and A <> B. For more information, see the Implementation Styles section of the Understanding Attributes chapter.
Encoding (ENCODING)Encoding defines the encoding scheme used to represent the data type of the module. Valid values are Signed and Unsigned.