Hardware interview practice
Reverse a physical bus at the lane boundary
A board routes a peripheral bus in reverse bit order. Build a parameterized combinational adapter whose output bit i is input bit W - 1 - i.
Reviewed example
Work through one case
Input
W=8; input=8'b1101_0010Expected output
output=8'b0100_1011Output bit i is wired directly from input bit 7-i, making this a bit reversal rather than a byte-endian conversion.
What to cover
Requirements
- Treat this as bit reversal, not a byte swap or numeric endian conversion.
- Support every static width W >= 1, including odd widths and W = 1.
- Drive every output bit on every evaluation and infer no state.
- Use only compile-time-bounded, synthesizable wiring.
