General Description: The use of the RD_COUNT and WR_COUNT output vectors for tracking the status of the Asynchronous FIFO v1_0 may not be clear from the description in the v1_0 datasheet. An example is included below.
Say you wish to be able to track 4 different states of a 1023-word deep FIFO--that is, when the FIFO is less than 1/4 full, 1/4 to less than 1/2 full, 1/2 to less than 3/4 full, and 3/4 or more full. Then the WR_COUNT will need to support a width of log2(4) = 2 bits to encode the 4 possible states as 00, 01, 10, and 11. This corresponds to data count values as shown below for a 1023 word deep FIFO: if depth = 1023, this corresponds to:
00: Less than 1/4 full data count < 256 01: 1/4 to less than 1/2 256 <= data count < 512 10: 1/2 to less than 3/4 513 <= data count < 768 11: 3/4 or more full 768 <= data count < 1024
Note that these flags may be off by one to three counts, depending on what the most recent operations are; however, this is usually not a problem for most applications. Also note that the particular count you use will depend on the clock domain you wish to examine the output in.
The problem has been fixed in the 3.x IP Update #2 version of the datasheet.