Gray code
SystemVerilog code for generating a Gray code of arbitrary width.
Why?
I needed an efficient, easy way to generate gray codes for dual clock FIFOs. It's a pain to manually write out a gray code. Why not let a module do the heavy lifting for you?
Usage
- Take files from
src/and add them to your own project. If you use hdlmake, you can add this repository itself as a remote module. - Other helpful modules are also available in this GitHub organization.
- Consult the testbench in
test/gray_code_tb.svfor example usage. - Read through the parameter descriptions in
gray_code.svand tailor any instantiations to your situation. - Please create an issue if you run into a problem or have any questions.
To-do List
On this page
Languages
SystemVerilog72.7%Python16.3%Stata11.0%
Contributors
Other
Created May 23, 2020
Updated January 13, 2025