Hardware interview practice
Pipeline a parameterized barrel rotator
Design a fully parameterized left/right barrel rotator split across two registered stages. Pipeline valid with the data and write a BFM that predicts rotations and checks the fixed latency.
Reviewed example
Work through one case
Input
W=8; accept x=8'b1001_0001, direction=left, shift=3 at cycle0Expected output
out_valid at cycle2 with 8'b1000_1100The two registered stages implement rotate-left-three modulo eight and pipeline valid with every data/control slice.
What to cover
Requirements
- Support any W greater than zero, including W = 1, and reduce shift amounts modulo W.
- Apply lower shift-control bits before the first register and upper bits before the output register.
- Pipeline direction, remaining shift bits, and valid alongside data.
- The predictor must handle shift zero without evaluating a shift by the full word width.
