The Barrel Shifter, named after the rotating barrels of large-calibre machine guns (similar devices in mechanical sorting machinery may be available), is a parallel asynchronous shift register, initially popularised by ARM. This implementation is split into three stages:

  1. The shift-proper,
    carried out here by two bits. Here, only the MSB is set, giving a shift of 2 places to the left, ie multiplying by 22, ie 4.

    The MSB row shifts left by 2 places; the LSB row by one place. They can operate simultaneously, and the principle can be extended, for as far as you want to shift - typically one less than the word length. This means a shift operation can be carried out without multiplexing/decoding the binary amount first.

  2. A rotation option,
    to turn a simple shift into a rotation. If it were invoke here, it would turn xGYBPxx into xxBPGY, ie the number lost past the word length, reappearing of the other side.
  3. And the swap (or not),
    which reverses the order of the output bits. This effectively turns a left-shift/rotate into a right-shift/rotate.

    So eg a multiplication by 4, would become a non-integer division by 4.


There may be some necessity for another alignment stage, and/or the interpretation of a binary floating point, or truncation to the right or left. depending upon what the result is needed for.
... Analysis of the input, desired, and actual swap data for all shift-cases may be necessary, but it'll do for now.


This may even turn into a live [interactive] version later.
(Only the controls will be changeable, not the input lines.)


SVG Index