Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Prove an elastic one-hot checker

Hardware interview practice

Prove an elastic one-hot checker

HardTemporal ChecksSystemVerilog

Write a checker for a one-entry elastic pipeline that classifies a grant mask as one-hot and reports the selected index. Prove function, ordering, stability, and reset behavior under arbitrary backpressure.

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 →
Reviewed example

Work through one case

Input
accept mask=5'b00100 and stall its output; on retirement simultaneously accept replacement mask=5'b00110
Expected output
first output onehot=1,index=2 stays stable; replacement output onehot=0,index=0

The ghost queue preserves ordering across simultaneous retire-and-replace, and a two-bit mask is classified invalid with deterministic index zero.

What to cover

Requirements

  1. Treat a mask as one-hot only when it is nonzero and mask AND mask-minus-one is zero, with width-controlled arithmetic.
  2. Associate each accepted input with the next accepted output, including simultaneous retire-and-replace.
  3. Return the sole set-bit index for legal masks and zero for zero or multi-hot masks.
  4. Require out_valid and payload stability while stalled and never allow accepted outputs to exceed accepted inputs since reset.
  5. Clear the ghost obligation on reset and cover zero, each one-hot bit, multi-hot values, and simultaneous handshakes.
Continue practicing

Related questions

Temporal ChecksAssert bounded eventual completion→Temporal ChecksAssert an integer square-root pipeline→Temporal ChecksOverlapped versus non-overlapped implication in SVA→
asic.fyi · Learn silicon end to end.info@asic.fyi