CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Sequential Logic

Gray to Binary Code Converter

EasyLogic CircuitBuild

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

combinationalcdcsynchronization

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.

Sign in to solveSee what Pro unlocks

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.

Related problems

  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Handshake Deadlock Due to Early ResetHard
  • Reconvergence of Individually Synchronized BitsHard
  • Debug: Asynchronous Clear GlitchHard
  • Clock Gate Enable Crossing DomainsHard

Browse all problems · Learning tracks