The FPGA Programming Handbook_Second Edition by Frank Bruno | Guy Eschemann

The FPGA Programming Handbook_Second Edition by Frank Bruno | Guy Eschemann

Author:Frank Bruno | Guy Eschemann
Language: eng
Format: epub
Tags: COM041000 - COMPUTERS / Microprocessors, COM025000 - COMPUTERS / Expert Systems, COM067000 - COMPUTERS / Hardware / General
Publisher: Packt
Published: 2024-04-22T09:37:49+00:00


Using Gray coding for passing counter values

Binary counts increment by adding a 1 to the lowest bit. This results in a count such as the following:

00 – 01 – 10 – 11

Gray coding only allows one bit to change at a time, such as the following sequence:

00 – 01 – 11 – 10

Gray-coded counters have a limited range as they must always only have one-bit change at a time. A power of 2 is always safe to implement, but other combinations, such as 2n + 2m, also work.

Let’s look at a FIFO using a Gray code:

Figure 6.18: Asynchronous FIFO with Gray coding

By adding a Gray code module and synchronizers across each clock domain, we can compare the gray-coded values against each other or convert them back to binary on the destination clock.

Since Gray code only allows one bit to change at a time, we are guaranteed to either capture the old value or the new one and not capture a transitional value that would cause a FIFO empty, full, or word count error.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.