Hardware interview practice
Predict Priority from If and Case Statements
A decoder has overlapping conditions. One version uses `if (c0) ... else if (c1) ...`; another uses a `case` statement whose legal input encodings are asserted mutually exclusive. Which statement is correct?
Choose one
Answer choices
- A. The `if/else if` text defines priority when both conditions are true; a fully specified mutually exclusive `case` expresses decode selection, but actual area and delay still depend on the logic and synthesis constraints.
- B. An `if/else if` statement has no priority because all synthesizable RTL is evaluated simultaneously.
- C. A `case` statement always creates parallel hardware with lower delay and larger area than any equivalent `if` statement.
- D. Omitting `default` from combinational `case` logic is safe because unmatched values automatically drive zero.
