Very nicely explained. One comment about the FIFO depth issue. In addition to using the formula you showed, there is another way to use pointer for any non power of 2 depth FIFOs as long as they are EVEN numbers. We need to modify our pointer generation logic to pick correct rd & wr pointers. So, say we want to design a 6 deep FIFO. List all the pointer values that you would need for next power of 2 depth FIFO which is FIFO depth 8 in this case. So, for FIFO depth 8, we need pointers as 000, 001, 011, 010, 110, 111, 101, 100. We need only 6 of these values for 6 deep FIFO. So remove middle 2 values, 010 110. So now we have 000, 001, 011, 111, 101, 100 . This is still gray coded. If rd and wr ptr generation logic can be designed to generate this sequence, the circuit will work correctly. This approach will work for any even numbered depth.
Hi Karthik, I work in VLSI company and needed to develop FIFO IP Core. ur lecture had a great explanation and covered all basics ,keep up this good work .Also, Plz could u provide material of this lecture somehow. Thanks
Hey yashvir, for the reference you can check asynchronous FIFO papers in Google scholar. Be patient while reading the papers , if you have any doubts , please feel free to comment 👍
Hey yashvir , thanks for asking , I will try to make , but Amba is huge ,it will be better if you read the specification and ask the specific topic . I will help you with doubts 👍
Thank you so much! I've tried to find a tutorial for async FIFO for such a time, but no one can explain it so clearly like you. Hope you can make a video about how to implement this using HDL.
Greatly explained Karthik. Got a chance to come across ur videos, and it is helping me a lot in understanding the concepts at base level. Cleared many doubts and very neat explanation. Learnt many things from the doubts raised by commenters also and your explanation of those... Could you please share VHDL code for FIFO design which you explained above. Would be more helpful in understanding it in implementation level. Please let me know the media for sharing RTL for this, would like to connect for further doubts. Thanks A lot. Keep rocking.. Be healthy.
Great video but the explanation to when we know the difference of full and empty (16:00) is confusing. If we flip the MSB of waddr and then the values of waddr[3:0] are the same as raddr then its full but that can also hold for the case when wadder is empty i.e.: wadder with 5 bits is 00000. Negate MSB: 10000 == raddr at empty. I'd appreciate a clarification here.
Hello Karthik, Thank you for the amazing explanation. I got all the points but I have one confusion in metastability, I mean you are supposing a "1" for FF 1 op that works as an input for 2nd FF. What if you take the FF1 output as 0? Can you please explain this condition? Thank you!
Hi Karthik , Greatly Appreciate your work and efforts for this wonderful explanation, I have a dbout in Depth calculation part. How did you consider as (2^10)/2 for that 520 depth FIFO calculation, Is it a approximation OR How?. please do the needful Thankyou.😊
thanks for video, sir i have one doubt that if we use 2 flip-flop synchronizer then it will delay one read_clk for generating empty condition check and similarly one write_clk for for generating full condition. so due to this delay we may read from empty fifo or write to full fifo. therefore what should i do to avoid this delay and generate full and empty condition in real time without any delay?.
The 2 clock delay makes the full and empty conditions pessimistic as the two points approach each other. Ingress will read full a bit earlier as information about a very recent withdrawal is delayed. Egress will read empty a bit earlier as information about a very recent deposit is delayed. If the two sides have similar throughout, a performance issue can arise as it buffets around both empty or full. This approach works best when the ingress and egress rates are sufficiently different to accommodate the delay in information between the two sides.
Hi Karthik It's an amazing explanation. Could you please let us know what are the changes need to be made to the design code pinned when Dual port asynchronous fifo has 2 write ports and 1 read port. All the three ports are working on different frequencies. The inputs ports have the capability to write simultaneously based on Write enable signal. If both ports try to write then port1 will be given the priority. Thank you.
Hey Karthik, Thank you so much for you video. Can you please upload an video on following design questions:- 1. Design of Synchronous Circuit to detect the toggling of flip flop. 2. Edge detector Circuit i.e to detect whether the Flip flop is +ve edge triggered or -ve. Thanks in Advance for your response
@@KarthikVippala Thanks you so much your, the best ! if you could explain about round robin arbiter design that would be of great help! Appreciate your efforts and your time !! thanks a lot
Thanks for the video. I have question regarding the depth of asynchronous FIFO formula that you mentioned at last. This formula is taking FIFO Depth . So this range is specifying what exactly?
Namaskaram 🙏 kankana , formula is for calculating range in case of non power of 2 depth , you can check fifo depth video on my channel for better understanding, Thanks for asking 😊, good luck & great health 👍.
Ihave little confusion on the empty and full condition. Because the synchronizer, the wrptr and rdptrt will be value of previous 2 clock cycles. When you use that to compare how does it work. Ie let say you want to compare empty condition. You would compare it in rd_clk domain. However, the rdptr value of rdptr is the current address of this clk cycle, but the wrptr is the old value of wrptr of previous 2clk cycle. Because of that, it does not compare to the current value, the empty condition is not a really empty.
Hey Tinh Lac, I understand your confusion , yes when the rdptr is passed to the wr_clk, there could be 3 to 4 clock cycles delay , with respect to rdptr in rd_clk domain and rptr value in wr_clk domain may reflect older value. This means more space is available in FIFO to write than what it is showing . When reading is stopped rdptr will catch up to the value of real rdptr. This will not effect the performance . Similarly when wrptr is passed to rd_clk domain , wrptr is 3 to 4 cycles delay compared to real time wrptr. If empty flag is generated , since we are writing there could be few data in FIFO ,when writing is completed this wrptr will catch up to the real time wrptr. There is a temporary lag in pointer value , which gets updated to correct value in several cycles. Hope this clears your confusion , if you any more doubts feel free to comment. Please do subscribe it will help me a lot 🙏
Sir what is the use of pointers ? Can't we design without pointers ? please give some relation between pointers and address ? -> i know that pointers contain the address of a particular memory location sir... beyond this could you please give some more information regarding my question. just subscribed sir thank you for this content and one more thanks in advance for addressing my question.
Hey pavan thanks for asking the question, Pointer shows the position (address) where data is read or written, Address is constant , data transfer might happen into memory to correctly track the data we use pointers . Pointers a must for the design .
In your toggle syn (cdc) why pulse with is increased as you said in 2 ff syn pulse can't detect. Ap you decided to use.. Toggle syn. But in toggle syn your pulse width is changed. So what you want to say.
Namaskaram Akshay🙏, gray code is used to perform proper synchronisation , in normal binary we will get false full and metastability. Good luck, great health 👍😊
Hey shridhara , thanks for asking the question, FIFO men contain memory element ie flip-flop , registers Wr_ptr and rd_ptr contains storage elements to store the value of pointers and comparators for comparing the values and some extra logic gates. Hope this clears your doubt , if you any more I am happy to help you 👍 Please do subscribe it will help a lot . Thanks for asking
Can a fifo take packets of data from one port and deliver it to 3 different destination based on destination id at same time. To bd simple can a asynchronous fifo have 3 output data ports
At 6:45, what is the guarantee that the signal is going to be to be sampled to 1 ? after meta stable state, the signal may even sample to a 0 value right? how can we know the correct value from 2 flop synchronizer?
Hi Karthik, thank you for making very informative videos. Please, clarify this doubt of mine: positiveskew helps meet setup time. But, slow corner ( min voltage, Max temperature_more delay) is the worst for setup. Can you tell me why slow corner is bad for setup, please?
Thanks for the video. I have a doubt here. please clarify. if we consider extra bit for address/pointers, full and empty can be set correctly. what happen to the next address of FIFO, i.e, 1000? how to roll off? if rd pointer is not 0, will it not try to write on 1001 location and so on? PLEASE ANSWER
Great explanation , though I miss to understand one thing. When using async FIFO we need to use one extra bit to determine full flag. This extra bit also goes through binary to grey encoding ? For example , if the FIFO depth is 8 then I have to use a 04 bit or 03 bit binary to grey encoder ? Thanks for answering.
Namaskaram Ashish _/\_ , Thanks for asking , Yes extra bit also go through encoding, for depth 8 we need to use 4bit. Good Luck and Great Health , take care :)
Even after grey code conversion we are not getting our desired result. As you said for grey 111 -> 101 we will be getiing 111 or 101. But they are two different counts , one indicated the number of data in the fifo as 5d other as 6d. Wont we have an error in the result ?
n should be such that it is greater than depth, let say depth is 520 , n will 10 as 2^10 is 1024, If depth is 9,n will 4 , 2^4 is 16. Thanks for asking, good luck.
What if output of QB1 settles to zero after metastability state? Then we are getting the complement of QA as the final output and eventually the use of synchroniser complemented the output
I have a question regarding grey code, imagine we are going from 4 (110) to 5 (111). Now what if 110 (4) changes to 100 (7) due to metastability, wouldn't it also generate a false full condition?
Hey Karthik, Great Explanation!! I have a question regarding the synchonization of Gray Counter. Suppose there was metastability during the CDC of gray counter, beacuse of this the value sampled in receiving domain is same as the previous value(intended value was incremented value). How do we take care of this situation as the pointer was supposed to increase but it didn't? Wouldn't it cause the false empty/full condition? Does the pessimism introduced in the design take care of the above condition as well?
Hey Aditya , thanks for asking ,if it some how system enters metastability , pointers will not be changed, even if pointers are increased we will send the same values again so pointer will not be effected . Good luck, good health 👍😊
@@KarthikVippala One follow-up question, let's consider the corner case..if the pointer would have incremented it would have caused empty/full condition but, due to metastability as you pointed out the pointer will not increase and the same value will be sent. Now the comparison module will compare the read and write pointer value and since the value doesn't satisfy the empty/full criteria (although it should but it didn't due to metastability) so, the enable single will remain asserted and read/write will happen. Since we are taking about the corner case, this would mean that we are trying to write to a full FIFO or read from an empty FIFO, thus violating the criteria of FIFO design. Am I missing something here? Thanks again for your time.
@@KarthikVippala Because one of the inputs to the and gate of enable logic is driven by empty/full condition. Since we didn't see the full/empty condition, the enable remained asserted.
@@ADITYA95KUMAR full and empty condition are dependent on wraddr and rdaddr , so I guess it won't be a problem . Can you please make question short , I am unable to concentrate for whole time😋.
Hi great video! Can you tell how to check the write full and read full condition in case of FIFO depth 6? Coz I guess adding an extra bit would't help in this case?
Hey Balaji Adithya thanks for your support and appreciate you effort to asking the questions. Full condition is {~wraddr[4],wraddr[3:0]} == rdaddr So when wr is at 10000 and rd is at 00000 it will be a full condition . May be you have not see clearly inverter "~" due to my shabby handwriting 😁. Adding extra bit will be helpful for finding out full condition. Thank you for asking the questions , if you have more doubts , I am happy to help you.
So for addressing & empty/full conditions you use the binary values itself but only for sending over the data of pointer to other clock domain you use the gray code r8?
@@KarthikVippala Hi Karthik, According to your formula the range of a fifo with depth 6 is from 001 to 110 ( binary ). now for checking the full condition adding extra bit may not work because if i increment the counter after the 0110 it goes to 0111 so my wraddr is 0111 and rdaddr is 0001 ( as it is the starting address ). This is my understanding please correct me if I am wrong.
sir, you are saying that if we use binary for pointers, they may enter into metastable state, but we were using synchronizers to avoid metastable states then why to worry? first the pointers get incremented and then they will be passed through synchronizers right? then to worry about intermediate staes? please clarify, I guess I didnt get the whoe purpose of using gray code. Somewhere I read that for binary to increment it will go through some intermediate states and there is a chance that one of the intermediate state will pass through synchronizers and gray code will be varied with single bit takes single cock... please tell the events flow.
Hey jnaneswar thanks for asking the question , Binary pointer creates problem even if we synchronizers , I have already discussed in the video (same below) Let say we are passed 5(101) using binary counter , next value will be 6 (110) for each bit we require one flop so 3 flops and for each we have two flop synchronizers, if there is a metastability the 101 can goto 111 which is 7 and say our depth is 7 then it's a false full condition Now if we use gray pointer then here we will not get false full , metastability will change only bit or nothing . Hope this clears your doubt , you have any doubts please feel free to comment.
When we apply this, due to 2 synchronisers, when the fifo memory is full, the full signal becomes 1 after a few cycles. Won't this cause a problem? Because the full signal occurs much later. Since the full signal is given late, data continues to be put into the fifo memory even if the fifo memory is full.
Thanks for the video! Question: For 520 depth you got 252 and 771 as addresses. But once FIFO is full we cannot roll over to 252 since we cannot decipher between empty and full. Instead do you think equation should be 2n-depth to 2n+depth-1 to cover for empty/full case and also Gray code rollover?
@@KarthikVippala Yes I understand it doesn’t go to zero. If FIFO is full it goes to 252. If FIFO is empty it also is at 252. Then how do you decipher between full and empty?
@@JaganJohn In that case , while rolling over that extra bit will change from '0' to '1' and also MSB will change from '0' to '1' since we are rolling over from address 771 to 252. So now we have two bits change in gray code while we roll over. Can you explain that?
@@KarthikVippala Aren't we considering extra bit for roll over to decide FIFO Full and Empty condition? If yes, then there are change in two bits while rolling over. 1. MSB changing from '0' to '1'. 2. One bit change while switching from 771 to 252. Can you please explain how this would work?
Thank you for the video! I learned a lot. I was thinking of implementing it myself on and FPGA. I have a question though - do you think that the conversion to Grey is necessary in nowadays FPGAs? Like Xilinx's FPGAs. I am not sure if such metastability could occur there.
Greatly explained ..👌 One question, In FIFO, like the read and write pointers, are the write address (waddr) and read address (raddr) also should be gray coded ???
Waddr and rdaddr are not in memory and they are changed according to their own clock so gray code conversion is not required . Thanks for asking. Good luck good health 👍👍
@@KarthikVippala when write pointer is at 00000 and read pointer at 10000 what happens what I mean is msb bit of write pointer is less will the fifo consider it as full condition
Hey alekhya thanks asking Full condition is {~wraddr[4],wraddr[3:0]} == rdaddr So when wr is at 10000 and rd is at 00000 it will be a full condition . May be you have not see clearly inverter "~" due to my shabby handwriting 😁. Adding extra bit will be helpful for finding out full condition. For your case also it is a full condition. Good luck, good health 👍
Hi I'm bit confused regarding pointer based synchronization scheme and Handshaking based Synchronization scheme, Can you please help me understand these things easily?
correct fifo code
module afifo(wclk, wrstn, wren, wdata, wfull,rclk, rrstn, rden, rdata, rempty);
parameter dsize = 8,
asize = 4;
localparam dw = dsize,
aw = asize;
input wire wclk, wrstn, wren;
input wire [dw-1:0] wdata;
output reg wfull;
input wire rclk, rrstn, rden;
output wire [dw-1:0] rdata;
output reg rempty;
wire [aw-1:0] waddrmem, raddrmem;
wire wfull_next, rempty_next;
reg [aw:0] wgray, wbin, wq2_rgray, wq1_rgray,rgray, rbin, rq2_wgray, rq1_wgray;
wire [aw:0] wgraynext, wbinnext;
wire [aw:0] rgraynext, rbinnext;
reg [dw-1:0] mem [0:((1
What is wq2_rgray, wq1_rgray,rq2_wgray, rq1_wgray?
Binary to gray conversion signals
@@KarthikVippala Thank you, I understand that. But what do these prefixes wq1, rq1 and wq2,rq2 mean? Why are there two of them?
@@КириллДенисов-л4т read and write req for each clock domain
I tested this code but some some data is corrupting
Very nicely explained. One comment about the FIFO depth issue. In addition to using the formula you showed, there is another way to use pointer for any non power of 2 depth FIFOs as long as they are EVEN numbers. We need to modify our pointer generation logic to pick correct rd & wr pointers. So, say we want to design a 6 deep FIFO. List all the pointer values that you would need for next power of 2 depth FIFO which is FIFO depth 8 in this case. So, for FIFO depth 8, we need pointers as 000, 001, 011, 010, 110, 111, 101, 100. We need only 6 of these values for 6 deep FIFO. So remove middle 2 values, 010 110. So now we have 000, 001, 011, 111, 101, 100 . This is still gray coded. If rd and wr ptr generation logic can be designed to generate this sequence, the circuit will work correctly. This approach will work for any even numbered depth.
Hey Shilpa you are correct , I have seen this patent . Thanks for explaining it in detail, appreciate your efforts , good luck 👍
Best video and best explanation on asynchronous FIFOs, keep up the good work man!
Namaste 🙏 Pedro palacios , thanks for your support and help inspiring words , good luck & great health 👍😊
very detailed information about async fifo, good job
Thank you man:) That explains way more clearly than what my teacher said in class omg
Your welcome 🙏
Your explanation is very clear and easy to understand. Thank you so much!
Thank you so much Kun liu ,Good luck , Good Health :)
The way of explanation is very good. It helped me a lot. Thank you so much for this video.
Thanks for feedback 👍
Hi Karthik, I work in VLSI company and needed to develop FIFO IP Core. ur lecture had a great explanation and covered all basics ,keep up this good work .Also, Plz could u provide material of this lecture somehow. Thanks
Hey yashvir, for the reference you can check asynchronous FIFO papers in Google scholar. Be patient while reading the papers , if you have any doubts , please feel free to comment 👍
@@KarthikVippala Can u make videos on AMBA protocols..that will be very useful.Thanks
Hey yashvir , thanks for asking ,
I will try to make , but Amba is huge ,it will be better if you read the specification and ask the specific topic . I will help you with doubts 👍
@@KarthikVippala can u please make video on writing functionsl coverage for a moduke
Thankyou so much!! you are a very good teacher. all the best yaar...
Your welcome, good luck, good health 👍😊
You are outstanding teacher. Thanks keep up the good work.
Thank you so much 🙏
very nice information at a depth of topic
Namaste 🙏 vinit
Thanks for the support,good luck & great health 👍😊
Great explanation, easy to understand.. Thank you Karthik..
Namaste 🙏 Sowmya , thank for the support, good luck and great health 👍😊
Thank you so much. Your explanation was fantastic. Thanks again.
Your welcome 🙏
Hey need video on any other topic , if I know that topic , I can do a video . Recommend some topics for video please 👍
Thank you so much! I've tried to find a tutorial for async FIFO for such a time, but no one can explain it so clearly like you. Hope you can make a video about how to implement this using HDL.
Your welcome 👍
good explaination can u explain how to implement in hdl
U r good soul 🎉🎉 excellent teaching
Namaskaram Mohana Rajendran , Thanks for the support , good luck & great health :)
Thank so much for clear explanation
Great video! You remind me of my favorite teacher in the college.
Thank you so much Yuting Gan 👍😁. Good luck and good health brother 👊
Thanks for the wonderful explanation.
Namaskaram Arijit🙏, thanks for the support, good luck & great health 👍😊, do you have any topics suggestions
Can you please explain Amba-apb and Amba-ahb protocols in detail?
How are you not famous damnnnn
Thanks 😂, good luck & great health 👍😊
Excellent and thank you. If you can control the excitement in your voice it will be much better. Thank you for the explanation.
Improving on it 🙏
you did excellent job bro,
and really appreciate your work...
Thank you so much Sudeep , for such kind words, good luck, good health 👍
So Clear !!!!!!!! omg!! Thank you, sir!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
Thank you so much 👍
Great video! you explained everything clearly!
Thank you 🙏
Thank you for your hard work ! Liked and subscribed!
Namaste 🙏 Big Dawg , thanks for the support, good luck & great health 👍😊
Nicely explained @Karthik. Kudos!
Thank you, good luck, good health 👍😊
Thanks for this wonderful lecture😃
Your welcome, good luck, good health 👍😊
Very effective teaching
Excellent explanation. Thanks
Namaste Manlu Piano 🙏 , thanks for the support, good luck & great health 👍😊
Thank You very much for such great explanation :)
Namaskaram _/|\_ Massine , Thanks for the support , good luck & great health,Take care :)
Greatly explained Karthik. Got a chance to come across ur videos, and it is helping me a lot in understanding the concepts at base level.
Cleared many doubts and very neat explanation. Learnt many things from the doubts raised by commenters also and your explanation of those...
Could you please share VHDL code for FIFO design which you explained above. Would be more helpful in understanding it in implementation level.
Please let me know the media for sharing RTL for this, would like to connect for further doubts.
Thanks A lot.
Keep rocking.. Be healthy.
shilpa , that's longer than my video 😊 , thanks for the supportive words , you can ask any doubts here even regarding code .
Good luck, good health 👍
Nice video👌...kindly add the links in description for other videos like binary to grey code conversion, mentioned in this tutorial
Namaskaram 🙏 Jagannathan , please check out my channel playlists 👍😊
Great video but the explanation to when we know the difference of full and empty (16:00) is confusing. If we flip the MSB of waddr and then the values of waddr[3:0] are the same as raddr then its full but that can also hold for the case when wadder is empty i.e.: wadder with 5 bits is 00000. Negate MSB: 10000 == raddr at empty. I'd appreciate a clarification here.
Hello Karthik,
Thank you for the amazing explanation. I got all the points but I have one confusion in metastability, I mean you are supposing a "1" for FF 1 op that works as an input for 2nd FF. What if you take the FF1 output as 0? Can you please explain this condition? Thank you!
Super ! Thanks for explaining
Namaste yeobi , thanks for the support, good luck and great health 👍😊
Thanks. That was a very clear explanataion.
Your welcome 👍
Do you have any suggestions of topics for the channel 👍
You can add videos on Low power design techniques.
@@aishwaryanair7047 thanks for your suggestion , I will try to do videos on them.
Superb awesome explanation....
Namaste 🙏 beautiful crafts , thanks for the support, good luck & great health 👍😊
Please do the videos on RTL integration
very good video, there is still one missing point there, the timing contraints for a async FIFO. :)
Great explanation 👏
Namaskaram neelima 🙏 , thanks for the support, good luck & great health 👍😊
Excellent video
Namaskaram Nitish Kumar 🙏 , thanks for support, good luck & great health 👍😊
Thank you!
Your welcome
Well explained...
Thank you🙏
great one
Thanks🙏
Very nice video.. Can you please explain us how a metastable signal recovers during synchronization.
Hi Karthik , Greatly Appreciate your work and efforts for this wonderful explanation, I have a dbout in Depth calculation part.
How did you consider as (2^10)/2 for that 520 depth FIFO calculation, Is it a approximation OR How?.
please do the needful
Thankyou.😊
@karthik, same doubt. What is 'n' here?
Nice video
Thank you 🙏
Thanks for the video! Why not sync rd_en and wr_en to generate empty and full condition? (no need for gray convertion)
To get syn rd_en , we need to do gray convertiona and pass through 2 flop synchronizer and back to binary syn rd_en. I guess.
Best ❤
Very Well explained !!!
thanks for video,
sir i have one doubt that if we use 2 flip-flop synchronizer then it will delay one read_clk for generating empty condition check and similarly one write_clk for for generating full condition. so due to this delay we may read from empty fifo or write to full fifo. therefore what should i do to avoid this delay and generate full and empty condition in real time without any delay?.
The 2 clock delay makes the full and empty conditions pessimistic as the two points approach each other. Ingress will read full a bit earlier as information about a very recent withdrawal is delayed. Egress will read empty a bit earlier as information about a very recent deposit is delayed. If the two sides have similar throughout, a performance issue can arise as it buffets around both empty or full. This approach works best when the ingress and egress rates are sufficiently different to accommodate the delay in information between the two sides.
Hi Karthik
It's an amazing explanation.
Could you please let us know what are the changes need to be made to the design code pinned when Dual port asynchronous fifo has 2 write ports and 1 read port. All the three ports are working on different frequencies. The inputs ports have the capability to write simultaneously based on Write enable signal. If both ports try to write then port1 will be given the priority.
Thank you.
Great buddy.
Namaskaram 🙏 Bharathwaj , thank you , good luck, great health 👍😊
This is very helpful
Thank you!
Great video thanks! Subbed
Your welcome
very nice explaination
Namaste Sai teja reddy, Thank you so much , Good luck & Great Health :)
Hey Karthik,
Thank you so much for you video. Can you please upload an video on following design questions:-
1. Design of Synchronous Circuit to detect the toggling of flip flop.
2. Edge detector Circuit i.e to detect whether the Flip flop is +ve edge triggered or -ve.
Thanks in Advance for your response
Hey abarajithan, I Will make it but need some time . Thanks for asking 👍
@@KarthikVippala Thanks you so much your, the best ! if you could explain about round robin arbiter design that would be of great help! Appreciate your efforts and your time !!
thanks a lot
Hey abarajithan , I will do them, but I will ask some questions while making the video. To know what exactly you need 👍.
Hey abarajithan , edge detection means edge detection of input or not.
Can you please elaborate about toggling of flop
Please can you explain in detail about flop synchronizers in detail
Namaste 🙏 Sathish , pls check my channel playlist :synchronizers where I explained about it in detail, good luck & great health 👍😊
Very good explanation
Thanks and welcome
Thanks for the video. I have question regarding the depth of asynchronous FIFO formula that you mentioned at last. This formula is taking FIFO Depth . So this range is specifying what exactly?
Namaskaram 🙏 kankana , formula is for calculating range in case of non power of 2 depth , you can check fifo depth video on my channel for better understanding,
Thanks for asking 😊, good luck & great health 👍.
Ihave little confusion on the empty and full condition. Because the synchronizer, the wrptr and rdptrt will be value of previous 2 clock cycles. When you use that to compare how does it work. Ie let say you want to compare empty condition. You would compare it in rd_clk domain. However, the rdptr value of rdptr is the current address of this clk cycle, but the wrptr is the old value of wrptr of previous 2clk cycle. Because of that, it does not compare to the current value, the empty condition is not a really empty.
Hey Tinh Lac, I understand your confusion ,
yes when the rdptr is passed to the wr_clk, there could be 3 to 4 clock cycles delay , with respect to rdptr in rd_clk domain and rptr value in wr_clk domain may reflect older value.
This means more space is available in FIFO to write than what it is showing .
When reading is stopped rdptr will catch up to the value of real rdptr.
This will not effect the performance .
Similarly when wrptr is passed to rd_clk domain , wrptr is 3 to 4 cycles delay compared to real time wrptr. If empty flag is generated , since we are writing there could be few data in FIFO ,when writing is completed this wrptr will catch up to the real time wrptr.
There is a temporary lag in pointer value , which gets updated to correct value in several cycles.
Hope this clears your confusion , if you any more doubts feel free to comment.
Please do subscribe it will help me a lot 🙏
Karthik Vippala just sub
@@tinhlac1405Thank you 🙏 so much
Thank you so much for making such great videos!!! Could you make some videos about JTAG, APB and iJTAG for DFT?
Sure🙏
@@KarthikVippala thank you, can’t wait for it!
hi Karthik
please provide information on CDC, LINT and SYNTHESIS
Namaskaram 🙏 mallikarjun, please watch cdc playlist on my channel, lint synth will update but it will take time
Thank you karthik
Sir what is the use of pointers ? Can't we design without pointers ?
please give some relation between pointers and address ?
-> i know that pointers contain the address of a particular memory location sir...
beyond this could you please give some more information regarding my question.
just subscribed sir
thank you for this content and one more thanks in advance for addressing my question.
Hey pavan thanks for asking the question,
Pointer shows the position (address) where data is read or written,
Address is constant , data transfer might happen into memory to correctly track the data we use pointers . Pointers a must for the design .
@@KarthikVippala got it sir 😊
hissing noise is good:))
In your toggle syn (cdc) why pulse with is increased as you said in 2 ff syn pulse can't detect. Ap you decided to use.. Toggle syn. But in toggle syn your pulse width is changed. So what you want to say.
Will get bck need to look video once
@@KarthikVippala will wait
thankyou sooooo much
Great explanation man! Is your in-depth understanding due to reading and research or work experience?
Thanks 😊. Good luck 👍
Sir Please make a video for synchronous FIFO
valuable video. Just subscribed to your channel. No offense, could you tune your voice that will help people feel more comfortable.
Thank you son nguyen , I will improve on my voice , good luck, good health 👍
@@KarthikVippala hi Karthik, I have 1 concern: Will 2-FF syncer work correctly if write_clk is much faster than read_clk or vice versa? Any data lost?
@@sonnguyen3874 no data won't be lost , we need to take care of overflow and under read .we might get some clock cycles delay but that's fine
Great Video . Could you explain a bit more on why gray code is needed .
Namaskaram Akshay🙏, gray code is used to perform proper synchronisation , in normal binary we will get false full and metastability.
Good luck, great health 👍😊
great explanation! Can we get same kinda explanation for FIFO depth calculation
Thank you for asking, please check video of Fifo depth consideration , link below ruclips.net/video/DQunDtD6Ybs/видео.html
Do you need any video on any other topic , if I know that topic I can make a video on it.
@@KarthikVippala sure Karthik I ll let you know about it and thanks for spreading knowledge
can you explain the internal architecture of the all the 3 major blocks such as fifi mem, fifo wr_ptr, fifo rd_ptr, synchroizers
Hey shridhara , thanks for asking the question,
FIFO men contain memory element ie flip-flop , registers
Wr_ptr and rd_ptr contains storage elements to store the value of pointers and comparators for comparing the values and some extra logic gates.
Hope this clears your doubt , if you any more I am happy to help you 👍
Please do subscribe it will help a lot .
Thanks for asking
Do we use gray code encoding in synchronous FIFO? or only in Async FIFO? if possible please make a video on Sync FIFO Design.
thankyou so much
Your welcome, good luck, good health 👍
Thank-you...
Namaste 🙏 Ranjan Parnami, thanks for the support, good luck & great health 👍😊
great work bro..
Thank you brother, good luck, good health 👍
@@KarthikVippala hello bro can you tell Circuit for 1st one finder for a series input
@@nabeelahmad4583 hi , I did not get you ,can you please elaborate 👍
@@KarthikVippala there is series of number entering in logic circuit,when 1st 1 enter output should be high
@@nabeelahmad4583 are numbers binary
Can a fifo take packets of data from one port and deliver it to 3 different destination based on destination id at same time.
To bd simple can a asynchronous fifo have 3 output data ports
Namaskaram Sushma Kakarla , Yes you can connect output to multiple ports , Thanks for asking, Good luck & Great Health _/\_ , Take care:)
At 6:45, what is the guarantee that the signal is going to be to be sampled to 1 ? after meta stable state, the signal may even sample to a 0 value right? how can we
know the correct value from 2 flop synchronizer?
Hi Karthik, thank you for making very informative videos. Please, clarify this doubt of mine: positiveskew helps meet setup time. But, slow corner ( min voltage, Max temperature_more delay) is the worst for setup. Can you tell me why slow corner is bad for setup, please?
Thanks for the video. I have a doubt here. please clarify. if we consider extra bit for address/pointers, full and empty can be set correctly. what happen to the next address of FIFO, i.e, 1000? how to roll off? if rd pointer is not 0, will it not try to write on 1001 location and so on? PLEASE ANSWER
The extra bit is only used for comparison, but masked off, so that only the lower bits are used as the memory address.
Thanks Chris 🤝
@@ChrisSmith-tc4df thankyou
Great explanation , though I miss to understand one thing.
When using async FIFO we need to use one extra bit to determine full flag.
This extra bit also goes through binary to grey encoding ? For example , if the FIFO depth is 8 then I have to use a 04 bit or 03 bit binary to grey encoder ?
Thanks for answering.
Namaskaram Ashish _/\_ , Thanks for asking , Yes extra bit also go through encoding, for depth 8 we need to use 4bit. Good Luck and Great Health , take care :)
@@KarthikVippala Thank you .
Even after grey code conversion we are not getting our desired result. As you said for grey 111 -> 101 we will be getiing 111 or 101. But they are two different counts , one indicated the number of data in the fifo as 5d other as 6d. Wont we have an error in the result ?
I have the same question!
How can we say that 2 stage synchronization is enough for avoid metastability,is their any relationship between number of stages and mtbf
In that formula, how do you come up with the value for "n"? is it "the first power of 2 number" after the given fifo depth?
n should be such that it is greater than depth, let say depth is 520 , n will 10 as 2^10 is 1024,
If depth is 9,n will 4 , 2^4 is 16.
Thanks for asking, good luck.
What if output of QB1 settles to zero after metastability state? Then we are getting the complement of QA as the final output and eventually the use of synchroniser complemented the output
I am asking from where you told about the two flop synchronisers
I have a question regarding grey code, imagine we are going from 4 (110) to 5 (111). Now what if 110 (4) changes to 100 (7) due to metastability, wouldn't it also generate a false full condition?
Yes it's a false full
@@KarthikVippala but if grey code also can generate false full, how is it any better than binary code?
Hey Karthik,
Great Explanation!!
I have a question regarding the synchonization of Gray Counter. Suppose there was metastability during the CDC of gray counter, beacuse of this the value sampled in receiving domain is same as the previous value(intended value was incremented value).
How do we take care of this situation as the pointer was supposed to increase but it didn't?
Wouldn't it cause the false empty/full condition?
Does the pessimism introduced in the design take care of the above condition as well?
Hey Aditya , thanks for asking ,if it some how system enters metastability , pointers will not be changed, even if pointers are increased we will send the same values again so pointer will not be effected .
Good luck, good health 👍😊
@@KarthikVippala One follow-up question, let's consider the corner case..if the pointer would have incremented it would have caused empty/full condition but, due to metastability as you pointed out the pointer will not increase and the same value will be sent. Now the comparison module will compare the read and write pointer value and since the value doesn't satisfy the empty/full criteria (although it should but it didn't due to metastability) so, the enable single will remain asserted and read/write will happen. Since we are taking about the corner case, this would mean that we are trying to write to a full FIFO or read from an empty FIFO, thus violating the criteria of FIFO design. Am I missing something here?
Thanks again for your time.
Why will enable signal will be high ?
@@KarthikVippala Because one of the inputs to the and gate of enable logic is driven by empty/full condition. Since we didn't see the full/empty condition, the enable remained asserted.
@@ADITYA95KUMAR full and empty condition are dependent on wraddr and rdaddr , so I guess it won't be a problem .
Can you please make question short , I am unable to concentrate for whole time😋.
Please make a video on C2MOS about how its insensitive to clock skew
Hi great video!
Can you tell how to check the write full and read full condition in case of FIFO depth 6?
Coz I guess adding an extra bit would't help in this case?
Hey Balaji Adithya thanks for your support and appreciate you effort to asking the questions.
Full condition is {~wraddr[4],wraddr[3:0]} == rdaddr
So when wr is at 10000 and rd is at 00000 it will be a full condition .
May be you have not see clearly inverter "~" due to my shabby handwriting 😁.
Adding extra bit will be helpful for finding out full condition.
Thank you for asking the questions , if you have more doubts , I am happy to help you.
Ok understood now! Thanks for the quick response!
So for addressing & empty/full conditions you use the binary values itself but only for sending over the data of pointer to other clock domain you use the gray code r8?
Yup u r correct 👍
@@KarthikVippala Hi Karthik, According to your formula the range of a fifo with depth 6 is from 001 to 110 ( binary ). now for checking the full condition adding extra bit may not work because if i increment the counter after the 0110 it goes to 0111 so my wraddr is 0111 and rdaddr is 0001 ( as it is the starting address ). This is my understanding please correct me if I am wrong.
sir, you are saying that if we use binary for pointers, they may enter into metastable state, but we were using synchronizers to avoid metastable states then why to worry?
first the pointers get incremented and then they will be passed through synchronizers right? then to worry about intermediate staes?
please clarify, I guess I didnt get the whoe purpose of using gray code.
Somewhere I read that for binary to increment it will go through some intermediate states and there is a chance that one of the intermediate state will pass through synchronizers and gray code will be varied with single bit takes single cock...
please tell the events flow.
Hey jnaneswar thanks for asking the question ,
Binary pointer creates problem even if we synchronizers , I have already discussed in the video (same below)
Let say we are passed 5(101) using binary counter , next value will be 6 (110) for each bit we require one flop so 3 flops and for each we have two flop synchronizers, if there is a metastability the 101 can goto 111 which is 7 and say our depth is 7 then it's a false full condition
Now if we use gray pointer then here we will not get false full , metastability will change only bit or nothing .
Hope this clears your doubt , you have any doubts please feel free to comment.
@@KarthikVippala got it sir, thnq very much
When we apply this, due to 2 synchronisers, when the fifo memory is full, the full signal becomes 1 after a few cycles. Won't this cause a problem? Because the full signal occurs much later. Since the full signal is given late, data continues to be put into the fifo memory even if the fifo memory is full.
Thanks for the video! Question: For 520 depth you got 252 and 771 as addresses. But once FIFO is full we cannot roll over to 252 since we cannot decipher between empty and full. Instead do you think equation should be 2n-depth to 2n+depth-1 to cover for empty/full case and also Gray code rollover?
Namaskaram 🙏 anil , thanks for asking, when we use 252 and 771 address , when fifo is full we rollover to 252 not zero.
@@KarthikVippala Yes I understand it doesn’t go to zero. If FIFO is full it goes to 252. If FIFO is empty it also is at 252. Then how do you decipher between full and empty?
@@Anil-yo3tx You need an extra bit in address for detecting rollover
@@JaganJohn In that case , while rolling over that extra bit will change from '0' to '1' and also MSB will change from '0' to '1' since we are rolling over from address 771 to 252. So now we have two bits change in gray code while we roll over. Can you explain that?
@@KarthikVippala Aren't we considering extra bit for roll over to decide FIFO Full and Empty condition? If yes, then there are change in two bits while rolling over. 1. MSB changing from '0' to '1'. 2. One bit change while switching from 771 to 252. Can you please explain how this would work?
Thank you for the video! I learned a lot.
I was thinking of implementing it myself on and FPGA.
I have a question though - do you think that the conversion to Grey is necessary in nowadays FPGAs? Like Xilinx's FPGAs. I am not sure if such metastability could occur there.
Greatly explained ..👌
One question,
In FIFO, like the read and write pointers, are the write address (waddr) and read address (raddr) also should be gray coded ???
Waddr and rdaddr are not in memory and they are changed according to their own clock so gray code conversion is not required .
Thanks for asking.
Good luck good health 👍👍
Whats the point of the flops block at 16:22? That was not explained in the video.
thanks
Namaskaram _/|\_ Renga Pradeep, Thanks for the support , good luck & great health, Take care :)
Very nice sir...but a small doubt what happens if msb of read pointer greater than msb of write pointer is it a full condition
Do you mean value or just msb ?
@@KarthikVippala when write pointer is at 00000 and read pointer at 10000 what happens what I mean is msb bit of write pointer is less will the fifo consider it as full condition
Hey alekhya thanks asking
Full condition is {~wraddr[4],wraddr[3:0]} == rdaddr
So when wr is at 10000 and rd is at 00000 it will be a full condition .
May be you have not see clearly inverter "~" due to my shabby handwriting 😁.
Adding extra bit will be helpful for finding out full condition.
For your case also it is a full condition.
Good luck, good health 👍
@@KarthikVippala sir tanq very much...really soo much
Your welcome 👍😊
Hi Karthik, does your professional regard to Verification also? If yes, I'd love to see some verification techniques from you.
I will do videos on it in future 👍
Hi
I'm bit confused regarding pointer based synchronization scheme and Handshaking based Synchronization scheme, Can you please help me understand these things easily?
Good job brother, can you suggest any good book for these topics , which has some numerical problems..?
Please find them forums , in particular there is no specific book i know which have numericals, thanks for asking, good luck and great health 👍😊
Hi Karthik, Nice explanation.
This formula applicable for FIFO depth is Even. What will be the procedure for ODD FIFO depth?
just round up to next even number, thats the simplest way