Gray to Binary Code Converter
Asynchronous FIFOs pass pointers between clock domains using Gray code to prevent multi-bit transition errors. Once safely synchronized in the destination domain, these pointers must be converted back to standard binary format to calculate the FIFO fill level and generate full or empty flags.
Build a 4-bit Gray code to binary code converter. The most significant bit of the binary output B3 equals the most significant bit of the Gray input G3. Each subsequent binary bit Bn is the XOR of the corresponding Gray bit Gn and the previously calculated binary bit directly above it.
| G3 | G2 | G1 | G0 | B3 | B2 | B1 | B0 | |------|------|------|------|------|------|------|------| | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
Constraints
- Combinational logic only.
- Implement the decode logic using only XOR gates and basic wiring.
Topics
Solve this problem
Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.
This problem is part of Codiode Pro. The statement above is free to read.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.