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

Asynchronous FIFO Depth Not Power of Two

HardLogic CircuitDebug

Asynchronous FIFOs require pointers to be encoded in Gray code to safely cross clock domains. For a custom depth-48 FIFO, the 6-bit pointer logic must maintain the strict single-bit change rule even when wrapping from the maximum value back to zero.

Expected behavior:

The logic maps the 0-indexed binary counter bin_ptr (0 to 47) to a truncated, symmetric Gray code sequence to preserve the 1-bit change property.

| bin_ptr (decimal) | gray_ptr (decimal) | gray_ptr (binary) | |---------------------|----------------------|---------------------| | 0 | 12 | 001100 | | 1 | 13 | 001101 | | 46 | 45 | 101101 | | 47 | 44 | 101100 |

Simulation shows gray_ptr = 56 (111000) for input bin_ptr = 47. When the FIFO wraps back to bin_ptr = 0, the pointer outputs 0 (000000). This creates an illegal 3-bit change across the clock domain boundary. Inspect the circuit and correct the fault.

Constraints

  • The input bin_ptr and output gray_ptr are 6-bit buses.
  • The binary counter only outputs values from 0 to 47.
  • You must use standard combinatorial logic to resolve the fault.

Topics

fifogray-codecdcpointers

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