|
|
Parameterized absolute value megafunction. Altera® recommends using the lpm_abs function to replace all other types of absolute value functions.
Altera also recommends instantiating this function as described in Using the MegaWizard® Plug-In Manager.
This topic contains the following information:
FUNCTION lpm_abs (data[LPM_WIDTH-1..0]) WITH (LPM_WIDTH, ADDERTYPE) RETURNS (result[LPM_WIDTH-1..0], overflow);
COMPONENT lpm_abs
GENERIC (LPM_WIDTH : POSITIVE;
LPM_TYPE: STRING := "LPM_ABS";
LPM_HINT: STRING := "UNUSED");
PORT (data : IN STD_LOGIC_VECTOR(LPM_WIDTH-1 DOWNTO 0);
result : OUT STD_LOGIC_VECTOR(LPM_WIDTH-1 DOWNTO 0);
overflow: OUT STD_LOGIC);
END COMPONENT;
The ADDERTYPE parameter is supported only for backward compatibility, but should not be used in newer projects. |
LIBRARY lpm; USE lpm.lpm_components.all;
INPUT PORTS
| Port Name | Required | Description | Comments |
|---|---|---|---|
data[] |
Yes | Signed number. | Input port LPM_WIDTH wide. |
OUTPUT PORTS
| Port Name | Required | Description | Comments |
|---|---|---|---|
result[] |
Yes | Absolute value of data[]. |
Output port LPM_WIDTH wide. |
overflow |
No | High if data = -2 ^
(LPM_WIDTH-1). |
Two's complement allows one more negative number
than positive. The overflow port detects that singular instance and goes
high to indicate that no positive equivalent exists. |
| Parameter | Type | Required | Description |
|---|---|---|---|
LPM_WIDTH |
Integer | Yes | Width of the data[] and result[]
ports. |
LPM_HINT |
String | No | Allows you to specify Altera-specific
parameters in VHDL Design Files (.vhd).
The default is "UNUSED". |
LPM_TYPE |
String | No | Identifies the library of parameterized modules (LPM) entity name in VHDL Design Files. |
| Inputs | Outputs | |
|---|---|---|
data[LPM_WIDTH-1..0] |
result[LPM_WIDTH-1..0] |
overflow |
| >= 0 | data[LPM_WIDTH-1..0] |
0 |
| < 0 | data[LPM_WIDTH-1..0] |
0 |
| 100... | 100... | 1 |
The following table summarizes the resource usage for an lpm_abs function used to implement a 16-bit absolute value converter with an up/down control and an overflow output.
| Design Goals | Design Results | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Numbers of shared expanders used are shown in parentheses ( ).
| This topic prints best in Landscape orientation. |
|
- PLDWorld - |
|
|
| Created by chm2web html help conversion utility. |