Asynchronous FIFO
Proprietary and Confidential 1
Agenda
➭ Importance
➭ Block diagram of FIFO
➭ Steps/Modules of FIFO
➭ FIFO pointers
➭ Gray code counter
➭ Handling Full & Empty conditions
➭ Different clock speeds
➭ Multibit asynchronous reset
➭ Advantages & Disadvantages of using binary pointers
Proprietary and Confidential 2
Importance of Asynchronous FIFO
➭ Asynchronous FIFOs are widely used to safely pass the data from one clock domain to
another clock domain.
➭ FIFOs are used in designs to safely pass multi-bit data words from one clock domain to
another.
➭ Data words are placed into a FIFO buffer memory array by control signals in one clock
domain, and the data words are retrieved from another port of the same FIFO buffer
memory array by control signals from a second clock domain.
➭ The difficulty associated with doing FIFO design is related to generating the FIFO
pointers and finding a reliable way to determine full and empty status on the FIFO.
Proprietary and Confidential 3
Figure 1: Block diagram of Asynchronous FIFO
Proprietary and Confidential 4
Modules for Asynchronous FIFO
➭ FIFO memory
➭ Binary & Gray Counter
➭ Synchronizer
➭ Full & Empty logic block
Proprietary and Confidential 5
FIFO Memory
➭ Heart of Asynchronous reset FIFO.
➭ Depth & width of memory is 16 bits and 8 bits.
➭ It has following inputs:
➭ Write Data
➭ Write Enable
➭ Read Enable
➭ Write Clock
➭ Write address
➭ Read Address
➭ Read Data
Proprietary and Confidential 6
Binary & Gray Counter
➭ Binary counter is used to address the FIFO MEMORY i.e. Write and
Read address.
➭ Gray counter is used for addressing Read and Write pointers.
Proprietary and Confidential 7
Synchronizer
Figure 2: How synchronizer works in Asynchronous FIFO
Proprietary and Confidential 8
Full or Empty Logic block
Figure 3: Block diagram of full or empty logic in Asynchronous FIFO
Proprietary and Confidential 9
Asynchronous FIFO pointers
Figure 4: FIFO full and empty conditions for binary pointers with depth 16
Proprietary and Confidential 10
Grey Code Counter - Style #1
Figure 5: Dual n-bit Gray code counter block diagram style 1
Proprietary and Confidential 11
Gray Code patterns
Figure 6: n-bit Gray code converted to an (n-1)-bit Gray code
Proprietary and Confidential 12
➭ Figure 6 describes the 4-bit Gary code.
➭ If we take an example of memory depth 8, w/r_add width will be 3 bits, w/r_ptr
will be 4 bits.
➭ We can create n-bit and n-1-bit Gray codes separately for pointers and address
pins.
➭ For efficient use, we can create a n-1 Gray code from n-bit Gray code.
➭ Here we are calling it as dual n-bit Gray code counter.
➭ For pointers there is no change from the above figure.
➭ For address pins there is an issue as (7-0100 and 8-1100) the LSB bits are same.
➭ When address reaches (7-100) it should do restart from (0-000), But from 4-bit
Gray we are receiving (7-1100) i.e. 3 LSB bits.
➭ To resolve this issue, we are making Xor of MSB bits and giving to address.
Proprietary and Confidential 13
Grey Code Counter- Style #2
Figure 7: Dual n bit Gray code counter block diagram style 2
Proprietary and Confidential 14
Handling Full & Empty Condition
Figure 8: Problems associated with extracting a 3-bit Gray code from a 4-bit Gray code
Proprietary and Confidential 15
➭ If we use Gray code counters, then checking empty condition has no issue.
➭ But checking full condition is not as simple as we did in binary counters.
➭ If we take the same example of memory depth 8, w/r_add width will be 3
bits, w/r_ptr will be 4 bits.
➭ From the above figure 8, when write and read pointers point to 7th location it
is empty condition with its Gray code value as 0100.
➭ Write and read address value will be 100.
➭ When we do next write, write pointer value will be 1100 and read pointer value
will be 0100.
➭ If we use the same concept used for binary counters, then it is a
full condition but here it is actually not.
➭ Also write address value not changing.
Proprietary and Confidential 16
Different clock speeds & Multi-bit Asynchronous reset
➭ Synchronized Gray code that increments twice but is only sampled once will
show multi-bit changes in the synchronized value, will this cause multi-bit
synchronization problems?.
➭ Will there be a problem associated with an asynchronous reset, which generally
causes multiple pointer bits to changes simultaneously?
Proprietary and Confidential 17
Advantages of using binary pointers over gray code pointers
➭ Each synchronized Gray code pointer requires 2n flip-flops. The sampled multi-bit
register requires 2n+4 flip-flops.
➭ The sampled multi-bit binary register allows arbitrary pointer changes. Gray code
pointers can only increment and decrement.
➭ The sampled multi-bit register technique permits arbitrary FIFO depths; whereas a
Gray code pointer requires power-of-2 FIFO depths.
➭ Using binary pointers makes it easy to calculate “almost-empty” and “almost-full”
status bits using simple binary arithmetic between the pointer values.
Proprietary and Confidential 18
Disadvantage of using binary pointers over gray code pointers
➭ Sampling and holding a binary FIFO pointer and then handshaking it across a
clock boundary can delay the capture of new samples by at least two clock edges
from the receiving clock domain and another two clock edges from the sending
clock domain.
Proprietary and Confidential 19
Formula for gray code to calculate FIFO depth
Proprietary and Confidential 20
Thank you
Proprietary and Confidential 21