Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Comparing read and write pointers in Asynchronous FIFO

Status
Not open for further replies.

identical

Member level 1
Joined
Feb 10, 2015
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
225
I don't really get why read and write pointers need to be compared in Async FIFO to generate the FULL and EMPTY signals. If read pointer is 1111 for example, doesn't that mean the buffer is FULL. Why does it have to be compared with the write pointer to see if it is full.
 

Hi,

no, the FIFO usually is implemented as a ring buffer.

Lets imagine a 16 byte deep FIFO.
Lets say write pointer and read pointer both are at 0.

now you send 3 bytes to the FIFO.
you write byte1 and the FIFO sets write pointer to 1
you write byte2 and the FIFO sets write pointer to 2
you write byte3 and the FIFO sets write pointer to 3

Read pointer is still at zero.
Now you read those three bytes from FIFO.
Read byte 1 (from address 0) and increment read pointer to 1
Read byte 2 (from address 1) and increment read pointer to 2
Read byte 3 (from address 2) and increment read pointer to 3

Now both pointers are equal at "3" that means FIFO is empty. (Because 3 bytes written, 3 bytes read)

***
write 12 bytes to the FIFO .. the pointer is at "15"
write a next byte and the pointer wraps around to 0
write additional 2 bytes and the write pointer is at 2 (this is "1" below the read pointer - it still is at "3") ... this means FIFO is full.

(maybe you recognized that the FIFO is full with 15 bytes, not 16. To be able to use the 16th byte you need an extra flag)

Klaus
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top