Black Box Method
The black-box method can be used for any LPM supported by Altera, such as LVDS, but requires more coding than the prepared components method. The prepared-component method is simpler and easier to use, so check to see if there is a prepared component available that you can use before choosing the black box method.
In the black-box method you instantiate a black-box component for the LPM, then assign LPM-specific attributes. This method works for all Altera LPMs.
The LPM_RAM_DQ is a parameterized RAM with separate input and output ports. Altera recommends using the LPM_RAM_DQ to implement asynchronous memory or memory with synchronous inputs and/or outputs. The LPM_RAM_DQ function uses EABs in FLEX10K and APEX20K devices, and latch arrays in other device families. If you are using a FLEX10K device, Altera recommends that you use synchronous rather than asynchronous RAM functions.
LPM_RAM_DQ Example
Here is an example of instantiating an LPM_RAM_DQ using the black box
method:
library synplify;
use synplify.attributes.all;
entity myram is
port (clock, we: in bit;
data : in bit_vector (3 downto 0);
address: in bit_vector (1 downto 0);
q: out bit_vector (3 downto 0));
end myram;
architecture arch1 of myram is
component myram_4x4
port (data: in bit_vector (3 downto 0);
address: in bit_vector (1 downto 0);
inclock, outclock, we: in bit;
q : out bit_vector (3 downto 0));
end component;
-- Assign the appropriate attribute values.
attribute syn_black_box of myram_4x4: component is true;
attribute LPM_WIDTH: POSITIVE;
attribute LPM_WIDTH of myram_4x4: component is 4;
attribute LPM_WIDTHAD: POSITIVE;
attribute LPM_WIDTHAD of myram_4x4: component is 2;
-- Specify that the LPM to be used is "LPM_RAM_DQ"
attribute LPM_TYPE: STRING;
attribute LPM_TYPE of myram_4x4: component is "LPM_RAM_DQ";
begin
-- Instantiate the LPM component
u1: myram_4x4
port map(data, address, clock, clock, we, q);
end arch1;
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。