Shifting

Most general purpose processors have instructions for shifting bits in a word. In addition, shifting is involved in two basic arithmetic operations: multiplication and division.

Shifting bits in hardware is a simple matter of rearranging the wires. To support controlling a shift a multiplexer is needed. The diagram below shows a circuit that, depending on the Op control signal, can either shift bits to the right by n bit positions or not shift them. The >>n notation is borrowed from C, C++, and Java to indicate a right shift of the wires by n bit positions.

For the right shift shown above, an issue arises about how to deal with the left n bits in the result. A similar issue arises in a left shift. The resolution of this issue is determined by an end fill policy.

End Fill