Shift/rotate an 8-bit word by a variable amount (0–7). Supports logical left/right, arithmetic right, rotate left/right, and pass-through.
Requirements
- Module:
univ_barrel8 - Inputs:
x[7:0], sh[2:0], mode[2:0] - Outputs:
y[7:0] - Keep it fully combinational (no clocks, no delays).
Behavior
- Inputs:
x[7:0], sh[2:0], mode[2:0] - Output:
y[7:0] - Modes (unsigned unless noted):
3'b000 → PASS3'b001 → LSL (logical left)3'b010 → LSR (logical right)3'b011 → ASR (arithmetic right, sign-extend)3'b100 → ROL (rotate left)3'b101 → ROR (rotate right)3'b110/111 → reserved (treat as PASS in reference)