← ProblemsCircuits / Sequential Logic / Shift Registers

Left/right rotator

15%shift-registersvectors

Build a 100-bit left/right rotator with parallel load. Unlike a shifter, a rotator wraps the bit shifted off one end back into the other end — no bits are lost or created.

  • load — load data[99:0] into the register (priority over rotation)
  • ena[1:0] selects the operation:
    • 2'b01 — rotate right by one (q[0] wraps around to q[99])
    • 2'b10 — rotate left by one (q[99] wraps around to q[0])
    • 2'b00 and 2'b11 — hold

There is no reset.