Asynchronous FIFO Depth Not Power of Two
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_ptrand outputgray_ptrare 6-bit buses. - The binary counter only outputs values from 0 to 47.
- You must use standard combinatorial logic to resolve the fault.
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.