Hardware interview practice
Vote across redundant state monitors
Sample five redundant multi-bit state codes and return the code that appears at least three times. If no strict majority exists, report an invalid result and return zero.
Reviewed example
Work through one case
Input
five sampled state codes=[3,5,3,3,5]Expected output
majority_valid=1; majority_code=3Three complete codes equal 3, satisfying the strict majority without unsafe per-bit voting.
What to cover
Requirements
- Compare complete state codes rather than voting each bit independently.
- Require at least three identical entries out of five.
- Produce deterministic zero data when the sampled set has no strict majority.
- Treat a rising edge of check as one request, sample all five entries together, and pulse done once for the registered result.
