Hardware interview practice
Cross-check a byte reverser
Write the reference checks for a byte-window design that reverses an active prefix and clears every inactive output slot. Use both a direct prediction and the identity reverse(reverse(prefix)) = prefix.
Reviewed example
Work through one case
Input
count=3; input slots=[A,B,C,DD,DD,DD,DD,DD,DD,DD,DD,DD,DD,DD,DD,DD]; feed the first result through againExpected output
first output=[C,B,A,0,0,0,0,0,0,0,0,0,0,0,0,0]; second active prefix=[A,B,C]The direct oracle checks reversal and zeroed inactive lanes, while reverse-twice independently recovers the original active prefix.
What to cover
Requirements
- For counts from 0 through 16, compare every active byte with input[count - 1 - i] and require the complete inactive suffix to be zero.
- Define the second-pass check for feeding a legal first result back with the same count; compare its active prefix with the original and require a zero suffix.
- For count greater than 16, require request_error and an all-zero output.
- Assert that an accepted request completes within the stated bound and that no new start is issued while busy.
- Explain how zero, one, odd, even, full, invalid, repeated, palindromic, and dirty-suffix cases exercise the two checks.
