Rotate a 4-bit word by 0 to 3 positions in either direction. Rotation wraps the bits that fall off one end back in at the other, so no bit is lost.
Inputs: in, 4 bits; amt, 2-bit rotate amount; dir, 0 = rotate left, 1 = rotate right.
Output: out, 4 bits.
The testbench applies all 128 combinations.
Contributed by Indicore