Hardware interview practice
Use Wildcard Case Constructs without Hiding Unknowns
A control decoder receives `sel = 2'bx1`. Its source code uses `casex (sel)` with an item `2'b01`, so simulation may select that item even though the high bit is unknown. Which explanation and remedy are correct?
Choose one
Answer choices
- A. Replace the decoder with case equality `===`; that automatically synthesizes a priority decoder and removes all X values from hardware.
- B. `casex` treats only Z as a wildcard, so the item cannot match while `sel[1]` is X.
- C. Ordinary `case` also treats X as a wildcard, so changing constructs cannot affect the result.
- D. `casex` treats X and Z bits as wildcards in both the expression and items, so it can hide a real unknown; use explicit masks or `case inside`/careful `casez` plus assertions that required control bits are known.
