
18
Altera Corporation
Arithmetic Functions
Parameters
Notes:
(1)
The following table describes the 
overflow
 port during 
"ADD"
 and 
"SUB"
 operations.
(2)
The following table describes the 
cout
 port during 
"ADD"
 and 
"SUB"
 operations.
Name
Required
Value
Description
LPM_DIRECTION
No
"ADD"
"SUB"
"DEFAULT"
The 
add_sub
 port cannot be used if the 
LPM_DIRECTION
parameter is has a value other than 
"DEFAULT"
. The default 
value is 
"DEFAULT"
.
LPM_PIPELINE
No
Integer 
≥
 0
Specifies the number of clock cycles of latency associated with 
the 
result[]
output. A value of zero (
0
) indicates that no 
latency exists, and that a purely combinatorial function will be 
instantiated. The default value is 0 (non-pipelined).
Type of addition performed. The default value is 
"SIGNED"
.
LPM_REPRESENTATION
No
"SIGNED"
"UNSIGNED"
Integer > 0
LPM_WIDTH
Yes
No
Width of the 
dataa[]
, 
datab[]
, and 
result[]
 ports.
Provides greater optimization if an input is constant. The 
default value is 
"NO"
.
ONE_INPUT_IS_CONSTANT
"YES"
"NO"
Value
ADD Operation
SUB Operation
"UNSIGNED"
Not meaningful.
(
dataa
 + 
datab
 + 
cin
) > 2
(
LPM_WIDTH
 – 1) – 1
or 
(
dataa
 + 
datab
 + 
cin
) > 2
(
LPM_WIDTH
 – 1)
Not meaningful.
(
dataa
 – 
datab
 – 
cin
) > 2
(
LPM_WIDTH
 – 1) – 1
or 
(
dataa
 – 
datab
 – 
cin
) > 2
(
LPM_WIDTH
 – 1)
"SIGNED"
Value
ADD Operation
SUB Operation
"UNSIGNED"
dataa
 + 
datab
 + 
cin
 > 2
(
LPM_WIDTH
 – 1) – 1
Normal subtract. However, if 
cout
 = 0, then 
(
dataa
 – 
datab
 – 
cin
) < 0.
Normal result when subtracting a positive 
number from a negative number, or possible 
overflow.
"SIGNED"
Normal result of adding two negative numbers, 
or possible overflow.