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.

Help me understand the FIFO operation

Status
Not open for further replies.

deepu_s_s

Full Member level 5
Joined
Mar 24, 2007
Messages
305
Helped
15
Reputation
30
Reaction score
5
Trophy points
1,298
Activity points
3,021
Hi Friends,

I am designing a FIFO. Please confirm whether I am correct about the FIFO.

FIFO : First in First Out . Consider an array of 10 elements. The FIFO will have write_pointer, read_pointer, full, empty signals. First two of them are not interfacing signals. They are used for internal purpose.

Initially, the write_pointer and the read_pointer are set to 0; the starting location of the FIFO.

If we want to write into FIFO, check the full = 0, then

fifo_array[write_pointer] = data_in
write_pointer = write_pointer + 1.

Suppose we inserted 5 elements. Then the write_pointer = 5.

Now we start reading the elements from it. we check the empty = 0, then

data_out = fifo_array[read_pointer]

We read all the 5 elements and now, the FIFO is empty. then empty = 1.
i.e empty is asserted when the read_pointer = write_pointer.

Now the full is asserted, when write_address = FIFO size.

If the read_pointer = write_pointer, i.e the FIFO EMPTY case, We then reset the values of read_pointer = write_pointer=0.


Am I right about the FIFO operation? Please correct me if I am wrong. And also please post me some docs .


Thanks and Regards
Deepak
 

alexadmin

Junior Member level 2
Joined
Jun 15, 2007
Messages
24
Helped
5
Reputation
10
Reaction score
0
Trophy points
1,281
Location
Russia
Activity points
1,398
Re: FIFO

deepu_s_s said:
Hi Friends,

Now the full is asserted, when write_address = FIFO size.

If the read_pointer = write_pointer, i.e the FIFO EMPTY case, We then reset the values of read_pointer = write_pointer=0.

Your FIFO conception will not work when reading and writing to FIFO is continuous operation and reading remain behind writing for several cycles.

In classic algorithm FIFO reading and writing operations are cyclic, i.e. writing to FIFO when write_address == (FIFO_size-1) moves write_address to 0. Condition of FIFO full is (read_address-write_address) mod FIFO_size = 1, where mod is modulo operator.
It is for simple FIFO implementation which not uses one memory cell (it can use only 127 cells of 128 cells FIFO for example). More intelligent logic can enable using of full range of FIFO. In this case read_pointer = write_pointer can be interpreted both fifo full and fifo empty state.
 

deepu_s_s

Full Member level 5
Joined
Mar 24, 2007
Messages
305
Helped
15
Reputation
30
Reaction score
5
Trophy points
1,298
Activity points
3,021
FIFO

Hi alexadmin,

I think I used the correct logic for FIFO empty case. Can u please explain me why u had taken

(read_pointer-write_pointer) mod FIFO_size == 1.

Regards
Deepak
 

rjainv

Full Member level 2
Joined
Feb 18, 2007
Messages
140
Helped
18
Reputation
36
Reaction score
4
Trophy points
1,298
Location
Bangalore, India
Activity points
2,066
Re: FIFO

deepu_s_s said:
Hi alexadmin,

I think I used the correct logic for FIFO empty case. Can u please explain me why u had taken

(read_pointer-write_pointer) mod FIFO_size == 1.

Regards
Deepak

Thats because FIFO storage is used as a circular buffer. So it could be while read_pointer is pointing at max location, write_pointer is pointing at 0.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top