FIFO size/depth Calculation

Assume that you have two systems T and R which operate at frequencies 200MHz and 20MHz respectively. How can you send data from A to B without any loss?
Fig: Question related to FIFO 

In this post, we will try to get an answer to these type of questions where we need to communicate from a high-frequency system (T) to a low-frequency system (R). If the system T sends some B bits of data at a time, then the system R will receive some bits of data and due to its slow speed it will not be able to cope up with the transmitting speed of T, hence the data will be lost. That data which has a possibility of getting lost, must be stored for some time until the slow system R reads it. This storage of data between T and R can be done using a FIFO buffer.

FIFO Introduction:

FIFO stands for first in first out. As the name suggests, it is a type of buffer which stores a given number of bits and the output from the buffer is taken in the same order as the input is stored. It can be developed using a simple serial in serial out shift register, where the number of flip-flops in the register is equal to the number of bits we need to store in this register.


FIFO Size/Depth Calculation:

Fig: Solution to the above question

Coming back to our question, we saw that a FIFO can be introduced between T and R to prevent data loss. Now, How many bits should our FIFO be capable of storing? This quantity also known as FIFO size/ FIFO depth is calculated considering the worst case scenario.

We get the worst scenario when the system T writes data at the maximum possible rate and system R reads data from the buffer at the minimum rate.

Let the maximum amount of data that the transmitter can write at a time be B bits. This is also known as the burst size.

Let the rate at which system T transmits data (writes into FIFO buffer) = RT Hz.
similarly, let the rate at which system R receives data (reads from FIFO buffer) = RR Hz.

As we have a burst size of B, the time taken to write B bits of data = B/RT seconds.
The number of bits system R can send in the same time = (B/RT)* RR bits.

The remaining bits must be stored in the buffer so that we don't lose it which gives us the depth of buffer.
Therefore, Depth = B - (B/RT)*RR  bits.

Note that we have not considered the idle cycles for read and write operation. If specified in the question, we can incorporate those also by analyzing the question in a similar manner as we saw above.

Thanks for reading!

1 comment:

  1. video link also you have to add here. anyone can refer from here

    ReplyDelete