Hi, here I am going to explain about FIFO full and empty. Example, I have four locations. this is zero zero location this is zero one location this is one zero one one location now write is happened here read is happened here to prevent overflow you required full you required full what is overflow to prevent underflow empty will be required okay what is overflow you've written four locations read will not re didn't happen then you re you written four data here but read is didn't happen then think that think that right don't know this read is happened or not that's why again you'll overwrite the data without reading your role right the data it means that you lose the data that is overflow to control that over flow what we are doing is we are generating one full signal full when full generated there is a four data is written to the fifo then this guy know that this right guy know that there is a full is there we can't write the data because read is not happened okay that's why we have to generate the full okay what is empty to prevent the underflow there is no data in the fifo if read is happened then you are reading junk data if you read junk data that is not correct that that due to for that you need empty if empty is one read know that there is no data in the fifo that's why that's why this empty will prevent the underflow okay this side also 0 0 0 1 1 0 1 1 okay see here see here i am explaining some points here please listen the thing then we can the full equation here okay there are four locations it required two bits to represent all the things okay all the locations okay here also why this is this is representing pointers pointers this is write pointer ptr this is read pointer this is write pointer this is read pointer when read pointer is incremented if you read the data read pointer will be incremented initially it is zero zero okay write pointer when it will be incremented when you write is happened then write pointer will be incremented see here if you know that we have four locations if you written four locations then full need to be generated how you can generate it sit pointer is increment to zero one because zero zero will be filled again you write the data write pointer incremented to 1 0 it means that 1 0 1 also filled now you are in 1 0 if you written another data you write pointer is in 1 0 location and if you written 1 0 location also your right pointer is increment to 1 1 then 1 0 also filled if again another data if you return 1 1 location if you return the data your right pointer increment to 0 0 okay see here if you compare write and read pointer at that time write pointer is 0 and read pointer is 0 if both pointers are 0 then we will generate full answer is no because why tell you how you can empty will be generated initially both pointer are same right that only empty right full also you are telling the same that will not work out okay see because you've written four data your rate pointer is in same location because first data you return 0 1 next data is written 1 0 next data is written 1 1 next data is written to 1 1 then it is implemented that is an increment to 0 then also if you data when empty condition both locations are same then empty cut that is correct right because there is no varieties happen there is no read is happen that's why empty if you return for data also you are satisfying same condition due to that due to that we required one extra bit to represent it it means that instead of two bit if you design for location before you required another one extra bit another extra bit why that extra bit will help you i will tell you okay one why we actually you require two bits only but you want to design this one it required another one more bit one more bit see what will happen at that time if you see it one one indirectly this is three bit if you take in three bit right indirectly you are taking one extra bit here one extra bit extra means 0 0 0 0 Again after when you incremented this one again it will increment to 100. 100 means that this MSB is not equal.
Here 000. Here 000. If read is not happened you have written 4 data. Then you are right pointer in this location. It means that this LSB bits are equal. MSB bit is not equal.
Then we can generate the full. Take an example. i've written five datas to the fifo one data read then total four locations only will fill right five data right and one data read then four locations is filled that means then full will be generated then which which point i will tell you the pointers now okay one data is written zero one another data is written one zero another data with three datas i've written one one zero one one if another data i've written one zero 00 okay next another data if the data I have written Then G 101 you are in 101 Okay, Phi data is written.
Then you are in 101 right now 101 now Now if one read is happened then what is happened here? 001 read point is 001 location Then if you compare these two MSB is not equal remaining bits are are equal correct I'm telling example five data is written five data is written means one data is written second third fourth fifth this data is filled then right pointer is in this location this location means three bit signal if I write the counter after 0 1 1 it will not come to 0 0 it will go to this one this one now what will happen 1 0 1 you are in present location is 1 0 1 if I data is written one data is reading this is the location now if we compare this one msb is not equal remaining bits are equal take an example seven data is written seven data is written three data is read one it means that seven data and three data is read it means that four only then fully to be generated four locations is filled then full will be generated read pointer is in 0 1 1 location what about right pointer one data is written 0 0 1 2 data is written 1 0 0 1 0 3 data is written 0 1 1 4th data is written 1 0 0 5th data written 1 0 1 6th data is written 1 1 0 7th data written 1 1 1 you are in this location now after 1 1 again it need to come to 0 0 0 because 3-bit pointer right okay actually increment by like this but it required 3-bit pointer not required this msb is ignored okay now you are in this location If you compare the four seven right is happened right pointer is in this location Read pointer is in this location because three data is read it means that already explained One data is read zero zero one another data is read zero one zero one date another data thought data is read zero one one if you Compare it the MSB is not equal now. What equation you write here write PTR of Three two two because three bit right it means that 2 is to 0 it means that MSB is 2 not equal to read pointer of 2 bracket and remaining bits are equal right pointer of 1 is to 0 is double equal to read pointer of 1 is to 0 Semi-colon. This is right full equation. Full equation means MSB is not equal.
Remaining bits are equal. That is full condition. What is empty condition? Both pointers are equal. Then that is empty.
If you see one write is happened. You are in this location. Another read is happened.
Immediately read. is happening you are in this location point first empty only now suppose three whites is happened to read C is happened to reads means you are in this location 0 1 0 3 rights is happened it means that one data is available three rights means is 0 1 1 both points are not equal one data is available now empty will not be generated if suppose three data is written you are in this location zero one one three data is written you are in same location three data is read then you are in zero zero one then three days have written three data read then you are in empty only okay now what point what right pointer ptr two is to zero easy double equal to read pointer two is to zero bracket close mt is equal to mt is equal to right pointer both pointers are equal then mt read what i can say msb is not equal remaining bits are equal then that is full okay thank you