2.10.6 FIFO Flag Logic

The FIFO is user configurable into various DEPTHs and WIDTHs. The following figure shows the FIFO address counter details.

  • Bits 11 to 5 are active for all modes
  • As the data word size is reduced, more least-significant bits are added to the address
  • As the number of cascaded blocks increases, the number of significant bits in the address increases

For example, if four blocks are cascaded as a 1kx16 FIFO with each block having a 1kx4 aspect ratio, bits 11 to 2 of the address will be used to specify locations within each RAM block, whereas bits 13 and 12 will be used to specify the RAM block.

Figure 2-63. FIFO Address Counters

The AFULL and AEMPTY flag threshold values are programmable. The threshold values are AFVAL and AEVAL, respectively. Although the trigger threshold for each flag is defined with eight bits, the effective number of threshold bits in the comparison depends on the configuration. The effective number of threshold bits corresponds to the range of active bits in the FIFO address space (see the following table).

Table 2-98. FIFO Flag Logic
ModeInactive AEVAL/AFVAL BitsInactive DIFF Bits (set to 0)DIFF Comparison to AFVAL/AEVAL
Non-cascade[7:4][15:12]DIFF[11:8] withAE/FVAL[3:0]
Cascade 2 blocks[7:5][15:13]DIFF[12:8] withAE/FVAL[4:0]
Cascade 4 blocks[7:6][15:14]DIFF[13:8] withAE/FVAL[5:0]
Cascade 8 blocks[7][15]DIFF[14:8] withAE/FVAL[6:0]
Cascade 16 blocksNoneNoneDIFF[15:8] withAE/FVAL[7:0]

The following figure illustrates flag generation.

Figure 2-64. ALMOST-EMPTY and ALMOST-FULL Logic

The Verilog codes for the flags are:

assign AF = (DIFF[15:0] >={AFVAL[7:0],8'b00000000})?1:0;
assign AE = ({AEVAL[7:0],8'b00000000}>=DIFF[15:0])?1:0;

The number of DIFF-bits active depends on the configuration depth and width (see the following table). 

Table 2-99. Number of Available Configuration Bits
Number of BlocksBlock DxWNumber of AEVAL/AFVAL Bits
11x14
21x24
22x15
41x44
42x25
44x16
81x84
82x45
84x26
88x17
161x164
162x85
164x46
168x27
1616x18

The active-high CLR pin is used to reset the FIFO to the empty state, which sets FULL and AFULL low, and EMPTY and AEMPTY high.

Assuming that the EMPTY flag is not set, new data is read from the FIFO when REN is valid on the active edge of the clock. Write and read transfers are described with timing requirements in Timing Characteristics .