|
4.3.1 LPM_ADD_SUB |
Copyright © 1998 University of Manchester |
Description | Comments | |||
Augend/Minuend | Vector, LPM_Width wide | |||
Addend/Subtrahend | Vector, LPM_Width wide | |||
Carry in to the low order bit
OP=ADD Low= 0 High= +1 OP=SUB Low = -1 High= 0 | If not connected, default value is LOW. | |||
The Operation to be performed
=H: OP = ADD =L: OP = SUB | Cannot be used it LPM_Direction property is used. If not connected, defaults value is ADD. | |||
DataA ± DataB ± Cin | Vector, LPM_Width wide | |||
Carry-out (~Borrow-in) of Most Significant Bit (MSB) | Note 1 | |||
Result exceeds available precision. | Note 2 | |||
Clock for pipelined usage | Note 3 | |||
Asynchronous Clear | Note 4 |
Note 1: Cout has a physical interpretation as the carry-out (~borrow-in) of the most significant bit. Cout is most meaningful for detecting overflow in unsigned numbers. See Table 1 for the arithmetic interpretation of Cout = 1.
Note 2: Overflow has a physical interpretation as the XOR (exclusive or) of the carry into the MSB with the carry out of the MSB. Overflow is only meaningful when the LPM_Representation is signed. It indicates that the Result has exceeded the available precision. See Table 2 for the arithmetic interpretation of Overflow = 1.
Note 3: The clock port provides for pipelined operation of the LPM_ADD_SUB. If a latency other 0 (default value) is specified, then the clock port must be connected.
Note 4: The pipelined initializes to undefined. The Aclr port
may be used at any time to reset the pipeline to all 0's asynchronously
to clock.
Table 1 | ||
Unsigned | (DataA + DataB + Cin) > 2LPM_Width-1 | Normal Subtract. However, if Cout = 0, then (DataA - DataB - Cin) < 0 |
Signed | Normal result of adding two negative numbers, or possible overflow. | Normal result when subtracting a positive number from a negative number, or possible overflow. |
Table 2 | OP=ADD | OP=SUB |
Unsigned | Not meaningful | Not meaningful |
Signed | (DataA + DataB + Cin) > 2LPM_Width-1-1
or (DataA + DataB + Cin) < -2LPM_Width-1 | (DataA - DataB - Cin) > 2LPM_Width-1-1
or (DataA - DataB - Cin) < -2LPM_Width-1 |
Value | Comments | ||
LPM Value > 0 | Width of DataA, DataB and Result | ||
ADD | SUB | Default is ADD. Add_Sub port may not be used if this property is used. | ||
UNSIGNED or SIGNED | Default is SIGNED | ||
LPM Value > = 0 | Default is 0 - non-pipelined |
When Cout is prepended to the Result, the result is a vector that always has sufficient precision to represent the result of the operation.
Copyright © 1998 University of Manchester |