A first in, first out (FIFO) memory system, comprising:
- a memory having a plurality of locations each having an address, a write address port for receiving a sequence of write address values during write operations, and a read address port for receiving a sequence of read address values during read operations;
- and
- a flag control circuit including:
- a first multi-bit comparator for detecting an almost-empty condition, which occurs when only one data value is stored in the memory, by comparing a first read address value associated with the sequence of read address values to a first write address value associated with the sequence of write address values;
- a first logic circuit connected to an output terminal of the first multi-bit comparator, wherein the first logic circuit asserts an ALMOST_EMPTY control signal on an output terminal when the first multi-bit comparator detects the almost-empty condition during a read operation;
- and
- a register for asserting an EMPTY control signal when there are no data values stored in the memory, the register having a data input terminal coupled to the output terminal of the first logic circuit, and a clock input terminal connected to receive a clock signal;
- wherein the register latches the ALMOST_EMPTY control signal immediately after the ALMOST_EMPTY control signal is asserted by the first logic circuit, thereby causing the register to assert the EMPTY control signal during the same clock cycle of the clock signal in which said only one data value is read from the memory.