Wednesday, July 8, 2009

FIFO Depth Calculation



We know that FIFO is useful for synchronizing between two clock domains .

In the case of FIFO ,FIFO depth calculation is very important. If we didn't calculate the depth of FIFO properly there is a chance to miss the data( information ).

You can find different equations & solutions from various website .

Here i am trying to explain FIFO depth calculation by a simple example.


Assume that Write Clock Frequency WClk = 200 Mhz
Read Clock Frequency RClk = 100 Mhz
No of data per 100 WClk cycle (Data rate including delay) = 80 data

So

WClk = 200Mhz = 5ns
RClk = 100 Mhz = 10ns

Total Time Taken for writing 80 data = 80*5 = 400ns .
But Time Taken for reading 80 data = 80*10 = 800 ns .

So difference b/w data write & read
same no of data = 800 -400 = 400 ns .


ie we want to store 400ns data to some position.Otherwise data will over write .

How many data will write this 400ns time = 400ns/5ns = 80 .

We have to store this 80 Data .

So we can say that FIFO should have minimum depth of 80 .

13 comments:

  1. Where have u taken into consideration that it takes 100 WClk cycles to write 80 data words ??

    ReplyDelete
  2. And more specific how to account for idle cycles which you see so often in FIFO depth problems ?

    ReplyDelete

  3. FIFO depth calculation = B - B *F2/(F1*I)
    in this case B = 80,
    F2 Read Clk Freq,
    F1 Write Clk Freq,
    I Idle clk Cycles for Reading side,(In this case it is 1 clk cycles),

    = 80 - 80 * 100*10^6/(200*10^6*1)

    = 80(1 - 1/2)
    = 40

    ReplyDelete
  4. 80 is correct. In worse case burst size will be 160. consider 20 idle , 80 data, 80 data, 20 idle cycles then effectively we write 160 data in 160 write cycles . i.e 160 data in 160*5=800ns. Now in 800 ns we can read back 800/10=80 data only so remaining 160-80=80 should be fifo depth.

    ReplyDelete
    Replies
    1. Yes, you are right. Worst case it can go to 160.

      Delete
  5. Yes this is correct explanation thanks ashish.

    ReplyDelete
  6. The equation is right. The depth of fifo totally depends on burst length. If the burst length increases as in from 80 to 160 the size becomes 80, else for a burst of 80 the size is 40 only

    ReplyDelete
  7. worst case explanation is correct!!!!

    ReplyDelete
  8. time taken to write 80 data should be 100*5ns=500ns
    data read in 500ns(assuming no idle cycles between successive reads)=500ns/10ns=50
    hence 50 words were read when 80 words were written, therefore FIFO depth=(80-50)=30

    ReplyDelete
  9. Casinos Near Casino York - Mapyro
    Find casinos and งานออนไลน์ other gaming facilities near Casinos Near 안동 출장샵 Casino York in New 거제 출장마사지 York, 경주 출장안마 including the Tropicana Las Vegas and LINQ Promenade. 부산광역 출장안마

    ReplyDelete