|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
|
FIFO Applications Enabled by Embedded RAM in FPGAs
By: John Birkner, QuickLogic Corporation
(birkner@quicklogic.com)
Passing data across the asynchronous boundary from one system clock to another, is one of the most challenging issues in digital design. Indeed, one consultant exclaimed: "I've made pots of money on 911 calls to solve asynchronous system bugs." When system reliability is crucial, design engineers must understand MTBF parameters associated with FIFO implementation. And herein lies the biggest problem --that is, acceptance, even awareness, that such a problem exists.
Are you having trouble passing data from one system to another? Answer: use a FIFO -- you can buy them off-the-shelf. Of course they work. They must work or why else would vendors make them. The appropriate analogy here is to beware of salesmen selling snake oil to cure all ills.
Even synchronous FIFOs can be challenging. Have you ever noticed an erroneous random pixel pattern on the left vertical column of a CRT display? Chances are, this is a FIFO protocol system bug caused by some FIFOs that deliver data one cycle later than the not_EMPTY flag assertion which signals data available. That protocol may be fortuitous to a semiconductor vendor's data sheet specs or convenient for an IP core vendor's HDL code, but it can cause grief with a designer's state-machine interface to a FIFO.
FPGA Embedded RAM to the rescue
Does your application require unique flags beyond FULL and EMPTY, such as HALF_FULL, ALMOST_FULL, FULL_MNUS-7? Or, is your FIFO depth uniquely a non-power-of-2, say for instance, 100? Then you may easily customize an IP core generated FIFO by editing the HDL code to your specific requirements. Will the data be available in the immediate cycle when not_EMPTY signals data available? When you can modify the HDL code, you are in control.
Synchronous FIFO basics
The synchronous FIFO design utilizes Dual Port RAM for independent PUSH and POP operation with a common clock. Write data is pushed in the clock period that PUSH is asserted. Read data is popped in the clock period that POP is asserted. The FIFO can be cascaded by connecting not_EMPTY to PUSH and not_FULL to POP of adjacent FIFOs. Custom flags such as FULL_MINUS_7 can be added, simply by adding a comparitor and a write-side counter initialized to 7. The write and read state machines are described as follows:
Synchronous Write-Side State Machine
Synchronous Read-Side State Machine
Asynchronous FIFO Challenge
The synchronous FIFO above can be modified for asynchronous operation by, first, separating the single clock to write-side and read-side clocks, WCLK, RCLK as shown in figure 4. Next, the hold conditions for FULL and EMPTY must be equated to the compare of write and read pointers for equality. When these pointers are equal, FULL and EMPTY must stay set if either were set. Using not_POP to hold FULL, or not_PUSH to hold EMPTY, as in the the synchronous design, will not work across the asynchronous boundary shown in figure 4.
As the write-side and read-side state machine dependencies are purely combinatorial, the MTBF of the asynchronous FIFO is identically equal to the metastable characteristic of a single master-slave flip-flop. Occasional FULL and EMPTY conditions will assert and fall back according to the flip-flop metastable characteristics. The false assertions that occur due to binary rollover decode spikes can be reduced by using Grey-code counters. Even though the Grey-code sequence allows only single bit transitions, there will still be occasional metastable events, but at the minimum rate.
The strategy employed in this FIFO design maximizes MTBF by isolating the write and read state machines as two separate synchronous systems that communicate over the "asynchronous boundary" with the minimum number of combinatorial signals. The write and read state machines are described as follows:
Asynchronous Write-Side State Machine
Asynchronous Read-Side State Machine
Designer's Responsibility
Home | Product of the Week | Tech Note | App Note | Vendor Tools | Feedback
|
|||||||||||||||||||||||||||||||||
|
Copyright © 2003 ChipCenter-QuestLink About ChipCenter-Questlink |
||||||||||||||||||||||||||||||||||