Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16592 Discussions

FIFO IP Full and Empty Simultaneously

Altera_Forum
Honored Contributor II
3,101 Views

Hello, 

 

I have DC FIFO I am working with in my design, and the FIFO is constantly showing it is both full and empty at the same time. The FIFO fills up with sampled and analyzed data from an ADC to wait for the microprocessor to come take them, and the processor is looking for the full flag to go high and the empty flag to be low, however the signals are showing that the FIFO is both full and empty at the same time, any ideas what can cause this?
0 Kudos
16 Replies
Altera_Forum
Honored Contributor II
1,710 Views

It tests the personality of your design, as it must decide if its empty or full. Wait, I think that's the half-empty and half-full signal. :) 

Naturally, that shouldn't occur. Do you have the read and write protection circuitry on? They are by default, but if you turn them off you can write when full or read when empty, which can cause the FIFO to wrap-around and do all sorts of weird stuff.
0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

Thanks for the reply! The protection circuitry is on, and I've followed the guidelines on the request signals and clock timing to make sure that data is available when requested. I am using an asynchronous reset signal, not tied to either clock, and my output width is 8 bits while my input width is 16 bits.

0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

I wouldn't expect it to be a problem, but maybe the mixed bit width is causing a problem? Async FIFOs are used in every design and pretty straightforward. That's the one thing you mention that isn't too common. (I would turn on the write side synchronization for coming out of reset, but that would cause a problem at initial startup and not later on). You may want to file an SR for help. SignalTapping the FIFO control signals would be of interest.

0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

And does it lock up? If you have the read/write protection circuitry on, then you can't read or write when it's empty or full, so having both signals on would prevent you from reading or writing. Just curious.

0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

 

--- Quote Start ---  

Hello, 

 

I have DC FIFO I am working with in my design, and the FIFO is constantly showing it is both full and empty at the same time. The FIFO fills up with sampled and analyzed data from an ADC to wait for the microprocessor to come take them, and the processor is looking for the full flag to go high and the empty flag to be low, however the signals are showing that the FIFO is both full and empty at the same time, any ideas what can cause this? 

--- Quote End ---  

 

 

either timing failure or wrong observation. How do you observe the flags?
0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

I am observing the control signals and flags via SignalTap, and the FIFO does not lock up while running, the FIFO is only accessed for a short portion of the overall system processes, and the flags can both be asserted regardless of where in the cycle the system is at.

0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

Can you setup the SignalTap trigger to catch the exact moment when they both get asserted? Also, try disabling the internal protection circuitry and control the read/write signals externally to prevent writing to a full and reading from an empty fifo.

0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

My recommendation would be to simulate your design. I wrote testbenches for the scfifo and dcfifo and posted them in this thread: 

 

http://www.alteraforum.com/forum/showthread.php?t=38988 

 

The code has lots of comments regarding the FIFO setup and my observations, eg., there are pipeline delays between the flags and counters in dual-clock mode. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

I had (and still have) a problem with Fifos and Quartus on some projects. On 3-4 projects that I currently maintain, there are a few fifos that have the same behaviour that you describe. The usedw signal is correct, but not the full and empty signals. The only workaround that I found was to delete all generated files, including the db and incremental_db folders, and compile the project from the beginning. Then the fifos work as expected. 

You could try and see if you have the same results.
0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

 

--- Quote Start ---  

I had (and still have) a problem with Fifos and Quartus on some projects. On 3-4 projects that I currently maintain, there are a few fifos that have the same behaviour that you describe. The usedw signal is correct, but not the full and empty signals. The only workaround that I found was to delete all generated files, including the db and incremental_db folders, and compile the project from the beginning. Then the fifos work as expected. 

You could try and see if you have the same results. 

--- Quote End ---  

 

 

Oh, dear! 

 

I will try this. I have too many trouble with FIFOs. Just a moment ago, a SCFIFO has the full flag set but usedw all zero.
0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

I have a similar problem with the LPM_FIFO...the fifo is 4 words deep, single clock, and thus has two usedw bits. If the usedw is anything but zero, I read the data from the FIFO, and several microseconds later, check to see if there is any more data. Typically usedw reads 1, and no more data has been pushed to the FIFO, but for some strange reason, it still reads 1. If I read the fifo again, usedw then decrements to 0. And the data that I read out this second read is the data which was pushed 3 times earlier. And this happens cyclically...4 times usedw does not decrement to 0 on the first read, then 1 time it decrements to 0 properly. 

 

That is, it is acting as if there is are internal pointers to a circular queue which determine where to push and pop the data, and the usedw decrement to zero properly only if the queue index is 0. 

 

It is an old design that worked fine for years, originally compiled with Quartus 9, with a MAX II EPLD. Perhaps this is a feature introduced in Quartus 13? 

 

Since it might be device dependent, I can add that now the device is a MAX V EPLD. 

 

Perhaps someone from Altera can check this out? It would be any easy mistake to make in doing the usedw logic, and while I understand that the LPM_FIFO is and old and fully debugged design, it is conceivable that someone tried to fix or optimize it for new silicon and made an error. 

 

Is there a way to see the logic at the gate level? Even in these days of "intellectual property" craziness, it is hard to see that anyone could see anything proprietary about a simple FIFO.http://www.alteraforum.com/forum//images/icons/icon7.png
0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

Has this issue been in any way resolved, or is there a workaround? I am experiencing the same problem, but deleting db and resynthesizing does not help at all. I have tried to circumvent using the empty and full signals and just use the usedw signal, but it doesn't show the right values either(It shows 0 when it should show 10 or such).  

No parts of my design fail timing.
0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

Have you raise a my support ticket?

0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

I am trying to do so, what is the product area for this? For the category, I have chosen Intellectual Property. 

EDIT: In the end, I have chosen Other.
0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

In the end, I used the DCFIFO megafuntion and hooked up the same clock and reset to both clock and reset ports. It worked without any of the problems mentioned above, at least so far. If it breaks, I will post an update so this is not misleading.

0 Kudos
Altera_Forum
Honored Contributor II
1,710 Views

Also, this link could help with the problems with the SCFIFO, too: 

https://www.altera.com/support/support-resources/knowledge-base/solutions/rd02232015_507.html
0 Kudos
Reply