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

Binary to Gray Code Conversion

EasyLogic CircuitAnalyze

Gray code enables safe clock domain crossing in asynchronous FIFOs by ensuring only one bit changes state during any transition. Standard binary counters cannot be used across clock domains because multiple bits flipping simultaneously can cause unpredictable sampling errors due to routing delays.

A 4-bit binary input B[3:0] is converted to a 4-bit Gray code output G[3:0]. The most significant bit B[3] connects directly to G[3]. Each subsequent Gray code bit is generated using a two-input XOR gate.

Determine the Boolean expressions for each output bit and trace the conversion for specific binary values.

Constraints

  • The most significant bit (MSB) is index 3.
  • All Boolean expressions must use the ^ operator for XOR without extra spaces.
  • Binary and Gray code values must be written as 4-bit strings (e.g., 0101).

Topics

Gray CodeXORClock Domain CrossingCDC

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

  • Binary to HexEasy
  • 1-to-4 Demultiplexer from AND and NOT GatesEasy
  • 2-to-4 Line Decoder with Active-High EnableEasy
  • Hex Nibble to BinaryEasy
  • Odd Parity Bit Generator for 3-bit DataEasy
  • Full Adder from Half AddersEasy
  • Modulo ArithmeticMedium
  • Two's Complement: Encode a Negative DecimalEasy

Browse all problems · Learning tracks