Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Predict Priority from If and Case Statements

Hardware interview practice

Predict Priority from If and Case Statements

EasyRTL DesignSystemVerilog

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?

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Choose one

Answer choices

  1. 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.
  2. B. An `if/else if` statement has no priority because all synthesizable RTL is evaluated simultaneously.
  3. C. A `case` statement always creates parallel hardware with lower delay and larger area than any equivalent `if` statement.
  4. D. Omitting `default` from combinational `case` logic is safe because unmatched values automatically drive zero.
Continue practicing

Related questions

RTL DesignDesign and verify a round-robin arbiter→RTL DesignCheck framed serial even parity→Temporal ChecksAssert bounded eventual completion→
asic.fyi · Learn silicon end to end.info@asic.fyi