FWFT模式fifo的使用细节

这两天使用fifo generator的时候,对First-Word Fall-Through(FWFT)模式详细看了下,发现了一点有趣的细节。

首先知道FWFT模式相对于Standard模式不同的是,不需要读命令,fifo自动将最新的数据放在dout上,这样对fifo读出的使能和数据能做到同步,控制更简单一些。从时序图上能很容易地明白。

standard_fifo_read.png FWFT_fifo_read.png

而特别的地方就在于如何实现提前将数据放在rd_dout上,查看datasheet发现是这么说的

By providing the capability to read the next data word before requesting it, first-word fall-through (FWFT) implementations increase the depth of the FIFO by 2 read words.

也就是多存了两个数据在里面,从Data Count也能看出来这一点。
那么当写入多少个数据时,读出接口的empty才会deasserted?

我仿了下IP核,用的非对称数据宽度和不同写入读出时钟,发现结果如下:

FWFT_fifo_empty.png

也就是说要写入两个数据时,empty信号才会deasserted,而且在这时立即读出的话,rd_dout不会更新,那么第二个写入的数据不会呈现出来。
这在连续读写时当然不会有问题,但在突发读写且会读空fifo的情况下,写入逻辑就需要稍微注意下,要多塞几个数进去才能将有效数据全部给拿出来,而具体多塞几个就看具体情况去控制了。

另外wr/rd_count也是个有趣的东西,在不同模式和不同读写宽度比例时其初始值不同。对其介绍Product Guide是这么说的

For FWFT implementations using More Accurate Data Counts (Use Extra Logic), data_count is guaranteed to be accurate when words are present in the FIFO, with the exception of when its near empty or almost empty or when initial writes occur on an empty FIFO. In these scenarios, data_count may be incorrect on up to two words.

在接近empty的时候rd_count是错的… 那要你来何用… 看了下前面的介绍,多是拿来判断fifo半空,四分之一空等,不过我暂没这么用过就是了。
反正用这个rd_count的时候也是要注意才行。

参考
PG057