Professional Documents
Culture Documents
F If o Depth Calculation
F If o Depth Calculation
F If o Depth Calculation
Basically we use FIFO for synchronizing two clock domains (different frequencies) so we need a device
which has some tolerance power to hold the data that device is called FIFO .By using FIFO we can easily
avoid overflow and underflow conditions The scenario can be two of following
l
In FIFO depth calculation we always have to consider worst cast .size of FIFO basically implies that how
much data is required to buffer . And it is totally depend on data rate of reading and writing.
Data rate = Number of Data x Time Period
Difference = DRFAST DRSLOW
Depth = Difference / Higher Freq. Time Period
Writing side is Source and Reading Side is Sink. If the data rate of writing is higher then the reading sides
data rate then the FIFO will now overflow.
Another Type of depth calculation can be done by this method:
Consider F1 is writing frequency and F2 is reading frequency (F1>F2) and Data Size is D (Data Words)
Time taken to write to FIFO = DATA/F1
Data Read from the FIFO in the same time = (DATA/F1) xF2
Excess Data is FIFO (Backlog) = DATA-((DATA/F1) x F2
Read side will take more time to read the data so that time is called mop-up time. Following is the
calculation of mop-up time
Mop-up time = Backlog/F2 = DATA-(DATA/F1 F2)
Fwrite = Clock Frequency of Write Clock Domain
Depth= Wmax {Wmax x Fread x Wread}
Fread = Clock Frequency of Read Clock Domain
Fwrite x Wwrite
Wmax= Maximum number of worlds can be Written
Wwrite = Number of Writes in Per Clock
Wread = Number of reads in Per Clock
Following are some cases of FIFO depth calculation with perfect explanation.
Case: 1
Writing Side
Reading Side
Solution:
Consider the data size is = 10
Data Rate of Writing = 10 x (1/30) =333.33 ns
Data Rate of Reading = 10 x (1/40) =250.0 ns.
Difference between Data Rates = 333.33 250.0 = 83.33
Now divide with highest frequency time period = 83.33/25ns = 3.3332 = 4 (Aprox)
Depth of FIFO Should be 4
Case: 2
Writing Side
Reading Side
No Randomization
Solution:
Data Size is = 80
Data Rate of Writing =80*10=800ns
Data Rate of Reading=80*12=900ns
Difference = 960-800=160ns
Now divide with highest frequency time period = 160/10ns=16
Depth of FIFO Should be 16
Case: 3
Writing Side
Reading Side
= 2.5 MHz=>400 ns
Word Size
=2
Solution:
Data Rate of Writing =100*2=200ns
Data Rate of Reading=400*2=800ns
Difference = 800-200=600
Now Divide by the lowest frequency time period = 600/400 = 1.5 = 2
Case: 4
Writing Data = 80 DATA/100 Clock (Randomization of 20 Datas)
Outgoing Data= 8 DATA/10 Clock
Solution:
Above shows that the Writing Frequency is equal to reading frequency
We will consider worst case
20 Data
80 Valid Data
80 Valid Data
20 Data
So we will consider 200 Cycles. In 200 Cycle 160 Data is written. it means 160 data continuously written in
160 clock it is the worst case .
At the reading side we will Read 8x16=128 data in 16x10=160 Clock Cycle.
So the Difference between Written Data and Read Back Data is = 160-128=32