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.
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).
Mode | Inactive AEVAL/AFVAL Bits | Inactive 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 blocks | None | None | DIFF[15:8] withAE/FVAL[7:0] |
The following figure illustrates flag generation.
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).
Number of Blocks | Block DxW | Number of AEVAL/AFVAL Bits |
---|---|---|
1 | 1x1 | 4 |
2 | 1x2 | 4 |
2 | 2x1 | 5 |
4 | 1x4 | 4 |
4 | 2x2 | 5 |
4 | 4x1 | 6 |
8 | 1x8 | 4 |
8 | 2x4 | 5 |
8 | 4x2 | 6 |
8 | 8x1 | 7 |
16 | 1x16 | 4 |
16 | 2x8 | 5 |
16 | 4x4 | 6 |
16 | 8x2 | 7 |
16 | 16x1 | 8 |
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 .