Consider an asynchronous FIFO of depth 2^N where pointers are maintained…
Consider an asynchronous FIFO of depth 2^N where pointers are maintained as (N+1) -bit registers: * b_wptr , b_rptr : (N+1) -bit binary write and read pointers. * g_wptr , g_rptr : (N+1) -bit Gray-coded write and read pointers. * g_rptr_sync : g\_rptr synchronized into the write clock domain. * g_wptr_sync : g\_wptr synchronized into the read clock domain. Which of the following implementations correctly assert the FIFO flags without incurring race hazards or false reads/writes? *(Select all that apply)*
- Full flag condition:
- Empty flag condition:
- Binary-based Full flag comparison evaluated across clock domains:
- Full flag condition using 2's complement Gray representation:
- The synchronized pointer g_rptr_sync is pessimistic: the FIFO may report wfull when it is not actually full, but it will never report not-full when it is full.
Correct answer
A. Full flag condition:; B. Empty flag condition:; E. The synchronized pointer g_rptr_sync is pessimistic: the FIFO may report wfull when it is not actually full, but it will never report not-full when it is full.
Explanation
* **A is TRUE:** In Gray-coded pointers of width $N+1$, the full condition corresponds to equal indices within the FIFO buffer while having wrapped around once. This reflects as the inversion of the two MSBs ($N$ and $N-1$) while all lower bits ($N-2$ down to $0$) remain identical. * **B is TRUE:** Empty occurs in the read domain when the local Gray read pointer identically equals the synchronized Gray write pointer. * **C is FALSE:** Synchronizing multi-bit binary pointers ( b_rptr ) across clock domains using standard 2-FF synchronizers causes severe multi-bit synchronization errors due to variable wire/gate delays. CDC pointers MUST be Gray-coded before crossing clock boundaries. * **D is FALSE:** Inverting all bits of a Gray code word does **not** generate the wrapped FIFO full condition; only the upper two MSBs must be inverted. * **E is TRUE:** Because the read pointer takes 2 or more clock cycles of the write clock to pass through the synchronizer, the write domain sees an older (delayed) version of the read pointer. Thus, the FIFO might consider itself full even after entries have been read (a safe, "pessimistic" condition), but will never overflow.