Megafunction

dcfifo (Dual-Clock FIFO) Megafunction



Parameterized dual-clock FIFO megafunction. The dcfifo function uses mega RAMs or M4K or M512 memory blocks in Stratix and Stratix GX devices, M4K memory blocks in Cyclone devices, Embedded System Blocks (ESB) in APEX 20K, APEX II, ARM®-based Excalibur, and Mercury devices, Embedded Array Blocks (EAB) in ACEX® 1K and FLEX 10KE devices, or DFFE or latch arrays in FLEX® 6000, MAX® 3000, and MAX 7000 devices or if the USE_EAB parameter is set to "OFF". Altera® strongly recommends using synchronous rather than asynchronous RAM functions.

NOTE The Quartus® II Compiler automatically implements suitable portions of this function in mega RAMs or M4K or M512 memory blocks in Stratix and Stratix GX devices, in M4K memory blocks in Cyclone devices, in ESBs in APEX 20K, APEX II, ARM-based Excalibur, and Mercury devices, and in EABs in ACEX 1K and FLEX 10KE devices. The Compiler automatically implements this function in logic cells in FLEX 6000, MAX 3000, and MAX 7000 devices.

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

NOTE The synchronization and internal logic in dcfifo may cause the information in the wrempty, wrfull, wrusedw[], rdempt, rdfull, and rdusedw[] ports to be delayed by one clock cycle of latency.

This topic contains the following information:

 

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

FUNCTION dcfifo (data[LPM_WIDTH-1..0], rdclk, rdreq, wrclk, wrreq,
      aclr)
   WITH (LPM_WIDTH, LPM_NUMWORDS, LPM_SHOWAHEAD,
      UNDERFLOW_CHECKING, OVERFLOW_CHECKING, USE_EAB,
      DELAY_RDUSEDW, DELAY_WRUSEDW, RDSYNC_DELAYPIPE,
      WRSYNC_DELAYPIPE)
   RETURNS (q[LPM_WIDTH-1..0], rdempty, rdfull, wrempty, wrfull,
      rdusedw[CEIL(LOG2(LPM_NUMWORDS))-1..0],
      wrusedw[CEIL(LOG2(LPM_NUMWORDS))-1..0]);

 

VHDL Component Declaration:

COMPONENT dcfifo
   GENERIC (LPM_WIDTH: POSITIVE;
      LPM_WIDTHU: POSITIVE;
      LPM_NUMWORDS: POSITIVE;
      LPM_SHOWAHEAD: STRING:= "OFF";
      OVERFLOW_CHECKING: STRING:= "ON";
      UNDERFLOW_CHECKING: STRING:= "ON";
      DELAY_RDUSEDW: POSITIVE:= 1;
      DELAY_WRUSEDW: POSITIVE:= 1;
      RDSYNC_DELAYPIPE: POSITIVE:= 3;
      WRSYNC_DELAYPIPE: POSITIVE:= 3);
   PORT (data: IN STD_LOGIC_VECTOR(LPM_WIDTH-1 DOWNTO 0);
      rdclk, wrclk, wrreq, rdreq, aclr: IN STD_LOGIC;
      rdfull,wrfull, wrempty, rdempty: OUT STD_LOGIC;
      q: OUT STD_LOGIC_VECTOR(LPM_WIDTH-1 DOWNTO 0)
      rdusedw, wrusedw: OUT STD_LOGIC_VECTOR(LPM_WIDTHU-1 DOWNTO
      0));
END COMPONENT;

 

VHDL LIBRARY-USE Declaration

LIBRARY altera_mf
USE altera_mf.altera_mf_components.all;

 

Port Descriptions:

INPUT PORTS

Port Name Required Description Comments
data[] Yes Data input to the dcfifo. Input port LPM_WIDTH wide.
rdclk Yes Positive-edge-triggered clock.  
wrclk Yes Positive-edge-triggered clock.  
wrreq Yes Write request. The data[] port is written to the dcfifo. Writing is disabled if wrfull = 1.
rdreq Yes Read request. The oldest data in the dcfifo goes to the q[] port. Reading is disabled if rdempty = 1.
aclr No Resets the dcfifo to empty.  

OUTPUT PORTS

Port Name Required Description Comments
q[] Yes Data output from the dcfifo. Output port LPM_WIDTH wide.
rdempty No If asserted, indicates that the dcfifo is empty and disables the rdreq port. Synchronized with rdclk.
wrfull No If asserted, indicates that the dcfifo is full and disables the wrreq port. Synchronized with wrclk.
wrempty No Indicates that the dcfifo is empty. Delayed version of rdempty that is synchronized with wrclk.
rdfull No If asserted, indicates that the dcfifo is full. Delayed version of wrfull that is synchronized with rdclk.
rdusedw[] No The number of words that are currently in the dcfifo.

Synchronized with rdclk.

Output port with width
[CEIL(LOG2(LPM_NUMWORDS))-1..0].

wrusedw[] No The number of words that are currently in the dcfifo.

Synchronized with wrclk.

Output port with width
[CEIL(LOG2(LPM_NUMWORDS))-1..0].

 

Parameter Descriptions:

Parameter Type Required Description
LPM_WIDTH Integer Yes Width of data[] and q[] ports.
LPM_WIDTHU Integer Yes (VHDL only) Width of usedw[] port.
LPM_NUMWORDS Integer Yes Number of words stored in memory, which is usually a power of 2. The last three words of the dcfifo may not be available for writing because of the synchronization pipelines between the two Clock schemes. These pipelines are intended to avoid internal metastability. Because of these pipelines, information available to one Clock scheme regarding when reads and writes occur may be temporarily unavailable to the other Clock. The wrfull and rdfull ports of a dcfifo must be raised high slightly before the dcfifo is completely full, in order to avoid overshooting the top of the fifo. This process may cause several words at the end of the fifo to become unavailable. Depending on the rate you are writing to the fifo, the wrfull and rdfull ports may go high with three words remaining, with two words remaining, or with one word remaining in the fifo. However, this process is necessary both to accommodate the clock synchronization and to ensure overshoot does not take place. If you need to maintain a specific number of words, you may want to specify a number for the LPM_NUMWORDS parameter that is up to three words greater than the amount you believe is needed.
LPM_SHOWAHEAD String No Allows the data to appear on q[] before rdreq is asserted. Values are "ON" or "OFF" (the default is "OFF"). Specifying "ON" for LPM_SHOWAHEAD may reduce performance.
OVERFLOW_CHECKING String No

Disables the overflow-checking logic when set to "OFF", so that wrfull is no longer checked for wrreq. Values are "ON" or "OFF" (the default is "ON").

Writing to a full dcfifo gives unpredictable results.
UNDERFLOW_CHECKING String No

Disables the underflow-checking logic when set to "OFF", so that rdempty is no longer checked for rdreq. Values are "ON" or "OFF" (the default is "ON").

NOTE Reading an empty dcfifo gives unpredictable results.
DELAY_RDUSEDW Integer No Any integer greater than or equal to 0. Specifies the number of register stages that are added internally to the rdusedw[] port. The default value of 1 adds a single register stage to the output to improve its performance.
DELAY_WRUSEDW Integer No Any integer greater than or equal to 0. Specifies the number of register stages that are added internally to the wrdusedw[] port. The default value of 1 adds a single register stage to the output to improve its performance.
RDSYNC_DELAYPIPE Integer No Specifies the number of register stages that are added internally for synchronization from the write control logic to the read control logic. The default value of 3 provides good insurance against the possibility of internal metastability when rdclk and wrclk are unrelated.
WRSYNC_DELAYPIPE Integer No Specifies the number of register stages that are added internally for synchronization from the read control logic to the write control logic. The default value of 3 provides good insurance against the possibility of internal metastability when rdclk and wrclk are unrelated.
USE_EAB String No Altera-specific parameter. Values are "ON", "OFF", and "UNUSED". Setting the USE_EAB parameter to "OFF" prevents the Quartus II software from using ESBs to implement the logic in APEX 20K, APEX II, ARM-based Excalibur, and Mercury devices, or EABs in ACEX 1K and FLEX 10KE devices; it can use only flipflops or latches. (The "ON" setting is not useful in memory functions: the Quartus II software automatically implements memory functions in ESBs or EABs by default.) This parameter is not available for simulation with other EDA simulators and for FLEX 6000, MAX 3000, MAX 7000, Stratix, and Stratix GX devices.

 

Truth Table/Functionality:

The dcfifo function represents memory with synchronous inputs and/or outputs.

Synchronous Memory Operations
rdclk rdreq wrclk wrreq aclr Function
X X X X H Resets the dcfifo to empty.
Rising Edge L X X L No change (requires positive Clock edge).
Rising Edge H X X L Read from the fifo (if not empty).
X X Rising Edge L L No change.
X X Rising Edge H L Write to the fifo (if not full).

 

Resource Usage:

Uses one embedded cell per data output bit for ACEX 1K, APEX 20K, APEX II, ARM-based Excalibur, FLEX 10KE, Mercury, Stratix, and Stratix GX devices; however, in FLEX 6000, MAX 3000, and MAX 7000 devices, or if the USE_EAB parameter is set to "OFF", uses one logic cell per memory bit.

The following table summarizes the resource usage for a dcfifo megafunction used to implement an 8-bit-wide FIFO buffer. A depth of 8 words is used for the FLEX 6000, MAX 3000, and MAX 7000 device families. A depth of 256 words is used for all other device families.

Design Goals Design Results
Device Family
APEX 20K
Width Depth Logic Cells ESBs Speed(ns) Notes
8 256 150 1 9 Note (6)

NOTE This topic prints best in Landscape orientation.


Back to Top

- PLDWorld -

 

Created by chm2web html help conversion utility.