Megafunction

lpm_and (AND Gate) Megafunction



Parameterized AND gate. Altera® recommends using AND primitives or operators rather than lpm_and for easier implementation and to improve compilation time. However, lpm_and may be useful if you need parameterized inputs.

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_and (data[LPM_SIZE-1..0][LPM_WIDTH-1..0])
   WITH (LPM_WIDTH, LPM_SIZE)
   RETURNS (result[LPM_WIDTH-1..0])

 

VHDL Component Declaration:

COMPONENT lpm_and
   GENERIC (LPM_WIDTH: POSITIVE;
      LPM_SIZE: POSITIVE;
      LPM_TYPE: STRING := "LPM_AND";
      LPM_HINT: STRING := "UNUSED");
   PORT (data: IN STD_LOGIC_2D(LPM_SIZE-1 DOWNTO 0, LPM_WIDTH-1 DOWNTO 0);
      result: OUT STD_LOGIC_VECTOR(LPM_WIDTH-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
data[][] Yes Data input to the AND gate. Input port LPM_SIZE x LPM_WIDTH wide. Two-dimensional bus ports are not supported in Verilog HDL.

OUTPUT PORTS

Port Name Required Description Comments
result[] Yes Each result[] bit is the result of the AND operators. Output port LPM_WIDTH wide.

 

Parameter Descriptions:

Parameter Type Required Description
LPM_WIDTH Integer Yes Width of the data[][] and result[] ports. Number of AND gates.
LPM_SIZE Integer Yes Number of inputs to each AND gate. Number of input buses.
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.

 

Truth Table/Functionality:

Each lpm_and function defines LPM_WIDTH AND gates. Each AND gate has the following function:

Inputs Outputs
data[LPM_SIZE-1]_[LPM_WIDTH-1] Note (1) result[LPM_WIDTH-1]
0XXX... 0
X0XX... 0
XX0X... 0
... ...
1111... 1

 

Resource Usage:

Simple lpm_and gates use approximately one logic cell per gate.

NOTE This topic prints best in Landscape orientation.


Back to Top

- PLDWorld -

 

Created by chm2web html help conversion utility.