Megafunction

lpm_mult (Multiplier) Megafunction



Parameterized multiplier megafunction. Altera® recommends that you use lpm_mult to replace all other types of multiplier functions.

Altera also recommends instantiating this function as described in Using the MegaWizard® Plug-In Manager.

This topic contains the following information:

 

AHDL Function Prototype (port name and order also apply to Verilog HDL):

FUNCTION lpm_mult (dataa[(LPM_WIDTHA-1)..0], datab[(LPM_WIDTHB-1)..0], sum[(LPM_WIDTHS-1)..0], aclr, clock)
   WITH (LPM_WIDTHA, LPM_WIDTHB, LPM_WIDTHP, LPM_WIDTHS, LPM_REPRESENTATION, LPM_PIPELINE, LATENCY,
      INPUT_A_IS_CONSTANT, INPUT_B_IS_CONSTANT, USE_EAB, MAXIMIZE_SPEED,     
      DEDICATED_MULTIPLIER_CIRCUITRY, DEDICATED_MULTIPLIER_MIN_INPUT_WIDTH_FOR_AUTO,
      DEDICATED_MULTIPLIER_MIN_OUTPUT_WIDTH_FOR_AUTO)
   RETURNS (result[LPM_WIDTHP-1..0]);
NOTE The LATENCY parameter is provided only for backward compatibility.

 

VHDL Component Declaration:

COMPONENT lpm_mult
   GENERIC (LPM_WIDTHA: POSITIVE;
      LPM_WIDTHB: POSITIVE;
      --LPM_WIDTHS: POSITIVE;
      LPM_WIDTHS: NATURAL := 0;
      LPM_WIDTHP: POSITIVE;
      LPM_REPRESENTATION: STRING := "UNSIGNED";
      LPM_PIPELINE: INTEGER := 0;
      LPM_TYPE: STRING := "LPM_MULT";
      LPM_HINT: STRING := "UNUSED";
      DEDICATED_MULTIPLIER_CIRCUITRY: STRING := "AUTO";
      DEDICATED_MULTIPLIER_MIN_INPUT_WIDTH_FOR_AUTO: INTEGER := 0;
      DEDICATED_MULTIPLIER_MIN_OUTPUT_WIDTH_FOR_AUTO: INTEGER := 0;
   PORT (dataa: IN STD_LOGIC_VECTOR(LPM_WIDTHA-1 DOWNTO 0);
      datab: IN STD_LOGIC_VECTOR(LPM_WIDTHB-1 DOWNTO 0);
      aclr, clock: IN STD_LOGIC := '0';
	  clken: IN STD_LOGIC := '1';
      sum: IN STD_LOGIC_VECTOR(LPM_WIDTHS-1 DOWNTO 0) := (OTHERS => '0');
      result: OUT STD_LOGIC_VECTOR(LPM_WIDTHP-1 DOWNTO 0));
END COMPONENT;

 

VHDL LIBRARY-USE Declaration

LIBRARY lpm;
USE lpm.lpm_components.all;

 

Port Descriptions:

INPUT PORTS

Port Name Required Description Comments
dataa[] Yes Multiplicand. Input port LPM_WIDTHA wide.
datab[] Yes Multiplier. Input port LPM_WIDTHB wide.
sum[] No Partial sum. Input port LPM_WIDTHS wide.
clock No Clock for pipelined usage. The clock port provides pipelined operation for the lpm_mult function. For LPM_PIPELINE values other than 0 (default value), the clock port must be connected.
clken No Clock enable for pipelined usage. If omitted, the default is 1.
aclr No Asynchronous clear for pipelined usage. The pipeline initializes to an undefined (X) logic level. The aclr port can be used at any time to reset the pipeline to all 0s, asynchronously to the clock signal. The outputs are a consistent, but non-zero value.

OUTPUT PORTS

Port Name Required Description Comments
result[] Yes result = dataa[] * datab[] + sum. The product LSB is aligned with the sum LSB. Output port LPM_WIDTHP wide. If LPM_WIDTHP < max (LPM_WIDTHA + LPM_WIDTHB, LPM_WIDTHS) or (LPM_WIDTHA + LPM_WIDTHS), only the LPM_WIDTHP MSBs are present.

 

Parameter Descriptions:

Parameter Type Required Description
LPM_WIDTHA Integer Yes Width of the dataa[] port.
LPM_WIDTHB Integer Yes Width of the datab[] port.
LPM_WIDTHP Integer Yes Width of the result[] port.
LPM_WIDTHS Integer Yes Width of the sum[] port. Required even if the sum port is not used.
LPM_REPRESENTATION String No Type of multiplication performed: "SIGNED", "UNSIGNED", or "UNUSED".  If omitted, the default is "UNSIGNED". The signed representation for all library of parameterized modules (LPM) megafunctions is two's complement.
LPM_PIPELINE Integer No 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. If the value of the LPM_PIPELINE parameter is greater than zero for the Mercury dedicated multiplier, one of the pipeline stages will always be placed on the outputs. If omitted, the default is 0 (non-pipelined). For Stratix and Stratix GX devices, if the design uses DSP blocks, you can increase the performance of the design when the value of the LPM_PIPELINE parameter is three or less.
LPM_HINT String No Allows you to assign 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.
INPUT_A_IS_CONSTANT String No Altera-specific parameter. Values are "YES", "NO", and "UNUSED". If dataa[] is connected to a constant value, setting INPUT_A_IS_CONSTANT to "YES" optimizes the multiplier for resource usage and speed. If omitted, the default is "NO".
INPUT_B_IS_CONSTANT String No Altera-specific parameter. Values are "YES", "NO", and "UNUSED". If datab[] is connected to a constant value, setting INPUT_B_IS_CONSTANT to "YES" optimizes the multiplier for resource usage and speed. The default is "NO".
USE_EAB String No

Altera-specific parameter. Values are "ON", "OFF", and "UNUSED". Setting the USE_EAB parameter to "ON" allows the Quartus® II software to use ESBs to implement 4 x 4 or (8 x const value) building blocks in APEX 20K, APEX II, ARM®-based Excalibur, and Mercury devices, or EABs in ACEX® 1K and FLEX 10KE devices. Altera recommends that you set USE_EAB to "ON" only when LCELLS are in short supply.

This parameter is not available for simulation with other EDA simulators and for FLEX® 6000, MAX® 3000, and MAX 7000 devices.

If you wish to use this parameter when you instantiate the function in a Block Design File (.bdf), you must specify it by entering the parameter name and value manually with the Parameters tab (Symbol Properties Command) or the Parameters tab (Block Properties Command). You can also use this parameter name in a Text Design File (.tdf) or a Verilog Design File (.v). You must use the LPM_HINT parameter to specify the USE_EAB parameter in VHDL Design Files.

LATENCY Integer No Altera-specific parameter. Same as LPM_PIPELINE. (This parameter is provided only for backward compatibility. For all new designs, you should use the LPM_PIPELINE parameter instead.)
MAXIMIZE_SPEED Integer No

Altera-specific parameter. You can specify a value between 0 and 10. If used, the Quartus II software attempts to optimize a specific instance of the lpm_mult function for speed rather than area, and overrides the setting of the Optimization Technique option in the Assignment Organizer dialog box (Assignment menu). If MAXIMIZE_SPEED is unused, the value of the Optimization Technique option is used instead. For a "SIGNED" multiplier with no inputs being a constant, if the setting for MAXIMIZE_SPEED is 9-10, the Compiler optimizes the lpm_mult megafunction for larger area, these settings are for backward compatibility only; if the setting is between 6-8, the Compiler optimizes for larger area and higher speed; if the setting is between 1-5, the Compiler optimizes for smaller area and high speed. If the setting is 0, the smallest and, generally, slowest design results. For designs with LPM_WIDTHB parameters that are non-power-of-2, the default setting is 1-5. For designs with LPM_WIDTHB parameters that are a power-of-2, the default is 6-8.

For an "UNSIGNED" multiplier with no inputs being a constant, if the setting for MAXIMIZE_SPEED is 6 or higher, the Compiler optimizes for larger area and higher speed; if the setting is between 0-5, which is the default value, the Compiler optimizes for smaller area.

DEDICATED_MULTIPLIER_CIRCUITRY String No

Specifies whether to use dedicated multiplier circuitry. Values are "AUTO", "YES", and "NO". If omitted, the default is "AUTO". This parameter is available for Mercury, Stratix, and Stratix GX devices only.

For Stratix and Stratix GX devices, the value of "AUTO" specifies that the Quartus II software will make a choice whether to use the dedicated multiplier circuitry based on the width of the multiplier. For Mercury devices, a value of "AUTO" defaults to no dedicated multiplier circuitry.

DEDICATED_MULTIPLIER_MIN_INPUT_WIDTH_FOR_AUTO Integer No If the DEDICATED_MULTIPLIER_CIRCUITRY parameter setting is "AUTO", this parameter specifies the minimum value of the LPM_WIDTHA and LPM_WIDTHB parameters in order for the multiplier to be built using dedicated circuitry. This parameter is available for Mercury, Stratix, and Stratix GX devices only.
DEDICATED_MULTIPLIER_MIN_OUTPUT_WIDTH_FOR_AUTO Integer No If the DEDICATED_MULTIPLIER_CIRCUITRY parameter setting is "AUTO", this parameter specifies the minimum value of the sum of the LPM_WIDTHA and LPM_WIDTHB parameters in order for the multiplier to be built using dedicated circuitry. This parameter is available for Mercury, Stratix, and Stratix GX devices only.

NOTE Specifying a value for MAXIMIZE_SPEED has an effect only if LPM_REPRESENTATION is set to "SIGNED".

 

Truth Table/Functionality:

Inputs Outputs
dataa[LPM_WIDTHA-1..0] datab[LPM_WIDTHB-1..0] sum[LPM_WIDTHS-1..0] product[LPM_WIDTHP-1..0]
a b s LPM_WIDTHP most significant bits of a * b + s

 

Resource Usage:

The following table summarizes the resource usage for an lpm_mult function used to implement 4-bit and 8-bit multipliers with LPM_PIPELINE = 0 and without the optional sum input. Logic cell usage scales linearly in proportion to the square of the input width.

Design Goals Design Results
Device Family Optimization
APEX 20K Routability
  Speed
  Routability
  Speed
Width Logic Cells
8 121
8 163
4 29
4 41

Numbers of shared expanders used are shown in parentheses ( ).

NOTE This topic prints best in Landscape orientation.


Back to Top

- PLDWorld -

 

Created by chm2web html help conversion utility.