Read Operation - 1.0 English

Embedded FIFO Generator LogiCORE IP Product Guide (PG327)

Document ID
PG327
Release Date
2023-05-10
Version
1.0 English

This section describes the behavior of a FIFO read operation and the associated status flags. When read enable is asserted and the FIFO is not empty, data is read from the FIFO on the output bus (dout), and the valid flag (data_valid) is asserted. If the FIFO is continuously read without being written, the FIFO empties. Read operations are successful when the FIFO is not empty. When the FIFO is empty and a read is requested, the read operation is ignored, the underflow flag is asserted, and there is no change in the state of the FIFO (underflowing the FIFO is non-destructive).

almost_empty and empty Flags

The almost empty flag (almost_empty) indicates that the FIFO will be empty after one more read operation. This flag is active-High and synchronous to rd_clk. This flag is asserted when the FIFO has one remaining word that can be read.

The empty flag (empty) indicates that the FIFO is empty and no more reads can be performed until data is written into the FIFO. This flag is active-High and synchronous to the read clock (rd_clk). If a read is initiated when empty is asserted, the request is ignored and underflow is asserted.

Common Clock Note

When write and read operations occur simultaneously while empty is asserted, the write operation is accepted and the read operation is ignored. On the next clock cycle, empty is deasserted and underflow is asserted.

Modes of Read Operation

The Embedded FIFO Generator core supports two modes of read options, standard read operation and first-word fall-through (FWFT) read operation. The standard read operation provides the user data on the cycle after it was requested. The FWFT read operation provides the user data on the same cycle in which it is requested.

Standard FIFO Read Operation

For a standard FIFO read operation, after read enable is asserted and if the FIFO is not empty, the next data stored in the FIFO is driven on the output bus (dout) and the valid flag (data_valid) is asserted.

The following figure shows a standard read access. When you write at least one word into the FIFO, empty is deasserted — indicating that the data is available to be read. When you assert rd_en, a read operation occurs on the next rising edge of rd_clk. The FIFO outputs the next available word on dout and asserts data_valid, indicating a successful read operation. When the last data word is read from the FIFO, the FIFO asserts empty. If you continue to assert rd_en while empty is asserted, the read request is ignored, data_valid is deasserted, and underflow is asserted. When you perform a write operation, the FIFO deasserts empty, allowing you to resume valid read operations, as indicated by the assertion of data_valid and deassertion of underflow.

Figure 1. Standard Read Operation for a FIFO with Independent Clocks

First-Word Fall-Through FIFO Read Operation

The first-word fall-through (FWFT) feature provides the ability to look-ahead to the next word available from the FIFO without issuing a read operation. When data is available in the FIFO, the first word falls through the FIFO and appears automatically on the output bus (dout). After the first word appears on dout, empty is deasserted indicating one or more readable words in the FIFO, and data_valid is asserted, indicating a valid word is present on dout.

The following figure shows a FWFT read access. Initially, the FIFO is not empty, the next available data word is placed on the output bus (dout), and data_valid is asserted. When you assert rd_en, the next rising clock edge of rd_clk places the next data word onto dout. After the last data word has been placed on dout, an additional read request causes the data on dout to become invalid, as indicated by the deassertion of data_valid and the assertion of empty. Any further attempts to read from the FIFO results in an underflow condition.

Unlike the standard read mode, the first-word-fall-through empty flag is asserted after the last data is read from the FIFO. When empty is asserted, data_valid is deasserted. In the standard read mode, when empty is asserted, data_valid is asserted for 1 clock cycle. The FWFT feature also increases the effective read depth of the FIFO by two read words.

The FWFT feature adds two clock cycle latency to the deassertion of empty, when the first data is written into a empty FIFO.

Note: For every write operation, an equal number of read operations is required to empty the FIFO. This is true for both the first-word-fall-through and standard FIFO.
Figure 2. FWFT Read Operation for a FIFO with Independent Clocks

Common Clock FIFO, Simultaneous Read and Write Operation

The following figure shows a typical write and read operation. A write is issued to the FIFO, resulting in the deassertion of the empty flag. A simultaneous write and read is then issued, resulting in no change in the status flags. After two or more words are present in the FIFO, the almost_empty flag is deasserted. Write requests are then issued to the FIFO, resulting in the assertion of almost_full when the FIFO can only accept one more write (without a read). A simultaneous write and read is then issued, resulting in no change in the status flags. Finally, one additional write without a read results in the FIFO asserting full, indicating no further data can be written until a read request is issued.

Figure 3. Write and Read Operation for a FIFO with Common Clocks